(kind: string)
| 102 | |
| 103 | /** Buckets the many backend node kinds into a small set of visual families. */ |
| 104 | export function kindFamily(kind: string): string { |
| 105 | if (/^(function|method|arrow_function|procedure|constructor|struct_method|abstract_method|macro)$/.test(kind)) { |
| 106 | return "fn"; |
| 107 | } |
| 108 | if (/^(struct|class|enum|enum_variant|union|record|data_class|case_class|sealed_class|inner_class|typedef|type_alias|pascal_record)$/.test(kind)) { |
| 109 | return "type"; |
| 110 | } |
| 111 | if (/^(trait|interface|interface_type|annotation|delegate)$/.test(kind)) { |
| 112 | return "trait"; |
| 113 | } |
| 114 | if (/^(module|namespace|package|file|library|go_package|scala_package|kotlin_package|pascal_unit|pascal_program)$/.test(kind)) { |
| 115 | return "module"; |
| 116 | } |
| 117 | if (/^(const|static|field|property|val|var|csharp_property|event)$/.test(kind)) { |
| 118 | return "value"; |
| 119 | } |
| 120 | if (kind === "impl") return "impl"; |
| 121 | return "other"; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Family → [design token, dark-theme fallback]. The canvas samples the token |
no test coverage detected