MCPcopy
hub / github.com/microsoft/rushstack

github.com/microsoft/rushstack @v1.2.2 sqlite

repository ↗ · DeepWiki ↗ · release v1.2.2 ↗
194 symbols 231 edges 8 files 11 documented · 6%
README

load-themed-styles

npm version

Build Status Dependencies

Loads a string of style rules, but supports detokenizing theme constants built within it.

Install

Install with npm

$ npm install --save load-themed-styles

Usage

To load a given string of styles, you can do this:

import { loadStyles } from 'load-themed-styles';

loadStyles('body { background: red; }');

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:

"[theme:{variableName}, default:{defaultValue}]"

For example:

loadStyles('body { background: "[theme:primaryBackgroundColor, default: blue]"');

When loading, the background will use the default value, blue. Providing your own theme values using the loadTheme function:

import { loadStyles, loadTheme } from 'load-themed-styles';

loadTheme({
  primaryBackgroundColor: "#EAEAEA"
});

loadStyles('body { background: "[theme:primaryBackgroundColor, default: #FFAAFA]"');

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.

License

MIT © Microsoft

Extension points exported contracts — how you extend this code

IRunnable (Interface)
Partial interface for Mocha's `Runnable` class.
typings/mocha/mocha.d.ts
IThemingInstruction (Interface)
(no doc)
src/index.ts
ChaiStatic (Interface)
(no doc)
typings/chai/chai.d.ts
ISuite (Interface)
Partial interface for Mocha's `Suite` class.
typings/mocha/mocha.d.ts
ITheme (Interface)
(no doc)
src/index.ts
ExpectStatic (Interface)
(no doc)
typings/chai/chai.d.ts
ITest (Interface)
Partial interface for Mocha's `Test` class.
typings/mocha/mocha.d.ts
IStyleSheet (Interface)
(no doc)
src/index.ts

Core symbols most depended-on inside this repo

equal
called by 16
typings/chai/chai.d.ts
detokenize
called by 11
src/index.ts
resolveThemableArray
called by 4
src/index.ts
splitStyles
called by 4
src/index.ts
configureLoadStyles
called by 2
src/index.ts
applyThemableStyles
called by 2
src/index.ts
loadTheme
called by 2
src/index.ts
loadStyles
called by 1
src/index.ts

Shape

Method 96
Interface 46
Class 40
Function 12

Languages

TypeScript100%

Modules by API surface

typings/chai/chai.d.ts122 symbols
typings/mocha/mocha.d.ts52 symbols
src/index.ts17 symbols
typings/assertion-error/assertion-error.d.ts2 symbols
src/index.test.ts1 symbols

Dependencies from manifests, versioned

@microsoft/node-library-build0.2.2 · 1×
chai3.5.0 · 1×
gulp3.9.1 · 1×

For agents

$ claude mcp add rushstack \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact