angular / angular/components

docs-bug(theming): Example with define-theme is outdated

Đang mở
#30,701 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
area: theming docs P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Documentation about define-theme seems to be outdated.

```
@use '@angular/material' as mat;

html {
@include mat.theme((
color: mat.$violet-palette,
typography: Roboto,
density: -2,
));
}
```

### Reproduction

You can check at:

https://material.angular.io/guide/theming#density

### Expected Behavior

The corret code should be:

```
$theme: mat.define-theme(
(
color: (
primary: mat.$azure-palette,
tertiary: mat.$violet-palette,
theme-type: light,
),
density: (
scale: -2,
),
)
);
```

### Actual Behavior

This code results in the following error:

`$config.density should be a density configuration object.`

I believe this error also occours with typography config.

### Environment

- Angular: 19
- CDK/Material: 19

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ phần density của hướng dẫn theming tại material.angular.io/guide/theming#density và so sánh ví dụ được ghi trong tài liệu với cấu hình define-theme được nêu trong issue. Cập nhật ví dụ đã lỗi thời để cấu hình density của ví dụ khớp với mã được mong đợi, đồng thời kiểm tra xem ví dụ typography có gặp vấn đề tương tự hay không. Hoàn tất khi hướng dẫn không còn hiển thị cấu hình tạo ra lỗi đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, sass
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.