MCPcopy Create free account
hub / github.com/chakra-ui/panda / getPropertyGroupMap

Function getPropertyGroupMap

packages/parser/src/classify.ts:486–526  ·  view source on GitHub ↗
(ctx: ParserOptions)

Source from the content-addressed store, hash-verified

484]
485
486function 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
528type PropertyIndexSet = Set<PropertyReportItem['index']>
529type ComponentIndexSet = Set<ComponentReportItem['componentIndex']>

Callers 1

classifyProjectFunction · 0.85

Calls 5

getMethod · 0.80
entriesMethod · 0.80
hasMethod · 0.80
forEachMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected