@fluentui/make-styles
Advanced tools
Comparing version 0.0.0-nightlyd3bf09bf8120211201.1 to 0.0.0-nightlyebf02572f720211207.1
@@ -5,5 +5,5 @@ { | ||
{ | ||
"date": "Wed, 01 Dec 2021 04:25:41 GMT", | ||
"tag": "@fluentui/make-styles_v0.0.0-nightlyd3bf09bf8120211201.1", | ||
"version": "0.0.0-nightlyd3bf09bf8120211201.1", | ||
"date": "Tue, 07 Dec 2021 04:14:31 GMT", | ||
"tag": "@fluentui/make-styles_v0.0.0-nightlyebf02572f720211207.1", | ||
"version": "0.0.0-nightlyebf02572f720211207.1", | ||
"comments": { | ||
@@ -14,3 +14,3 @@ "prerelease": [ | ||
"package": "@fluentui/make-styles", | ||
"commit": "40bec5fdab524f928e775fb2ed002822255eb2a7", | ||
"commit": "2523b8c9da23ec860780244563814b63ba963043", | ||
"comment": "Release nightly v9" | ||
@@ -29,2 +29,8 @@ }, | ||
"comment": "Add shorthand functions for styles" | ||
}, | ||
{ | ||
"author": "lingfangao@hotmail.com", | ||
"package": "@fluentui/make-styles", | ||
"commit": "dea36b70172522ea1d9da527ae961226ab2c847c", | ||
"comment": "Add `unstable_filterCSSRule` option to default `createDOMRenderer`" | ||
} | ||
@@ -31,0 +37,0 @@ ], |
# Change Log - @fluentui/make-styles | ||
This log was last generated on Wed, 01 Dec 2021 04:25:41 GMT and should not be manually modified. | ||
This log was last generated on Tue, 07 Dec 2021 04:14:31 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.0.0-nightlyd3bf09bf8120211201.1](https://github.com/microsoft/fluentui/tree/@fluentui/make-styles_v0.0.0-nightlyd3bf09bf8120211201.1) | ||
## [0.0.0-nightlyebf02572f720211207.1](https://github.com/microsoft/fluentui/tree/@fluentui/make-styles_v0.0.0-nightlyebf02572f720211207.1) | ||
Wed, 01 Dec 2021 04:25:41 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/make-styles_v9.0.0-beta.3..@fluentui/make-styles_v0.0.0-nightlyd3bf09bf8120211201.1) | ||
Tue, 07 Dec 2021 04:14:31 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/make-styles_v9.0.0-beta.3..@fluentui/make-styles_v0.0.0-nightlyebf02572f720211207.1) | ||
### Changes | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/40bec5fdab524f928e775fb2ed002822255eb2a7) by email not defined) | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/2523b8c9da23ec860780244563814b63ba963043) by email not defined) | ||
- improve types, add new types ([PR #20786](https://github.com/microsoft/fluentui/pull/20786) by olfedias@microsoft.com) | ||
- Add shorthand functions for styles ([PR #20628](https://github.com/microsoft/fluentui/pull/20628) by olfedias@microsoft.com) | ||
- Add `unstable_filterCSSRule` option to default `createDOMRenderer` ([PR #20827](https://github.com/microsoft/fluentui/pull/20827) by lingfangao@hotmail.com) | ||
@@ -18,0 +19,0 @@ ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/make-styles_v9.0.0-beta.3) |
@@ -92,4 +92,16 @@ import type { BorderColorProperty } from 'csstype'; | ||
*/ | ||
export declare function createDOMRenderer(target?: Document | undefined): MakeStylesRenderer; | ||
export declare function createDOMRenderer(target?: Document | undefined, options?: CreateDOMRendererOptions): MakeStylesRenderer; | ||
export declare interface CreateDOMRendererOptions { | ||
/** | ||
* A filter run before css rule insertion to systematically remove css rules at render time. | ||
* This can be used to forbid specific rules from being written to the style sheet at run time without | ||
* affecting build time styles. | ||
* | ||
* ⚠️ Keep the filter as performant as possible to avoid negative performance impacts to your application. | ||
* ⚠️ This API is unstable and can be removed from the library at any time. | ||
*/ | ||
unstable_filterCSSRule?: (cssRule: string) => boolean; | ||
} | ||
export declare type CSSClasses = /* ltrClassName */ string | [/* ltrClassName */ string, /* rtlClassName */ string]; | ||
@@ -96,0 +108,0 @@ |
@@ -18,2 +18,3 @@ import { border, borderLeft, borderBottom, borderRight, borderTop, borderColor, borderStyle, borderRadius, borderWidth, gap, margin, padding, overflow } from './shorthands/index'; | ||
export { createDOMRenderer } from './renderer/createDOMRenderer'; | ||
export type { CreateDOMRendererOptions } from './renderer/createDOMRenderer'; | ||
export { styleBucketOrdering } from './renderer/getStyleSheetForBucket'; | ||
@@ -20,0 +21,0 @@ export { rehydrateRendererCache } from './renderer/rehydrateRendererCache'; |
import { MakeStylesRenderer } from '../types'; | ||
export interface CreateDOMRendererOptions { | ||
/** | ||
* A filter run before css rule insertion to systematically remove css rules at render time. | ||
* This can be used to forbid specific rules from being written to the style sheet at run time without | ||
* affecting build time styles. | ||
* | ||
* ⚠️ Keep the filter as performant as possible to avoid negative performance impacts to your application. | ||
* ⚠️ This API is unstable and can be removed from the library at any time. | ||
*/ | ||
unstable_filterCSSRule?: (cssRule: string) => boolean; | ||
} | ||
/** | ||
@@ -7,2 +18,2 @@ * Creates a new instances of a renderer. | ||
*/ | ||
export declare function createDOMRenderer(target?: Document | undefined): MakeStylesRenderer; | ||
export declare function createDOMRenderer(target?: Document | undefined, options?: CreateDOMRendererOptions): MakeStylesRenderer; |
@@ -17,3 +17,6 @@ "use strict"; | ||
function createDOMRenderer(target = typeof document === 'undefined' ? undefined : document) { | ||
function createDOMRenderer(target = typeof document === 'undefined' ? undefined : document, options = {}) { | ||
const { | ||
unstable_filterCSSRule | ||
} = options; | ||
const renderer = { | ||
@@ -41,3 +44,9 @@ insertionCache: {}, | ||
try { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
if (unstable_filterCSSRule) { | ||
if (unstable_filterCSSRule(ruleCSS)) { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
} | ||
} else { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
} | ||
} catch (e) { | ||
@@ -44,0 +53,0 @@ // We've disabled these warnings due to false-positive errors with browser prefixes |
@@ -18,2 +18,3 @@ import { border, borderLeft, borderBottom, borderRight, borderTop, borderColor, borderStyle, borderRadius, borderWidth, gap, margin, padding, overflow } from './shorthands/index'; | ||
export { createDOMRenderer } from './renderer/createDOMRenderer'; | ||
export type { CreateDOMRendererOptions } from './renderer/createDOMRenderer'; | ||
export { styleBucketOrdering } from './renderer/getStyleSheetForBucket'; | ||
@@ -20,0 +21,0 @@ export { rehydrateRendererCache } from './renderer/rehydrateRendererCache'; |
import { MakeStylesRenderer } from '../types'; | ||
export interface CreateDOMRendererOptions { | ||
/** | ||
* A filter run before css rule insertion to systematically remove css rules at render time. | ||
* This can be used to forbid specific rules from being written to the style sheet at run time without | ||
* affecting build time styles. | ||
* | ||
* ⚠️ Keep the filter as performant as possible to avoid negative performance impacts to your application. | ||
* ⚠️ This API is unstable and can be removed from the library at any time. | ||
*/ | ||
unstable_filterCSSRule?: (cssRule: string) => boolean; | ||
} | ||
/** | ||
@@ -7,2 +18,2 @@ * Creates a new instances of a renderer. | ||
*/ | ||
export declare function createDOMRenderer(target?: Document | undefined): MakeStylesRenderer; | ||
export declare function createDOMRenderer(target?: Document | undefined, options?: CreateDOMRendererOptions): MakeStylesRenderer; |
@@ -9,3 +9,6 @@ import { getStyleSheetForBucket } from './getStyleSheetForBucket'; | ||
export function createDOMRenderer(target = typeof document === 'undefined' ? undefined : document) { | ||
export function createDOMRenderer(target = typeof document === 'undefined' ? undefined : document, options = {}) { | ||
const { | ||
unstable_filterCSSRule | ||
} = options; | ||
const renderer = { | ||
@@ -33,3 +36,9 @@ insertionCache: {}, | ||
try { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
if (unstable_filterCSSRule) { | ||
if (unstable_filterCSSRule(ruleCSS)) { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
} | ||
} else { | ||
sheet.insertRule(ruleCSS, sheet.cssRules.length); | ||
} | ||
} catch (e) { | ||
@@ -36,0 +45,0 @@ // We've disabled these warnings due to false-positive errors with browser prefixes |
{ | ||
"name": "@fluentui/make-styles", | ||
"version": "0.0.0-nightlyd3bf09bf8120211201.1", | ||
"version": "0.0.0-nightlyebf02572f720211207.1", | ||
"description": "Experimental utility for creating css styles/classes.", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
305130
5012