Skip to content

Commit

Permalink
feat(material/core): expose styling information to the docs site
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
crisbeto committed Oct 3, 2024
1 parent c7e27ac commit 104b593
Show file tree
Hide file tree
Showing 37 changed files with 233 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components-examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ package_docs_content(
"//src/cdk:overviews": "overviews/cdk",
"//src/material:overviews": "overviews/material",

# Package the extracted token information into the docs content.
"//src/material:tokens": "tokens/material",

# Package the API docs for the Material and CDK package into the docs-content
"//src:api-docs": "api-docs",

Expand Down
5 changes: 5 additions & 0 deletions src/material/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ filegroup(
srcs = ["//src/material/%s:overview" % name for name in MATERIAL_ENTRYPOINTS],
)

filegroup(
name = "tokens",
srcs = ["//src/material/%s:tokens" % name for name in MATERIAL_ENTRYPOINTS],
)

sass_library(
name = "sass_lib",
srcs = [
Expand Down
19 changes: 18 additions & 1 deletion src/material/autocomplete/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
load("//tools:defaults.bzl", "markdown_to_html", "ng_module", "ng_test_library", "ng_web_test_suite", "sass_binary", "sass_library")
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
"ng_web_test_suite",
"sass_binary",
"sass_library",
)

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

Expand Down Expand Up @@ -27,6 +36,9 @@ ng_module(
sass_library(
name = "autocomplete_scss_lib",
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material/core:core_scss_lib",
],
)

sass_binary(
Expand Down Expand Up @@ -75,6 +87,11 @@ markdown_to_html(
srcs = [":autocomplete.md"],
)

extract_tokens(
name = "tokens",
srcs = [":autocomplete_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/badge/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -71,6 +72,11 @@ markdown_to_html(
srcs = [":badge.md"],
)

extract_tokens(
name = "tokens",
srcs = [":badge_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/bottom-sheet/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -81,6 +82,11 @@ markdown_to_html(
srcs = [":bottom-sheet.md"],
)

extract_tokens(
name = "tokens",
srcs = [":bottom_sheet_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/button-toggle/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -70,6 +71,11 @@ markdown_to_html(
srcs = [":button-toggle.md"],
)

extract_tokens(
name = "tokens",
srcs = [":button_toggle_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/button/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -107,6 +108,11 @@ markdown_to_html(
srcs = [":button.md"],
)

extract_tokens(
name = "tokens",
srcs = [":button_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/card/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -58,6 +59,11 @@ markdown_to_html(
srcs = [":card.md"],
)

extract_tokens(
name = "tokens",
srcs = [":card_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/checkbox/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -72,6 +73,11 @@ markdown_to_html(
srcs = [":checkbox.md"],
)

extract_tokens(
name = "tokens",
srcs = [":checkbox_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/chips/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -94,6 +95,11 @@ markdown_to_html(
srcs = [":chips.md"],
)

extract_tokens(
name = "tokens",
srcs = [":chips_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/core/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("//src/material:config.bzl", "MATERIAL_SCSS_LIBS")
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -189,6 +190,11 @@ markdown_to_html(
],
)

extract_tokens(
name = "tokens",
srcs = [":core_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/datepicker/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -137,6 +138,11 @@ markdown_to_html(
srcs = [":datepicker.md"],
)

extract_tokens(
name = "tokens",
srcs = [":datepicker_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/dialog/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -79,6 +80,11 @@ markdown_to_html(
srcs = [":dialog.md"],
)

extract_tokens(
name = "tokens",
srcs = [":dialog_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/divider/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -61,6 +62,11 @@ markdown_to_html(
srcs = [":divider.md"],
)

extract_tokens(
name = "tokens",
srcs = [":divider_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/expansion/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -82,6 +83,11 @@ markdown_to_html(
srcs = [":expansion.md"],
)

extract_tokens(
name = "tokens",
srcs = [":expansion_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/form-field/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"sass_binary",
Expand Down Expand Up @@ -71,6 +72,11 @@ markdown_to_html(
srcs = [":form-field.md"],
)

extract_tokens(
name = "tokens",
srcs = [":form_field_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/grid-list/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -60,6 +61,11 @@ markdown_to_html(
srcs = [":grid-list.md"],
)

extract_tokens(
name = "tokens",
srcs = [":grid_list_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/icon/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -63,6 +64,11 @@ markdown_to_html(
srcs = [":icon.md"],
)

extract_tokens(
name = "tokens",
srcs = [":icon_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/input/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -64,6 +65,11 @@ markdown_to_html(
srcs = [":input.md"],
)

extract_tokens(
name = "tokens",
srcs = [":input_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
6 changes: 6 additions & 0 deletions src/material/list/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//tools:defaults.bzl",
"extract_tokens",
"markdown_to_html",
"ng_module",
"ng_test_library",
Expand Down Expand Up @@ -108,6 +109,11 @@ markdown_to_html(
srcs = [":list.md"],
)

extract_tokens(
name = "tokens",
srcs = [":list_scss_lib"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
Expand Down
Loading

0 comments on commit 104b593

Please sign in to comment.