css-calipers 0.13.0 → 0.15.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 +21 -25
- package/dist/cjs/factory.js +0 -3
- package/dist/cjs/internal/createCoreApi.js +30 -9
- package/dist/esm/core.d.ts +21 -17
- package/dist/esm/core.d.ts.map +1 -1
- package/dist/esm/factory.d.ts +0 -2
- package/dist/esm/factory.d.ts.map +1 -1
- package/dist/esm/factory.js +0 -3
- package/dist/esm/internal/createCoreApi.d.ts +7 -11
- package/dist/esm/internal/createCoreApi.d.ts.map +1 -1
- package/dist/esm/internal/createCoreApi.js +30 -9
- package/package.json +11 -24
- package/RELEASING.md +0 -62
- package/dist/cjs/comparisons/index.js +0 -25
- package/dist/cjs/containerQueries/containerQueries.js +0 -115
- package/dist/cjs/containerQueries/factory.js +0 -123
- package/dist/cjs/containerQueries/helpers.js +0 -95
- package/dist/cjs/containerQueries/index.js +0 -16
- package/dist/cjs/containerQueries/linting/aspectRatio.js +0 -24
- package/dist/cjs/containerQueries/linting/block.js +0 -23
- package/dist/cjs/containerQueries/linting/core.js +0 -25
- package/dist/cjs/containerQueries/linting/custom.js +0 -11
- package/dist/cjs/containerQueries/linting/inline.js +0 -23
- package/dist/cjs/containerQueries/linting/resolution.js +0 -12
- package/dist/cjs/containerQueries/linting/style.js +0 -28
- package/dist/cjs/containerQueries/linting.js +0 -24
- package/dist/cjs/containerQueries/moduleRegistry.js +0 -5
- package/dist/cjs/containerQueries/modules/aspectRatio.js +0 -51
- package/dist/cjs/containerQueries/modules/block.js +0 -53
- package/dist/cjs/containerQueries/modules/custom.js +0 -43
- package/dist/cjs/containerQueries/modules/index.js +0 -21
- package/dist/cjs/containerQueries/modules/inline.js +0 -53
- package/dist/cjs/containerQueries/modules/size.js +0 -2
- package/dist/cjs/containerQueries/modules/style.js +0 -36
- package/dist/cjs/containerQueries/types.js +0 -2
- package/dist/cjs/containerQueries/validation.js +0 -191
- package/dist/cjs/fraction.js +0 -139
- package/dist/cjs/internal/createComponentQueriesApi.js +0 -56
- package/dist/cjs/internal/createMediaQueriesApi.js +0 -74
- package/dist/cjs/internal/normalizeToArray.js +0 -9
- package/dist/cjs/libraryHelpers/vanilla-extract.js +0 -11
- package/dist/cjs/logicalOperators/index.js +0 -18
- package/dist/cjs/mediaQueries/factory.js +0 -187
- package/dist/cjs/mediaQueries/helpers.js +0 -97
- package/dist/cjs/mediaQueries/index.js +0 -23
- package/dist/cjs/mediaQueries/libraryHelpers/vanilla-extract.js +0 -77
- package/dist/cjs/mediaQueries/linting/core.js +0 -19
- package/dist/cjs/mediaQueries/linting/resolution.js +0 -11
- package/dist/cjs/mediaQueries/linting.js +0 -24
- package/dist/cjs/mediaQueries/mediaQueries.js +0 -53
- package/dist/cjs/mediaQueries/mediaQueryFactory.js +0 -120
- package/dist/cjs/mediaQueries/moduleRegistry.js +0 -5
- package/dist/cjs/mediaQueries/modules/custom.js +0 -26
- package/dist/cjs/mediaQueries/modules/dimensions.js +0 -61
- package/dist/cjs/mediaQueries/modules/display.js +0 -20
- package/dist/cjs/mediaQueries/modules/environment.js +0 -20
- package/dist/cjs/mediaQueries/modules/index.js +0 -23
- package/dist/cjs/mediaQueries/modules/interaction.js +0 -26
- package/dist/cjs/mediaQueries/modules/preferences.js +0 -26
- package/dist/cjs/mediaQueries/modules/resolution.js +0 -31
- package/dist/cjs/mediaQueries/types.js +0 -2
- package/dist/cjs/mediaQueries/validation.js +0 -131
- package/dist/cjs/types.js +0 -2
- package/dist/cjs/validation.js +0 -20
- package/dist/esm/comparisons/index.d.ts +0 -23
- package/dist/esm/comparisons/index.d.ts.map +0 -1
- package/dist/esm/comparisons/index.js +0 -22
- package/dist/esm/containerQueries/containerQueries.d.ts +0 -36
- package/dist/esm/containerQueries/containerQueries.d.ts.map +0 -1
- package/dist/esm/containerQueries/containerQueries.js +0 -109
- package/dist/esm/containerQueries/factory.d.ts +0 -20
- package/dist/esm/containerQueries/factory.d.ts.map +0 -1
- package/dist/esm/containerQueries/factory.js +0 -119
- package/dist/esm/containerQueries/helpers.d.ts +0 -53
- package/dist/esm/containerQueries/helpers.d.ts.map +0 -1
- package/dist/esm/containerQueries/helpers.js +0 -82
- package/dist/esm/containerQueries/index.d.ts +0 -10
- package/dist/esm/containerQueries/index.d.ts.map +0 -1
- package/dist/esm/containerQueries/index.js +0 -4
- package/dist/esm/containerQueries/linting/aspectRatio.d.ts +0 -4
- package/dist/esm/containerQueries/linting/aspectRatio.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/aspectRatio.js +0 -19
- package/dist/esm/containerQueries/linting/block.d.ts +0 -4
- package/dist/esm/containerQueries/linting/block.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/block.js +0 -18
- package/dist/esm/containerQueries/linting/core.d.ts +0 -4
- package/dist/esm/containerQueries/linting/core.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/core.js +0 -20
- package/dist/esm/containerQueries/linting/custom.d.ts +0 -3
- package/dist/esm/containerQueries/linting/custom.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/custom.js +0 -7
- package/dist/esm/containerQueries/linting/inline.d.ts +0 -4
- package/dist/esm/containerQueries/linting/inline.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/inline.js +0 -18
- package/dist/esm/containerQueries/linting/resolution.d.ts +0 -1
- package/dist/esm/containerQueries/linting/resolution.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/resolution.js +0 -12
- package/dist/esm/containerQueries/linting/style.d.ts +0 -3
- package/dist/esm/containerQueries/linting/style.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting/style.js +0 -24
- package/dist/esm/containerQueries/linting.d.ts +0 -4
- package/dist/esm/containerQueries/linting.d.ts.map +0 -1
- package/dist/esm/containerQueries/linting.js +0 -20
- package/dist/esm/containerQueries/moduleRegistry.d.ts +0 -25
- package/dist/esm/containerQueries/moduleRegistry.d.ts.map +0 -1
- package/dist/esm/containerQueries/moduleRegistry.js +0 -1
- package/dist/esm/containerQueries/modules/aspectRatio.d.ts +0 -17
- package/dist/esm/containerQueries/modules/aspectRatio.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/aspectRatio.js +0 -47
- package/dist/esm/containerQueries/modules/block.d.ts +0 -20
- package/dist/esm/containerQueries/modules/block.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/block.js +0 -49
- package/dist/esm/containerQueries/modules/custom.d.ts +0 -13
- package/dist/esm/containerQueries/modules/custom.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/custom.js +0 -39
- package/dist/esm/containerQueries/modules/index.d.ts +0 -6
- package/dist/esm/containerQueries/modules/index.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/index.js +0 -5
- package/dist/esm/containerQueries/modules/inline.d.ts +0 -20
- package/dist/esm/containerQueries/modules/inline.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/inline.js +0 -49
- package/dist/esm/containerQueries/modules/size.d.ts +0 -41
- package/dist/esm/containerQueries/modules/size.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/size.js +0 -1
- package/dist/esm/containerQueries/modules/style.d.ts +0 -11
- package/dist/esm/containerQueries/modules/style.d.ts.map +0 -1
- package/dist/esm/containerQueries/modules/style.js +0 -32
- package/dist/esm/containerQueries/types.d.ts +0 -81
- package/dist/esm/containerQueries/types.d.ts.map +0 -1
- package/dist/esm/containerQueries/types.js +0 -1
- package/dist/esm/containerQueries/validation.d.ts +0 -41
- package/dist/esm/containerQueries/validation.d.ts.map +0 -1
- package/dist/esm/containerQueries/validation.js +0 -187
- package/dist/esm/fraction.d.ts +0 -23
- package/dist/esm/fraction.d.ts.map +0 -1
- package/dist/esm/fraction.js +0 -129
- package/dist/esm/internal/createComponentQueriesApi.d.ts +0 -34
- package/dist/esm/internal/createComponentQueriesApi.d.ts.map +0 -1
- package/dist/esm/internal/createComponentQueriesApi.js +0 -52
- package/dist/esm/internal/createMediaQueriesApi.d.ts +0 -35
- package/dist/esm/internal/createMediaQueriesApi.d.ts.map +0 -1
- package/dist/esm/internal/createMediaQueriesApi.js +0 -70
- package/dist/esm/internal/normalizeToArray.d.ts +0 -2
- package/dist/esm/internal/normalizeToArray.d.ts.map +0 -1
- package/dist/esm/internal/normalizeToArray.js +0 -5
- package/dist/esm/libraryHelpers/vanilla-extract.d.ts +0 -4
- package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +0 -1
- package/dist/esm/libraryHelpers/vanilla-extract.js +0 -6
- package/dist/esm/logicalOperators/index.d.ts +0 -2
- package/dist/esm/logicalOperators/index.d.ts.map +0 -1
- package/dist/esm/logicalOperators/index.js +0 -17
- package/dist/esm/mediaQueries/factory.d.ts +0 -45
- package/dist/esm/mediaQueries/factory.d.ts.map +0 -1
- package/dist/esm/mediaQueries/factory.js +0 -183
- package/dist/esm/mediaQueries/helpers.d.ts +0 -40
- package/dist/esm/mediaQueries/helpers.d.ts.map +0 -1
- package/dist/esm/mediaQueries/helpers.js +0 -87
- package/dist/esm/mediaQueries/index.d.ts +0 -8
- package/dist/esm/mediaQueries/index.d.ts.map +0 -1
- package/dist/esm/mediaQueries/index.js +0 -7
- package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts +0 -5
- package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts.map +0 -1
- package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.js +0 -71
- package/dist/esm/mediaQueries/linting/core.d.ts +0 -5
- package/dist/esm/mediaQueries/linting/core.d.ts.map +0 -1
- package/dist/esm/mediaQueries/linting/core.js +0 -14
- package/dist/esm/mediaQueries/linting/resolution.d.ts +0 -3
- package/dist/esm/mediaQueries/linting/resolution.d.ts.map +0 -1
- package/dist/esm/mediaQueries/linting/resolution.js +0 -7
- package/dist/esm/mediaQueries/linting.d.ts +0 -4
- package/dist/esm/mediaQueries/linting.d.ts.map +0 -1
- package/dist/esm/mediaQueries/linting.js +0 -20
- package/dist/esm/mediaQueries/mediaQueries.d.ts +0 -23
- package/dist/esm/mediaQueries/mediaQueries.d.ts.map +0 -1
- package/dist/esm/mediaQueries/mediaQueries.js +0 -48
- package/dist/esm/mediaQueries/moduleRegistry.d.ts +0 -27
- package/dist/esm/mediaQueries/moduleRegistry.d.ts.map +0 -1
- package/dist/esm/mediaQueries/moduleRegistry.js +0 -1
- package/dist/esm/mediaQueries/modules/custom.d.ts +0 -10
- package/dist/esm/mediaQueries/modules/custom.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/custom.js +0 -22
- package/dist/esm/mediaQueries/modules/dimensions.d.ts +0 -19
- package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/dimensions.js +0 -57
- package/dist/esm/mediaQueries/modules/display.d.ts +0 -9
- package/dist/esm/mediaQueries/modules/display.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/display.js +0 -16
- package/dist/esm/mediaQueries/modules/environment.d.ts +0 -9
- package/dist/esm/mediaQueries/modules/environment.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/environment.js +0 -16
- package/dist/esm/mediaQueries/modules/index.d.ts +0 -8
- package/dist/esm/mediaQueries/modules/index.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/index.js +0 -7
- package/dist/esm/mediaQueries/modules/interaction.d.ts +0 -11
- package/dist/esm/mediaQueries/modules/interaction.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/interaction.js +0 -22
- package/dist/esm/mediaQueries/modules/preferences.d.ts +0 -11
- package/dist/esm/mediaQueries/modules/preferences.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/preferences.js +0 -22
- package/dist/esm/mediaQueries/modules/resolution.d.ts +0 -12
- package/dist/esm/mediaQueries/modules/resolution.d.ts.map +0 -1
- package/dist/esm/mediaQueries/modules/resolution.js +0 -27
- package/dist/esm/mediaQueries/types.d.ts +0 -117
- package/dist/esm/mediaQueries/types.d.ts.map +0 -1
- package/dist/esm/mediaQueries/types.js +0 -1
- package/dist/esm/mediaQueries/validation.d.ts +0 -34
- package/dist/esm/mediaQueries/validation.d.ts.map +0 -1
- package/dist/esm/mediaQueries/validation.js +0 -127
- package/dist/esm/types.d.ts +0 -35
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -1
- package/dist/esm/validation.d.ts +0 -10
- package/dist/esm/validation.d.ts.map +0 -1
- package/dist/esm/validation.js +0 -15
- package/dist/examples/containerQueries.example.js +0 -54
- package/dist/examples/examples/containerQueries.example.js +0 -54
- package/dist/examples/examples/factory-wrapper.example.js +0 -33
- package/dist/examples/examples/lineHeight-normalizer.example.js +0 -81
- package/dist/examples/examples/mediaQueries-multipleInstances.example.js +0 -127
- package/dist/examples/examples/mixedQueries.example.js +0 -55
- package/dist/examples/examples/validation-and-runtime-checks.example.js +0 -85
- package/dist/examples/examples/validation-unit-tests.example.js +0 -35
- package/dist/examples/factory-wrapper.example.js +0 -33
- package/dist/examples/lineHeight-normalizer.example.js +0 -81
- package/dist/examples/mediaQueries-multipleInstances.example.js +0 -127
- package/dist/examples/mixedQueries.example.js +0 -60
- package/dist/examples/src/comparisons/index.js +0 -25
- package/dist/examples/src/containerQueries/containerQueries.js +0 -96
- package/dist/examples/src/containerQueries/factory.js +0 -123
- package/dist/examples/src/containerQueries/helpers.js +0 -94
- package/dist/examples/src/containerQueries/index.js +0 -16
- package/dist/examples/src/containerQueries/linting/aspectRatio.js +0 -20
- package/dist/examples/src/containerQueries/linting/block.js +0 -20
- package/dist/examples/src/containerQueries/linting/core.js +0 -19
- package/dist/examples/src/containerQueries/linting/custom.js +0 -11
- package/dist/examples/src/containerQueries/linting/inline.js +0 -20
- package/dist/examples/src/containerQueries/linting/style.js +0 -28
- package/dist/examples/src/containerQueries/linting.js +0 -24
- package/dist/examples/src/containerQueries/moduleRegistry.js +0 -5
- package/dist/examples/src/containerQueries/modules/aspectRatio.js +0 -33
- package/dist/examples/src/containerQueries/modules/block.js +0 -44
- package/dist/examples/src/containerQueries/modules/custom.js +0 -31
- package/dist/examples/src/containerQueries/modules/index.js +0 -21
- package/dist/examples/src/containerQueries/modules/inline.js +0 -44
- package/dist/examples/src/containerQueries/modules/style.js +0 -36
- package/dist/examples/src/containerQueries/types.js +0 -2
- package/dist/examples/src/containerQueries/validation.js +0 -177
- package/dist/examples/src/core.js +0 -16
- package/dist/examples/src/factory.js +0 -21
- package/dist/examples/src/index.js +0 -30
- package/dist/examples/src/internal/buildMeasurementCreationError.js +0 -16
- package/dist/examples/src/internal/createCoreApi.js +0 -336
- package/dist/examples/src/internal/createMediaQueriesApi.js +0 -74
- package/dist/examples/src/internal/createUnitsApi.js +0 -18
- package/dist/examples/src/internal/errors.js +0 -130
- package/dist/examples/src/libraryHelpers/vanilla-extract.js +0 -11
- package/dist/examples/src/mediaQueries/factory.js +0 -163
- package/dist/examples/src/mediaQueries/helpers.js +0 -88
- package/dist/examples/src/mediaQueries/index.js +0 -23
- package/dist/examples/src/mediaQueries/linting/core.js +0 -19
- package/dist/examples/src/mediaQueries/linting/resolution.js +0 -11
- package/dist/examples/src/mediaQueries/linting.js +0 -24
- package/dist/examples/src/mediaQueries/mediaQueries.js +0 -53
- package/dist/examples/src/mediaQueries/moduleRegistry.js +0 -5
- package/dist/examples/src/mediaQueries/modules/custom.js +0 -26
- package/dist/examples/src/mediaQueries/modules/dimensions.js +0 -61
- package/dist/examples/src/mediaQueries/modules/display.js +0 -20
- package/dist/examples/src/mediaQueries/modules/environment.js +0 -20
- package/dist/examples/src/mediaQueries/modules/index.js +0 -23
- package/dist/examples/src/mediaQueries/modules/interaction.js +0 -26
- package/dist/examples/src/mediaQueries/modules/preferences.js +0 -26
- package/dist/examples/src/mediaQueries/modules/resolution.js +0 -31
- package/dist/examples/src/mediaQueries/types.js +0 -2
- package/dist/examples/src/mediaQueries/validation.js +0 -128
- package/dist/examples/src/ratio.js +0 -141
- package/dist/examples/src/types.js +0 -2
- package/dist/examples/src/unitDefinitions.js +0 -67
- package/dist/examples/src/units/absolute.js +0 -11
- package/dist/examples/src/units/angle.js +0 -8
- package/dist/examples/src/units/container.js +0 -10
- package/dist/examples/src/units/font-relative.js +0 -16
- package/dist/examples/src/units/frequency.js +0 -6
- package/dist/examples/src/units/grid.js +0 -5
- package/dist/examples/src/units/percent.js +0 -7
- package/dist/examples/src/units/resolution.js +0 -7
- package/dist/examples/src/units/time.js +0 -6
- package/dist/examples/src/units/viewport-dynamic.js +0 -10
- package/dist/examples/src/units/viewport-large.js +0 -10
- package/dist/examples/src/units/viewport-small.js +0 -10
- package/dist/examples/src/units/viewport.js +0 -10
- package/dist/examples/src/validation.js +0 -20
- package/dist/examples/validation-and-runtime-checks.example.js +0 -85
- package/dist/examples/validation-unit-tests.example.js +0 -35
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ComplexStyleRule, StyleRule } from './types';
|
|
2
|
-
import type { MediaQueryBuilderConfig } from './helpers';
|
|
3
|
-
import type { IMediaQueryProps } from './mediaQueries';
|
|
4
|
-
import type { MediaQueryModulePropsMap, MediaQueryModulesList } from './moduleRegistry';
|
|
5
|
-
type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer R) => void ? R : never;
|
|
6
|
-
type ModulesToProps<TModules extends MediaQueryModulesList> = UnionToIntersection<MediaQueryModulePropsMap[TModules[number]]>;
|
|
7
|
-
type FactoryQueryProps<TModules extends MediaQueryModulesList | undefined> = TModules extends MediaQueryModulesList ? ModulesToProps<TModules> : IMediaQueryProps;
|
|
8
|
-
type MediaQueryStyleMap<TQueries> = Partial<Record<keyof TQueries, StyleRule>>;
|
|
9
|
-
type CustomHookResult = boolean | string | null | undefined | {
|
|
10
|
-
valid: boolean;
|
|
11
|
-
message?: string;
|
|
12
|
-
};
|
|
13
|
-
type MediaQueryFactoryCustomHooks = {
|
|
14
|
-
key: string;
|
|
15
|
-
validator?: (props: IMediaQueryProps) => CustomHookResult;
|
|
16
|
-
linter?: (props: IMediaQueryProps) => CustomHookResult;
|
|
17
|
-
};
|
|
18
|
-
declare const MODULE_EMITTERS: {
|
|
19
|
-
core: (props: import("./mediaQueries").IMediaQueryCore, helpers: import("./helpers").MediaQueryBuilderHelpers) => void;
|
|
20
|
-
dimensions: (props: import("./modules").IMediaQueryDimensions, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryDimensionsValidator) => void;
|
|
21
|
-
resolution: (props: import("./modules").IMediaQueryResolutionRange, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryResolutionValidator) => void;
|
|
22
|
-
interaction: (props: import("./modules").IMediaQueryInteraction, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryInteractionValidator) => void;
|
|
23
|
-
preferences: (props: import("./modules").IMediaQueryPreferences, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryPreferencesValidator) => void;
|
|
24
|
-
display: (props: import("./modules").IMediaQueryDisplay, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryDisplayValidator) => void;
|
|
25
|
-
environment: (props: import("./modules").IMediaQueryEnvironment, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryEnvironmentValidator) => void;
|
|
26
|
-
custom: (props: import("./modules").IMediaQueryCustomFeatures, helpers: import("./helpers").MediaQueryBuilderHelpers, validate?: import("./modules").MediaQueryCustomFeaturesValidator) => void;
|
|
27
|
-
};
|
|
28
|
-
export type MediaQueryModuleEmitters = typeof MODULE_EMITTERS;
|
|
29
|
-
export type MediaQueryFactoryConfig<TModules extends MediaQueryModulesList | undefined = undefined, TOutput = ComplexStyleRule> = MediaQueryBuilderConfig & {
|
|
30
|
-
label: string;
|
|
31
|
-
modules?: TModules;
|
|
32
|
-
preProcessor?: (media: StyleRule) => StyleRule;
|
|
33
|
-
output?: (media: StyleRule) => TOutput;
|
|
34
|
-
custom?: MediaQueryFactoryCustomHooks;
|
|
35
|
-
};
|
|
36
|
-
export declare const createMediaQueryFactory: (emitters: MediaQueryModuleEmitters) => <TModules extends MediaQueryModulesList | undefined, TQueries extends Record<string, FactoryQueryProps<TModules>>, TOutput = ComplexStyleRule>(options: {
|
|
37
|
-
queries: TQueries;
|
|
38
|
-
config: MediaQueryFactoryConfig<TModules, TOutput>;
|
|
39
|
-
}) => (stylesByQuery: MediaQueryStyleMap<TQueries>) => TOutput;
|
|
40
|
-
export declare const mediaQueryFactory: <TModules extends MediaQueryModulesList | undefined, TQueries extends Record<string, FactoryQueryProps<TModules>>, TOutput = ComplexStyleRule>(options: {
|
|
41
|
-
queries: TQueries;
|
|
42
|
-
config: MediaQueryFactoryConfig<TModules, TOutput>;
|
|
43
|
-
}) => (stylesByQuery: MediaQueryStyleMap<TQueries>) => TOutput;
|
|
44
|
-
export {};
|
|
45
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWvD,OAAO,KAAK,EAEV,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAC5B,CAAC,SAAS,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAC/C,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAC9B,CAAC,GACD,KAAK,CAAC;AAEV,KAAK,cAAc,CAAC,QAAQ,SAAS,qBAAqB,IACxD,mBAAmB,CAAC,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAElE,KAAK,iBAAiB,CAAC,QAAQ,SAAS,qBAAqB,GAAG,SAAS,IACvE,QAAQ,SAAS,qBAAqB,GAClC,cAAc,CAAC,QAAQ,CAAC,GACxB,gBAAgB,CAAC;AAEvB,KAAK,kBAAkB,CAAC,QAAQ,IAAI,OAAO,CACzC,MAAM,CAAC,MAAM,QAAQ,EAAE,SAAS,CAAC,CAClC,CAAC;AAEF,KAAK,gBAAgB,GACjB,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT;IACE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,KAAK,4BAA4B,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;CACxD,CAAC;AAuCF,QAAA,MAAM,eAAe;;;;;;;;;CASpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,eAAe,CAAC;AA+C9D,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,qBAAqB,GAAG,SAAS,GAAG,SAAS,EAC9D,OAAO,GAAG,gBAAgB,IACxB,uBAAuB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;IACvC,MAAM,CAAC,EAAE,4BAA4B,CAAC;CACvC,CAAC;AA2DF,eAAO,MAAM,uBAAuB,GAClC,UAAU,wBAAwB,MAElC,QAAQ,SAAS,qBAAqB,GAAG,SAAS,EAClD,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAC5D,OAAO,GAAG,gBAAgB,EAC1B,SAAS;IACT,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;CACpD,MAuCS,eAAe,kBAAkB,CAAC,QAAQ,CAAC,KAAG,OAiCvD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAhF5B,QAAQ,SAAS,qBAAqB,GAAG,SAAS,EAClD,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAC5D,OAAO,8BACE;IACT,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;CACpD,MAuCS,eAAe,kBAAkB,CAAC,QAAQ,CAAC,KAAG,OAmCiB,CAAC"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { createMediaQueryBuilder } from './helpers';
|
|
2
|
-
import { emitCoreFeatures } from './mediaQueries';
|
|
3
|
-
import { emitCustomFeatures, emitDimensionsFeatures, emitDisplayFeatures, emitEnvironmentFeatures, emitInteractionFeatures, emitPreferencesFeatures, emitResolutionFeatures, } from './modules';
|
|
4
|
-
const ALL_MEDIA_QUERY_MODULES = [
|
|
5
|
-
'core',
|
|
6
|
-
'dimensions',
|
|
7
|
-
'resolution',
|
|
8
|
-
'interaction',
|
|
9
|
-
'preferences',
|
|
10
|
-
'display',
|
|
11
|
-
'environment',
|
|
12
|
-
'custom',
|
|
13
|
-
];
|
|
14
|
-
const MODULE_KEYS = {
|
|
15
|
-
core: ['type', 'minWidth', 'maxWidth'],
|
|
16
|
-
dimensions: [
|
|
17
|
-
'width',
|
|
18
|
-
'height',
|
|
19
|
-
'minHeight',
|
|
20
|
-
'maxHeight',
|
|
21
|
-
'aspectRatio',
|
|
22
|
-
'minAspectRatio',
|
|
23
|
-
'maxAspectRatio',
|
|
24
|
-
'orientation',
|
|
25
|
-
],
|
|
26
|
-
resolution: ['resolutionValue', 'minResolution', 'maxResolution'],
|
|
27
|
-
interaction: ['hover', 'anyHover', 'pointer', 'anyPointer', 'update'],
|
|
28
|
-
preferences: [
|
|
29
|
-
'colorScheme',
|
|
30
|
-
'reducedMotion',
|
|
31
|
-
'reducedData',
|
|
32
|
-
'contrast',
|
|
33
|
-
'forcedColors',
|
|
34
|
-
],
|
|
35
|
-
display: ['colorGamut', 'dynamicRange', 'invertedColors'],
|
|
36
|
-
environment: ['scripting', 'overflowBlock', 'overflowInline'],
|
|
37
|
-
custom: ['customFeatures'],
|
|
38
|
-
};
|
|
39
|
-
const MODULE_EMITTERS = {
|
|
40
|
-
core: emitCoreFeatures,
|
|
41
|
-
dimensions: emitDimensionsFeatures,
|
|
42
|
-
resolution: emitResolutionFeatures,
|
|
43
|
-
interaction: emitInteractionFeatures,
|
|
44
|
-
preferences: emitPreferencesFeatures,
|
|
45
|
-
display: emitDisplayFeatures,
|
|
46
|
-
environment: emitEnvironmentFeatures,
|
|
47
|
-
custom: emitCustomFeatures,
|
|
48
|
-
};
|
|
49
|
-
const ALL_MODULE_KEYS = MODULE_KEYS;
|
|
50
|
-
const KEY_TO_MODULE = Object.fromEntries(Object.keys(ALL_MODULE_KEYS).flatMap((moduleId) => ALL_MODULE_KEYS[moduleId].map((key) => [key, moduleId])));
|
|
51
|
-
const guardUnsupportedProps = (props, modules, config, label) => {
|
|
52
|
-
const allowed = new Set();
|
|
53
|
-
modules.forEach((moduleId) => {
|
|
54
|
-
ALL_MODULE_KEYS[moduleId].forEach((key) => {
|
|
55
|
-
allowed.add(key);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
Object.keys(props).forEach((key) => {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
if (props[key] === undefined)
|
|
61
|
-
return;
|
|
62
|
-
if (allowed.has(key))
|
|
63
|
-
return;
|
|
64
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
65
|
-
const moduleHint = KEY_TO_MODULE[key];
|
|
66
|
-
const moduleSuffix = moduleHint
|
|
67
|
-
? ` Add "${moduleHint}" to modules.`
|
|
68
|
-
: '';
|
|
69
|
-
const message = `Media query factory "${label}" received unsupported feature "${key}".${moduleSuffix}`;
|
|
70
|
-
if (mode === 'log') {
|
|
71
|
-
console.warn(message);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (mode === 'allow')
|
|
75
|
-
return;
|
|
76
|
-
throw new Error(message);
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const normalizeCustomResult = (result) => {
|
|
80
|
-
if (result === undefined || result === null)
|
|
81
|
-
return { valid: true };
|
|
82
|
-
if (typeof result === 'boolean')
|
|
83
|
-
return { valid: result };
|
|
84
|
-
if (typeof result === 'string') {
|
|
85
|
-
return result ? { valid: false, message: result } : { valid: true };
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
89
|
-
const runCustomValidator = (props, config) => {
|
|
90
|
-
var _a, _b;
|
|
91
|
-
const custom = config.custom;
|
|
92
|
-
if (!(custom === null || custom === void 0 ? void 0 : custom.validator))
|
|
93
|
-
return;
|
|
94
|
-
const normalized = normalizeCustomResult(custom.validator(props));
|
|
95
|
-
if (normalized.valid)
|
|
96
|
-
return;
|
|
97
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
98
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
99
|
-
const message = `Media query factory "${config.label}" custom validator "${custom.key}" failed${suffix}`;
|
|
100
|
-
if (mode === 'log') {
|
|
101
|
-
console.warn(message);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (mode === 'allow')
|
|
105
|
-
return;
|
|
106
|
-
throw new Error(message);
|
|
107
|
-
};
|
|
108
|
-
const runCustomLinter = (props, config) => {
|
|
109
|
-
var _a, _b;
|
|
110
|
-
const custom = config.custom;
|
|
111
|
-
if (!(custom === null || custom === void 0 ? void 0 : custom.linter))
|
|
112
|
-
return;
|
|
113
|
-
const normalized = normalizeCustomResult(custom.linter(props));
|
|
114
|
-
if (normalized.valid)
|
|
115
|
-
return;
|
|
116
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
117
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
118
|
-
const message = `Media query factory "${config.label}" custom linter "${custom.key}" flagged${suffix}`;
|
|
119
|
-
if (mode === 'log') {
|
|
120
|
-
console.warn(message);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (mode === 'allow')
|
|
124
|
-
return;
|
|
125
|
-
throw new Error(message);
|
|
126
|
-
};
|
|
127
|
-
export const createMediaQueryFactory = (emitters) => (options) => {
|
|
128
|
-
var _a;
|
|
129
|
-
const modules = (_a = options.config.modules) !== null && _a !== void 0 ? _a : ALL_MEDIA_QUERY_MODULES;
|
|
130
|
-
const buildMediaQuery = createMediaQueryBuilder({
|
|
131
|
-
emitBase: (props, helpers) => {
|
|
132
|
-
guardUnsupportedProps(props, modules, options.config, options.config.label);
|
|
133
|
-
runCustomValidator(props, options.config);
|
|
134
|
-
runCustomLinter(props, options.config);
|
|
135
|
-
modules.forEach((moduleId) => {
|
|
136
|
-
emitters[moduleId](props, helpers);
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
resolveType: (props) => props.type,
|
|
140
|
-
config: options.config,
|
|
141
|
-
});
|
|
142
|
-
const handleUnknownQueryKey = (key, config) => {
|
|
143
|
-
var _a, _b;
|
|
144
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
145
|
-
const message = `Media query factory "${config.label}" received unknown query key "${key}".`;
|
|
146
|
-
if (mode === 'log') {
|
|
147
|
-
console.warn(message);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (mode === 'allow')
|
|
151
|
-
return;
|
|
152
|
-
throw new Error(message);
|
|
153
|
-
};
|
|
154
|
-
return (stylesByQuery) => {
|
|
155
|
-
const result = {};
|
|
156
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
157
|
-
const styles = stylesByQuery[key];
|
|
158
|
-
if (!styles)
|
|
159
|
-
return;
|
|
160
|
-
if (Object.prototype.hasOwnProperty.call(options.queries, key)) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
handleUnknownQueryKey(String(key), options.config);
|
|
164
|
-
});
|
|
165
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
166
|
-
const styles = stylesByQuery[key];
|
|
167
|
-
const props = options.queries[key];
|
|
168
|
-
if (!styles || !props)
|
|
169
|
-
return;
|
|
170
|
-
result[buildMediaQuery(props)] = styles;
|
|
171
|
-
});
|
|
172
|
-
const mediaQuery = {
|
|
173
|
-
'@media': result,
|
|
174
|
-
};
|
|
175
|
-
const processed = options.config.preProcessor
|
|
176
|
-
? options.config.preProcessor(mediaQuery)
|
|
177
|
-
: mediaQuery;
|
|
178
|
-
return options.config.output
|
|
179
|
-
? options.config.output(processed)
|
|
180
|
-
: processed;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
export const mediaQueryFactory = createMediaQueryFactory(MODULE_EMITTERS);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { IMeasurement, IRatio } from '../core';
|
|
2
|
-
type MediaQueryFeatureValue = string | number | IMeasurement | IRatio;
|
|
3
|
-
type MediaQueryFeatureEmitter = (name: string, value: MediaQueryFeatureValue) => void;
|
|
4
|
-
export type MediaQueryInvalidValueMode = 'allow' | 'log' | 'throw';
|
|
5
|
-
export type MediaQueryLintingMode = 'allow' | 'log' | 'throw';
|
|
6
|
-
export type MediaQueryBuilderConfig = {
|
|
7
|
-
errorHandling?: {
|
|
8
|
-
invalidValueMode?: MediaQueryInvalidValueMode;
|
|
9
|
-
lintingMode?: MediaQueryLintingMode;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export interface MediaQueryBuilderHelpers {
|
|
13
|
-
addFeature: MediaQueryFeatureEmitter;
|
|
14
|
-
config: MediaQueryBuilderConfig;
|
|
15
|
-
}
|
|
16
|
-
export type MediaQueryValidationResult = boolean | string | null | undefined | {
|
|
17
|
-
valid: boolean;
|
|
18
|
-
message?: string;
|
|
19
|
-
};
|
|
20
|
-
export type MediaQueryValidator<TConfig> = (config: TConfig) => MediaQueryValidationResult;
|
|
21
|
-
export type MediaQueryExtensionHandler<TConfig> = (config: TConfig, helpers: MediaQueryBuilderHelpers) => void;
|
|
22
|
-
type MediaQueryBuilderOptions<TConfig> = {
|
|
23
|
-
emitBase: MediaQueryExtensionHandler<TConfig>;
|
|
24
|
-
emitExtensions?: MediaQueryExtensionHandler<TConfig>;
|
|
25
|
-
resolveType?: (config: TConfig) => 'all' | 'print' | 'screen' | undefined;
|
|
26
|
-
config?: MediaQueryBuilderConfig;
|
|
27
|
-
};
|
|
28
|
-
export declare const formatMediaQueryValue: (value: MediaQueryFeatureValue) => string;
|
|
29
|
-
export declare const buildMediaQueryStringFromParts: (mediaType: "all" | "print" | "screen", parts: string[]) => string;
|
|
30
|
-
export declare const createMediaQueryFeatureEmitter: (parts: string[]) => MediaQueryFeatureEmitter;
|
|
31
|
-
type MediaQueryFeatureEmitterOptions = {
|
|
32
|
-
emitted?: Set<string>;
|
|
33
|
-
lintingMode?: MediaQueryLintingMode;
|
|
34
|
-
};
|
|
35
|
-
export declare const createMediaQueryFeatureEmitterWithTracking: (parts: string[], options?: MediaQueryFeatureEmitterOptions) => MediaQueryFeatureEmitter;
|
|
36
|
-
export declare const createMediaQueryBuilder: <TConfig>(options: MediaQueryBuilderOptions<TConfig>) => (config: TConfig) => string;
|
|
37
|
-
export declare const applyMediaQueryValidation: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, validator?: MediaQueryValidator<TConfig>, context?: string) => boolean;
|
|
38
|
-
export declare const buildMediaQueryFromFeatures: (features: Record<string, MediaQueryFeatureValue>, mediaType?: "all" | "print" | "screen") => string;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGpD,KAAK,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC;AAEtE,KAAK,wBAAwB,GAAG,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,sBAAsB,KAC1B,IAAI,CAAC;AAEV,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC;AACnE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,CAAC,EAAE;QACd,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;QAC9C,WAAW,CAAC,EAAE,qBAAqB,CAAC;KACrC,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,wBAAwB,CAAC;IACrC,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED,MAAM,MAAM,0BAA0B,GAClC,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT;IACE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,MAAM,MAAM,mBAAmB,CAAC,OAAO,IAAI,CACzC,MAAM,EAAE,OAAO,KACZ,0BAA0B,CAAC;AAEhC,MAAM,MAAM,0BAA0B,CAAC,OAAO,IAAI,CAChD,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,wBAAwB,KAC9B,IAAI,CAAC;AAEV,KAAK,wBAAwB,CAAC,OAAO,IAAI;IACvC,QAAQ,EAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC1E,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAO,sBAAsB,KAC5B,MAA6D,CAAC;AAEjE,eAAO,MAAM,8BAA8B,GACzC,WAAW,KAAK,GAAG,OAAO,GAAG,QAAQ,EACrC,OAAO,MAAM,EAAE,KACd,MAAgF,CAAC;AAEpF,eAAO,MAAM,8BAA8B,GACzC,OAAO,MAAM,EAAE,KACd,wBAGA,CAAC;AAEJ,KAAK,+BAA+B,GAAG;IACrC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,0CAA0C,GACrD,OAAO,MAAM,EAAE,EACf,UAAS,+BAAoC,KAC5C,wBAkBF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,OAAO,EAC7C,SAAS,wBAAwB,CAAC,OAAO,CAAC,MAElC,QAAQ,OAAO,KAAG,MAiB3B,CAAC;AAaF,eAAO,MAAM,yBAAyB,GAAI,OAAO,EAC/C,QAAQ,OAAO,EACf,SAAS,wBAAwB,EACjC,YAAY,mBAAmB,CAAC,OAAO,CAAC,EACxC,UAAU,MAAM,KACf,OAqBF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAChD,YAAW,KAAK,GAAG,OAAO,GAAG,QAAmB,KAC/C,MAaF,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { hasCssMethod } from '../core';
|
|
2
|
-
export const formatMediaQueryValue = (value) => (hasCssMethod(value) ? value.css() : String(value));
|
|
3
|
-
export const buildMediaQueryStringFromParts = (mediaType, parts) => (parts.length ? `${mediaType} and ${parts.join(' and ')}` : mediaType);
|
|
4
|
-
export const createMediaQueryFeatureEmitter = (parts) => (name, value) => {
|
|
5
|
-
parts.push(`(${name}: ${formatMediaQueryValue(value)})`);
|
|
6
|
-
};
|
|
7
|
-
export const createMediaQueryFeatureEmitterWithTracking = (parts, options = {}) => {
|
|
8
|
-
const { emitted, lintingMode = 'throw' } = options;
|
|
9
|
-
return (name, value) => {
|
|
10
|
-
if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
|
|
11
|
-
if (lintingMode === 'throw') {
|
|
12
|
-
throw new Error(`Media query feature "${name}" was emitted more than once.`);
|
|
13
|
-
}
|
|
14
|
-
if (lintingMode === 'log') {
|
|
15
|
-
console.warn(`Media query feature "${name}" was emitted more than once; using the latest value.`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
|
|
19
|
-
parts.push(`(${name}: ${formatMediaQueryValue(value)})`);
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export const createMediaQueryBuilder = (options) => {
|
|
23
|
-
return (config) => {
|
|
24
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
25
|
-
const parts = [];
|
|
26
|
-
const emittedFeatures = new Set();
|
|
27
|
-
const helpers = {
|
|
28
|
-
addFeature: createMediaQueryFeatureEmitterWithTracking(parts, {
|
|
29
|
-
emitted: emittedFeatures,
|
|
30
|
-
lintingMode: (_c = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.errorHandling) === null || _b === void 0 ? void 0 : _b.lintingMode) !== null && _c !== void 0 ? _c : 'throw',
|
|
31
|
-
}),
|
|
32
|
-
config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
|
|
33
|
-
};
|
|
34
|
-
options.emitBase(config, helpers);
|
|
35
|
-
(_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
|
|
36
|
-
const mediaType = (_g = (_f = options.resolveType) === null || _f === void 0 ? void 0 : _f.call(options, config)) !== null && _g !== void 0 ? _g : 'screen';
|
|
37
|
-
return buildMediaQueryStringFromParts(mediaType, parts);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const normalizeValidationResult = (result) => {
|
|
41
|
-
if (result === undefined || result === null)
|
|
42
|
-
return { valid: true };
|
|
43
|
-
if (typeof result === 'boolean')
|
|
44
|
-
return { valid: result };
|
|
45
|
-
if (typeof result === 'string') {
|
|
46
|
-
return result ? { valid: false, message: result } : { valid: true };
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
export const applyMediaQueryValidation = (config, helpers, validator, context) => {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
if (!validator)
|
|
53
|
-
return true;
|
|
54
|
-
const normalized = normalizeValidationResult(validator(config));
|
|
55
|
-
if (normalized.valid)
|
|
56
|
-
return true;
|
|
57
|
-
const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
58
|
-
if (mode === 'log') {
|
|
59
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
60
|
-
const prefix = context
|
|
61
|
-
? `Media query ${context} validation failed`
|
|
62
|
-
: 'Media query validation failed';
|
|
63
|
-
console.warn(`${prefix}${suffix}`);
|
|
64
|
-
}
|
|
65
|
-
if (mode === 'allow')
|
|
66
|
-
return true;
|
|
67
|
-
if (mode === 'log')
|
|
68
|
-
return true;
|
|
69
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
70
|
-
const prefix = context
|
|
71
|
-
? `Media query ${context} validation failed`
|
|
72
|
-
: 'Media query validation failed';
|
|
73
|
-
throw new Error(`${prefix}${suffix}`);
|
|
74
|
-
};
|
|
75
|
-
export const buildMediaQueryFromFeatures = (features, mediaType = 'screen') => {
|
|
76
|
-
const parts = [];
|
|
77
|
-
const addFeature = createMediaQueryFeatureEmitterWithTracking(parts, {
|
|
78
|
-
emitted: new Set(),
|
|
79
|
-
lintingMode: 'throw',
|
|
80
|
-
});
|
|
81
|
-
Object.entries(features).forEach(([name, value]) => {
|
|
82
|
-
if (value === undefined || value === null)
|
|
83
|
-
return;
|
|
84
|
-
addFeature(name, value);
|
|
85
|
-
});
|
|
86
|
-
return buildMediaQueryStringFromParts(mediaType, parts);
|
|
87
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './helpers';
|
|
3
|
-
export * from './factory';
|
|
4
|
-
export * from './mediaQueries';
|
|
5
|
-
export * from './modules';
|
|
6
|
-
export * from './moduleRegistry';
|
|
7
|
-
export * from './libraryHelpers/vanilla-extract';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SelectorMap, StyleRule } from "../types";
|
|
2
|
-
export declare const mediaQueryOutputVanillaExtract: <TSelectorMap extends Record<string, unknown> = SelectorMap>(media: StyleRule) => TSelectorMap;
|
|
3
|
-
export declare const outputVanillaExtract: (media: StyleRule) => SelectorMap;
|
|
4
|
-
export declare const preprocessorVanillaExtract: (media: StyleRule) => SelectorMap;
|
|
5
|
-
//# sourceMappingURL=vanilla-extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vanilla-extract.d.ts","sourceRoot":"","sources":["../../../../src/mediaQueries/libraryHelpers/vanilla-extract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAsB,MAAM,UAAU,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACzC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAE1D,OAAO,SAAS,KACf,YAKoC,CAAC;AAExC,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,KACf,WACiD,CAAC;AAErD,eAAO,MAAM,0BAA0B,GAAI,OAAO,SAAS,KAAG,WA+E7D,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export const mediaQueryOutputVanillaExtract = (media) => ("@media" in media
|
|
2
|
-
? {
|
|
3
|
-
"&": media,
|
|
4
|
-
}
|
|
5
|
-
: media);
|
|
6
|
-
export const outputVanillaExtract = (media) => mediaQueryOutputVanillaExtract(media);
|
|
7
|
-
export const preprocessorVanillaExtract = (media) => {
|
|
8
|
-
const result = {};
|
|
9
|
-
const mediaQueries = media["@media"];
|
|
10
|
-
if (!mediaQueries) {
|
|
11
|
-
return {
|
|
12
|
-
"&": media,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const mergeRule = (base, next) => {
|
|
16
|
-
if (!base)
|
|
17
|
-
return next;
|
|
18
|
-
const merged = { ...base, ...next };
|
|
19
|
-
const baseMedia = base["@media"];
|
|
20
|
-
const nextMedia = next["@media"];
|
|
21
|
-
if (baseMedia && nextMedia) {
|
|
22
|
-
merged["@media"] = { ...baseMedia, ...nextMedia };
|
|
23
|
-
}
|
|
24
|
-
return merged;
|
|
25
|
-
};
|
|
26
|
-
const combineSelectors = (parent, child) => {
|
|
27
|
-
if (child.includes("&")) {
|
|
28
|
-
return child.replace(/&/g, parent);
|
|
29
|
-
}
|
|
30
|
-
return `${parent} ${child}`.trim();
|
|
31
|
-
};
|
|
32
|
-
const collectSelectors = (rule, parentSelector, acc) => {
|
|
33
|
-
const { selectors, ...rest } = rule;
|
|
34
|
-
const hasBase = Object.keys(rest).length > 0;
|
|
35
|
-
if (hasBase) {
|
|
36
|
-
acc[parentSelector] = mergeRule(acc[parentSelector], rest);
|
|
37
|
-
}
|
|
38
|
-
if (!selectors)
|
|
39
|
-
return;
|
|
40
|
-
Object.keys(selectors).forEach((selector) => {
|
|
41
|
-
const selectorRule = selectors[selector];
|
|
42
|
-
if (!selectorRule)
|
|
43
|
-
return;
|
|
44
|
-
const combined = combineSelectors(parentSelector, selector);
|
|
45
|
-
collectSelectors(selectorRule, combined, acc);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
Object.keys(mediaQueries).forEach((query) => {
|
|
49
|
-
const rule = mediaQueries[query];
|
|
50
|
-
if (!rule)
|
|
51
|
-
return;
|
|
52
|
-
const perQuery = {};
|
|
53
|
-
collectSelectors(rule, "&", perQuery);
|
|
54
|
-
Object.keys(perQuery).forEach((selector) => {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
const selectorRule = perQuery[selector];
|
|
57
|
-
if (!selectorRule || Object.keys(selectorRule).length === 0)
|
|
58
|
-
return;
|
|
59
|
-
const existing = (_a = result[selector]) !== null && _a !== void 0 ? _a : { "@media": {} };
|
|
60
|
-
const existingMedia = (_b = existing["@media"]) !== null && _b !== void 0 ? _b : {};
|
|
61
|
-
result[selector] = {
|
|
62
|
-
...existing,
|
|
63
|
-
"@media": {
|
|
64
|
-
...existingMedia,
|
|
65
|
-
[query]: selectorRule,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
return result;
|
|
71
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { IMediaQueryCore } from '../mediaQueries';
|
|
2
|
-
import type { IMediaQueryDimensions } from '../modules/dimensions';
|
|
3
|
-
export declare const lintWidthRedundancy: (props: IMediaQueryCore & IMediaQueryDimensions) => void;
|
|
4
|
-
export declare const lintHeightRedundancy: (props: IMediaQueryDimensions) => void;
|
|
5
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { IMeasurement } from "../core";
|
|
2
|
-
import type { ComplexStyleRule, StyleRule } from "./types";
|
|
3
|
-
import type { MediaQueryBuilderHelpers } from "./helpers";
|
|
4
|
-
import { type MediaQueryValidation } from "./validation";
|
|
5
|
-
import { IMediaQueryCustomFeatures, IMediaQueryDimensions, IMediaQueryDisplay, IMediaQueryEnvironment, IMediaQueryInteraction, IMediaQueryPreferences, IMediaQueryResolutionRange } from "./modules";
|
|
6
|
-
export interface IMediaQueryProps extends IMediaQueryCore, IMediaQueryDimensions, IMediaQueryResolutionRange, IMediaQueryInteraction, IMediaQueryPreferences, IMediaQueryDisplay, IMediaQueryEnvironment, IMediaQueryCustomFeatures {
|
|
7
|
-
}
|
|
8
|
-
export interface IMediaQueryCore {
|
|
9
|
-
type?: "all" | "print" | "screen";
|
|
10
|
-
minWidth?: IMeasurement;
|
|
11
|
-
maxWidth?: IMeasurement;
|
|
12
|
-
}
|
|
13
|
-
export interface IMediaQuery {
|
|
14
|
-
props: IMediaQueryProps;
|
|
15
|
-
styles: StyleRule;
|
|
16
|
-
}
|
|
17
|
-
export type IMediaQueries = Record<string, IMediaQueryProps>;
|
|
18
|
-
export type IMediaQueryStyles<T extends IMediaQueries> = Partial<Record<keyof T, StyleRule>>;
|
|
19
|
-
export declare const createEmitCoreFeatures: (validation: MediaQueryValidation) => (props: IMediaQueryCore, helpers: MediaQueryBuilderHelpers) => void;
|
|
20
|
-
export declare const emitCoreFeatures: (props: IMediaQueryCore, helpers: MediaQueryBuilderHelpers) => void;
|
|
21
|
-
export declare const buildMediaQueryString: (config: IMediaQueryProps) => string;
|
|
22
|
-
export declare const makeMediaQueryStyle: <T extends IMediaQueries>(queries: T) => (stylesByQuery: IMediaQueryStyles<T>) => ComplexStyleRule;
|
|
23
|
-
//# sourceMappingURL=mediaQueries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAE1D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,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,sBAAsB,GACjC,YAAY,oBAAoB,MAEhC,OAAO,eAAe,EACtB,SAAS,wBAAwB,KAChC,IAqCF,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAzCpB,eAAe,WACb,wBAAwB,KAChC,IAyCF,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"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createMediaQueryBuilder } from "./helpers";
|
|
2
|
-
import { defaultMediaQueryValidation, } from "./validation";
|
|
3
|
-
import { emitCustomFeatures, emitDimensionsFeatures, emitDisplayFeatures, emitEnvironmentFeatures, emitInteractionFeatures, emitPreferencesFeatures, emitResolutionFeatures, } from "./modules";
|
|
4
|
-
export const createEmitCoreFeatures = (validation) => (props, helpers) => {
|
|
5
|
-
const { runMediaQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, } = validation;
|
|
6
|
-
if (!runMediaQueryValidation(props, helpers, validateMinMaxWidth, "core", "minWidth must be less than or equal to maxWidth")) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, "core", "width values must be greater than 0")) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const { addFeature } = helpers;
|
|
13
|
-
if (props.minWidth) {
|
|
14
|
-
addFeature("min-width", props.minWidth);
|
|
15
|
-
}
|
|
16
|
-
if (props.maxWidth) {
|
|
17
|
-
addFeature("max-width", props.maxWidth);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export const emitCoreFeatures = createEmitCoreFeatures(defaultMediaQueryValidation);
|
|
21
|
-
const emitBaseFeatures = (props, helpers) => {
|
|
22
|
-
emitCoreFeatures(props, helpers);
|
|
23
|
-
emitDimensionsFeatures(props, helpers);
|
|
24
|
-
emitResolutionFeatures(props, helpers);
|
|
25
|
-
emitInteractionFeatures(props, helpers);
|
|
26
|
-
emitPreferencesFeatures(props, helpers);
|
|
27
|
-
emitDisplayFeatures(props, helpers);
|
|
28
|
-
emitEnvironmentFeatures(props, helpers);
|
|
29
|
-
emitCustomFeatures(props, helpers);
|
|
30
|
-
};
|
|
31
|
-
export const buildMediaQueryString = createMediaQueryBuilder({
|
|
32
|
-
emitBase: emitBaseFeatures,
|
|
33
|
-
resolveType: (props) => props.type,
|
|
34
|
-
});
|
|
35
|
-
export const makeMediaQueryStyle = (queries) => (stylesByQuery) => {
|
|
36
|
-
const result = {};
|
|
37
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
38
|
-
const styles = stylesByQuery[key];
|
|
39
|
-
const props = queries[key];
|
|
40
|
-
if (!styles || !props)
|
|
41
|
-
return;
|
|
42
|
-
result[buildMediaQueryString(props)] = styles;
|
|
43
|
-
});
|
|
44
|
-
const mediaQuery = {
|
|
45
|
-
"@media": result,
|
|
46
|
-
};
|
|
47
|
-
return mediaQuery;
|
|
48
|
-
};
|