css-calipers 0.14.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/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 +5 -18
- 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,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.preprocessorVanillaExtract = exports.outputVanillaExtract = exports.mediaQueryOutputVanillaExtract = void 0;
|
|
4
|
-
const mediaQueryOutputVanillaExtract = (media) => ("@media" in media
|
|
5
|
-
? {
|
|
6
|
-
"&": media,
|
|
7
|
-
}
|
|
8
|
-
: media);
|
|
9
|
-
exports.mediaQueryOutputVanillaExtract = mediaQueryOutputVanillaExtract;
|
|
10
|
-
const outputVanillaExtract = (media) => (0, exports.mediaQueryOutputVanillaExtract)(media);
|
|
11
|
-
exports.outputVanillaExtract = outputVanillaExtract;
|
|
12
|
-
const preprocessorVanillaExtract = (media) => {
|
|
13
|
-
const result = {};
|
|
14
|
-
const mediaQueries = media["@media"];
|
|
15
|
-
if (!mediaQueries) {
|
|
16
|
-
return {
|
|
17
|
-
"&": media,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const mergeRule = (base, next) => {
|
|
21
|
-
if (!base)
|
|
22
|
-
return next;
|
|
23
|
-
const merged = { ...base, ...next };
|
|
24
|
-
const baseMedia = base["@media"];
|
|
25
|
-
const nextMedia = next["@media"];
|
|
26
|
-
if (baseMedia && nextMedia) {
|
|
27
|
-
merged["@media"] = { ...baseMedia, ...nextMedia };
|
|
28
|
-
}
|
|
29
|
-
return merged;
|
|
30
|
-
};
|
|
31
|
-
const combineSelectors = (parent, child) => {
|
|
32
|
-
if (child.includes("&")) {
|
|
33
|
-
return child.replace(/&/g, parent);
|
|
34
|
-
}
|
|
35
|
-
return `${parent} ${child}`.trim();
|
|
36
|
-
};
|
|
37
|
-
const collectSelectors = (rule, parentSelector, acc) => {
|
|
38
|
-
const { selectors, ...rest } = rule;
|
|
39
|
-
const hasBase = Object.keys(rest).length > 0;
|
|
40
|
-
if (hasBase) {
|
|
41
|
-
acc[parentSelector] = mergeRule(acc[parentSelector], rest);
|
|
42
|
-
}
|
|
43
|
-
if (!selectors)
|
|
44
|
-
return;
|
|
45
|
-
Object.keys(selectors).forEach((selector) => {
|
|
46
|
-
const selectorRule = selectors[selector];
|
|
47
|
-
if (!selectorRule)
|
|
48
|
-
return;
|
|
49
|
-
const combined = combineSelectors(parentSelector, selector);
|
|
50
|
-
collectSelectors(selectorRule, combined, acc);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
Object.keys(mediaQueries).forEach((query) => {
|
|
54
|
-
const rule = mediaQueries[query];
|
|
55
|
-
if (!rule)
|
|
56
|
-
return;
|
|
57
|
-
const perQuery = {};
|
|
58
|
-
collectSelectors(rule, "&", perQuery);
|
|
59
|
-
Object.keys(perQuery).forEach((selector) => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const selectorRule = perQuery[selector];
|
|
62
|
-
if (!selectorRule || Object.keys(selectorRule).length === 0)
|
|
63
|
-
return;
|
|
64
|
-
const existing = (_a = result[selector]) !== null && _a !== void 0 ? _a : { "@media": {} };
|
|
65
|
-
const existingMedia = (_b = existing["@media"]) !== null && _b !== void 0 ? _b : {};
|
|
66
|
-
result[selector] = {
|
|
67
|
-
...existing,
|
|
68
|
-
"@media": {
|
|
69
|
-
...existingMedia,
|
|
70
|
-
[query]: selectorRule,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
return result;
|
|
76
|
-
};
|
|
77
|
-
exports.preprocessorVanillaExtract = preprocessorVanillaExtract;
|
|
@@ -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,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.queriesToStrings = queriesToStrings;
|
|
4
|
-
exports.useMediaQuery = useMediaQuery;
|
|
5
|
-
exports.useMediaFromMap = useMediaFromMap;
|
|
6
|
-
exports.makeClientFns = makeClientFns;
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const mediaQueries_1 = require("./mediaQueries");
|
|
9
|
-
function toQueryString(q) {
|
|
10
|
-
return (0, mediaQueries_1.buildMediaQueryString)(q);
|
|
11
|
-
}
|
|
12
|
-
function queriesToStrings(queries) {
|
|
13
|
-
return Object.fromEntries(Object.entries(queries).map(([k, v,]) => [
|
|
14
|
-
k,
|
|
15
|
-
typeof v === 'string' ? v : toQueryString(v),
|
|
16
|
-
]));
|
|
17
|
-
}
|
|
18
|
-
// ---------- Core hooks ----------
|
|
19
|
-
/**
|
|
20
|
-
* SSR-safe: undefined on server, boolean on client; subscribes to
|
|
21
|
-
* changes.
|
|
22
|
-
*/
|
|
23
|
-
function useMediaQuery(queryString) {
|
|
24
|
-
const [matches, setMatches,] = (0, react_1.useState)(undefined);
|
|
25
|
-
(0, react_1.useEffect)(() => {
|
|
26
|
-
var _a;
|
|
27
|
-
if (typeof window === 'undefined')
|
|
28
|
-
return;
|
|
29
|
-
const mql = window.matchMedia(queryString);
|
|
30
|
-
const onChange = () => setMatches(mql.matches);
|
|
31
|
-
const frameId = requestAnimationFrame(() => {
|
|
32
|
-
setMatches(mql.matches);
|
|
33
|
-
});
|
|
34
|
-
(_a = mql.addEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
|
|
35
|
-
return () => {
|
|
36
|
-
var _a;
|
|
37
|
-
(_a = mql.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
|
|
38
|
-
cancelAnimationFrame(frameId);
|
|
39
|
-
};
|
|
40
|
-
}, [
|
|
41
|
-
queryString,
|
|
42
|
-
]);
|
|
43
|
-
return matches;
|
|
44
|
-
}
|
|
45
|
-
// Aggregate hook with guarded updates to avoid loops
|
|
46
|
-
function useMediaFromMap(strings) {
|
|
47
|
-
const shallowEqual = (0, react_1.useCallback)((a, b) => {
|
|
48
|
-
const ak = Object.keys(a);
|
|
49
|
-
const bk = Object.keys(b);
|
|
50
|
-
if (ak.length !== bk.length)
|
|
51
|
-
return false;
|
|
52
|
-
for (const k of ak)
|
|
53
|
-
if (a[k] !== b[k])
|
|
54
|
-
return false;
|
|
55
|
-
return true;
|
|
56
|
-
}, []);
|
|
57
|
-
// Stable, sorted list of [key, queryString]
|
|
58
|
-
const entries = (0, react_1.useMemo)(() => {
|
|
59
|
-
const e = Object.entries(strings);
|
|
60
|
-
e.sort((a, b) => a[0].localeCompare(b[0]));
|
|
61
|
-
return e;
|
|
62
|
-
}, [
|
|
63
|
-
strings,
|
|
64
|
-
]);
|
|
65
|
-
const [matches, setMatches,] = (0, react_1.useState)(() => Object.create(null));
|
|
66
|
-
(0, react_1.useEffect)(() => {
|
|
67
|
-
if (typeof window === 'undefined')
|
|
68
|
-
return;
|
|
69
|
-
const mqls = entries.map(([k, qs,]) => [
|
|
70
|
-
k,
|
|
71
|
-
window.matchMedia(qs),
|
|
72
|
-
]);
|
|
73
|
-
// Initial snapshot — only set if changed
|
|
74
|
-
const initial = Object.fromEntries(mqls.map(([k, mql,]) => [
|
|
75
|
-
k,
|
|
76
|
-
mql.matches,
|
|
77
|
-
]));
|
|
78
|
-
const frameId = requestAnimationFrame(() => {
|
|
79
|
-
setMatches((prev) => shallowEqual(prev, initial) ? prev : initial);
|
|
80
|
-
});
|
|
81
|
-
// Subscribe with guarded setState
|
|
82
|
-
const handlers = mqls.map(([k, mql,]) => {
|
|
83
|
-
var _a;
|
|
84
|
-
const onChange = () => setMatches((prev) => {
|
|
85
|
-
const next = {
|
|
86
|
-
...prev,
|
|
87
|
-
[k]: mql.matches,
|
|
88
|
-
};
|
|
89
|
-
return shallowEqual(prev, next) ? prev : next;
|
|
90
|
-
});
|
|
91
|
-
(_a = mql.addEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
|
|
92
|
-
return [
|
|
93
|
-
mql,
|
|
94
|
-
onChange,
|
|
95
|
-
];
|
|
96
|
-
});
|
|
97
|
-
return () => {
|
|
98
|
-
var _a;
|
|
99
|
-
cancelAnimationFrame(frameId);
|
|
100
|
-
for (const [mql, onChange,] of handlers) {
|
|
101
|
-
(_a = mql.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}, [
|
|
105
|
-
entries,
|
|
106
|
-
shallowEqual,
|
|
107
|
-
]);
|
|
108
|
-
return matches;
|
|
109
|
-
}
|
|
110
|
-
// ---------- Client-only predicates ----------
|
|
111
|
-
/** For event handlers/effects only; don't call in SSR render paths. */
|
|
112
|
-
function makeClientFns(strings) {
|
|
113
|
-
const out = {};
|
|
114
|
-
Object.keys(strings).forEach((k) => {
|
|
115
|
-
out[k] = () => typeof window !== 'undefined'
|
|
116
|
-
? window.matchMedia(strings[k]).matches
|
|
117
|
-
: false;
|
|
118
|
-
});
|
|
119
|
-
return out;
|
|
120
|
-
}
|
|
@@ -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);
|