Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 16cea88

Browse files
Splaktarjelbourn
authored andcommitted
docs(migration): add reference document for migration (#11690)
to Angular Material, CDK, and Flex Layout update highlight.js to support Sass and TypeScript
1 parent a62d160 commit 16cea88

File tree

8 files changed

+663
-53
lines changed

8 files changed

+663
-53
lines changed

docs/app/js/app.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,16 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
335335
});
336336

337337
sections.push({
338-
name: 'Contributors',
339-
url: 'contributors',
340-
type: 'link'
341-
});
338+
name: 'Migration to Angular',
339+
url: 'migration',
340+
type: 'link'
341+
});
342+
343+
sections.push({
344+
name: 'Contributors',
345+
url: 'contributors',
346+
type: 'link'
347+
});
342348

343349
sections.push({
344350
name: 'License',

docs/app/js/highlight.pack.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/content/Theming/01_introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Theme [**color palettes**](https://material.io/archive/guidelines/style/color.ht
99
Theming allows changing the color of your AngularJS Material application. If you
1010
need more custom styling (such as layout changes including padding, margins,
1111
etc) you will need to either write CSS rules with custom selectors, or build a
12-
custom version of the `angular-material.css` file using SASS and custom
12+
custom version of the `angular-material.css` file using Sass and custom
1313
variables.
1414

1515
> <b>Note:</b> The Material Theming system provides the <a ng-href="/api/service/$mdThemingProvider#mdthemingprovider-setnonce-noncevalue">

docs/content/migration.md

Lines changed: 597 additions & 0 deletions
Large diffs are not rendered by default.

src/components/colors/colors.js

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,32 @@
2626
* @module material.components.colors
2727
*
2828
* @description
29-
* With only defining themes, one couldn't get non AngularJS Material elements colored with
30-
* Material colors, `$mdColors` service is used by the md-color directive to convert the
31-
* 1..n color expressions to RGBA values and will apply those values to element as CSS property
32-
* values.
29+
* By default, defining a theme does not make its colors available for applying to non AngularJS
30+
* Material elements. The `$mdColors` service is used by the `md-color` directive to convert a
31+
* set of color expressions to RGBA values and then apply those values to the element as CSS
32+
* property values.
33+
*
34+
* @usage
35+
* Getting a color based on a theme
3336
*
34-
* @usage
3537
* <hljs lang="js">
3638
* angular.controller('myCtrl', function ($mdColors) {
37-
* var color = $mdColors.getThemeColor('myTheme-red-200-0.5');
39+
* var color = $mdColors.getThemeColor('myTheme-primary-900-0.5');
3840
* ...
3941
* });
4042
* </hljs>
4143
*
44+
* Applying a color from a palette to an element
45+
* <hljs lang="js">
46+
* app.directive('myDirective', function($mdColors) {
47+
* return {
48+
* ...
49+
* link: function (scope, elem) {
50+
* $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'});
51+
* }
52+
* }
53+
* });
54+
* </hljs>
4255
*/
4356
function MdColorsService($mdTheming, $mdUtil, $log) {
4457
colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES);
@@ -59,24 +72,14 @@
5972
* @name $mdColors#applyThemeColors
6073
*
6174
* @description
62-
* Gets a color json object, keys are css properties and values are string of the wanted color
63-
* Then calculate the rgba() values based on the theme color parts
75+
* Lookup a set of colors by hue, theme, and palette, then apply those colors
76+
* with the provided opacity (via `rgba()`) to the specified CSS property.
6477
*
65-
* @param {angular.element} element the element to apply the styles on.
66-
* @param {Object} colorExpression json object, keys are css properties and values are string of
67-
* the wanted color, for example: `{color: 'red-A200-0.3'}`.
68-
*
69-
* @usage
70-
* <hljs lang="js">
71-
* app.directive('myDirective', function($mdColors) {
72-
* return {
73-
* ...
74-
* link: function (scope, elem) {
75-
* $mdColors.applyThemeColors(elem, {color: 'red'});
76-
* }
77-
* }
78-
* });
79-
* </hljs>
78+
* @param {angular.element} element the element to apply the styles to
79+
* @param {Object} colorExpression Keys are CSS properties and values are strings representing
80+
* the `theme-palette-hue-opacity` of the desired color. For example:
81+
* `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and
82+
* opacity are optional.
8083
*/
8184
function applyThemeColors(element, colorExpression) {
8285
try {
@@ -94,19 +97,12 @@
9497
* @name $mdColors#getThemeColor
9598
*
9699
* @description
97-
* Get parsed color from expression
98-
*
99-
* @param {string} expression string of a color expression (for instance `'red-700-0.8'`)
100+
* Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the
101+
* desired color.
100102
*
101-
* @returns {string} a css color expression (for instance `rgba(211, 47, 47, 0.8)`)
102-
*
103-
* @usage
104-
* <hljs lang="js">
105-
* angular.controller('myCtrl', function ($mdColors) {
106-
* var color = $mdColors.getThemeColor('myTheme-red-200-0.5');
107-
* ...
108-
* });
109-
* </hljs>
103+
* @param {string} expression color expression like `'red-A200-0.3'` or
104+
* `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional.
105+
* @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)`
110106
*/
111107
function getThemeColor(expression) {
112108
var color = extractColorOptions(expression);
@@ -262,14 +258,15 @@
262258
* @description
263259
* `mdColors` directive will apply the theme-based color expression as RGBA CSS style values.
264260
*
265-
* The format will be similar to our color defining in the scss files:
261+
* The format will be similar to the colors defined in the Sass files:
266262
*
267263
* ## `[?theme]-[palette]-[?hue]-[?opacity]`
268264
* - [theme] - default value is the default theme
269265
* - [palette] - can be either palette name or primary/accent/warn/background
270266
* - [hue] - default is 500 (hue-x can be used with primary/accent/warn/background)
271267
* - [opacity] - default is 1
272268
*
269+
*
273270
* > `?` indicates optional parameter
274271
*
275272
* @usage
@@ -281,7 +278,7 @@
281278
* </div>
282279
* </hljs>
283280
*
284-
* `mdColors` directive will automatically watch for changes in the expression if it recognizes
281+
* The `mdColors` directive will automatically watch for changes in the expression if it recognizes
285282
* an interpolation expression or a function. For performance options, you can use `::` prefix to
286283
* the `md-colors` expression to indicate a one-time data binding.
287284
*

src/components/swipe/swipe.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
*
1717
* ### Notes
1818
* - The `$event.currentTarget` of the swiped element will be `null`, but you can get a
19-
* reference to the element that actually holds the `md-swipe-left` directive by using `$target.current`
19+
* reference to the element that actually holds the `md-swipe-left` directive by using
20+
* `$target.current`
2021
*
21-
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer Tools console while swiping).
22+
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer
23+
* Tools console while swiping).
2224
*
2325
* @usage
2426
* <hljs lang="html">
@@ -38,9 +40,11 @@
3840
*
3941
* ### Notes
4042
* - The `$event.currentTarget` of the swiped element will be `null`, but you can get a
41-
* reference to the element that actually holds the `md-swipe-right` directive by using `$target.current`
43+
* reference to the element that actually holds the `md-swipe-right` directive by using
44+
* `$target.current`
4245
*
43-
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer Tools console while swiping).
46+
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer
47+
* Tools console while swiping).
4448
*
4549
* @usage
4650
* <hljs lang="html">
@@ -60,9 +64,11 @@
6064
*
6165
* ### Notes
6266
* - The `$event.currentTarget` of the swiped element will be `null`, but you can get a
63-
* reference to the element that actually holds the `md-swipe-up` directive by using `$target.current`
67+
* reference to the element that actually holds the `md-swipe-up` directive by using
68+
* `$target.current`
6469
*
65-
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer Tools console while swiping).
70+
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer
71+
* Tools console while swiping).
6672
*
6773
* @usage
6874
* <hljs lang="html">
@@ -82,13 +88,15 @@
8288
*
8389
* ### Notes
8490
* - The `$event.currentTarget` of the swiped element will be `null`, but you can get a
85-
* reference to the element that actually holds the `md-swipe-down` directive by using `$target.current`
91+
* reference to the element that actually holds the `md-swipe-down` directive by using
92+
* `$target.current`
8693
*
87-
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer Tools console while swiping).
94+
* > You can see this in action on the <a ng-href="demo/swipe">demo page</a> (Look at the Developer
95+
* Tools console while swiping).
8896
*
8997
* @usage
9098
* <hljs lang="html">
91-
* <div md-swipe-down="onSwipDown($event, $target)">Swipe me down!</div>
99+
* <div md-swipe-down="onSwipeDown($event, $target)">Swipe me down!</div>
92100
* </hljs>
93101
*/
94102

src/core/services/ripple/ripple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) {
6464
* @module material.core.ripple
6565
*
6666
* @description
67-
* `$mdInkRipple` is a service for adding ripples to any element
67+
* `$mdInkRipple` is a service for adding ripples to any element.
6868
*
6969
* @usage
7070
* <hljs lang="js">

src/core/services/theming/theming.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ function ThemingProvider($mdColorPalette, $$mdMetaProvider) {
691691
*
692692
* @param {string} name Theme name to define
693693
* @param {object} options Theme definition options
694+
*
694695
* Options are:<br/>
695696
* - `primary` - `{string}`: The name of the primary palette to use in the theme.<br/>
696697
* - `primaryHues` - `{object=}`: Override hues for primary palette.<br/>

0 commit comments

Comments
 (0)