Skip to content

Commit 03456e7

Browse files
committed
Add 'libraries/load-themed-styles/' from commit '3a1581f0dd93ab15f97359a2b5a44150505050c9'
git-subtree-dir: libraries/load-themed-styles git-subtree-mainline: fe9f969 git-subtree-split: 3a1581f
2 parents fe9f969 + 3a1581f commit 03456e7

14 files changed

Lines changed: 639 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Windows image file caches
2+
Thumbs.db
3+
ehthumbs.db
4+
5+
# Folder config file
6+
Desktop.ini
7+
8+
# Recycle Bin used on file shares
9+
$RECYCLE.BIN/
10+
11+
# Windows Installer files
12+
*.cab
13+
*.msi
14+
*.msm
15+
*.msp
16+
17+
# =========================
18+
# Operating System Files
19+
# =========================
20+
21+
# OSX
22+
# =========================
23+
24+
.DS_Store
25+
.AppleDouble
26+
.LSOverride
27+
28+
# Icon must ends with two \r.
29+
Icon
30+
31+
32+
# Thumbnails
33+
._*
34+
35+
# Files that might appear on external disk
36+
.Spotlight-V100
37+
38+
node_modules
39+
lib
40+
lib-amd
41+
coverage
42+
temp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage
2+
node_modules
3+
gulpfile.js
4+
*.test.js
5+
*.test.d.ts
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://registry.npmjs.org/
2+
always-auth=false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
node_js:
3+
- '6.9'
4+
before_script:
5+
- npm install -g gulp
6+
script: gulp
7+
deploy:
8+
skip_cleanup: true
9+
provider: npm
10+
email: odspnpm@microsoft.com
11+
api_key:
12+
secure: An2gTrJ70beptZPnISICwvzqqut9y5wXOhSwXGecpNw9gj835af5a212v0fBxNkMdgWWCQ1YobEyaUk79HeEKc3M0acsSvMbqBQtye7rZ+5PiiGT7ofhw82sAE2a6uDIXOPI4FAjC8s9Wm2GyHVbYFa5s121OFov+YxoXh+EHG8D/c9rwmF5nCi25xR2/AyJbA8r7824bdNHj981D7YttbXXppv6swd2hX1ywA5Trd4Rr8+23WKcUBA0u2deOztv3RL3BFNJKhAVWl49mrmIK430iGu8sFNug3OQb03lhqkLcsmKRluVMW+lT+DUvAnb6ZKlmh48tUujbIeXljVXOFrTFhNbo5TBi46+I13jSE8L4/ZgY6CLMaPCbQTVfIA2vBFdEHxh+IaXFTpia34CC09Ue9t8aBSs5rX3/JA25Tf+pzo6F8YMLhj/sKGkMQFWaqLYUHO6NAL0iF1vPvoQ8eya/4X38fsRfqO+FYREsEvT3FPHmM32O6ts7+8ELE492lLYQUC0N/aX8nuf3Q0wGV/5STQfW/vP+RKx1Bxa9Okhlv6L/2WyrianzfzkYnBwT3ZkjX3lVLu2t+rh8kslIrHQr8/oHfhG6MSEBMv/6AwqZPIJGFui06aIGFP/p87GX1Kf+mGAJ1vl6+5lXARcdal2qdaBgPE/wbH3DikeOTU=
13+
on:
14+
tags: true
15+
repo: Microsoft/load-themed-styles
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
9+
"stopOnEntry": false,
10+
"args": [
11+
],
12+
"cwd": "${workspaceRoot}",
13+
"runtimeExecutable": null,
14+
"runtimeArgs": [
15+
"--nolazy",
16+
"--debug"
17+
],
18+
"env": {
19+
"NODE_ENV": "development"
20+
},
21+
"externalConsole": false,
22+
"sourceMaps": false,
23+
"outDir": null
24+
},
25+
{
26+
"name": "Attach",
27+
"type": "node",
28+
"request": "attach",
29+
"port": 5858
30+
}
31+
]
32+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
// Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened.
4+
"editor.tabSize": 2
5+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "gulp",
4+
"isShellCommand": true,
5+
"tasks": [
6+
{
7+
"taskName": "build",
8+
9+
"echoCommand": true,
10+
"args": [
11+
],
12+
"isBuildCommand": true,
13+
"showOutput": "always",
14+
"isWatching": true
15+
},
16+
{
17+
"taskName": "watch",
18+
"isBuildCommand": false,
19+
"showOutput": "always",
20+
"isWatching": true
21+
}
22+
]
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@microsoft/load-themed-styles
2+
3+
Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
MIT License
6+
7+
Permission is hereby granted, free of charge, to any person obtaining
8+
a copy of this software and associated documentation files (the
9+
"Software"), to deal in the Software without restriction, including
10+
without limitation the rights to use, copy, modify, merge, publish,
11+
distribute, sublicense, and/or sell copies of the Software, and to
12+
permit persons to whom the Software is furnished to do so, subject to
13+
the following conditions:
14+
15+
The above copyright notice and this permission notice shall be
16+
included in all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# @microsoft/load-themed-styles
2+
[![npm version](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles.svg)](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles)
3+
4+
[![Build Status](https://travis-ci.org/Microsoft/load-themed-styles.svg?branch=master)](https://travis-ci.org/Microsoft/load-themed-styles) [![Dependencies](https://david-dm.org/Microsoft/load-themed-styles.svg)](https://david-dm.org/Microsoft/load-themed-styles)
5+
6+
> Loads a string of style rules, but supports detokenizing theme constants built within it.
7+
8+
## Install
9+
10+
Install with [npm](https://www.npmjs.com/)
11+
12+
```
13+
$ npm install --save @microsoft/load-themed-styles
14+
```
15+
16+
## Usage
17+
18+
To load a given string of styles, you can do this in TypeScript or ES6:
19+
20+
```TypeScript
21+
import { loadStyles } from '@microsoft/load-themed-styles';
22+
23+
loadStyles('body { background: red; }');
24+
```
25+
26+
This will register any set of styles given. However, in the above example the color is hardcoded to red. To make this theme-able, replace it with the string token in this format:
27+
28+
```
29+
"[theme:{variableName}, default:{defaultValue}]"
30+
```
31+
32+
For example:
33+
34+
```js
35+
loadStyles('body { background: "[theme:primaryBackgroundColor, default: blue]"');
36+
```
37+
38+
When loading, the background will use the default value, blue. Providing your own theme values using the `loadTheme` function:
39+
40+
```js
41+
import { loadStyles, loadTheme } from '@microsoft/load-themed-styles';
42+
43+
loadTheme({
44+
primaryBackgroundColor: "#EAEAEA"
45+
});
46+
47+
loadStyles('body { background: "[theme:primaryBackgroundColor, default: #FFAAFA]"');
48+
```
49+
50+
This will register #EAEAEA as the body's background color. If you call loadTheme again after styles have already been registered, it will replace the style elements with retokenized values.
51+
52+
## License
53+
54+
MIT © [Microsoft](http://github.com/Microsoft)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
let build = require('@microsoft/node-library-build');
4+
5+
build.setConfig({
6+
libAMDFolder: 'lib-amd'
7+
});
8+
9+
build.initialize(require('gulp'));

0 commit comments

Comments
 (0)