css-calipers 0.7.0 → 0.9.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.
Files changed (79) hide show
  1. package/README.md +36 -1
  2. package/dist/cjs/libraryHelpers/vanilla-extract.js +7 -0
  3. package/dist/cjs/mediaQueries/factory.js +162 -0
  4. package/dist/cjs/mediaQueries/helpers.js +97 -0
  5. package/dist/cjs/mediaQueries/index.js +22 -0
  6. package/dist/cjs/mediaQueries/linting/core.js +19 -0
  7. package/dist/cjs/mediaQueries/linting/resolution.js +11 -0
  8. package/dist/cjs/mediaQueries/linting.js +24 -0
  9. package/dist/cjs/mediaQueries/mediaQueries.js +51 -0
  10. package/dist/cjs/mediaQueries/mediaQueryFactory.js +120 -0
  11. package/dist/cjs/mediaQueries/moduleRegistry.js +5 -0
  12. package/dist/cjs/mediaQueries/modules/custom.js +26 -0
  13. package/dist/cjs/mediaQueries/modules/dimensions.js +59 -0
  14. package/dist/cjs/mediaQueries/modules/display.js +20 -0
  15. package/dist/cjs/mediaQueries/modules/environment.js +20 -0
  16. package/dist/cjs/mediaQueries/modules/index.js +23 -0
  17. package/dist/cjs/mediaQueries/modules/interaction.js +26 -0
  18. package/dist/cjs/mediaQueries/modules/preferences.js +26 -0
  19. package/dist/cjs/mediaQueries/modules/resolution.js +29 -0
  20. package/dist/cjs/mediaQueries/types.js +2 -0
  21. package/dist/cjs/mediaQueries/validation.js +133 -0
  22. package/dist/esm/libraryHelpers/vanilla-extract.d.ts +3 -0
  23. package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +1 -0
  24. package/dist/esm/libraryHelpers/vanilla-extract.js +3 -0
  25. package/dist/esm/mediaQueries/factory.d.ts +29 -0
  26. package/dist/esm/mediaQueries/factory.d.ts.map +1 -0
  27. package/dist/esm/mediaQueries/factory.js +158 -0
  28. package/dist/esm/mediaQueries/helpers.d.ts +40 -0
  29. package/dist/esm/mediaQueries/helpers.d.ts.map +1 -0
  30. package/dist/esm/mediaQueries/helpers.js +87 -0
  31. package/dist/esm/mediaQueries/index.d.ts +7 -0
  32. package/dist/esm/mediaQueries/index.d.ts.map +1 -0
  33. package/dist/esm/mediaQueries/index.js +6 -0
  34. package/dist/esm/mediaQueries/linting/core.d.ts +5 -0
  35. package/dist/esm/mediaQueries/linting/core.d.ts.map +1 -0
  36. package/dist/esm/mediaQueries/linting/core.js +14 -0
  37. package/dist/esm/mediaQueries/linting/resolution.d.ts +3 -0
  38. package/dist/esm/mediaQueries/linting/resolution.d.ts.map +1 -0
  39. package/dist/esm/mediaQueries/linting/resolution.js +7 -0
  40. package/dist/esm/mediaQueries/linting.d.ts +4 -0
  41. package/dist/esm/mediaQueries/linting.d.ts.map +1 -0
  42. package/dist/esm/mediaQueries/linting.js +20 -0
  43. package/dist/esm/mediaQueries/mediaQueries.d.ts +21 -0
  44. package/dist/esm/mediaQueries/mediaQueries.d.ts.map +1 -0
  45. package/dist/esm/mediaQueries/mediaQueries.js +46 -0
  46. package/dist/esm/mediaQueries/moduleRegistry.d.ts +27 -0
  47. package/dist/esm/mediaQueries/moduleRegistry.d.ts.map +1 -0
  48. package/dist/esm/mediaQueries/moduleRegistry.js +1 -0
  49. package/dist/esm/mediaQueries/modules/custom.d.ts +10 -0
  50. package/dist/esm/mediaQueries/modules/custom.d.ts.map +1 -0
  51. package/dist/esm/mediaQueries/modules/custom.js +22 -0
  52. package/dist/esm/mediaQueries/modules/dimensions.d.ts +17 -0
  53. package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +1 -0
  54. package/dist/esm/mediaQueries/modules/dimensions.js +55 -0
  55. package/dist/esm/mediaQueries/modules/display.d.ts +9 -0
  56. package/dist/esm/mediaQueries/modules/display.d.ts.map +1 -0
  57. package/dist/esm/mediaQueries/modules/display.js +16 -0
  58. package/dist/esm/mediaQueries/modules/environment.d.ts +9 -0
  59. package/dist/esm/mediaQueries/modules/environment.d.ts.map +1 -0
  60. package/dist/esm/mediaQueries/modules/environment.js +16 -0
  61. package/dist/esm/mediaQueries/modules/index.d.ts +8 -0
  62. package/dist/esm/mediaQueries/modules/index.d.ts.map +1 -0
  63. package/dist/esm/mediaQueries/modules/index.js +7 -0
  64. package/dist/esm/mediaQueries/modules/interaction.d.ts +11 -0
  65. package/dist/esm/mediaQueries/modules/interaction.d.ts.map +1 -0
  66. package/dist/esm/mediaQueries/modules/interaction.js +22 -0
  67. package/dist/esm/mediaQueries/modules/preferences.d.ts +11 -0
  68. package/dist/esm/mediaQueries/modules/preferences.d.ts.map +1 -0
  69. package/dist/esm/mediaQueries/modules/preferences.js +22 -0
  70. package/dist/esm/mediaQueries/modules/resolution.d.ts +10 -0
  71. package/dist/esm/mediaQueries/modules/resolution.d.ts.map +1 -0
  72. package/dist/esm/mediaQueries/modules/resolution.js +25 -0
  73. package/dist/esm/mediaQueries/types.d.ts +117 -0
  74. package/dist/esm/mediaQueries/types.d.ts.map +1 -0
  75. package/dist/esm/mediaQueries/types.js +1 -0
  76. package/dist/esm/mediaQueries/validation.d.ts +14 -0
  77. package/dist/esm/mediaQueries/validation.d.ts.map +1 -0
  78. package/dist/esm/mediaQueries/validation.js +122 -0
  79. package/package.json +27 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/linting/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,mBAAmB,GAC9B,OAAO,eAAe,GAAG,qBAAqB,KAC7C,IAOF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,qBAAqB,KAC3B,IAOF,CAAC"}
