Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support repeat() in grid templates #6090

Merged
merged 8 commits into from
Jul 18, 2024
Merged

Support repeat() in grid templates #6090

merged 8 commits into from
Jul 18, 2024

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Jul 17, 2024

Problem:

Grids with repeat() in their template are correctly displayed, but cannot be resized because the dimensions are FALLBACK.

Fix:

Expand the repeat() functions inside the templates when parsing them, so they are calculated correctly.

Screen.Recording.2024-07-17.at.12.10.05.mov

Fixes #6089

Copy link
Contributor

github-actions bot commented Jul 17, 2024

Try me

@@ -943,11 +943,35 @@ export function parseGridRange(
}
}

// this regex matches 'repeat ( [unit] , [value] )', capturing groups around the unit (1) and the value (2)
const reRepeatFunction = /repeat\s*\(\s*(\d+)\s*,\s*([^,\)]+)\s*\)/
Copy link
Contributor

@liady liady Jul 17, 2024

Choose a reason for hiding this comment

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

just a note - maybe add a TODO to support non-units repeaters (i.e auto-fit, auto-fill, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, done ✅

Copy link

relativeci bot commented Jul 17, 2024

#13416 Bundle Size — 62.63MiB (-0.05%).

e739009(current) vs 6339ece master#13413(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 1 regression Improvement 1 improvement
                 Current
#13416
     Baseline
#13413
Improvement  Initial JS 45.7MiB(-0.07%) 45.73MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 26.47% 21.56%
No change  Chunks 31 31
No change  Assets 34 34
Change  Modules 4374(+0.07%) 4371
Regression  Duplicate Modules 523(+0.38%) 521
Change  Duplicate Code 31.69%(+0.03%) 31.68%
No change  Packages 469 469
No change  Duplicate Packages 70 70
Bundle size by type  Change 2 changes Improvement 2 improvements
                 Current
#13416
     Baseline
#13413
Improvement  JS 62.62MiB (-0.05%) 62.65MiB
Improvement  HTML 11.16KiB (-0.33%) 11.2KiB

Bundle analysis reportBranch feat/grid-template-repeatProject dashboard

@ruggi ruggi marked this pull request as draft July 17, 2024 15:57
@ruggi ruggi marked this pull request as ready for review July 18, 2024 10:19
@ruggi ruggi merged commit 691037d into master Jul 18, 2024
15 checks passed
@ruggi ruggi deleted the feat/grid-template-repeat branch July 18, 2024 14:30
liady pushed a commit that referenced this pull request Dec 13, 2024
**Problem:**

Grids with `repeat()` in their template are correctly displayed, but
cannot be resized because the dimensions are `FALLBACK`.

**Fix:**

Expand the `repeat()` functions inside the templates when parsing them,
so they are calculated correctly.



https://github.com/user-attachments/assets/7744262c-f701-4685-a357-6ddaf9685bca



Fixes #6089
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.

support repeat() functions in grid templates
4 participants