css-calipers 0.14.0 → 1.0.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 +15 -29
- package/dist/cjs/factory.js +0 -3
- 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/package.json +4 -17
- 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 -73
- 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 -134
- package/dist/cjs/sciNotation.js +0 -74
- 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 -69
- 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 -33
- package/dist/esm/mediaQueries/validation.d.ts.map +0 -1
- package/dist/esm/mediaQueries/validation.js +0 -130
- package/dist/esm/sciNotation.d.ts +0 -14
- package/dist/esm/sciNotation.d.ts.map +0 -1
- package/dist/esm/sciNotation.js +0 -69
- 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,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mediaQueryFactory = exports.createMediaQueryFactory = void 0;
|
|
4
|
-
const helpers_1 = require("./helpers");
|
|
5
|
-
const mediaQueries_1 = require("./mediaQueries");
|
|
6
|
-
const modules_1 = require("./modules");
|
|
7
|
-
const ALL_MEDIA_QUERY_MODULES = [
|
|
8
|
-
'core',
|
|
9
|
-
'dimensions',
|
|
10
|
-
'resolution',
|
|
11
|
-
'interaction',
|
|
12
|
-
'preferences',
|
|
13
|
-
'display',
|
|
14
|
-
'environment',
|
|
15
|
-
'custom',
|
|
16
|
-
];
|
|
17
|
-
const MODULE_KEYS = {
|
|
18
|
-
core: ['type', 'minWidth', 'maxWidth'],
|
|
19
|
-
dimensions: [
|
|
20
|
-
'width',
|
|
21
|
-
'height',
|
|
22
|
-
'minHeight',
|
|
23
|
-
'maxHeight',
|
|
24
|
-
'aspectRatio',
|
|
25
|
-
'minAspectRatio',
|
|
26
|
-
'maxAspectRatio',
|
|
27
|
-
'orientation',
|
|
28
|
-
],
|
|
29
|
-
resolution: ['resolutionValue', 'minResolution', 'maxResolution'],
|
|
30
|
-
interaction: ['hover', 'anyHover', 'pointer', 'anyPointer', 'update'],
|
|
31
|
-
preferences: [
|
|
32
|
-
'colorScheme',
|
|
33
|
-
'reducedMotion',
|
|
34
|
-
'reducedData',
|
|
35
|
-
'contrast',
|
|
36
|
-
'forcedColors',
|
|
37
|
-
],
|
|
38
|
-
display: ['colorGamut', 'dynamicRange', 'invertedColors'],
|
|
39
|
-
environment: ['scripting', 'overflowBlock', 'overflowInline'],
|
|
40
|
-
custom: ['customFeatures'],
|
|
41
|
-
};
|
|
42
|
-
const MODULE_EMITTERS = {
|
|
43
|
-
core: mediaQueries_1.emitCoreFeatures,
|
|
44
|
-
dimensions: modules_1.emitDimensionsFeatures,
|
|
45
|
-
resolution: modules_1.emitResolutionFeatures,
|
|
46
|
-
interaction: modules_1.emitInteractionFeatures,
|
|
47
|
-
preferences: modules_1.emitPreferencesFeatures,
|
|
48
|
-
display: modules_1.emitDisplayFeatures,
|
|
49
|
-
environment: modules_1.emitEnvironmentFeatures,
|
|
50
|
-
custom: modules_1.emitCustomFeatures,
|
|
51
|
-
};
|
|
52
|
-
const ALL_MODULE_KEYS = MODULE_KEYS;
|
|
53
|
-
const KEY_TO_MODULE = Object.fromEntries(Object.keys(ALL_MODULE_KEYS).flatMap((moduleId) => ALL_MODULE_KEYS[moduleId].map((key) => [key, moduleId])));
|
|
54
|
-
const guardUnsupportedProps = (props, modules, config, label) => {
|
|
55
|
-
const allowed = new Set();
|
|
56
|
-
modules.forEach((moduleId) => {
|
|
57
|
-
ALL_MODULE_KEYS[moduleId].forEach((key) => {
|
|
58
|
-
allowed.add(key);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
Object.keys(props).forEach((key) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
if (props[key] === undefined)
|
|
64
|
-
return;
|
|
65
|
-
if (allowed.has(key))
|
|
66
|
-
return;
|
|
67
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
68
|
-
const moduleHint = KEY_TO_MODULE[key];
|
|
69
|
-
const moduleSuffix = moduleHint
|
|
70
|
-
? ` Add "${moduleHint}" to modules.`
|
|
71
|
-
: '';
|
|
72
|
-
const message = `Media query factory "${label}" received unsupported feature "${key}".${moduleSuffix}`;
|
|
73
|
-
if (mode === 'log') {
|
|
74
|
-
console.warn(message);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (mode === 'allow')
|
|
78
|
-
return;
|
|
79
|
-
throw new Error(message);
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
const normalizeCustomResult = (result) => {
|
|
83
|
-
if (result === undefined || result === null)
|
|
84
|
-
return { valid: true };
|
|
85
|
-
if (typeof result === 'boolean')
|
|
86
|
-
return { valid: result };
|
|
87
|
-
if (typeof result === 'string') {
|
|
88
|
-
return result ? { valid: false, message: result } : { valid: true };
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
};
|
|
92
|
-
const runCustomValidator = (props, config) => {
|
|
93
|
-
var _a, _b;
|
|
94
|
-
const custom = config.custom;
|
|
95
|
-
if (!(custom === null || custom === void 0 ? void 0 : custom.validator))
|
|
96
|
-
return;
|
|
97
|
-
const normalized = normalizeCustomResult(custom.validator(props));
|
|
98
|
-
if (normalized.valid)
|
|
99
|
-
return;
|
|
100
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
101
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
102
|
-
const message = `Media query factory "${config.label}" custom validator "${custom.key}" failed${suffix}`;
|
|
103
|
-
if (mode === 'log') {
|
|
104
|
-
console.warn(message);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (mode === 'allow')
|
|
108
|
-
return;
|
|
109
|
-
throw new Error(message);
|
|
110
|
-
};
|
|
111
|
-
const runCustomLinter = (props, config) => {
|
|
112
|
-
var _a, _b;
|
|
113
|
-
const custom = config.custom;
|
|
114
|
-
if (!(custom === null || custom === void 0 ? void 0 : custom.linter))
|
|
115
|
-
return;
|
|
116
|
-
const normalized = normalizeCustomResult(custom.linter(props));
|
|
117
|
-
if (normalized.valid)
|
|
118
|
-
return;
|
|
119
|
-
const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
120
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
121
|
-
const message = `Media query factory "${config.label}" custom linter "${custom.key}" flagged${suffix}`;
|
|
122
|
-
if (mode === 'log') {
|
|
123
|
-
console.warn(message);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (mode === 'allow')
|
|
127
|
-
return;
|
|
128
|
-
throw new Error(message);
|
|
129
|
-
};
|
|
130
|
-
const createMediaQueryFactory = (emitters) => (options) => {
|
|
131
|
-
var _a;
|
|
132
|
-
const modules = (_a = options.config.modules) !== null && _a !== void 0 ? _a : ALL_MEDIA_QUERY_MODULES;
|
|
133
|
-
const buildMediaQuery = (0, helpers_1.createMediaQueryBuilder)({
|
|
134
|
-
emitBase: (props, helpers) => {
|
|
135
|
-
guardUnsupportedProps(props, modules, options.config, options.config.label);
|
|
136
|
-
runCustomValidator(props, options.config);
|
|
137
|
-
runCustomLinter(props, options.config);
|
|
138
|
-
modules.forEach((moduleId) => {
|
|
139
|
-
emitters[moduleId](props, helpers);
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
resolveType: (props) => props.type,
|
|
143
|
-
config: options.config,
|
|
144
|
-
});
|
|
145
|
-
return (stylesByQuery) => {
|
|
146
|
-
const result = {};
|
|
147
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
148
|
-
const styles = stylesByQuery[key];
|
|
149
|
-
const props = options.queries[key];
|
|
150
|
-
if (!styles || !props)
|
|
151
|
-
return;
|
|
152
|
-
result[buildMediaQuery(props)] = styles;
|
|
153
|
-
});
|
|
154
|
-
const mediaQuery = {
|
|
155
|
-
'@media': result,
|
|
156
|
-
};
|
|
157
|
-
return options.config.output
|
|
158
|
-
? options.config.output(mediaQuery)
|
|
159
|
-
: mediaQuery;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
exports.createMediaQueryFactory = createMediaQueryFactory;
|
|
163
|
-
exports.mediaQueryFactory = (0, exports.createMediaQueryFactory)(MODULE_EMITTERS);
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildMediaQueryFromFeatures = exports.applyMediaQueryValidation = exports.createMediaQueryBuilder = exports.createMediaQueryFeatureEmitterWithTracking = exports.createMediaQueryFeatureEmitter = exports.buildMediaQueryStringFromParts = exports.formatMediaQueryValue = void 0;
|
|
4
|
-
const core_1 = require("../core");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const formatMediaQueryValue = (value) => ((0, core_1.hasCssMethod)(value) ? value.css() : String(value));
|
|
7
|
-
exports.formatMediaQueryValue = formatMediaQueryValue;
|
|
8
|
-
const buildMediaQueryStringFromParts = (mediaType, parts) => (parts.length ? `${mediaType} and ${parts.join(' and ')}` : mediaType);
|
|
9
|
-
exports.buildMediaQueryStringFromParts = buildMediaQueryStringFromParts;
|
|
10
|
-
const createMediaQueryFeatureEmitter = (parts) => (name, value) => {
|
|
11
|
-
parts.push(`(${name}: ${(0, exports.formatMediaQueryValue)(value)})`);
|
|
12
|
-
};
|
|
13
|
-
exports.createMediaQueryFeatureEmitter = createMediaQueryFeatureEmitter;
|
|
14
|
-
const createMediaQueryFeatureEmitterWithTracking = (parts, options = {}) => {
|
|
15
|
-
const { emitted, lintingMode = 'throw' } = options;
|
|
16
|
-
return (name, value) => {
|
|
17
|
-
if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
|
|
18
|
-
if (lintingMode === 'throw') {
|
|
19
|
-
throw new Error(`Media query feature "${name}" was emitted more than once.`);
|
|
20
|
-
}
|
|
21
|
-
if (lintingMode === 'log') {
|
|
22
|
-
console.warn(`Media query feature "${name}" was emitted more than once; using the latest value.`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
|
|
26
|
-
parts.push(`(${name}: ${(0, exports.formatMediaQueryValue)(value)})`);
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
exports.createMediaQueryFeatureEmitterWithTracking = createMediaQueryFeatureEmitterWithTracking;
|
|
30
|
-
const createMediaQueryBuilder = (options) => {
|
|
31
|
-
return (config) => {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
33
|
-
const parts = [];
|
|
34
|
-
const emittedFeatures = new Set();
|
|
35
|
-
const helpers = {
|
|
36
|
-
addFeature: (0, exports.createMediaQueryFeatureEmitterWithTracking)(parts, {
|
|
37
|
-
emitted: emittedFeatures,
|
|
38
|
-
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',
|
|
39
|
-
}),
|
|
40
|
-
config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
|
|
41
|
-
};
|
|
42
|
-
options.emitBase(config, helpers);
|
|
43
|
-
(_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
|
|
44
|
-
const mediaType = (_g = (_f = options.resolveType) === null || _f === void 0 ? void 0 : _f.call(options, config)) !== null && _g !== void 0 ? _g : 'screen';
|
|
45
|
-
return (0, exports.buildMediaQueryStringFromParts)(mediaType, parts);
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
exports.createMediaQueryBuilder = createMediaQueryBuilder;
|
|
49
|
-
const applyMediaQueryValidation = (config, helpers, validator, context) => {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
if (!validator)
|
|
52
|
-
return true;
|
|
53
|
-
const normalized = (0, validation_1.normalizeValidationResult)(validator(config));
|
|
54
|
-
if (normalized.valid)
|
|
55
|
-
return true;
|
|
56
|
-
const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
57
|
-
if (mode === 'log') {
|
|
58
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
59
|
-
const prefix = context
|
|
60
|
-
? `Media query ${context} validation failed`
|
|
61
|
-
: 'Media query validation failed';
|
|
62
|
-
console.warn(`${prefix}${suffix}`);
|
|
63
|
-
}
|
|
64
|
-
if (mode === 'allow')
|
|
65
|
-
return true;
|
|
66
|
-
if (mode === 'log')
|
|
67
|
-
return true;
|
|
68
|
-
const suffix = normalized.message ? `: ${normalized.message}` : '';
|
|
69
|
-
const prefix = context
|
|
70
|
-
? `Media query ${context} validation failed`
|
|
71
|
-
: 'Media query validation failed';
|
|
72
|
-
throw new Error(`${prefix}${suffix}`);
|
|
73
|
-
};
|
|
74
|
-
exports.applyMediaQueryValidation = applyMediaQueryValidation;
|
|
75
|
-
const buildMediaQueryFromFeatures = (features, mediaType = 'screen') => {
|
|
76
|
-
const parts = [];
|
|
77
|
-
const addFeature = (0, exports.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 (0, exports.buildMediaQueryStringFromParts)(mediaType, parts);
|
|
87
|
-
};
|
|
88
|
-
exports.buildMediaQueryFromFeatures = buildMediaQueryFromFeatures;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./helpers"), exports);
|
|
19
|
-
__exportStar(require("./factory"), exports);
|
|
20
|
-
__exportStar(require("./mediaQueries"), exports);
|
|
21
|
-
__exportStar(require("./modules"), exports);
|
|
22
|
-
__exportStar(require("./moduleRegistry"), exports);
|
|
23
|
-
__exportStar(require("../libraryHelpers/vanilla-extract"), exports);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lintHeightRedundancy = exports.lintWidthRedundancy = void 0;
|
|
4
|
-
const lintWidthRedundancy = (props) => {
|
|
5
|
-
if (!props.width)
|
|
6
|
-
return;
|
|
7
|
-
if (props.minWidth || props.maxWidth) {
|
|
8
|
-
throw new Error('width should not be combined with minWidth or maxWidth');
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
exports.lintWidthRedundancy = lintWidthRedundancy;
|
|
12
|
-
const lintHeightRedundancy = (props) => {
|
|
13
|
-
if (!props.height)
|
|
14
|
-
return;
|
|
15
|
-
if (props.minHeight || props.maxHeight) {
|
|
16
|
-
throw new Error('height should not be combined with minHeight or maxHeight');
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.lintHeightRedundancy = lintHeightRedundancy;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lintResolutionRedundancy = void 0;
|
|
4
|
-
const lintResolutionRedundancy = (props) => {
|
|
5
|
-
if (!props.resolutionValue)
|
|
6
|
-
return;
|
|
7
|
-
if (props.minResolution || props.maxResolution) {
|
|
8
|
-
throw new Error('resolution should not be combined with minResolution or maxResolution');
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
exports.lintResolutionRedundancy = lintResolutionRedundancy;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runMediaQueryLint = void 0;
|
|
4
|
-
const runMediaQueryLint = (config, helpers, check, message = 'Media query lint failed') => {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
if (!check)
|
|
7
|
-
return true;
|
|
8
|
-
const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : 'throw';
|
|
9
|
-
if (mode === 'allow')
|
|
10
|
-
return true;
|
|
11
|
-
if (mode === 'log') {
|
|
12
|
-
try {
|
|
13
|
-
check(config);
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
console.warn(message);
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
check(config);
|
|
22
|
-
return true;
|
|
23
|
-
};
|
|
24
|
-
exports.runMediaQueryLint = runMediaQueryLint;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeMediaQueryStyle = exports.buildMediaQueryString = exports.emitCoreFeatures = exports.createEmitCoreFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("./helpers");
|
|
5
|
-
const validation_1 = require("./validation");
|
|
6
|
-
const modules_1 = require("./modules");
|
|
7
|
-
const createEmitCoreFeatures = (validation) => (props, helpers) => {
|
|
8
|
-
const { runMediaQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, } = validation;
|
|
9
|
-
if (!runMediaQueryValidation(props, helpers, validateMinMaxWidth, "core", "minWidth must be less than or equal to maxWidth")) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, "core", "width values must be greater than 0")) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const { addFeature } = helpers;
|
|
16
|
-
if (props.minWidth) {
|
|
17
|
-
addFeature("min-width", props.minWidth);
|
|
18
|
-
}
|
|
19
|
-
if (props.maxWidth) {
|
|
20
|
-
addFeature("max-width", props.maxWidth);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
exports.createEmitCoreFeatures = createEmitCoreFeatures;
|
|
24
|
-
exports.emitCoreFeatures = (0, exports.createEmitCoreFeatures)(validation_1.defaultMediaQueryValidation);
|
|
25
|
-
const emitBaseFeatures = (props, helpers) => {
|
|
26
|
-
(0, exports.emitCoreFeatures)(props, helpers);
|
|
27
|
-
(0, modules_1.emitDimensionsFeatures)(props, helpers);
|
|
28
|
-
(0, modules_1.emitResolutionFeatures)(props, helpers);
|
|
29
|
-
(0, modules_1.emitInteractionFeatures)(props, helpers);
|
|
30
|
-
(0, modules_1.emitPreferencesFeatures)(props, helpers);
|
|
31
|
-
(0, modules_1.emitDisplayFeatures)(props, helpers);
|
|
32
|
-
(0, modules_1.emitEnvironmentFeatures)(props, helpers);
|
|
33
|
-
(0, modules_1.emitCustomFeatures)(props, helpers);
|
|
34
|
-
};
|
|
35
|
-
exports.buildMediaQueryString = (0, helpers_1.createMediaQueryBuilder)({
|
|
36
|
-
emitBase: emitBaseFeatures,
|
|
37
|
-
resolveType: (props) => props.type,
|
|
38
|
-
});
|
|
39
|
-
const makeMediaQueryStyle = (queries) => (stylesByQuery) => {
|
|
40
|
-
const result = {};
|
|
41
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
42
|
-
const styles = stylesByQuery[key];
|
|
43
|
-
const props = queries[key];
|
|
44
|
-
if (!styles || !props)
|
|
45
|
-
return;
|
|
46
|
-
result[(0, exports.buildMediaQueryString)(props)] = styles;
|
|
47
|
-
});
|
|
48
|
-
const mediaQuery = {
|
|
49
|
-
"@media": result,
|
|
50
|
-
};
|
|
51
|
-
return mediaQuery;
|
|
52
|
-
};
|
|
53
|
-
exports.makeMediaQueryStyle = makeMediaQueryStyle;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitCustomFeatures = void 0;
|
|
4
|
-
const core_1 = require("../../core");
|
|
5
|
-
const helpers_1 = require("../helpers");
|
|
6
|
-
const emitCustomFeatures = (props, helpers, validate) => {
|
|
7
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'custom')) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const { addFeature } = helpers;
|
|
11
|
-
if (!props.customFeatures)
|
|
12
|
-
return;
|
|
13
|
-
Object.entries(props.customFeatures).forEach(([name, value]) => {
|
|
14
|
-
if (value === undefined || value === null)
|
|
15
|
-
return;
|
|
16
|
-
const trimmedName = name.trim();
|
|
17
|
-
if (!trimmedName) {
|
|
18
|
-
throw new Error('Custom feature name must be non-empty.');
|
|
19
|
-
}
|
|
20
|
-
if (typeof value === 'object' && !(0, core_1.hasCssMethod)(value)) {
|
|
21
|
-
throw new Error(`Custom feature "${trimmedName}" must be a primitive or a measurement.`);
|
|
22
|
-
}
|
|
23
|
-
addFeature(trimmedName, value);
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
exports.emitCustomFeatures = emitCustomFeatures;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitDimensionsFeatures = exports.createEmitDimensionsFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const linting_1 = require("../linting");
|
|
7
|
-
const core_1 = require("../linting/core");
|
|
8
|
-
const createEmitDimensionsFeatures = (validation) => (props, helpers, validate) => {
|
|
9
|
-
const { runMediaQueryValidation, validateMinMaxHeight, validateHeightValuesPositive, validateMinMaxAspectRatio, validateAspectRatioValuesPositive, validateWidthValuesPositive, } = validation;
|
|
10
|
-
if (!runMediaQueryValidation(props, helpers, validateMinMaxHeight, 'dimensions', 'minHeight must be less than or equal to maxHeight')) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!runMediaQueryValidation(props, helpers, validateHeightValuesPositive, 'dimensions', 'height values must be greater than 0')) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!(0, linting_1.runMediaQueryLint)(props, helpers, core_1.lintWidthRedundancy, 'width should not be combined with minWidth or maxWidth')) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!(0, linting_1.runMediaQueryLint)(props, helpers, core_1.lintHeightRedundancy, 'height should not be combined with minHeight or maxHeight')) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, 'dimensions', 'width values must be greater than 0')) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!runMediaQueryValidation(props, helpers, validateMinMaxAspectRatio, 'dimensions', 'minAspectRatio must be less than or equal to maxAspectRatio')) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (!runMediaQueryValidation(props, helpers, validateAspectRatioValuesPositive, 'dimensions', 'aspect ratio values must be greater than 0')) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'dimensions')) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const { addFeature } = helpers;
|
|
35
|
-
if (props.width) {
|
|
36
|
-
addFeature('width', props.width);
|
|
37
|
-
}
|
|
38
|
-
if (props.height) {
|
|
39
|
-
addFeature('height', props.height);
|
|
40
|
-
}
|
|
41
|
-
if (props.minHeight) {
|
|
42
|
-
addFeature('min-height', props.minHeight);
|
|
43
|
-
}
|
|
44
|
-
if (props.maxHeight) {
|
|
45
|
-
addFeature('max-height', props.maxHeight);
|
|
46
|
-
}
|
|
47
|
-
if (props.aspectRatio) {
|
|
48
|
-
addFeature('aspect-ratio', props.aspectRatio);
|
|
49
|
-
}
|
|
50
|
-
if (props.minAspectRatio) {
|
|
51
|
-
addFeature('min-aspect-ratio', props.minAspectRatio);
|
|
52
|
-
}
|
|
53
|
-
if (props.maxAspectRatio) {
|
|
54
|
-
addFeature('max-aspect-ratio', props.maxAspectRatio);
|
|
55
|
-
}
|
|
56
|
-
if (props.orientation) {
|
|
57
|
-
addFeature('orientation', props.orientation);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
exports.createEmitDimensionsFeatures = createEmitDimensionsFeatures;
|
|
61
|
-
exports.emitDimensionsFeatures = (0, exports.createEmitDimensionsFeatures)(validation_1.defaultMediaQueryValidation);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitDisplayFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const emitDisplayFeatures = (props, helpers, validate) => {
|
|
6
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'display')) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { addFeature } = helpers;
|
|
10
|
-
if (props.colorGamut) {
|
|
11
|
-
addFeature('color-gamut', props.colorGamut);
|
|
12
|
-
}
|
|
13
|
-
if (props.dynamicRange) {
|
|
14
|
-
addFeature('dynamic-range', props.dynamicRange);
|
|
15
|
-
}
|
|
16
|
-
if (props.invertedColors) {
|
|
17
|
-
addFeature('inverted-colors', props.invertedColors);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.emitDisplayFeatures = emitDisplayFeatures;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitEnvironmentFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const emitEnvironmentFeatures = (props, helpers, validate) => {
|
|
6
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'environment')) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { addFeature } = helpers;
|
|
10
|
-
if (props.scripting) {
|
|
11
|
-
addFeature('scripting', props.scripting);
|
|
12
|
-
}
|
|
13
|
-
if (props.overflowBlock) {
|
|
14
|
-
addFeature('overflow-block', props.overflowBlock);
|
|
15
|
-
}
|
|
16
|
-
if (props.overflowInline) {
|
|
17
|
-
addFeature('overflow-inline', props.overflowInline);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.emitEnvironmentFeatures = emitEnvironmentFeatures;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./custom"), exports);
|
|
18
|
-
__exportStar(require("./dimensions"), exports);
|
|
19
|
-
__exportStar(require("./display"), exports);
|
|
20
|
-
__exportStar(require("./environment"), exports);
|
|
21
|
-
__exportStar(require("./interaction"), exports);
|
|
22
|
-
__exportStar(require("./preferences"), exports);
|
|
23
|
-
__exportStar(require("./resolution"), exports);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitInteractionFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const emitInteractionFeatures = (props, helpers, validate) => {
|
|
6
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'interaction')) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { addFeature } = helpers;
|
|
10
|
-
if (props.hover) {
|
|
11
|
-
addFeature('hover', props.hover);
|
|
12
|
-
}
|
|
13
|
-
if (props.anyHover) {
|
|
14
|
-
addFeature('any-hover', props.anyHover);
|
|
15
|
-
}
|
|
16
|
-
if (props.pointer) {
|
|
17
|
-
addFeature('pointer', props.pointer);
|
|
18
|
-
}
|
|
19
|
-
if (props.anyPointer) {
|
|
20
|
-
addFeature('any-pointer', props.anyPointer);
|
|
21
|
-
}
|
|
22
|
-
if (props.update) {
|
|
23
|
-
addFeature('update', props.update);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.emitInteractionFeatures = emitInteractionFeatures;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitPreferencesFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const emitPreferencesFeatures = (props, helpers, validate) => {
|
|
6
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'preferences')) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { addFeature } = helpers;
|
|
10
|
-
if (props.colorScheme) {
|
|
11
|
-
addFeature('prefers-color-scheme', props.colorScheme);
|
|
12
|
-
}
|
|
13
|
-
if (props.reducedMotion) {
|
|
14
|
-
addFeature('prefers-reduced-motion', props.reducedMotion);
|
|
15
|
-
}
|
|
16
|
-
if (props.reducedData) {
|
|
17
|
-
addFeature('prefers-reduced-data', props.reducedData);
|
|
18
|
-
}
|
|
19
|
-
if (props.contrast) {
|
|
20
|
-
addFeature('prefers-contrast', props.contrast);
|
|
21
|
-
}
|
|
22
|
-
if (props.forcedColors) {
|
|
23
|
-
addFeature('forced-colors', props.forcedColors);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.emitPreferencesFeatures = emitPreferencesFeatures;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitResolutionFeatures = exports.createEmitResolutionFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const linting_1 = require("../linting");
|
|
7
|
-
const resolution_1 = require("../linting/resolution");
|
|
8
|
-
const createEmitResolutionFeatures = (validation) => (props, helpers, validate) => {
|
|
9
|
-
const { runMediaQueryValidation, validateResolutionValues } = validation;
|
|
10
|
-
if (!runMediaQueryValidation(props, helpers, validateResolutionValues, 'resolution', 'resolution values must be greater than 0')) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!(0, linting_1.runMediaQueryLint)(props, helpers, resolution_1.lintResolutionRedundancy, 'resolution should not be combined with minResolution or maxResolution')) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'resolution')) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const { addFeature } = helpers;
|
|
20
|
-
if (props.resolutionValue) {
|
|
21
|
-
addFeature('resolution', props.resolutionValue);
|
|
22
|
-
}
|
|
23
|
-
if (props.minResolution) {
|
|
24
|
-
addFeature('min-resolution', props.minResolution);
|
|
25
|
-
}
|
|
26
|
-
if (props.maxResolution) {
|
|
27
|
-
addFeature('max-resolution', props.maxResolution);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.createEmitResolutionFeatures = createEmitResolutionFeatures;
|
|
31
|
-
exports.emitResolutionFeatures = (0, exports.createEmitResolutionFeatures)(validation_1.defaultMediaQueryValidation);
|