css-calipers 0.7.0 โ 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/cjs/mediaQueries/helpers.js +97 -0
- package/dist/cjs/mediaQueries/index.js +20 -0
- package/dist/cjs/mediaQueries/linting/core.js +19 -0
- package/dist/cjs/mediaQueries/linting/resolution.js +11 -0
- package/dist/cjs/mediaQueries/linting.js +24 -0
- package/dist/cjs/mediaQueries/mediaQueries.js +50 -0
- package/dist/cjs/mediaQueries/mediaQueryFactory.js +120 -0
- package/dist/cjs/mediaQueries/modules/custom.js +26 -0
- package/dist/cjs/mediaQueries/modules/dimensions.js +59 -0
- package/dist/cjs/mediaQueries/modules/display.js +20 -0
- package/dist/cjs/mediaQueries/modules/environment.js +20 -0
- package/dist/cjs/mediaQueries/modules/index.js +23 -0
- package/dist/cjs/mediaQueries/modules/interaction.js +26 -0
- package/dist/cjs/mediaQueries/modules/preferences.js +26 -0
- package/dist/cjs/mediaQueries/modules/resolution.js +29 -0
- package/dist/cjs/mediaQueries/types.js +2 -0
- package/dist/cjs/mediaQueries/validation.js +133 -0
- package/dist/esm/mediaQueries/helpers.d.ts +40 -0
- package/dist/esm/mediaQueries/helpers.d.ts.map +1 -0
- package/dist/esm/mediaQueries/helpers.js +87 -0
- package/dist/esm/mediaQueries/index.d.ts +5 -0
- package/dist/esm/mediaQueries/index.d.ts.map +1 -0
- package/dist/esm/mediaQueries/index.js +4 -0
- package/dist/esm/mediaQueries/linting/core.d.ts +5 -0
- package/dist/esm/mediaQueries/linting/core.d.ts.map +1 -0
- package/dist/esm/mediaQueries/linting/core.js +14 -0
- package/dist/esm/mediaQueries/linting/resolution.d.ts +3 -0
- package/dist/esm/mediaQueries/linting/resolution.d.ts.map +1 -0
- package/dist/esm/mediaQueries/linting/resolution.js +7 -0
- package/dist/esm/mediaQueries/linting.d.ts +4 -0
- package/dist/esm/mediaQueries/linting.d.ts.map +1 -0
- package/dist/esm/mediaQueries/linting.js +20 -0
- package/dist/esm/mediaQueries/mediaQueries.d.ts +19 -0
- package/dist/esm/mediaQueries/mediaQueries.d.ts.map +1 -0
- package/dist/esm/mediaQueries/mediaQueries.js +46 -0
- package/dist/esm/mediaQueries/modules/custom.d.ts +10 -0
- package/dist/esm/mediaQueries/modules/custom.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/custom.js +22 -0
- package/dist/esm/mediaQueries/modules/dimensions.d.ts +17 -0
- package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/dimensions.js +55 -0
- package/dist/esm/mediaQueries/modules/display.d.ts +9 -0
- package/dist/esm/mediaQueries/modules/display.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/display.js +16 -0
- package/dist/esm/mediaQueries/modules/environment.d.ts +9 -0
- package/dist/esm/mediaQueries/modules/environment.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/environment.js +16 -0
- package/dist/esm/mediaQueries/modules/index.d.ts +8 -0
- package/dist/esm/mediaQueries/modules/index.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/index.js +7 -0
- package/dist/esm/mediaQueries/modules/interaction.d.ts +11 -0
- package/dist/esm/mediaQueries/modules/interaction.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/interaction.js +22 -0
- package/dist/esm/mediaQueries/modules/preferences.d.ts +11 -0
- package/dist/esm/mediaQueries/modules/preferences.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/preferences.js +22 -0
- package/dist/esm/mediaQueries/modules/resolution.d.ts +10 -0
- package/dist/esm/mediaQueries/modules/resolution.d.ts.map +1 -0
- package/dist/esm/mediaQueries/modules/resolution.js +25 -0
- package/dist/esm/mediaQueries/types.d.ts +117 -0
- package/dist/esm/mediaQueries/types.d.ts.map +1 -0
- package/dist/esm/mediaQueries/types.js +1 -0
- package/dist/esm/mediaQueries/validation.d.ts +14 -0
- package/dist/esm/mediaQueries/validation.d.ts.map +1 -0
- package/dist/esm/mediaQueries/validation.js +122 -0
- package/package.json +20 -9
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
|
|
2
|
+
export interface IMediaQueryInteraction {
|
|
3
|
+
hover?: 'none' | 'hover';
|
|
4
|
+
anyHover?: 'none' | 'hover';
|
|
5
|
+
pointer?: 'none' | 'coarse' | 'fine';
|
|
6
|
+
anyPointer?: 'none' | 'coarse' | 'fine';
|
|
7
|
+
update?: 'none' | 'slow' | 'fast';
|
|
8
|
+
}
|
|
9
|
+
export type MediaQueryInteractionValidator = MediaQueryValidator<IMediaQueryInteraction>;
|
|
10
|
+
export declare const emitInteractionFeatures: (props: IMediaQueryInteraction, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryInteractionValidator) => void;
|
|
11
|
+
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,MAAM,8BAA8B,GACxC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAE9C,eAAO,MAAM,uBAAuB,GAClC,OAAO,sBAAsB,EAC7B,SAAS,wBAAwB,EACjC,WAAW,8BAA8B,KACxC,IAwBF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { applyMediaQueryValidation } from '../helpers';
|
|
2
|
+
export const emitInteractionFeatures = (props, helpers, validate) => {
|
|
3
|
+
if (!applyMediaQueryValidation(props, helpers, validate, 'interaction')) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const { addFeature } = helpers;
|
|
7
|
+
if (props.hover) {
|
|
8
|
+
addFeature('hover', props.hover);
|
|
9
|
+
}
|
|
10
|
+
if (props.anyHover) {
|
|
11
|
+
addFeature('any-hover', props.anyHover);
|
|
12
|
+
}
|
|
13
|
+
if (props.pointer) {
|
|
14
|
+
addFeature('pointer', props.pointer);
|
|
15
|
+
}
|
|
16
|
+
if (props.anyPointer) {
|
|
17
|
+
addFeature('any-pointer', props.anyPointer);
|
|
18
|
+
}
|
|
19
|
+
if (props.update) {
|
|
20
|
+
addFeature('update', props.update);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
|
|
2
|
+
export interface IMediaQueryPreferences {
|
|
3
|
+
colorScheme?: 'light' | 'dark';
|
|
4
|
+
reducedMotion?: 'no-preference' | 'reduce';
|
|
5
|
+
reducedData?: 'no-preference' | 'reduce';
|
|
6
|
+
contrast?: 'no-preference' | 'more' | 'less';
|
|
7
|
+
forcedColors?: 'none' | 'active';
|
|
8
|
+
}
|
|
9
|
+
export type MediaQueryPreferencesValidator = MediaQueryValidator<IMediaQueryPreferences>;
|
|
10
|
+
export declare const emitPreferencesFeatures: (props: IMediaQueryPreferences, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryPreferencesValidator) => void;
|
|
11
|
+
//# sourceMappingURL=preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/preferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAC;IAC3C,WAAW,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAC;IACzC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAClC;AAED,MAAM,MAAM,8BAA8B,GACxC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAE9C,eAAO,MAAM,uBAAuB,GAClC,OAAO,sBAAsB,EAC7B,SAAS,wBAAwB,EACjC,WAAW,8BAA8B,KACxC,IAwBF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { applyMediaQueryValidation } from '../helpers';
|
|
2
|
+
export const emitPreferencesFeatures = (props, helpers, validate) => {
|
|
3
|
+
if (!applyMediaQueryValidation(props, helpers, validate, 'preferences')) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const { addFeature } = helpers;
|
|
7
|
+
if (props.colorScheme) {
|
|
8
|
+
addFeature('prefers-color-scheme', props.colorScheme);
|
|
9
|
+
}
|
|
10
|
+
if (props.reducedMotion) {
|
|
11
|
+
addFeature('prefers-reduced-motion', props.reducedMotion);
|
|
12
|
+
}
|
|
13
|
+
if (props.reducedData) {
|
|
14
|
+
addFeature('prefers-reduced-data', props.reducedData);
|
|
15
|
+
}
|
|
16
|
+
if (props.contrast) {
|
|
17
|
+
addFeature('prefers-contrast', props.contrast);
|
|
18
|
+
}
|
|
19
|
+
if (props.forcedColors) {
|
|
20
|
+
addFeature('forced-colors', props.forcedColors);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IMeasurement } from '../../core';
|
|
2
|
+
import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
|
|
3
|
+
export interface IMediaQueryResolutionRange {
|
|
4
|
+
minResolution?: IMeasurement;
|
|
5
|
+
maxResolution?: IMeasurement;
|
|
6
|
+
resolutionValue?: IMeasurement;
|
|
7
|
+
}
|
|
8
|
+
export type MediaQueryResolutionValidator = MediaQueryValidator<IMediaQueryResolutionRange>;
|
|
9
|
+
export declare const emitResolutionFeatures: (props: IMediaQueryResolutionRange, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryResolutionValidator) => void;
|
|
10
|
+
//# sourceMappingURL=resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,eAAe,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,MAAM,MAAM,6BAA6B,GACvC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC;AAElD,eAAO,MAAM,sBAAsB,GACjC,OAAO,0BAA0B,EACjC,SAAS,wBAAwB,EACjC,WAAW,6BAA6B,KACvC,IAqCF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { applyMediaQueryValidation } from '../helpers';
|
|
2
|
+
import { runMediaQueryValidation, validateResolutionValues } from '../validation';
|
|
3
|
+
import { runMediaQueryLint } from '../linting';
|
|
4
|
+
import { lintResolutionRedundancy } from '../linting/resolution';
|
|
5
|
+
export const emitResolutionFeatures = (props, helpers, validate) => {
|
|
6
|
+
if (!runMediaQueryValidation(props, helpers, validateResolutionValues, 'resolution', 'resolution values must be greater than 0')) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!runMediaQueryLint(props, helpers, lintResolutionRedundancy, 'resolution should not be combined with minResolution or maxResolution')) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!applyMediaQueryValidation(props, helpers, validate, 'resolution')) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const { addFeature } = helpers;
|
|
16
|
+
if (props.resolutionValue) {
|
|
17
|
+
addFeature('resolution', props.resolutionValue);
|
|
18
|
+
}
|
|
19
|
+
if (props.minResolution) {
|
|
20
|
+
addFeature('min-resolution', props.minResolution);
|
|
21
|
+
}
|
|
22
|
+
if (props.maxResolution) {
|
|
23
|
+
addFeature('max-resolution', props.maxResolution);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AtRule, Properties } from 'csstype';
|
|
2
|
+
export type Resolve<T> = {
|
|
3
|
+
[Key in keyof T]: T[Key];
|
|
4
|
+
} & {};
|
|
5
|
+
export type CSSVarFunction = string;
|
|
6
|
+
export type MapLeafNodes<T, Leaf> = T extends null ? null : T extends string ? Leaf : T extends object ? {
|
|
7
|
+
[Key in keyof T]: MapLeafNodes<T[Key], Leaf>;
|
|
8
|
+
} : Leaf;
|
|
9
|
+
type CSSTypeProperties = Properties<number | (string & {})>;
|
|
10
|
+
export type CSSProperties = {
|
|
11
|
+
[Property in keyof CSSTypeProperties]: CSSTypeProperties[Property] | CSSVarFunction | Array<CSSVarFunction | CSSTypeProperties[Property]>;
|
|
12
|
+
};
|
|
13
|
+
export interface CSSKeyframes {
|
|
14
|
+
[time: string]: CSSPropertiesWithVars;
|
|
15
|
+
}
|
|
16
|
+
export type CSSPropertiesWithVars = CSSProperties & {
|
|
17
|
+
vars?: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type SimplePseudo = `:${string}` | `::${string}`;
|
|
22
|
+
type PseudoProperties = {
|
|
23
|
+
[key in SimplePseudo]?: CSSPropertiesWithVars;
|
|
24
|
+
};
|
|
25
|
+
type CSSPropertiesAndPseudos = CSSPropertiesWithVars & PseudoProperties;
|
|
26
|
+
type Query<Key extends string, StyleType> = {
|
|
27
|
+
[key in Key]?: {
|
|
28
|
+
[query: string]: Omit<StyleType, Key>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type MediaQueries<StyleType> = Query<'@media', StyleType>;
|
|
32
|
+
export type FeatureQueries<StyleType> = Query<'@supports', StyleType>;
|
|
33
|
+
export type ContainerQueries<StyleType> = Query<'@container', StyleType>;
|
|
34
|
+
export type Layers<StyleType> = Query<'@layer', StyleType>;
|
|
35
|
+
export type StartingStyle<StyleType> = {
|
|
36
|
+
'@starting-style'?: Omit<StyleType, '@starting-style'>;
|
|
37
|
+
};
|
|
38
|
+
interface AllQueries<StyleType> extends MediaQueries<StyleType & AllQueries<StyleType>>, FeatureQueries<StyleType & AllQueries<StyleType>>, ContainerQueries<StyleType & AllQueries<StyleType>>, Layers<StyleType & AllQueries<StyleType>>, StartingStyle<StyleType> {
|
|
39
|
+
}
|
|
40
|
+
export type WithQueries<StyleType> = StyleType & AllQueries<StyleType>;
|
|
41
|
+
interface SelectorMap {
|
|
42
|
+
[selector: string]: WithQueries<CSSPropertiesWithVars>;
|
|
43
|
+
}
|
|
44
|
+
export interface StyleWithSelectors extends CSSPropertiesAndPseudos {
|
|
45
|
+
selectors?: SelectorMap;
|
|
46
|
+
}
|
|
47
|
+
export type StyleRule = WithQueries<StyleWithSelectors>;
|
|
48
|
+
export type GlobalStyleRule = WithQueries<CSSPropertiesWithVars>;
|
|
49
|
+
export type GlobalFontFaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>;
|
|
50
|
+
export type FontFaceRule = Omit<GlobalFontFaceRule, 'fontFamily'>;
|
|
51
|
+
export type CSSStyleBlock = {
|
|
52
|
+
type: 'local';
|
|
53
|
+
selector: string;
|
|
54
|
+
rule: StyleRule;
|
|
55
|
+
};
|
|
56
|
+
export type CSSFontFaceBlock = {
|
|
57
|
+
type: 'fontFace';
|
|
58
|
+
rule: GlobalFontFaceRule;
|
|
59
|
+
};
|
|
60
|
+
export type CSSKeyframesBlock = {
|
|
61
|
+
type: 'keyframes';
|
|
62
|
+
name: string;
|
|
63
|
+
rule: CSSKeyframes;
|
|
64
|
+
};
|
|
65
|
+
export type CSSSelectorBlock = {
|
|
66
|
+
type: 'selector' | 'global';
|
|
67
|
+
selector: string;
|
|
68
|
+
rule: GlobalStyleRule;
|
|
69
|
+
};
|
|
70
|
+
export type CSSLayerDeclaration = {
|
|
71
|
+
type: 'layer';
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
74
|
+
export type CSSPropertyBlock = {
|
|
75
|
+
type: 'property';
|
|
76
|
+
name: string;
|
|
77
|
+
rule: AtRule.Property;
|
|
78
|
+
};
|
|
79
|
+
export type CSS = CSSStyleBlock | CSSFontFaceBlock | CSSKeyframesBlock | CSSSelectorBlock | CSSLayerDeclaration | CSSPropertyBlock;
|
|
80
|
+
export type FileScope = {
|
|
81
|
+
packageName?: string;
|
|
82
|
+
filePath: string;
|
|
83
|
+
};
|
|
84
|
+
export interface Composition {
|
|
85
|
+
identifier: string;
|
|
86
|
+
classList: string;
|
|
87
|
+
}
|
|
88
|
+
type CustomIdentFunction = (params: {
|
|
89
|
+
hash: string;
|
|
90
|
+
filePath: string;
|
|
91
|
+
debugId?: string;
|
|
92
|
+
packageName?: string;
|
|
93
|
+
}) => string;
|
|
94
|
+
type IdentOption = 'short' | 'debug' | CustomIdentFunction;
|
|
95
|
+
export interface Adapter {
|
|
96
|
+
appendCss: (css: CSS, fileScope: FileScope) => void;
|
|
97
|
+
registerClassName: (className: string, fileScope: FileScope) => void;
|
|
98
|
+
registerComposition: (composition: Composition, fileScope: FileScope) => void;
|
|
99
|
+
markCompositionUsed: (identifier: string) => void;
|
|
100
|
+
onBeginFileScope?: (fileScope: FileScope) => void;
|
|
101
|
+
onEndFileScope: (fileScope: FileScope) => void;
|
|
102
|
+
getIdentOption: () => IdentOption;
|
|
103
|
+
}
|
|
104
|
+
export type NullableTokens = {
|
|
105
|
+
[key: string]: string | NullableTokens | null;
|
|
106
|
+
};
|
|
107
|
+
export type Tokens = {
|
|
108
|
+
[key: string]: string | Tokens;
|
|
109
|
+
};
|
|
110
|
+
export type ThemeVars<ThemeContract extends NullableTokens> = MapLeafNodes<ThemeContract, CSSVarFunction>;
|
|
111
|
+
export type ClassNames = string | Array<ClassNames>;
|
|
112
|
+
export type ComplexStyleRule = StyleRule | Array<StyleRule | ClassNames>;
|
|
113
|
+
type _PropertySyntax = '<angle>' | '<color>' | '<custom-ident>' | '<image>' | '<integer>' | '<length-percentage>' | '<length>' | '<number>' | '<percentage>' | '<resolution>' | '<string>' | '<time>' | '<transform-function>' | '<transform-list>' | '<url>' | '*';
|
|
114
|
+
type LooseAutocomplete<Suggestions extends string> = Suggestions | Omit<string, Suggestions>;
|
|
115
|
+
export type PropertySyntax = LooseAutocomplete<_PropertySyntax>;
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KACtB,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;CACzB,GAAG,EAAE,CAAC;AAEP,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,IAAI,GAC9C,IAAI,GACJ,CAAC,SAAS,MAAM,GACd,IAAI,GACJ,CAAC,SAAS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GACd,cAAc,GACd,UAAU,GACV,QAAQ,GACR,sBAAsB,GACtB,kBAAkB,GAClB,OAAO,GACP,GAAG,CAAC;AAER,KAAK,iBAAiB,CAAC,WAAW,SAAS,MAAM,IAC7C,WAAW,GACX,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE9B,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MediaQueryBuilderHelpers } from './helpers';
|
|
2
|
+
import type { IMediaQueryCore } from './mediaQueries';
|
|
3
|
+
import type { IMediaQueryDimensions } from './modules/dimensions';
|
|
4
|
+
import type { IMediaQueryResolutionRange } from './modules/resolution';
|
|
5
|
+
export type MediaQueryValidationCheck<TConfig> = (config: TConfig) => void;
|
|
6
|
+
export declare const runMediaQueryValidation: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, check?: MediaQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean;
|
|
7
|
+
export declare const validateMinMaxWidth: (props: IMediaQueryCore) => void;
|
|
8
|
+
export declare const validateWidthValuesPositive: (props: IMediaQueryCore & IMediaQueryDimensions) => void;
|
|
9
|
+
export declare const validateMinMaxHeight: (props: IMediaQueryDimensions) => void;
|
|
10
|
+
export declare const validateHeightValuesPositive: (props: IMediaQueryDimensions) => void;
|
|
11
|
+
export declare const validateMinMaxAspectRatio: (props: IMediaQueryDimensions) => void;
|
|
12
|
+
export declare const validateAspectRatioValuesPositive: (props: IMediaQueryDimensions) => void;
|
|
13
|
+
export declare const validateResolutionValues: (props: IMediaQueryResolutionRange) => void;
|
|
14
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGvE,MAAM,MAAM,yBAAyB,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAU3E,eAAO,MAAM,uBAAuB,GAAI,OAAO,EAC7C,QAAQ,OAAO,EACf,SAAS,wBAAwB,EACjC,QAAQ,yBAAyB,CAAC,OAAO,CAAC,EAC1C,UAAU,MAAM,EAChB,wBAAqD,KACpD,OAcF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,eAAe,KAAG,IAW5D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,OAAO,eAAe,GAAG,qBAAqB,KAC7C,IAoBF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,qBAAqB,KAC3B,IAWF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,OAAO,qBAAqB,KAC3B,IAoBF,CAAC;AAwBF,eAAO,MAAM,yBAAyB,GACpC,OAAO,qBAAqB,KAC3B,IAYF,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,OAAO,qBAAqB,KAC3B,IA0BF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,OAAO,0BAA0B,KAChC,IAwBF,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { applyMediaQueryValidation } from './helpers';
|
|
2
|
+
import { assertCondition, assertMatchingUnits } from '../core';
|
|
3
|
+
const toValidationResult = (error, fallback) => {
|
|
4
|
+
if (error instanceof Error && error.message)
|
|
5
|
+
return error.message;
|
|
6
|
+
return fallback;
|
|
7
|
+
};
|
|
8
|
+
export const runMediaQueryValidation = (config, helpers, check, context, fallbackMessage = 'Invalid media query configuration') => {
|
|
9
|
+
if (!check)
|
|
10
|
+
return true;
|
|
11
|
+
try {
|
|
12
|
+
check(config);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
const result = toValidationResult(error, fallbackMessage);
|
|
17
|
+
return applyMediaQueryValidation(config, helpers, () => result, context);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const validateMinMaxWidth = (props) => {
|
|
21
|
+
if (!props.minWidth || !props.maxWidth)
|
|
22
|
+
return;
|
|
23
|
+
assertMatchingUnits(props.minWidth, props.maxWidth, 'mediaQueries.minMaxWidth');
|
|
24
|
+
assertCondition(props.minWidth.getValue() <= props.maxWidth.getValue(), 'minWidth must be less than or equal to maxWidth');
|
|
25
|
+
};
|
|
26
|
+
export const validateWidthValuesPositive = (props) => {
|
|
27
|
+
const assertPositive = (value, label) => {
|
|
28
|
+
assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
|
|
29
|
+
};
|
|
30
|
+
if (props.width) {
|
|
31
|
+
assertPositive(props.width, 'width');
|
|
32
|
+
}
|
|
33
|
+
if (props.minWidth) {
|
|
34
|
+
assertPositive(props.minWidth, 'minWidth');
|
|
35
|
+
}
|
|
36
|
+
if (props.maxWidth) {
|
|
37
|
+
assertPositive(props.maxWidth, 'maxWidth');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const validateMinMaxHeight = (props) => {
|
|
41
|
+
if (!props.minHeight || !props.maxHeight)
|
|
42
|
+
return;
|
|
43
|
+
assertMatchingUnits(props.minHeight, props.maxHeight, 'mediaQueries.minMaxHeight');
|
|
44
|
+
assertCondition(props.minHeight.getValue() <= props.maxHeight.getValue(), 'minHeight must be less than or equal to maxHeight');
|
|
45
|
+
};
|
|
46
|
+
export const validateHeightValuesPositive = (props) => {
|
|
47
|
+
const assertPositive = (value, label) => {
|
|
48
|
+
assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
|
|
49
|
+
};
|
|
50
|
+
if (props.height) {
|
|
51
|
+
assertPositive(props.height, 'height');
|
|
52
|
+
}
|
|
53
|
+
if (props.minHeight) {
|
|
54
|
+
assertPositive(props.minHeight, 'minHeight');
|
|
55
|
+
}
|
|
56
|
+
if (props.maxHeight) {
|
|
57
|
+
assertPositive(props.maxHeight, 'maxHeight');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const parseAspectRatio = (value) => {
|
|
61
|
+
if (value === undefined || value === null)
|
|
62
|
+
return null;
|
|
63
|
+
if (typeof value === 'number')
|
|
64
|
+
return Number.isFinite(value) ? value : null;
|
|
65
|
+
const trimmed = value.trim();
|
|
66
|
+
if (!trimmed)
|
|
67
|
+
return null;
|
|
68
|
+
if (trimmed.includes('/')) {
|
|
69
|
+
const [left, right] = trimmed.split('/');
|
|
70
|
+
if (left === undefined || right === undefined)
|
|
71
|
+
return null;
|
|
72
|
+
const numerator = Number(left.trim());
|
|
73
|
+
const denominator = Number(right.trim());
|
|
74
|
+
if (!Number.isFinite(numerator) || !Number.isFinite(denominator)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
if (denominator === 0)
|
|
78
|
+
return null;
|
|
79
|
+
return numerator / denominator;
|
|
80
|
+
}
|
|
81
|
+
const parsed = Number(trimmed);
|
|
82
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
83
|
+
};
|
|
84
|
+
export const validateMinMaxAspectRatio = (props) => {
|
|
85
|
+
if (!props.minAspectRatio || !props.maxAspectRatio)
|
|
86
|
+
return;
|
|
87
|
+
const minRatio = parseAspectRatio(props.minAspectRatio);
|
|
88
|
+
const maxRatio = parseAspectRatio(props.maxAspectRatio);
|
|
89
|
+
assertCondition(minRatio !== null && maxRatio !== null, 'aspectRatio values must be valid numbers or ratio strings');
|
|
90
|
+
assertCondition(minRatio <= maxRatio, 'minAspectRatio must be less than or equal to maxAspectRatio');
|
|
91
|
+
};
|
|
92
|
+
export const validateAspectRatioValuesPositive = (props) => {
|
|
93
|
+
const assertValidPositive = (label, value) => {
|
|
94
|
+
assertCondition(value !== null && value > 0, `${label} must be a valid ratio greater than 0`);
|
|
95
|
+
};
|
|
96
|
+
if (props.aspectRatio !== undefined) {
|
|
97
|
+
assertValidPositive('aspectRatio', parseAspectRatio(props.aspectRatio));
|
|
98
|
+
}
|
|
99
|
+
if (props.minAspectRatio !== undefined) {
|
|
100
|
+
assertValidPositive('minAspectRatio', parseAspectRatio(props.minAspectRatio));
|
|
101
|
+
}
|
|
102
|
+
if (props.maxAspectRatio !== undefined) {
|
|
103
|
+
assertValidPositive('maxAspectRatio', parseAspectRatio(props.maxAspectRatio));
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
export const validateResolutionValues = (props) => {
|
|
107
|
+
const assertPositive = (value, label) => {
|
|
108
|
+
assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
|
|
109
|
+
};
|
|
110
|
+
if (props.resolutionValue) {
|
|
111
|
+
assertPositive(props.resolutionValue, 'resolution');
|
|
112
|
+
}
|
|
113
|
+
if (props.minResolution) {
|
|
114
|
+
assertPositive(props.minResolution, 'minResolution');
|
|
115
|
+
}
|
|
116
|
+
if (props.maxResolution) {
|
|
117
|
+
assertPositive(props.maxResolution, 'maxResolution');
|
|
118
|
+
}
|
|
119
|
+
if (props.minResolution && props.maxResolution) {
|
|
120
|
+
assertMatchingUnits(props.minResolution, props.maxResolution, 'mediaQueries.resolutionUnits');
|
|
121
|
+
}
|
|
122
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-calipers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Compile-time unit safety for numeric, unit-bearing CSS values via typed measurements.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"import": "./dist/esm/index.js",
|
|
43
43
|
"require": "./dist/cjs/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./mediaQueries": {
|
|
46
|
+
"types": "./dist/esm/mediaQueries/index.d.ts",
|
|
47
|
+
"import": "./dist/esm/mediaQueries/index.js",
|
|
48
|
+
"require": "./dist/cjs/mediaQueries/index.js"
|
|
49
|
+
},
|
|
45
50
|
"./units": {
|
|
46
51
|
"types": "./dist/esm/units/index.d.ts",
|
|
47
52
|
"import": "./dist/esm/units/index.js",
|
|
@@ -54,10 +59,12 @@
|
|
|
54
59
|
},
|
|
55
60
|
"./package.json": "./package.json"
|
|
56
61
|
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"csstype": "^3.1.3"
|
|
64
|
+
},
|
|
57
65
|
"devDependencies": {
|
|
58
66
|
"@types/node": "^24.10.1",
|
|
59
67
|
"@vitest/coverage-v8": "^4.0.14",
|
|
60
|
-
"csstype": "^3.1.3",
|
|
61
68
|
"tsd": "^0.31.0",
|
|
62
69
|
"typescript": "^5.6.3",
|
|
63
70
|
"vitest": "^4.0.14"
|
|
@@ -66,17 +73,21 @@
|
|
|
66
73
|
"build": "npm run build:cjs && npm run build:esm",
|
|
67
74
|
"build:cjs": "echo \"๐ ๏ธ Building CommonJS (cjs) bundle...\" && tsc -p tsconfig.build.cjs.json",
|
|
68
75
|
"build:esm": "echo \"๐ ๏ธ Building ES module (esm) bundle...\" && tsc -p tsconfig.build.esm.json",
|
|
69
|
-
"build:test": "npm run build && npm run test
|
|
76
|
+
"build:test": "npm run build && npm run test",
|
|
70
77
|
"build:delete": "node -e \"const { existsSync, rmSync } = require('fs'); const paths = ['dist/cjs', 'dist/esm']; for (const p of paths) { console.log('Scanning', p + '...'); if (existsSync(p)) { console.log('Found', p + ', deleting...'); rmSync(p, { recursive: true, force: true }); console.log('Deleted', p); } else { console.log(p + ' not found, skipping.'); } }\"",
|
|
71
78
|
"prepublishOnly": "node -e \"if (!process.env.CSS_CALIPERS_RELEASE) { console.error('Direct npm publish is disabled; use \\\"npm run release\\\" instead.'); process.exit(1); }\"",
|
|
72
79
|
"release": "node scripts/release.mjs",
|
|
73
80
|
"release:dry": "node scripts/release.mjs --dry-run",
|
|
74
|
-
"test": "
|
|
81
|
+
"test": "npm run test:core && npm run test:mediaQueries && npm run test:dist && npm run test:types",
|
|
82
|
+
"test:mediaQueries": "vitest run tests/runtime/mediaQueries/mediaQueries.src.test.ts",
|
|
83
|
+
"test:mediaQueries:cjs": "vitest run tests/runtime/mediaQueries/mediaQueries.cjs.test.ts tests/runtime/api-surface/mediaQueries.api-surface.cjs.test.ts",
|
|
84
|
+
"test:mediaQueries:esm": "vitest run tests/runtime/mediaQueries/mediaQueries.esm.test.ts tests/runtime/api-surface/mediaQueries.api-surface.esm.test.ts",
|
|
85
|
+
"test:mediaQueries:dist": "npm run test:mediaQueries:cjs && npm run test:mediaQueries:esm",
|
|
75
86
|
"test:core": "vitest run tests/runtime/core/core.src.test.ts",
|
|
76
|
-
"test:cjs": "vitest run tests/runtime/core/core.cjs.test.ts tests/runtime/api-surface/api-surface.cjs.test.ts",
|
|
77
|
-
"test:esm": "vitest run tests/runtime/core/core.esm.test.ts tests/runtime/api-surface/api-surface.esm.test.ts",
|
|
78
|
-
"test:dist": "npm run test:cjs && npm run test:esm",
|
|
79
|
-
"test:
|
|
80
|
-
"test:
|
|
87
|
+
"test:core:cjs": "vitest run tests/runtime/core/core.cjs.test.ts tests/runtime/api-surface/api-surface.cjs.test.ts",
|
|
88
|
+
"test:core:esm": "vitest run tests/runtime/core/core.esm.test.ts tests/runtime/api-surface/api-surface.esm.test.ts",
|
|
89
|
+
"test:core:dist": "npm run test:core:cjs && npm run test:core:esm",
|
|
90
|
+
"test:types": "echo \"\n ๐งช Starting tsd type checks...\n\" && tsd --files tests/types/**/*.test-d.ts && echo \"โ
tsd type checks passed!\n\"",
|
|
91
|
+
"test:dist": "npm run test:core:dist && npm run test:mediaQueries:dist"
|
|
81
92
|
}
|
|
82
93
|
}
|