Skip to content

Commit 104b593

Browse files
committed
feat(material/core): expose styling information to the docs site
Exposes information about the available tokens in each component to the docs site. This makes it easier for users to track down the available tokens, instead of inspecting it with the dev tools. (cherry picked from commit b777c2d)
1 parent c7e27ac commit 104b593

File tree

37 files changed

+233
-1
lines changed

37 files changed

+233
-1
lines changed

src/components-examples/BUILD.bazel

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ package_docs_content(
3232
"//src/cdk:overviews": "overviews/cdk",
3333
"//src/material:overviews": "overviews/material",
3434

35+
# Package the extracted token information into the docs content.
36+
"//src/material:tokens": "tokens/material",
37+
3538
# Package the API docs for the Material and CDK package into the docs-content
3639
"//src:api-docs": "api-docs",
3740

src/material/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ filegroup(
1919
srcs = ["//src/material/%s:overview" % name for name in MATERIAL_ENTRYPOINTS],
2020
)
2121

22+
filegroup(
23+
name = "tokens",
24+
srcs = ["//src/material/%s:tokens" % name for name in MATERIAL_ENTRYPOINTS],
25+
)
26+
2227
sass_library(
2328
name = "sass_lib",
2429
srcs = [

src/material/autocomplete/BUILD.bazel

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
load("//tools:defaults.bzl", "markdown_to_html", "ng_module", "ng_test_library", "ng_web_test_suite", "sass_binary", "sass_library")
1+
load(
2+
"//tools:defaults.bzl",
3+
"extract_tokens",
4+
"markdown_to_html",
5+
"ng_module",
6+
"ng_test_library",
7+
"ng_web_test_suite",
8+
"sass_binary",
9+
"sass_library",
10+
)
211

312
package(default_visibility = ["//visibility:public"])
413

@@ -27,6 +36,9 @@ ng_module(
2736
sass_library(
2837
name = "autocomplete_scss_lib",
2938
srcs = glob(["**/_*.scss"]),
39+
deps = [
40+
"//src/material/core:core_scss_lib",
41+
],
3042
)
3143

3244
sass_binary(
@@ -75,6 +87,11 @@ markdown_to_html(
7587
srcs = [":autocomplete.md"],
7688
)
7789

90+
extract_tokens(
91+
name = "tokens",
92+
srcs = [":autocomplete_scss_lib"],
93+
)
94+
7895
filegroup(
7996
name = "source-files",
8097
srcs = glob(["**/*.ts"]),

src/material/badge/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -71,6 +72,11 @@ markdown_to_html(
7172
srcs = [":badge.md"],
7273
)
7374

75+
extract_tokens(
76+
name = "tokens",
77+
srcs = [":badge_scss_lib"],
78+
)
79+
7480
filegroup(
7581
name = "source-files",
7682
srcs = glob(["**/*.ts"]),

src/material/bottom-sheet/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -81,6 +82,11 @@ markdown_to_html(
8182
srcs = [":bottom-sheet.md"],
8283
)
8384

85+
extract_tokens(
86+
name = "tokens",
87+
srcs = [":bottom_sheet_scss_lib"],
88+
)
89+
8490
filegroup(
8591
name = "source-files",
8692
srcs = glob(["**/*.ts"]),

src/material/button-toggle/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -70,6 +71,11 @@ markdown_to_html(
7071
srcs = [":button-toggle.md"],
7172
)
7273

74+
extract_tokens(
75+
name = "tokens",
76+
srcs = [":button_toggle_scss_lib"],
77+
)
78+
7379
filegroup(
7480
name = "source-files",
7581
srcs = glob(["**/*.ts"]),

src/material/button/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -107,6 +108,11 @@ markdown_to_html(
107108
srcs = [":button.md"],
108109
)
109110

111+
extract_tokens(
112+
name = "tokens",
113+
srcs = [":button_scss_lib"],
114+
)
115+
110116
filegroup(
111117
name = "source-files",
112118
srcs = glob(["**/*.ts"]),

src/material/card/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -58,6 +59,11 @@ markdown_to_html(
5859
srcs = [":card.md"],
5960
)
6061

62+
extract_tokens(
63+
name = "tokens",
64+
srcs = [":card_scss_lib"],
65+
)
66+
6167
filegroup(
6268
name = "source-files",
6369
srcs = glob(["**/*.ts"]),

src/material/checkbox/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -72,6 +73,11 @@ markdown_to_html(
7273
srcs = [":checkbox.md"],
7374
)
7475

76+
extract_tokens(
77+
name = "tokens",
78+
srcs = [":checkbox_scss_lib"],
79+
)
80+
7581
filegroup(
7682
name = "source-files",
7783
srcs = glob(["**/*.ts"]),

src/material/chips/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -94,6 +95,11 @@ markdown_to_html(
9495
srcs = [":chips.md"],
9596
)
9697

98+
extract_tokens(
99+
name = "tokens",
100+
srcs = [":chips_scss_lib"],
101+
)
102+
97103
filegroup(
98104
name = "source-files",
99105
srcs = glob(["**/*.ts"]),

src/material/core/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
load("//src/material:config.bzl", "MATERIAL_SCSS_LIBS")
22
load(
33
"//tools:defaults.bzl",
4+
"extract_tokens",
45
"markdown_to_html",
56
"ng_module",
67
"ng_test_library",
@@ -189,6 +190,11 @@ markdown_to_html(
189190
],
190191
)
191192

193+
extract_tokens(
194+
name = "tokens",
195+
srcs = [":core_scss_lib"],
196+
)
197+
192198
filegroup(
193199
name = "source-files",
194200
srcs = glob(["**/*.ts"]),

src/material/datepicker/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -137,6 +138,11 @@ markdown_to_html(
137138
srcs = [":datepicker.md"],
138139
)
139140

141+
extract_tokens(
142+
name = "tokens",
143+
srcs = [":datepicker_scss_lib"],
144+
)
145+
140146
filegroup(
141147
name = "source-files",
142148
srcs = glob(["**/*.ts"]),

src/material/dialog/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -79,6 +80,11 @@ markdown_to_html(
7980
srcs = [":dialog.md"],
8081
)
8182

83+
extract_tokens(
84+
name = "tokens",
85+
srcs = [":dialog_scss_lib"],
86+
)
87+
8288
filegroup(
8389
name = "source-files",
8490
srcs = glob(["**/*.ts"]),

src/material/divider/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -61,6 +62,11 @@ markdown_to_html(
6162
srcs = [":divider.md"],
6263
)
6364

65+
extract_tokens(
66+
name = "tokens",
67+
srcs = [":divider_scss_lib"],
68+
)
69+
6470
filegroup(
6571
name = "source-files",
6672
srcs = glob(["**/*.ts"]),

src/material/expansion/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -82,6 +83,11 @@ markdown_to_html(
8283
srcs = [":expansion.md"],
8384
)
8485

86+
extract_tokens(
87+
name = "tokens",
88+
srcs = [":expansion_scss_lib"],
89+
)
90+
8591
filegroup(
8692
name = "source-files",
8793
srcs = glob(["**/*.ts"]),

src/material/form-field/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"sass_binary",
@@ -71,6 +72,11 @@ markdown_to_html(
7172
srcs = [":form-field.md"],
7273
)
7374

75+
extract_tokens(
76+
name = "tokens",
77+
srcs = [":form_field_scss_lib"],
78+
)
79+
7480
filegroup(
7581
name = "source-files",
7682
srcs = glob(["**/*.ts"]),

src/material/grid-list/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -60,6 +61,11 @@ markdown_to_html(
6061
srcs = [":grid-list.md"],
6162
)
6263

64+
extract_tokens(
65+
name = "tokens",
66+
srcs = [":grid_list_scss_lib"],
67+
)
68+
6369
filegroup(
6470
name = "source-files",
6571
srcs = glob(["**/*.ts"]),

src/material/icon/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -63,6 +64,11 @@ markdown_to_html(
6364
srcs = [":icon.md"],
6465
)
6566

67+
extract_tokens(
68+
name = "tokens",
69+
srcs = [":icon_scss_lib"],
70+
)
71+
6672
filegroup(
6773
name = "source-files",
6874
srcs = glob(["**/*.ts"]),

src/material/input/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -64,6 +65,11 @@ markdown_to_html(
6465
srcs = [":input.md"],
6566
)
6667

68+
extract_tokens(
69+
name = "tokens",
70+
srcs = [":input_scss_lib"],
71+
)
72+
6773
filegroup(
6874
name = "source-files",
6975
srcs = glob(["**/*.ts"]),

src/material/list/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
3+
"extract_tokens",
34
"markdown_to_html",
45
"ng_module",
56
"ng_test_library",
@@ -108,6 +109,11 @@ markdown_to_html(
108109
srcs = [":list.md"],
109110
)
110111

112+
extract_tokens(
113+
name = "tokens",
114+
srcs = [":list_scss_lib"],
115+
)
116+
111117
filegroup(
112118
name = "source-files",
113119
srcs = glob(["**/*.ts"]),

0 commit comments

Comments
 (0)