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,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMediaQueriesApi = void 0;
|
|
4
|
-
const helpers_1 = require("../mediaQueries/helpers");
|
|
5
|
-
const validation_1 = require("../mediaQueries/validation");
|
|
6
|
-
const mediaQueries_1 = require("../mediaQueries/mediaQueries");
|
|
7
|
-
const modules_1 = require("../mediaQueries/modules");
|
|
8
|
-
const resolution_1 = require("../mediaQueries/modules/resolution");
|
|
9
|
-
const factory_1 = require("../mediaQueries/factory");
|
|
10
|
-
const vanilla_extract_1 = require("../libraryHelpers/vanilla-extract");
|
|
11
|
-
const createMediaQueriesApi = (core) => {
|
|
12
|
-
const validation = (0, validation_1.createMediaQueryValidation)({
|
|
13
|
-
assertCondition: core.assertCondition,
|
|
14
|
-
assertMatchingUnits: core.assertMatchingUnits,
|
|
15
|
-
});
|
|
16
|
-
const emitCoreFeatures = (0, mediaQueries_1.createEmitCoreFeatures)(validation);
|
|
17
|
-
const emitDimensionsFeatures = (0, modules_1.createEmitDimensionsFeatures)(validation);
|
|
18
|
-
const emitResolutionFeatures = (0, resolution_1.createEmitResolutionFeatures)(validation);
|
|
19
|
-
const emitBaseFeatures = (props, helpers) => {
|
|
20
|
-
emitCoreFeatures(props, helpers);
|
|
21
|
-
emitDimensionsFeatures(props, helpers);
|
|
22
|
-
emitResolutionFeatures(props, helpers);
|
|
23
|
-
(0, modules_1.emitInteractionFeatures)(props, helpers);
|
|
24
|
-
(0, modules_1.emitPreferencesFeatures)(props, helpers);
|
|
25
|
-
(0, modules_1.emitDisplayFeatures)(props, helpers);
|
|
26
|
-
(0, modules_1.emitEnvironmentFeatures)(props, helpers);
|
|
27
|
-
(0, modules_1.emitCustomFeatures)(props, helpers);
|
|
28
|
-
};
|
|
29
|
-
const buildMediaQueryString = (0, helpers_1.createMediaQueryBuilder)({
|
|
30
|
-
emitBase: emitBaseFeatures,
|
|
31
|
-
resolveType: (props) => props.type,
|
|
32
|
-
});
|
|
33
|
-
const makeMediaQueryStyle = (queries) => (stylesByQuery) => {
|
|
34
|
-
const result = {};
|
|
35
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
36
|
-
const styles = stylesByQuery[key];
|
|
37
|
-
const props = queries[key];
|
|
38
|
-
if (!styles || !props)
|
|
39
|
-
return;
|
|
40
|
-
result[buildMediaQueryString(props)] = styles;
|
|
41
|
-
});
|
|
42
|
-
const mediaQuery = {
|
|
43
|
-
"@media": result,
|
|
44
|
-
};
|
|
45
|
-
return mediaQuery;
|
|
46
|
-
};
|
|
47
|
-
const moduleEmitters = {
|
|
48
|
-
core: emitCoreFeatures,
|
|
49
|
-
dimensions: emitDimensionsFeatures,
|
|
50
|
-
resolution: emitResolutionFeatures,
|
|
51
|
-
interaction: modules_1.emitInteractionFeatures,
|
|
52
|
-
preferences: modules_1.emitPreferencesFeatures,
|
|
53
|
-
display: modules_1.emitDisplayFeatures,
|
|
54
|
-
environment: modules_1.emitEnvironmentFeatures,
|
|
55
|
-
custom: modules_1.emitCustomFeatures,
|
|
56
|
-
};
|
|
57
|
-
const mediaQueryFactory = (0, factory_1.createMediaQueryFactory)(moduleEmitters);
|
|
58
|
-
return {
|
|
59
|
-
buildMediaQueryString,
|
|
60
|
-
makeMediaQueryStyle,
|
|
61
|
-
mediaQueryFactory,
|
|
62
|
-
emitCoreFeatures,
|
|
63
|
-
emitDimensionsFeatures,
|
|
64
|
-
emitResolutionFeatures,
|
|
65
|
-
emitInteractionFeatures: modules_1.emitInteractionFeatures,
|
|
66
|
-
emitPreferencesFeatures: modules_1.emitPreferencesFeatures,
|
|
67
|
-
emitDisplayFeatures: modules_1.emitDisplayFeatures,
|
|
68
|
-
emitEnvironmentFeatures: modules_1.emitEnvironmentFeatures,
|
|
69
|
-
emitCustomFeatures: modules_1.emitCustomFeatures,
|
|
70
|
-
mediaQueryOutputVanillaExtract: vanilla_extract_1.mediaQueryOutputVanillaExtract,
|
|
71
|
-
createMediaQueryBuilder: helpers_1.createMediaQueryBuilder,
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
exports.createMediaQueriesApi = createMediaQueriesApi;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUnitsApi = void 0;
|
|
4
|
-
const unitDefinitions_1 = require("../unitDefinitions");
|
|
5
|
-
const createUnitsApi = (core) => {
|
|
6
|
-
const helpers = Object.keys(unitDefinitions_1.UNIT_DEFINITIONS).reduce((acc, name) => {
|
|
7
|
-
const helperName = name;
|
|
8
|
-
acc[helperName] = core.makeUnitHelperFromDefinition(helperName);
|
|
9
|
-
return acc;
|
|
10
|
-
}, {});
|
|
11
|
-
const mPercent = helpers.mPercent;
|
|
12
|
-
return {
|
|
13
|
-
...helpers,
|
|
14
|
-
isPercentMeasurement: core.makeUnitGuard(mPercent),
|
|
15
|
-
assertPercentMeasurement: core.makeUnitAssert(mPercent),
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.createUnitsApi = createUnitsApi;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throwHelperError = exports.throwMeasurementMethodError = exports.createErrorHelpers = exports.getErrorConfig = exports.setErrorConfig = exports.createErrorConfigStore = void 0;
|
|
4
|
-
const DEFAULT_ERROR_CONFIG = {
|
|
5
|
-
stackHints: "auto",
|
|
6
|
-
};
|
|
7
|
-
let errorConfig = { ...DEFAULT_ERROR_CONFIG };
|
|
8
|
-
const createErrorConfigStore = (initial = {}) => {
|
|
9
|
-
let config = {
|
|
10
|
-
...DEFAULT_ERROR_CONFIG,
|
|
11
|
-
...initial,
|
|
12
|
-
};
|
|
13
|
-
return {
|
|
14
|
-
getErrorConfig: () => config,
|
|
15
|
-
setErrorConfig: (next) => {
|
|
16
|
-
config = { ...config, ...next };
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.createErrorConfigStore = createErrorConfigStore;
|
|
21
|
-
const setErrorConfig = (next) => {
|
|
22
|
-
errorConfig = { ...errorConfig, ...next };
|
|
23
|
-
};
|
|
24
|
-
exports.setErrorConfig = setErrorConfig;
|
|
25
|
-
const getErrorConfig = () => errorConfig;
|
|
26
|
-
exports.getErrorConfig = getErrorConfig;
|
|
27
|
-
const createErrorHelpers = (store) => {
|
|
28
|
-
const getConfig = () => store.getErrorConfig();
|
|
29
|
-
const throwMeasurementMethodError = (ctx) => {
|
|
30
|
-
const includeStack = shouldIncludeStackHint(ctx.includeStackHint, getConfig());
|
|
31
|
-
const stackHint = includeStack
|
|
32
|
-
? extractStackHint(new Error().stack)
|
|
33
|
-
: undefined;
|
|
34
|
-
throw new Error(formatErrorMessage(ctx.operation, ctx.message, ctx.context, {
|
|
35
|
-
...ctx.details,
|
|
36
|
-
stackHint,
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
const throwHelperError = (ctx) => {
|
|
40
|
-
const includeStack = shouldIncludeStackHint(ctx.includeStackHint, getConfig());
|
|
41
|
-
const stackHint = includeStack
|
|
42
|
-
? extractStackHint(new Error().stack)
|
|
43
|
-
: undefined;
|
|
44
|
-
throw new Error(formatErrorMessage(ctx.operation, ctx.message, ctx.context, {
|
|
45
|
-
...ctx.details,
|
|
46
|
-
stackHint,
|
|
47
|
-
}));
|
|
48
|
-
};
|
|
49
|
-
return { throwMeasurementMethodError, throwHelperError };
|
|
50
|
-
};
|
|
51
|
-
exports.createErrorHelpers = createErrorHelpers;
|
|
52
|
-
const isProductionEnv = () => {
|
|
53
|
-
var _a;
|
|
54
|
-
if (typeof globalThis === "undefined")
|
|
55
|
-
return false;
|
|
56
|
-
const maybeProcess = globalThis
|
|
57
|
-
.process;
|
|
58
|
-
return ((_a = maybeProcess === null || maybeProcess === void 0 ? void 0 : maybeProcess.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === "production";
|
|
59
|
-
};
|
|
60
|
-
const shouldIncludeStackHint = (override, config = errorConfig) => {
|
|
61
|
-
if (override === false)
|
|
62
|
-
return false;
|
|
63
|
-
if (config.stackHints === "off")
|
|
64
|
-
return false;
|
|
65
|
-
if (config.stackHints === "on")
|
|
66
|
-
return true;
|
|
67
|
-
if (override === true)
|
|
68
|
-
return !isProductionEnv();
|
|
69
|
-
return false;
|
|
70
|
-
};
|
|
71
|
-
const formatDetailBlock = (details) => {
|
|
72
|
-
if (!details)
|
|
73
|
-
return "";
|
|
74
|
-
const parts = [];
|
|
75
|
-
if (details.code)
|
|
76
|
-
parts.push(`code=${details.code}`);
|
|
77
|
-
if (details.helper)
|
|
78
|
-
parts.push(`helper=${details.helper}`);
|
|
79
|
-
if (details.inputSummary)
|
|
80
|
-
parts.push(`inputs=${details.inputSummary}`);
|
|
81
|
-
if (details.stackHint)
|
|
82
|
-
parts.push(`stack=${details.stackHint}`);
|
|
83
|
-
return parts.length > 0 ? ` [${parts.join(" | ")}]` : "";
|
|
84
|
-
};
|
|
85
|
-
const formatErrorMessage = (operation, message, context, details) => {
|
|
86
|
-
const core = `${operation}: ${message}`;
|
|
87
|
-
const base = context ? `${context}: ${core}` : core;
|
|
88
|
-
return `${base}${formatDetailBlock(details)}`;
|
|
89
|
-
};
|
|
90
|
-
const extractStackHint = (stack) => {
|
|
91
|
-
var _a;
|
|
92
|
-
if (!stack)
|
|
93
|
-
return undefined;
|
|
94
|
-
const lines = stack
|
|
95
|
-
.split("\n")
|
|
96
|
-
.map((line) => line.trim())
|
|
97
|
-
.filter(Boolean)
|
|
98
|
-
.slice(1);
|
|
99
|
-
if (lines.length === 0)
|
|
100
|
-
return undefined;
|
|
101
|
-
const filtered = lines.filter((line) => !line.includes("/src/internal/errors") &&
|
|
102
|
-
!line.includes("throwHelperError") &&
|
|
103
|
-
!line.includes("throwMeasurementMethodError"));
|
|
104
|
-
const hint = (_a = filtered[0]) !== null && _a !== void 0 ? _a : lines[0];
|
|
105
|
-
return hint.replace(/^at\s+/, "");
|
|
106
|
-
};
|
|
107
|
-
/** Throw an Error for a Measurement instance method using a structured context. */
|
|
108
|
-
const throwMeasurementMethodError = (ctx) => {
|
|
109
|
-
const includeStack = shouldIncludeStackHint(ctx.includeStackHint);
|
|
110
|
-
const stackHint = includeStack
|
|
111
|
-
? extractStackHint(new Error().stack)
|
|
112
|
-
: undefined;
|
|
113
|
-
throw new Error(formatErrorMessage(ctx.operation, ctx.message, ctx.context, {
|
|
114
|
-
...ctx.details,
|
|
115
|
-
stackHint,
|
|
116
|
-
}));
|
|
117
|
-
};
|
|
118
|
-
exports.throwMeasurementMethodError = throwMeasurementMethodError;
|
|
119
|
-
/** Throw an Error for a helper/free function using a structured context. */
|
|
120
|
-
const throwHelperError = (ctx) => {
|
|
121
|
-
const includeStack = shouldIncludeStackHint(ctx.includeStackHint);
|
|
122
|
-
const stackHint = includeStack
|
|
123
|
-
? extractStackHint(new Error().stack)
|
|
124
|
-
: undefined;
|
|
125
|
-
throw new Error(formatErrorMessage(ctx.operation, ctx.message, ctx.context, {
|
|
126
|
-
...ctx.details,
|
|
127
|
-
stackHint,
|
|
128
|
-
}));
|
|
129
|
-
};
|
|
130
|
-
exports.throwHelperError = throwHelperError;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.containerQueryOutputVanillaExtract = exports.mediaQueryOutputVanillaExtract = void 0;
|
|
4
|
-
const mediaQueryOutputVanillaExtract = (media) => ({
|
|
5
|
-
"&": media,
|
|
6
|
-
});
|
|
7
|
-
exports.mediaQueryOutputVanillaExtract = mediaQueryOutputVanillaExtract;
|
|
8
|
-
const containerQueryOutputVanillaExtract = (container) => ({
|
|
9
|
-
"&": container,
|
|
10
|
-
});
|
|
11
|
-
exports.containerQueryOutputVanillaExtract = containerQueryOutputVanillaExtract;
|
|
@@ -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;
|