14.0.0 • Published 12 months ago

@material/feature-targeting v14.0.0

Weekly downloads
117,776
License
MIT
Repository
github
Last release
12 months ago

Feature Targeting

MDC Feature Targeting provides infrastructure to allow CSS styles to be included or excluded categorically.

Most of the time, you shouldn't need to depend on mdc-feature-targeting directly. However, understanding it can be useful if you're interested in having more control over when certain types of MDC styles are emitted.

Installation

npm install @material/feature-targeting

Basic Usage

Styles

Authoring component styles:

@import "@material/feature-targeting/functions";
@import "@material/feature-targeting/mixins";

@mixin my-component-core-styles($query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-feature-targets($feat-structure) {
    // ...
  }
}

Consuming component styles:

@import "@material/feature-targeting/functions";
@import "my-component-mixins";

// To include all styles (using the default of mdc-feature-all() defined above):
@include my-component-core-styles;

// Or, to include a specific subset of styles:
@include my-component-core-styles(structure);
@include my-component-core-styles(mdc-feature-any(color, typography));
// The above two @includes and the following @include would produce equivalent results:
@include my-component-core-styles(mdc-feature-without(animation));

Sass Mixins and Functions

MixinDescription
mdc-feature-targets($feature-targets...)Conditionalizes content to only be emitted if the given feature target(s) is/are queried.
FunctionDescription
mdc-feature-create-target($feature-query, $targeted-feature)Returns a variable to be passed to mdc-feature-targets in order to filter emitted styles.
mdc-feature-all($feature-queries...)Returns a query object which will result in emitting mdc-feature-targets blocks that match all of the specified features. Passing no arguments results in all blocks being emitted, which is the most common use case.
mdc-feature-any($feature-queries...)Returns a query object which will result in emitting mdc-feature-targets blocks that match any of the specified features. Passing no arguments results in no blocks being emitted.
mdc-feature-without($feature-query)Returns a query object which will result in emitting mdc-feature-targets blocks that do not match the specified feature.

$feature-query and $feature-queries refer to one or more of the values listed below under Supported Features.

Supported Features

MDC Web's styles are currently split according to the following features:

  • structure - All baseline styles that don't fit into any other category
  • animation - Styles responsible for causing animations and transitions to occur
  • color - Color-specific styles which rely on mdc-theme variables
  • typography - Typography-specific styles which rely on mdc-typography
@everything-registry/sub-chunk-584@detachhead/smui-button@detachhead/smui-extra-accordion@detachhead/smui-select@detachhead/smui-snackbar@detachhead/smui-switch@detachhead/smui-textfield@detachhead/smui-top-app-bar@detachhead/smui-extra-badge@detachhead/smui-extra-bottom-app-bar@detachhead/smui-fab@detachhead/smui-form-field@detachhead/smui-list@detachhead/smui-paper@cpangular/ng-material-theme@authentic/mwc-chips@authentic/mwc-list@aurelia2-mdc-web/expandable@aurelia-mdc-web/expandable@aurelia-mdc-web/button@infinitebrahmanuniverse/nolb-_mate@labstack/data-table@maicol07/mwa-card@maicol07/mwa-data-table@maicol07/mwc-card@mhamrah/svelte-material-ui@material/theme@material/tab-scroller@material/typography@material/textfield@material/touch-target@material/tooltip@material/menu-surface@material/list@material/menu@material/select@material/slider@material/snackbar@material/switch@material/tab@material/tab-indicator@material/tab-bar@material/shape@material/segmented-button@material/banner@material/button@material/card@material/form-field@material/grid-list@material/icon-button@material/image-list@material/linear-progress@material/floating-label@material/line-ripple@material/focus-ring@material/notched-outline@material/radio@material/ripple@material/dialog@material/dom@material/checkbox@material/drawer@material/chips@material/fab@material/elevation@material/data-table@material/circular-progress@emuanalytics/flow-rdf@react-universal-dialogs/android@smui-extra/accordion@smui-extra/badge@smui-extra/bottom-app-bar@smui/button@smui/fab@smui/form-field@smui/list@smui/top-app-bar@smui/select@smui/snackbar@smui/switch@smui/textfield@smui/papersariska-cobrowsingsariska-webappmaterial-components-webbw-material
14.0.0

3 years ago

13.0.0

4 years ago

12.0.0

4 years ago

11.0.0

4 years ago

10.0.0

4 years ago

9.0.0

4 years ago

8.0.0

5 years ago

7.0.0

5 years ago

6.0.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.0

6 years ago

4.0.0-canary.1

6 years ago

4.0.0-canary.0

6 years ago

4.0.0-alpha.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

0.44.1

6 years ago

0.44.0

6 years ago