@@ -0,0 +1,14 @@
1
+ export const lintWidthRedundancy = (props) => {
2
+ if (!props.width)
3
+ return;
4
+ if (props.minWidth || props.maxWidth) {
5
+ throw new Error('width should not be combined with minWidth or maxWidth');
6
+ }
7
+ };
8
+ export const lintHeightRedundancy = (props) => {
9
+ if (!props.height)
10
+ return;
11
+ if (props.minHeight || props.maxHeight) {
12
+ throw new Error('height should not be combined with minHeight or maxHeight');
13
+ }
14
+ };
@@ -0,0 +1,3 @@
1
+ import type { IMediaQueryResolutionRange } from '../modules/resolution';
2
+ export declare const lintResolutionRedundancy: (props: IMediaQueryResolutionRange) => void;
3
+ //# sourceMappingURL=resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/linting/resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,eAAO,MAAM,wBAAwB,GACnC,OAAO,0BAA0B,KAChC,IAOF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export const lintResolutionRedundancy = (props) => {
2
+ if (!props.resolutionValue)
3
+ return;
4
+ if (props.minResolution || props.maxResolution) {
5
+ throw new Error('resolution should not be combined with minResolution or maxResolution');
6
+ }
7
+ };
@@ -0,0 +1,4 @@
1
+ import type { MediaQueryBuilderHelpers } from './helpers';
2
+ export type MediaQueryLintCheck<TConfig> = (config: TConfig) => void;
3
+ export declare const runMediaQueryLint: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, check?: MediaQueryLintCheck<TConfig>, message?: string) => boolean;
4
+ //# sourceMappingURL=linting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linting.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/linting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,mBAAmB,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAErE,eAAO,MAAM,iBAAiB,GAAI,OAAO,EACvC,QAAQ,OAAO,EACf,SAAS,wBAAwB,EACjC,QAAQ,mBAAmB,CAAC,OAAO,CAAC,EACpC,gBAAmC,KAClC,OAiBF,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const runMediaQueryLint = (config, helpers, check, message = 'Media query lint failed') => {
2
+ var _a, _b;
3
+ if (!check)
4
+ return true;
5
+ const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : 'throw';
6
+ if (mode === 'allow')
7
+ return true;
8
+ if (mode === 'log') {
9
+ try {
10
+ check(config);
11
+ return true;
12
+ }
13
+ catch {
14
+ console.warn(message);
15
+ return true;
16
+ }
17
+ }
18
+ check(config);
19
+ return true;
20
+ };
@@ -0,0 +1,21 @@
1
+ import type { IMeasurement } from "../core";
2
+ import type { ComplexStyleRule, StyleRule } from "./types";
3
+ import type { MediaQueryBuilderHelpers } from "./helpers";
4
+ import { IMediaQueryCustomFeatures, IMediaQueryDimensions, IMediaQueryDisplay, IMediaQueryEnvironment, IMediaQueryInteraction, IMediaQueryPreferences, IMediaQueryResolutionRange } from "./modules";
5
+ export interface IMediaQueryProps extends IMediaQueryCore, IMediaQueryDimensions, IMediaQueryResolutionRange, IMediaQueryInteraction, IMediaQueryPreferences, IMediaQueryDisplay, IMediaQueryEnvironment, IMediaQueryCustomFeatures {
6
+ }
7
+ export interface IMediaQueryCore {
8
+ type?: "all" | "print" | "screen";
9
+ minWidth?: IMeasurement;
10
+ maxWidth?: IMeasurement;
11
+ }
12
+ export interface IMediaQuery {
13
+ props: IMediaQueryProps;
14
+ styles: StyleRule;
15
+ }
16
+ export type IMediaQueries = Record<string, IMediaQueryProps>;
17
+ export type IMediaQueryStyles<T extends IMediaQueries> = Partial<Record<keyof T, StyleRule>>;
18
+ export declare const emitCoreFeatures: (props: IMediaQueryCore, helpers: MediaQueryBuilderHelpers) => void;
19
+ export declare const buildMediaQueryString: (config: IMediaQueryProps) => string;
20
+ export declare const makeMediaQueryStyle: <T extends IMediaQueries>(queries: T) => (stylesByQuery: IMediaQueryStyles<T>) => ComplexStyleRule;
21
+ //# sourceMappingURL=mediaQueries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/mediaQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAO1D,OAAO,EAQL,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,gBACf,SAAQ,eAAe,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB;CAAG;AAEhC,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAE7D,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,aAAa,IAAI,OAAO,CAC9D,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAC3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,eAAe,EACtB,SAAS,wBAAwB,KAChC,IA+BF,CAAC;AAgBF,eAAO,MAAM,qBAAqB,sCAGhC,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC7B,CAAC,SAAS,aAAa,EAAE,SAAS,CAAC,MACnC,eAAe,iBAAiB,CAAC,CAAC,CAAC,KAAG,gBActC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { createMediaQueryBuilder } from "./helpers";
2
+ import { runMediaQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, } from "./validation";
3
+ import { emitCustomFeatures, emitDimensionsFeatures, emitDisplayFeatures, emitEnvironmentFeatures, emitInteractionFeatures, emitPreferencesFeatures, emitResolutionFeatures, } from "./modules";
4
+ export const emitCoreFeatures = (props, helpers) => {
5
+ if (!runMediaQueryValidation(props, helpers, validateMinMaxWidth, "core", "minWidth must be less than or equal to maxWidth")) {
6
+ return;
7
+ }
8
+ if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, "core", "width values must be greater than 0")) {
9
+ return;
10
+ }
11
+ const { addFeature } = helpers;
12
+ if (props.minWidth) {
13
+ addFeature("min-width", props.minWidth);
14
+ }
15
+ if (props.maxWidth) {
16
+ addFeature("max-width", props.maxWidth);
17
+ }
18
+ };
19
+ const emitBaseFeatures = (props, helpers) => {
20
+ emitCoreFeatures(props, helpers);
21
+ emitDimensionsFeatures(props, helpers);
22
+ emitResolutionFeatures(props, helpers);
23
+ emitInteractionFeatures(props, helpers);
24
+ emitPreferencesFeatures(props, helpers);
25
+ emitDisplayFeatures(props, helpers);
26
+ emitEnvironmentFeatures(props, helpers);
27
+ emitCustomFeatures(props, helpers);
28
+ };
29
+ export const buildMediaQueryString = createMediaQueryBuilder({
30
+ emitBase: emitBaseFeatures,
31
+ resolveType: (props) => props.type,
32
+ });
33
+ export const makeMediaQueryStyle = (queries) => (stylesByQuery) => {
34
+ const result = {};
35
+ Object.keys(stylesByQuery).forEach((key) => {
36
+ const styles = stylesByQuery[key];
37
+ const props = queries[key];
38
+ if (!styles || !props)
39
+ return;
40
+ result[buildMediaQueryString(props)] = styles;
41
+ });
42
+ const mediaQuery = {
43
+ "@media": result,
44
+ };
45
+ return mediaQuery;
46
+ };
@@ -0,0 +1,27 @@
1
+ import type { IMediaQueryCore } from './mediaQueries';
2
+ import type { IMediaQueryCustomFeatures, IMediaQueryDimensions, IMediaQueryDisplay, IMediaQueryEnvironment, IMediaQueryInteraction, IMediaQueryPreferences, IMediaQueryResolutionRange } from './modules';
3
+ export type MediaQueryModuleId = 'core' | 'dimensions' | 'resolution' | 'interaction' | 'preferences' | 'display' | 'environment' | 'custom';
4
+ export type MediaQueryModulePropsMap = {
5
+ core: IMediaQueryCore;
6
+ dimensions: IMediaQueryDimensions;
7
+ resolution: IMediaQueryResolutionRange;
8
+ interaction: IMediaQueryInteraction;
9
+ preferences: IMediaQueryPreferences;
10
+ display: IMediaQueryDisplay;
11
+ environment: IMediaQueryEnvironment;
12
+ custom: IMediaQueryCustomFeatures;
13
+ };
14
+ export type MediaQueryModuleKeysMap = {
15
+ core: 'type' | 'minWidth' | 'maxWidth';
16
+ dimensions: 'width' | 'height' | 'minHeight' | 'maxHeight' | 'aspectRatio' | 'minAspectRatio' | 'maxAspectRatio' | 'orientation';
17
+ resolution: 'resolutionValue' | 'minResolution' | 'maxResolution';
18
+ interaction: 'hover' | 'anyHover' | 'pointer' | 'anyPointer' | 'update';
19
+ preferences: 'colorScheme' | 'reducedMotion' | 'reducedData' | 'contrast' | 'forcedColors';
20
+ display: 'colorGamut' | 'dynamicRange' | 'invertedColors';
21
+ environment: 'scripting' | 'overflowBlock' | 'overflowInline';
22
+ custom: 'customFeatures';
23
+ };
24
+ export type MediaQueryModuleKeys<M extends MediaQueryModuleId> = MediaQueryModuleKeysMap[M];
25
+ export type MediaQueryModulesList = readonly MediaQueryModuleId[];
26
+ export declare const defineMediaQueryModules: <T extends MediaQueryModulesList>(...modules: T) => T;
27
+ //# sourceMappingURL=moduleRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleRegistry.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/moduleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,aAAa,GACb,SAAS,GACT,aAAa,GACb,QAAQ,CAAC;AAEb,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;IACpC,WAAW,EAAE,sBAAsB,CAAC;IACpC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,WAAW,EAAE,sBAAsB,CAAC;IACpC,MAAM,EAAE,yBAAyB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IACvC,UAAU,EACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,WAAW,GACX,aAAa,GACb,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,CAAC;IAClB,UAAU,EAAE,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAAC;IAClE,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IACxE,WAAW,EACP,aAAa,GACb,eAAe,GACf,aAAa,GACb,UAAU,GACV,cAAc,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,cAAc,GAAG,gBAAgB,CAAC;IAC1D,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC9D,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,kBAAkB,IAC3D,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAE7B,MAAM,MAAM,qBAAqB,GAAG,SAAS,kBAAkB,EAAE,CAAC;AAElE,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,qBAAqB,EACrE,GAAG,SAAS,CAAC,KACZ,CAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export const defineMediaQueryModules = (...modules) => modules;
@@ -0,0 +1,10 @@
1
+ import type { IMeasurement } from '../../core';
2
+ import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
3
+ type MediaQueryFeatureValue = string | number | IMeasurement;
4
+ export interface IMediaQueryCustomFeatures {
5
+ customFeatures?: Record<string, MediaQueryFeatureValue>;
6
+ }
7
+ export type MediaQueryCustomFeaturesValidator = MediaQueryValidator<IMediaQueryCustomFeatures>;
8
+ export declare const emitCustomFeatures: (props: IMediaQueryCustomFeatures, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryCustomFeaturesValidator) => void;
9
+ export {};
10
+ //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,KAAK,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAE7D,MAAM,WAAW,yBAAyB;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,iCAAiC,GAC3C,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;AAEjD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,yBAAyB,EAChC,SAAS,wBAAwB,EACjC,WAAW,iCAAiC,KAC3C,IAqBF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { hasCssMethod } from '../../core';
2
+ import { applyMediaQueryValidation } from '../helpers';
3
+ export const emitCustomFeatures = (props, helpers, validate) => {
4
+ if (!applyMediaQueryValidation(props, helpers, validate, 'custom')) {
5
+ return;
6
+ }
7
+ const { addFeature } = helpers;
8
+ if (!props.customFeatures)
9
+ return;
10
+ Object.entries(props.customFeatures).forEach(([name, value]) => {
11
+ if (value === undefined || value === null)
12
+ return;
13
+ const trimmedName = name.trim();
14
+ if (!trimmedName) {
15
+ throw new Error('Custom feature name must be non-empty.');
16
+ }
17
+ if (typeof value === 'object' && !hasCssMethod(value)) {
18
+ throw new Error(`Custom feature "${trimmedName}" must be a primitive or a measurement.`);
19
+ }
20
+ addFeature(trimmedName, value);
21
+ });
22
+ };
@@ -0,0 +1,17 @@
1
+ import type { IMeasurement } from '../../core';
2
+ import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
3
+ type MediaQueryRatio = number | string;
4
+ export interface IMediaQueryDimensions {
5
+ width?: IMeasurement;
6
+ minHeight?: IMeasurement;
7
+ maxHeight?: IMeasurement;
8
+ height?: IMeasurement;
9
+ aspectRatio?: MediaQueryRatio;
10
+ minAspectRatio?: MediaQueryRatio;
11
+ maxAspectRatio?: MediaQueryRatio;
12
+ orientation?: 'landscape' | 'portrait';
13
+ }
14
+ export type MediaQueryDimensionsValidator = MediaQueryValidator<IMediaQueryDimensions>;
15
+ export declare const emitDimensionsFeatures: (props: IMediaQueryDimensions, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryDimensionsValidator) => void;
16
+ export {};
17
+ //# sourceMappingURL=dimensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/dimensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAgBpB,KAAK,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,WAAW,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACxC;AAED,MAAM,MAAM,6BAA6B,GACvC,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAE7C,eAAO,MAAM,sBAAsB,GACjC,OAAO,qBAAqB,EAC5B,SAAS,wBAAwB,EACjC,WAAW,6BAA6B,KACvC,IA0GF,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { applyMediaQueryValidation } from '../helpers';
2
+ import { runMediaQueryValidation, validateAspectRatioValuesPositive, validateHeightValuesPositive, validateMinMaxAspectRatio, validateMinMaxHeight, validateWidthValuesPositive, } from '../validation';
3
+ import { runMediaQueryLint } from '../linting';
4
+ import { lintHeightRedundancy, lintWidthRedundancy, } from '../linting/core';
5
+ export const emitDimensionsFeatures = (props, helpers, validate) => {
6
+ if (!runMediaQueryValidation(props, helpers, validateMinMaxHeight, 'dimensions', 'minHeight must be less than or equal to maxHeight')) {
7
+ return;
8
+ }
9
+ if (!runMediaQueryValidation(props, helpers, validateHeightValuesPositive, 'dimensions', 'height values must be greater than 0')) {
10
+ return;
11
+ }
12
+ if (!runMediaQueryLint(props, helpers, lintWidthRedundancy, 'width should not be combined with minWidth or maxWidth')) {
13
+ return;
14
+ }
15
+ if (!runMediaQueryLint(props, helpers, lintHeightRedundancy, 'height should not be combined with minHeight or maxHeight')) {
16
+ return;
17
+ }
18
+ if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, 'dimensions', 'width values must be greater than 0')) {
19
+ return;
20
+ }
21
+ if (!runMediaQueryValidation(props, helpers, validateMinMaxAspectRatio, 'dimensions', 'minAspectRatio must be less than or equal to maxAspectRatio')) {
22
+ return;
23
+ }
24
+ if (!runMediaQueryValidation(props, helpers, validateAspectRatioValuesPositive, 'dimensions', 'aspect ratio values must be greater than 0')) {
25
+ return;
26
+ }
27
+ if (!applyMediaQueryValidation(props, helpers, validate, 'dimensions')) {
28
+ return;
29
+ }
30
+ const { addFeature } = helpers;
31
+ if (props.width) {
32
+ addFeature('width', props.width);
33
+ }
34
+ if (props.height) {
35
+ addFeature('height', props.height);
36
+ }
37
+ if (props.minHeight) {
38
+ addFeature('min-height', props.minHeight);
39
+ }
40
+ if (props.maxHeight) {
41
+ addFeature('max-height', props.maxHeight);
42
+ }
43
+ if (props.aspectRatio) {
44
+ addFeature('aspect-ratio', props.aspectRatio);
45
+ }
46
+ if (props.minAspectRatio) {
47
+ addFeature('min-aspect-ratio', props.minAspectRatio);
48
+ }
49
+ if (props.maxAspectRatio) {
50
+ addFeature('max-aspect-ratio', props.maxAspectRatio);
51
+ }
52
+ if (props.orientation) {
53
+ addFeature('orientation', props.orientation);
54
+ }
55
+ };
@@ -0,0 +1,9 @@
1
+ import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
2
+ export interface IMediaQueryDisplay {
3
+ colorGamut?: 'srgb' | 'p3' | 'rec2020';
4
+ dynamicRange?: 'standard' | 'high';
5
+ invertedColors?: 'none' | 'inverted';
6
+ }
7
+ export type MediaQueryDisplayValidator = MediaQueryValidator<IMediaQueryDisplay>;
8
+ export declare const emitDisplayFeatures: (props: IMediaQueryDisplay, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryDisplayValidator) => void;
9
+ //# sourceMappingURL=display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,YAAY,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CACtC;AAED,MAAM,MAAM,0BAA0B,GACpC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AAE1C,eAAO,MAAM,mBAAmB,GAC9B,OAAO,kBAAkB,EACzB,SAAS,wBAAwB,EACjC,WAAW,0BAA0B,KACpC,IAgBF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { applyMediaQueryValidation } from '../helpers';
2
+ export const emitDisplayFeatures = (props, helpers, validate) => {
3
+ if (!applyMediaQueryValidation(props, helpers, validate, 'display')) {
4
+ return;
5
+ }
6
+ const { addFeature } = helpers;
7
+ if (props.colorGamut) {
8
+ addFeature('color-gamut', props.colorGamut);
9
+ }
10
+ if (props.dynamicRange) {
11
+ addFeature('dynamic-range', props.dynamicRange);
12
+ }
13
+ if (props.invertedColors) {
14
+ addFeature('inverted-colors', props.invertedColors);
15
+ }
16
+ };
@@ -0,0 +1,9 @@
1
+ import type { MediaQueryBuilderHelpers, MediaQueryValidator } from '../helpers';
2
+ export interface IMediaQueryEnvironment {
3
+ scripting?: 'none' | 'initial-only' | 'enabled';
4
+ overflowBlock?: 'none' | 'scroll' | 'paged';
5
+ overflowInline?: 'none' | 'scroll';
6
+ }
7
+ export type MediaQueryEnvironmentValidator = MediaQueryValidator<IMediaQueryEnvironment>;
8
+ export declare const emitEnvironmentFeatures: (props: IMediaQueryEnvironment, helpers: MediaQueryBuilderHelpers, validate?: MediaQueryEnvironmentValidator) => void;
9
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAChD,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACpC;AAED,MAAM,MAAM,8BAA8B,GACxC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAE9C,eAAO,MAAM,uBAAuB,GAClC,OAAO,sBAAsB,EAC7B,SAAS,wBAAwB,EACjC,WAAW,8BAA8B,KACxC,IAkBF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { applyMediaQueryValidation } from '../helpers';
2
+ export const emitEnvironmentFeatures = (props, helpers, validate) => {
3
+ if (!applyMediaQueryValidation(props, helpers, validate, 'environment')) {
4
+ return;
5
+ }
6
+ const { addFeature } = helpers;
7
+ if (props.scripting) {
8
+ addFeature('scripting', props.scripting);
9
+ }
10
+ if (props.overflowBlock) {
11
+ addFeature('overflow-block', props.overflowBlock);
12
+ }
13
+ if (props.overflowInline) {
14
+ addFeature('overflow-inline', props.overflowInline);
15
+ }
16
+ };
@@ -0,0 +1,8 @@
1
+ export * from './custom';
2
+ export * from './dimensions';
3
+ export * from './display';
4
+ export * from './environment';
5
+ export * from './interaction';
6
+ export * from './preferences';
7
+ export * from './resolution';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './custom';
2
+ export * from './dimensions';
3
+ export * from './display';
4
+ export * from './environment';
5
+ export * from './interaction';
6
+ export * from './preferences';
7
+ export * from './resolution';
@@ -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
+ export 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