| 484 | ] |
| 485 | |
| 486 | function getPropertyGroupMap(ctx: ParserOptions) { |
| 487 | const groups = new Map<CssSemanticGroup, Set<string>>(defaultGroupNames.map((name) => [name, new Set()])) |
| 488 | const groupByProp = new Map<string, CssSemanticGroup>() |
| 489 | |
| 490 | const systemGroup = groups.get('System')! |
| 491 | systemGroup.add('base') |
| 492 | systemGroup.add('colorPalette') |
| 493 | |
| 494 | const otherStyleProps = groups.get('Other')! |
| 495 | |
| 496 | Object.entries(ctx.utility.config).map(([key, value]) => { |
| 497 | const group = value?.group |
| 498 | if (!group) { |
| 499 | otherStyleProps.add(key) |
| 500 | return |
| 501 | } |
| 502 | |
| 503 | if (!groups.has(group)) { |
| 504 | groups.set(group, new Set()) |
| 505 | } |
| 506 | |
| 507 | const set = groups.get(group)! |
| 508 | |
| 509 | if (value.shorthand) { |
| 510 | if (Array.isArray(value.shorthand)) { |
| 511 | value.shorthand.forEach((shorthand) => { |
| 512 | set.add(shorthand) |
| 513 | groupByProp.set(shorthand, group) |
| 514 | }) |
| 515 | } else { |
| 516 | set.add(value.shorthand) |
| 517 | groupByProp.set(value.shorthand, group) |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | set.add(key) |
| 522 | groupByProp.set(key, group) |
| 523 | }) |
| 524 | |
| 525 | return { groups, groupByProp } |
| 526 | } |
| 527 | |
| 528 | type PropertyIndexSet = Set<PropertyReportItem['index']> |
| 529 | type ComponentIndexSet = Set<ComponentReportItem['componentIndex']> |