@contember/utilities
Advanced tools
Comparing version 1.2.6 to 1.3.0-alpha.2
@@ -14,2 +14,3 @@ import { AssertionError } from "./assert-types/AssertionError.js"; | ||
import { px } from "./css-utilities/px.js"; | ||
import { dateToStringWithoutTimezone } from "./data-utilities/dateToStringWithoutTimezone.js"; | ||
import { deprecate } from "./deprecate/deprecate.js"; | ||
@@ -23,2 +24,3 @@ import { fallback } from "./deprecate/fallback.js"; | ||
import { parseTransformMatrix } from "./dom/parseTransformMatrix.js"; | ||
import { shouldCancelStart } from "./dom/shouldCancelStart.js"; | ||
import { stateDataAttributes } from "./dom/stateDataAttributes.js"; | ||
@@ -45,2 +47,3 @@ import { svgSizeProps } from "./dom/svgSizeProps.js"; | ||
dataAttribute, | ||
dateToStringWithoutTimezone, | ||
deduplicateClassName, | ||
@@ -90,2 +93,3 @@ deprecate, | ||
setHasOneOf, | ||
shouldCancelStart, | ||
stateClassName, | ||
@@ -92,0 +96,0 @@ stateDataAttributes, |
@@ -14,2 +14,3 @@ import { AssertionError } from "./assert-types/AssertionError.js"; | ||
import { px } from "./css-utilities/px.js"; | ||
import { dateToStringWithoutTimezone } from "./data-utilities/dateToStringWithoutTimezone.js"; | ||
import { deprecate } from "./deprecate/deprecate.js"; | ||
@@ -23,2 +24,3 @@ import { fallback } from "./deprecate/fallback.js"; | ||
import { parseTransformMatrix } from "./dom/parseTransformMatrix.js"; | ||
import { shouldCancelStart } from "./dom/shouldCancelStart.js"; | ||
import { stateDataAttributes } from "./dom/stateDataAttributes.js"; | ||
@@ -45,2 +47,3 @@ import { svgSizeProps } from "./dom/svgSizeProps.js"; | ||
dataAttribute, | ||
dateToStringWithoutTimezone, | ||
deduplicateClassName, | ||
@@ -90,2 +93,3 @@ deprecate, | ||
setHasOneOf, | ||
shouldCancelStart, | ||
stateClassName, | ||
@@ -92,0 +96,0 @@ stateDataAttributes, |
@@ -9,13 +9,4 @@ /** | ||
* - theme-default | ||
* - theme-default:hover | ||
* - theme-default:active | ||
* - theme-default:focus | ||
* - theme-default-content | ||
* - theme-default-content:hover | ||
* - theme-default-content:active | ||
* - theme-default-content:focus | ||
* - theme-default-controls | ||
* - theme-default-controls:hover | ||
* - theme-default-controls:active | ||
* - theme-default-controls:focus | ||
* | ||
@@ -25,13 +16,4 @@ * If theme is `brand-color` then it will match: | ||
* - theme-brand-color | ||
* - theme-brand-color:hover | ||
* - theme-brand-color:active | ||
* - theme-brand-color:focus | ||
* - theme-brand-color-content | ||
* - theme-brand-color-content:hover | ||
* - theme-brand-color-content:active | ||
* - theme-brand-color-content:focus | ||
* - theme-brand-color-controls | ||
* - theme-brand-color-controls:hover | ||
* - theme-brand-color-controls:active | ||
* - theme-brand-color-controls:focus | ||
*/ | ||
@@ -38,0 +20,0 @@ export declare const THEME_CLASS_NAME_REG_EXP: RegExp; |
@@ -9,3 +9,2 @@ import { KebabCase } from 'type-fest'; | ||
* @param contentTheme - Theme name basis for content | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A content theme class name | ||
@@ -21,5 +20,3 @@ * | ||
* const contentThemeClassName = contentThemeClassName('default') | ||
* // ^ 'theme-default-content:hover' | ||
* const dangerOnMouseOverTheme = controlsThemeClassName('danger', ':hover') | ||
* // ^ 'theme-danger-controls:hover' | ||
* // ^ 'theme-default-content' | ||
* | ||
@@ -40,3 +37,2 @@ * return ( | ||
* @param theme - Theme name basis for controls | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A controls theme class name | ||
@@ -52,5 +48,3 @@ * | ||
* const contentThemeClassName = contentThemeClassName('default') | ||
* // ^ 'theme-default-content:hover' | ||
* const dangerOnMouseOverTheme = controlsThemeClassName('danger', ':hover') | ||
* // ^ 'theme-danger-controls:hover' | ||
* // ^ 'theme-default-content' | ||
* | ||
@@ -71,3 +65,2 @@ * return ( | ||
* @param theme - Theme name basis for content and controls | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A tuple with a content theme class name and a controls theme class name | ||
@@ -74,0 +67,0 @@ * |
@@ -7,4 +7,5 @@ export * from './dataAttribute'; | ||
export * from './parseTransformMatrix'; | ||
export * from './shouldCancelStart'; | ||
export * from './stateDataAttributes'; | ||
export * from './svgSizeProps'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from './assert-types'; | ||
export * from './class-name'; | ||
export * from './css-utilities'; | ||
export * from './data-utilities'; | ||
export * from './deprecate'; | ||
@@ -5,0 +6,0 @@ export * from './dom'; |
{ | ||
"name": "@contember/utilities", | ||
"license": "Apache-2.0", | ||
"version": "1.2.6", | ||
"version": "1.3.0-alpha.2", | ||
"type": "module", | ||
@@ -15,2 +15,8 @@ "sideEffects": false, | ||
"default": "./dist/production/index.js" | ||
}, | ||
"require": { | ||
"types": "./dist/types/index.d.ts", | ||
"development": "./dist/development/index.cjs", | ||
"production": "./dist/production/index.cjs", | ||
"default": "./dist/production/index.cjs" | ||
} | ||
@@ -42,3 +48,4 @@ } | ||
"type-fest": "^3.12.0" | ||
} | ||
}, | ||
"stableVersion": "0.0.0" | ||
} |
@@ -9,13 +9,4 @@ /** | ||
* - theme-default | ||
* - theme-default:hover | ||
* - theme-default:active | ||
* - theme-default:focus | ||
* - theme-default-content | ||
* - theme-default-content:hover | ||
* - theme-default-content:active | ||
* - theme-default-content:focus | ||
* - theme-default-controls | ||
* - theme-default-controls:hover | ||
* - theme-default-controls:active | ||
* - theme-default-controls:focus | ||
* | ||
@@ -25,15 +16,7 @@ * If theme is `brand-color` then it will match: | ||
* - theme-brand-color | ||
* - theme-brand-color:hover | ||
* - theme-brand-color:active | ||
* - theme-brand-color:focus | ||
* - theme-brand-color-content | ||
* - theme-brand-color-content:hover | ||
* - theme-brand-color-content:active | ||
* - theme-brand-color-content:focus | ||
* - theme-brand-color-controls | ||
* - theme-brand-color-controls:hover | ||
* - theme-brand-color-controls:active | ||
* - theme-brand-color-controls:focus | ||
*/ | ||
// TODO: v1.3.0 >>> THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\w-]+?)(?:-(?<scope>content|controls))?$/ | ||
export const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\w-]+?)(?:-(?<scope>content|controls))?(?<state>:[\w]+(?:[\w-]+)?)?$/ | ||
@@ -40,0 +23,0 @@ |
import { KebabCase } from 'type-fest' | ||
import { deprecate } from '../deprecate' | ||
import { isColorSchemeClassName } from './colorSchemeClassName' | ||
@@ -32,2 +33,3 @@ import { THEME_CLASS_NAME_REG_EXP } from './constants' | ||
if (state) { | ||
deprecate('1.3.0', true, 'State themes are deprecated.', null) | ||
stateThemes[state] = stateThemes[state] ?? { content: undefined, controls: undefined } | ||
@@ -34,0 +36,0 @@ |
import { KebabCase } from 'type-fest' | ||
import { isDefined } from '../assert-types' | ||
import { deprecate } from '../deprecate' | ||
import { ThemeContentClassName, ThemeControlsClassName } from './types' | ||
@@ -10,3 +12,2 @@ | ||
* @param contentTheme - Theme name basis for content | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A content theme class name | ||
@@ -22,5 +23,3 @@ * | ||
* const contentThemeClassName = contentThemeClassName('default') | ||
* // ^ 'theme-default-content:hover' | ||
* const dangerOnMouseOverTheme = controlsThemeClassName('danger', ':hover') | ||
* // ^ 'theme-danger-controls:hover' | ||
* // ^ 'theme-default-content' | ||
* | ||
@@ -41,2 +40,4 @@ * return ( | ||
) { | ||
deprecate('1.3.0', isDefined(state), '`state` argument', null) | ||
return theme ? `theme-${theme}-content${state ?? ''}` as ThemeContentClassName<ContentTheme, State> : undefined | ||
@@ -51,3 +52,2 @@ } | ||
* @param theme - Theme name basis for controls | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A controls theme class name | ||
@@ -63,5 +63,3 @@ * | ||
* const contentThemeClassName = contentThemeClassName('default') | ||
* // ^ 'theme-default-content:hover' | ||
* const dangerOnMouseOverTheme = controlsThemeClassName('danger', ':hover') | ||
* // ^ 'theme-danger-controls:hover' | ||
* // ^ 'theme-default-content' | ||
* | ||
@@ -82,2 +80,4 @@ * return ( | ||
) { | ||
deprecate('1.3.0', isDefined(state), '`state` argument', null) | ||
return theme ? `theme-${theme}-controls${state ?? ''}` as ThemeControlsClassName<ControlsTheme, State> : undefined | ||
@@ -92,3 +92,2 @@ } | ||
* @param theme - Theme name basis for content and controls | ||
* @param state - State of the theme starting with a ":", e.g. `":hover"`, `":focus"`, `":active"`, `":focus-visible"` | ||
* @returns A tuple with a content theme class name and a controls theme class name | ||
@@ -116,5 +115,7 @@ * | ||
>( | ||
theme: Theme | null | undefined, | ||
state?: State | null | undefined, | ||
theme: Theme | null | undefined, | ||
state?: State | null | undefined, | ||
) { | ||
deprecate('1.3.0', isDefined(state), '`state` argument', null) | ||
return [ | ||
@@ -121,0 +122,0 @@ contentThemeClassName(theme, state), |
@@ -27,3 +27,3 @@ import { SemverString } from './types' | ||
} else { | ||
console.warn(`Use of ${deprecated} is deprecated and might be removed in the next release.${replacement ? ` Use ${replacement} instead.` : 'There is no replacement.'}`) | ||
console.warn(`Use of ${deprecated} is deprecated and might be removed in the next release.${replacement ? ` Use ${replacement} instead.` : ' There is no replacement.'}`) | ||
} | ||
@@ -30,0 +30,0 @@ } |
@@ -7,3 +7,4 @@ export * from './dataAttribute' | ||
export * from './parseTransformMatrix' | ||
export * from './shouldCancelStart' | ||
export * from './stateDataAttributes' | ||
export * from './svgSizeProps' |
export * from './assert-types' | ||
export * from './class-name' | ||
export * from './css-utilities' | ||
export * from './data-utilities' | ||
export * from './deprecate' | ||
@@ -5,0 +6,0 @@ export * from './dom' |
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
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
396564
446
4267
2