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,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitCustomFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const linting_1 = require("../linting");
|
|
7
|
-
const custom_1 = require("../linting/custom");
|
|
8
|
-
const normalizeToArray_1 = require("../../internal/normalizeToArray");
|
|
9
|
-
const emitCustomFeatures = (props, helpers, options, validate) => {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const { runContainerQueryValidation, validateCustomFeatures } = validation_1.defaultContainerQueryValidation;
|
|
12
|
-
if (!runContainerQueryValidation(props, helpers, validateCustomFeatures, "custom", "custom features must be valid and non-empty")) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (!(0, linting_1.runContainerQueryLint)(props, helpers, custom_1.lintCustomFeatures, "customFeatures should not be empty")) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "custom")) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const { addFeatureUnsafe, addFeature } = helpers;
|
|
22
|
-
const allowQueryArrays = (_b = (_a = options === null || options === void 0 ? void 0 : options.allowQueryArrays) !== null && _a !== void 0 ? _a : helpers.config.allowQueryArrays) !== null && _b !== void 0 ? _b : true;
|
|
23
|
-
if (!props.customFeatures)
|
|
24
|
-
return;
|
|
25
|
-
Object.entries(props.customFeatures).forEach(([name, value]) => {
|
|
26
|
-
if (value === undefined || value === null)
|
|
27
|
-
return;
|
|
28
|
-
const trimmedName = name.trim();
|
|
29
|
-
if (!trimmedName)
|
|
30
|
-
return;
|
|
31
|
-
if (Array.isArray(value) && !allowQueryArrays) {
|
|
32
|
-
throw new Error(`Custom feature "${trimmedName}" does not allow arrays.`);
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(value)) {
|
|
35
|
-
(0, normalizeToArray_1.normalizeToArray)(value).forEach((entry) => {
|
|
36
|
-
(addFeatureUnsafe !== null && addFeatureUnsafe !== void 0 ? addFeatureUnsafe : addFeature)(trimmedName, entry);
|
|
37
|
-
});
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
addFeature(trimmedName, value);
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
exports.emitCustomFeatures = emitCustomFeatures;
|
|
@@ -1,21 +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("./aspectRatio"), exports);
|
|
18
|
-
__exportStar(require("./block"), exports);
|
|
19
|
-
__exportStar(require("./custom"), exports);
|
|
20
|
-
__exportStar(require("./inline"), exports);
|
|
21
|
-
__exportStar(require("./style"), exports);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitInlineSizeFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const linting_1 = require("../linting");
|
|
7
|
-
const inline_1 = require("../linting/inline");
|
|
8
|
-
const normalizeToArray_1 = require("../../internal/normalizeToArray");
|
|
9
|
-
const emitInlineComparison = (name, comparison, addCondition) => {
|
|
10
|
-
addCondition((0, helpers_1.formatContainerQueryComparison)(name, comparison.operator, comparison.value));
|
|
11
|
-
};
|
|
12
|
-
const emitInlineRange = (name, range, addCondition) => {
|
|
13
|
-
const min = (0, helpers_1.formatContainerQueryValue)(range.min);
|
|
14
|
-
const max = (0, helpers_1.formatContainerQueryValue)(range.max);
|
|
15
|
-
if ("minOperator" in range) {
|
|
16
|
-
addCondition(`(${min} ${range.minOperator} ${name})`);
|
|
17
|
-
addCondition(`(${name} <= ${max})`);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
addCondition(`(${min} <= ${name})`);
|
|
21
|
-
addCondition(`(${name} ${range.maxOperator} ${max})`);
|
|
22
|
-
};
|
|
23
|
-
const emitInlineSizeFeatures = (props, helpers, validate) => {
|
|
24
|
-
const allowQueryArrays = helpers.config.allowQueryArrays !== false;
|
|
25
|
-
const assertNoArray = (value, label) => {
|
|
26
|
-
if (Array.isArray(value) && !allowQueryArrays) {
|
|
27
|
-
throw new Error(`${label} does not allow arrays.`);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const { runContainerQueryValidation, validateInlineSizeValues, } = validation_1.defaultContainerQueryValidation;
|
|
31
|
-
if (!runContainerQueryValidation(props, helpers, validateInlineSizeValues, "inline", "inline size values must be valid measurements greater than 0")) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (!(0, linting_1.runContainerQueryLint)(props, helpers, inline_1.lintInlineRedundancy, "inlineSize should not be combined with inlineSizeRange")) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!(0, linting_1.runContainerQueryLint)(props, helpers, inline_1.lintInlineRangeCollapse, "inlineSizeRange min and max are equal; use inlineSize instead")) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "inline")) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const { addCondition } = helpers;
|
|
44
|
-
assertNoArray(props.inlineSize, "inlineSize");
|
|
45
|
-
(0, normalizeToArray_1.normalizeToArray)(props.inlineSize).forEach((value) => {
|
|
46
|
-
emitInlineComparison("inline-size", value, addCondition);
|
|
47
|
-
});
|
|
48
|
-
assertNoArray(props.inlineSizeRange, "inlineSizeRange");
|
|
49
|
-
(0, normalizeToArray_1.normalizeToArray)(props.inlineSizeRange).forEach((value) => {
|
|
50
|
-
emitInlineRange("inline-size", value, addCondition);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
exports.emitInlineSizeFeatures = emitInlineSizeFeatures;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitStyleFeatures = void 0;
|
|
4
|
-
const helpers_1 = require("../helpers");
|
|
5
|
-
const validation_1 = require("../validation");
|
|
6
|
-
const linting_1 = require("../linting");
|
|
7
|
-
const style_1 = require("../linting/style");
|
|
8
|
-
const emitStyleFeatures = (props, helpers, validate) => {
|
|
9
|
-
const { runContainerQueryValidation, validateStyleValues, } = validation_1.defaultContainerQueryValidation;
|
|
10
|
-
if (!runContainerQueryValidation(props, helpers, validateStyleValues, "style", "style conditions must be valid and non-empty")) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!(0, linting_1.runContainerQueryLint)(props, helpers, style_1.lintStyleCondition, "style conditions must be valid and non-empty")) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "style")) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!props.style)
|
|
20
|
-
return;
|
|
21
|
-
const { addCondition } = helpers;
|
|
22
|
-
Object.entries(props.style).forEach(([name, value]) => {
|
|
23
|
-
if (value === undefined || value === null)
|
|
24
|
-
return;
|
|
25
|
-
if (Array.isArray(value)) {
|
|
26
|
-
value.forEach((entry) => {
|
|
27
|
-
if (entry === undefined || entry === null)
|
|
28
|
-
return;
|
|
29
|
-
addCondition(`(style(${name}: ${(0, helpers_1.formatContainerQueryValue)(entry)}))`);
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
addCondition(`(style(${name}: ${(0, helpers_1.formatContainerQueryValue)(value)}))`);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
exports.emitStyleFeatures = emitStyleFeatures;
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultContainerQueryValidation = exports.validateCustomFeatures = exports.validateStyleValues = exports.validateAspectRatioValues = exports.validateBlockSizeValues = exports.validateInlineSizeValues = exports.validateHeightValuesPositive = exports.validateMinMaxHeight = exports.validateWidthValuesPositive = exports.validateMinMaxWidth = exports.runContainerQueryValidation = exports.createContainerQueryValidation = void 0;
|
|
4
|
-
const helpers_1 = require("./helpers");
|
|
5
|
-
const core_1 = require("../core");
|
|
6
|
-
const validation_1 = require("../validation");
|
|
7
|
-
const normalizeToArray_1 = require("../internal/normalizeToArray");
|
|
8
|
-
const ratio_1 = require("../ratio");
|
|
9
|
-
const isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
10
|
-
const assertMeasurement = (value, label) => {
|
|
11
|
-
(0, core_1.assertCondition)((0, core_1.isMeasurement)(value), `${label} must be a measurement`);
|
|
12
|
-
};
|
|
13
|
-
const assertMeasurementPositive = (value, label) => {
|
|
14
|
-
(0, core_1.assertCondition)(value.getValue() > 0, `${label} must be greater than 0`);
|
|
15
|
-
};
|
|
16
|
-
const assertRatio = (value, label) => {
|
|
17
|
-
(0, core_1.assertCondition)((0, core_1.isRatio)(value), `${label} must be a ratio created with r()`);
|
|
18
|
-
};
|
|
19
|
-
const assertRatioPositive = (value, label) => {
|
|
20
|
-
(0, core_1.assertCondition)(value.numerator() > 0, `${label} numerator must be greater than 0`);
|
|
21
|
-
(0, core_1.assertCondition)(value.denominator() > 0, `${label} denominator must be greater than 0`);
|
|
22
|
-
};
|
|
23
|
-
const isStyleValue = (value) => {
|
|
24
|
-
if (typeof value === "string")
|
|
25
|
-
return true;
|
|
26
|
-
if (isFiniteNumber(value))
|
|
27
|
-
return true;
|
|
28
|
-
if ((0, core_1.hasCssMethod)(value))
|
|
29
|
-
return true;
|
|
30
|
-
return false;
|
|
31
|
-
};
|
|
32
|
-
const createContainerQueryValidation = (core) => {
|
|
33
|
-
const assertCondition = core.assertCondition;
|
|
34
|
-
const assertMatchingUnits = core.assertMatchingUnits;
|
|
35
|
-
const runContainerQueryValidation = (config, helpers, check, context, fallbackMessage = "Invalid container query configuration") => {
|
|
36
|
-
if (!check)
|
|
37
|
-
return true;
|
|
38
|
-
try {
|
|
39
|
-
check(config);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
const result = (0, validation_1.toValidationResult)(error, fallbackMessage);
|
|
44
|
-
return (0, helpers_1.applyContainerQueryValidation)(config, helpers, () => result, context);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const validateMinMaxWidth = (props) => {
|
|
48
|
-
if (!props.minWidth || !props.maxWidth)
|
|
49
|
-
return;
|
|
50
|
-
if (Array.isArray(props.minWidth) || Array.isArray(props.maxWidth)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
assertMatchingUnits(props.minWidth, props.maxWidth, "containerQueries.minMaxWidth");
|
|
54
|
-
assertCondition(props.minWidth.getValue() <= props.maxWidth.getValue(), "minWidth must be less than or equal to maxWidth");
|
|
55
|
-
};
|
|
56
|
-
const validateWidthValuesPositive = (props) => {
|
|
57
|
-
(0, normalizeToArray_1.normalizeToArray)(props.minWidth).forEach((value) => {
|
|
58
|
-
assertMeasurement(value, "minWidth");
|
|
59
|
-
assertMeasurementPositive(value, "minWidth");
|
|
60
|
-
});
|
|
61
|
-
(0, normalizeToArray_1.normalizeToArray)(props.maxWidth).forEach((value) => {
|
|
62
|
-
assertMeasurement(value, "maxWidth");
|
|
63
|
-
assertMeasurementPositive(value, "maxWidth");
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
const validateMinMaxHeight = (props) => {
|
|
67
|
-
if (!props.minHeight || !props.maxHeight)
|
|
68
|
-
return;
|
|
69
|
-
if (Array.isArray(props.minHeight) || Array.isArray(props.maxHeight)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
assertMatchingUnits(props.minHeight, props.maxHeight, "containerQueries.minMaxHeight");
|
|
73
|
-
assertCondition(props.minHeight.getValue() <= props.maxHeight.getValue(), "minHeight must be less than or equal to maxHeight");
|
|
74
|
-
};
|
|
75
|
-
const validateHeightValuesPositive = (props) => {
|
|
76
|
-
(0, normalizeToArray_1.normalizeToArray)(props.minHeight).forEach((value) => {
|
|
77
|
-
assertMeasurement(value, "minHeight");
|
|
78
|
-
assertMeasurementPositive(value, "minHeight");
|
|
79
|
-
});
|
|
80
|
-
(0, normalizeToArray_1.normalizeToArray)(props.maxHeight).forEach((value) => {
|
|
81
|
-
assertMeasurement(value, "maxHeight");
|
|
82
|
-
assertMeasurementPositive(value, "maxHeight");
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const validateInlineSizeValues = (props) => {
|
|
86
|
-
(0, normalizeToArray_1.normalizeToArray)(props.inlineSize).forEach((value) => {
|
|
87
|
-
assertMeasurement(value.value, "inlineSize");
|
|
88
|
-
assertMeasurementPositive(value.value, "inlineSize");
|
|
89
|
-
});
|
|
90
|
-
(0, normalizeToArray_1.normalizeToArray)(props.inlineSizeRange).forEach((value) => {
|
|
91
|
-
assertMeasurement(value.min, "inlineSizeRange.min");
|
|
92
|
-
assertMeasurement(value.max, "inlineSizeRange.max");
|
|
93
|
-
assertMeasurementPositive(value.min, "inlineSizeRange.min");
|
|
94
|
-
assertMeasurementPositive(value.max, "inlineSizeRange.max");
|
|
95
|
-
assertMatchingUnits(value.min, value.max, "containerQueries.inlineSizeRangeUnits");
|
|
96
|
-
assertCondition(value.min.getValue() <= value.max.getValue(), "inlineSizeRange min must be less than or equal to max");
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
const validateBlockSizeValues = (props) => {
|
|
100
|
-
(0, normalizeToArray_1.normalizeToArray)(props.blockSize).forEach((value) => {
|
|
101
|
-
assertMeasurement(value.value, "blockSize");
|
|
102
|
-
assertMeasurementPositive(value.value, "blockSize");
|
|
103
|
-
});
|
|
104
|
-
(0, normalizeToArray_1.normalizeToArray)(props.blockSizeRange).forEach((value) => {
|
|
105
|
-
assertMeasurement(value.min, "blockSizeRange.min");
|
|
106
|
-
assertMeasurement(value.max, "blockSizeRange.max");
|
|
107
|
-
assertMeasurementPositive(value.min, "blockSizeRange.min");
|
|
108
|
-
assertMeasurementPositive(value.max, "blockSizeRange.max");
|
|
109
|
-
assertMatchingUnits(value.min, value.max, "containerQueries.blockSizeRangeUnits");
|
|
110
|
-
assertCondition(value.min.getValue() <= value.max.getValue(), "blockSizeRange min must be less than or equal to max");
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
const validateAspectRatioValues = (props) => {
|
|
114
|
-
(0, normalizeToArray_1.normalizeToArray)(props.aspectRatio).forEach((value) => {
|
|
115
|
-
assertRatio(value, "aspectRatio");
|
|
116
|
-
assertRatioPositive(value, "aspectRatio");
|
|
117
|
-
});
|
|
118
|
-
(0, normalizeToArray_1.normalizeToArray)(props.minAspectRatio).forEach((value) => {
|
|
119
|
-
assertRatio(value, "minAspectRatio");
|
|
120
|
-
assertRatioPositive(value, "minAspectRatio");
|
|
121
|
-
});
|
|
122
|
-
(0, normalizeToArray_1.normalizeToArray)(props.maxAspectRatio).forEach((value) => {
|
|
123
|
-
assertRatio(value, "maxAspectRatio");
|
|
124
|
-
assertRatioPositive(value, "maxAspectRatio");
|
|
125
|
-
});
|
|
126
|
-
if (props.minAspectRatio &&
|
|
127
|
-
props.maxAspectRatio &&
|
|
128
|
-
!Array.isArray(props.minAspectRatio) &&
|
|
129
|
-
!Array.isArray(props.maxAspectRatio)) {
|
|
130
|
-
const minValue = (0, ratio_1.ratioToFloat)(props.minAspectRatio);
|
|
131
|
-
const maxValue = (0, ratio_1.ratioToFloat)(props.maxAspectRatio);
|
|
132
|
-
assertCondition(minValue <= maxValue, "minAspectRatio must be less than or equal to maxAspectRatio");
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const validateStyleValues = (props) => {
|
|
136
|
-
if (!props.style)
|
|
137
|
-
return;
|
|
138
|
-
const entries = Object.entries(props.style);
|
|
139
|
-
assertCondition(entries.length > 0, "style conditions must not be empty.");
|
|
140
|
-
entries.forEach(([name, value]) => {
|
|
141
|
-
if (value === undefined || value === null)
|
|
142
|
-
return;
|
|
143
|
-
if (Array.isArray(value)) {
|
|
144
|
-
assertCondition(value.length > 0, `style.${name} must not be empty`);
|
|
145
|
-
value.forEach((entry, index) => {
|
|
146
|
-
assertCondition(isStyleValue(entry), `style.${name}[${index}] must be a primitive or measurement`);
|
|
147
|
-
});
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
assertCondition(isStyleValue(value), `style.${name} must be a primitive or measurement`);
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const validateCustomFeatures = (props) => {
|
|
154
|
-
if (!props.customFeatures)
|
|
155
|
-
return;
|
|
156
|
-
const entries = Object.entries(props.customFeatures);
|
|
157
|
-
assertCondition(entries.length > 0, "customFeatures should not be empty.");
|
|
158
|
-
entries.forEach(([name, value]) => {
|
|
159
|
-
const trimmedName = name.trim();
|
|
160
|
-
assertCondition(trimmedName.length > 0, "Custom feature name must be non-empty.");
|
|
161
|
-
if (value === undefined || value === null)
|
|
162
|
-
return;
|
|
163
|
-
if (Array.isArray(value)) {
|
|
164
|
-
value.forEach((entry, index) => {
|
|
165
|
-
assertCondition(isStyleValue(entry), `Custom feature "${trimmedName}[${index}]" must be a primitive or a measurement.`);
|
|
166
|
-
});
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
assertCondition(isStyleValue(value), `Custom feature "${trimmedName}" must be a primitive or a measurement.`);
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
return {
|
|
173
|
-
runContainerQueryValidation,
|
|
174
|
-
validateMinMaxWidth,
|
|
175
|
-
validateWidthValuesPositive,
|
|
176
|
-
validateMinMaxHeight,
|
|
177
|
-
validateHeightValuesPositive,
|
|
178
|
-
validateInlineSizeValues,
|
|
179
|
-
validateBlockSizeValues,
|
|
180
|
-
validateAspectRatioValues,
|
|
181
|
-
validateStyleValues,
|
|
182
|
-
validateCustomFeatures,
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
exports.createContainerQueryValidation = createContainerQueryValidation;
|
|
186
|
-
const defaultContainerQueryValidation = (0, exports.createContainerQueryValidation)({
|
|
187
|
-
assertCondition: core_1.assertCondition,
|
|
188
|
-
assertMatchingUnits: core_1.assertMatchingUnits,
|
|
189
|
-
});
|
|
190
|
-
exports.defaultContainerQueryValidation = defaultContainerQueryValidation;
|
|
191
|
-
exports.runContainerQueryValidation = defaultContainerQueryValidation.runContainerQueryValidation, exports.validateMinMaxWidth = defaultContainerQueryValidation.validateMinMaxWidth, exports.validateWidthValuesPositive = defaultContainerQueryValidation.validateWidthValuesPositive, exports.validateMinMaxHeight = defaultContainerQueryValidation.validateMinMaxHeight, exports.validateHeightValuesPositive = defaultContainerQueryValidation.validateHeightValuesPositive, exports.validateInlineSizeValues = defaultContainerQueryValidation.validateInlineSizeValues, exports.validateBlockSizeValues = defaultContainerQueryValidation.validateBlockSizeValues, exports.validateAspectRatioValues = defaultContainerQueryValidation.validateAspectRatioValues, exports.validateStyleValues = defaultContainerQueryValidation.validateStyleValues, exports.validateCustomFeatures = defaultContainerQueryValidation.validateCustomFeatures;
|
package/dist/cjs/fraction.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _FractionImpl_numerator, _FractionImpl_denominator, _FractionImpl_omitDenominatorWhenOne;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.fractionToFloat = exports.simplifyFraction = exports.reduceFraction = exports.normalizeFraction = exports.parseRatio = exports.isFraction = void 0;
|
|
16
|
-
exports.r = r;
|
|
17
|
-
class FractionImpl {
|
|
18
|
-
constructor(numerator, denominator, options = {}) {
|
|
19
|
-
var _a;
|
|
20
|
-
_FractionImpl_numerator.set(this, void 0);
|
|
21
|
-
_FractionImpl_denominator.set(this, void 0);
|
|
22
|
-
_FractionImpl_omitDenominatorWhenOne.set(this, void 0);
|
|
23
|
-
if (!Number.isFinite(numerator) || !Number.isFinite(denominator)) {
|
|
24
|
-
throw new Error('Fraction values must be finite numbers.');
|
|
25
|
-
}
|
|
26
|
-
if (denominator === 0) {
|
|
27
|
-
throw new Error('Fraction denominator cannot be zero.');
|
|
28
|
-
}
|
|
29
|
-
__classPrivateFieldSet(this, _FractionImpl_numerator, numerator, "f");
|
|
30
|
-
__classPrivateFieldSet(this, _FractionImpl_denominator, denominator, "f");
|
|
31
|
-
__classPrivateFieldSet(this, _FractionImpl_omitDenominatorWhenOne, (_a = options.omitDenominatorWhenOne) !== null && _a !== void 0 ? _a : false, "f");
|
|
32
|
-
}
|
|
33
|
-
numerator() {
|
|
34
|
-
return __classPrivateFieldGet(this, _FractionImpl_numerator, "f");
|
|
35
|
-
}
|
|
36
|
-
denominator() {
|
|
37
|
-
return __classPrivateFieldGet(this, _FractionImpl_denominator, "f");
|
|
38
|
-
}
|
|
39
|
-
withNumerator(numerator) {
|
|
40
|
-
return new FractionImpl(numerator, __classPrivateFieldGet(this, _FractionImpl_denominator, "f"));
|
|
41
|
-
}
|
|
42
|
-
withDenominator(denominator) {
|
|
43
|
-
return new FractionImpl(__classPrivateFieldGet(this, _FractionImpl_numerator, "f"), denominator);
|
|
44
|
-
}
|
|
45
|
-
valueOf() {
|
|
46
|
-
return __classPrivateFieldGet(this, _FractionImpl_numerator, "f") / __classPrivateFieldGet(this, _FractionImpl_denominator, "f");
|
|
47
|
-
}
|
|
48
|
-
css() {
|
|
49
|
-
if (__classPrivateFieldGet(this, _FractionImpl_omitDenominatorWhenOne, "f") && __classPrivateFieldGet(this, _FractionImpl_denominator, "f") === 1) {
|
|
50
|
-
return String(__classPrivateFieldGet(this, _FractionImpl_numerator, "f"));
|
|
51
|
-
}
|
|
52
|
-
return `${__classPrivateFieldGet(this, _FractionImpl_numerator, "f")}/${__classPrivateFieldGet(this, _FractionImpl_denominator, "f")}`;
|
|
53
|
-
}
|
|
54
|
-
toString() {
|
|
55
|
-
return this.css();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
_FractionImpl_numerator = new WeakMap(), _FractionImpl_denominator = new WeakMap(), _FractionImpl_omitDenominatorWhenOne = new WeakMap();
|
|
59
|
-
function r(numeratorOrDenominator, denominator) {
|
|
60
|
-
const numerator = denominator === undefined ? numeratorOrDenominator : numeratorOrDenominator;
|
|
61
|
-
const resolvedDenominator = denominator === undefined ? 1 : denominator;
|
|
62
|
-
return new FractionImpl(numerator, resolvedDenominator);
|
|
63
|
-
}
|
|
64
|
-
const isFraction = (value) => {
|
|
65
|
-
return (typeof value === "object" &&
|
|
66
|
-
value !== null &&
|
|
67
|
-
"css" in value &&
|
|
68
|
-
"numerator" in value &&
|
|
69
|
-
"denominator" in value &&
|
|
70
|
-
typeof value.css === "function" &&
|
|
71
|
-
typeof value.numerator === "function" &&
|
|
72
|
-
typeof value.denominator === "function");
|
|
73
|
-
};
|
|
74
|
-
exports.isFraction = isFraction;
|
|
75
|
-
const parseRatio = (value) => {
|
|
76
|
-
if (typeof value === "number") {
|
|
77
|
-
return Number.isFinite(value) ? { numerator: value, denominator: 1 } : null;
|
|
78
|
-
}
|
|
79
|
-
if ((0, exports.isFraction)(value)) {
|
|
80
|
-
return { numerator: value.numerator(), denominator: value.denominator() };
|
|
81
|
-
}
|
|
82
|
-
const trimmed = value.trim();
|
|
83
|
-
if (!trimmed)
|
|
84
|
-
return null;
|
|
85
|
-
if (trimmed.includes("/")) {
|
|
86
|
-
const [left, right] = trimmed.split("/");
|
|
87
|
-
if (left === undefined || right === undefined)
|
|
88
|
-
return null;
|
|
89
|
-
const numerator = Number(left.trim());
|
|
90
|
-
const denominator = Number(right.trim());
|
|
91
|
-
if (!Number.isFinite(numerator) || !Number.isFinite(denominator))
|
|
92
|
-
return null;
|
|
93
|
-
if (denominator === 0)
|
|
94
|
-
return null;
|
|
95
|
-
return { numerator, denominator };
|
|
96
|
-
}
|
|
97
|
-
const parsed = Number(trimmed);
|
|
98
|
-
return Number.isFinite(parsed) ? { numerator: parsed, denominator: 1 } : null;
|
|
99
|
-
};
|
|
100
|
-
exports.parseRatio = parseRatio;
|
|
101
|
-
const normalizeFraction = (fraction) => {
|
|
102
|
-
let numerator = fraction.numerator();
|
|
103
|
-
let denominator = fraction.denominator();
|
|
104
|
-
if (!Number.isFinite(numerator) || !Number.isFinite(denominator)) {
|
|
105
|
-
throw new Error("Fraction values must be finite numbers.");
|
|
106
|
-
}
|
|
107
|
-
if (denominator === 0) {
|
|
108
|
-
throw new Error("Fraction denominator cannot be zero.");
|
|
109
|
-
}
|
|
110
|
-
if (!Number.isInteger(numerator) || !Number.isInteger(denominator)) {
|
|
111
|
-
return new FractionImpl(numerator, denominator);
|
|
112
|
-
}
|
|
113
|
-
if (denominator < 0) {
|
|
114
|
-
numerator = -numerator;
|
|
115
|
-
denominator = Math.abs(denominator);
|
|
116
|
-
}
|
|
117
|
-
const gcd = (a, b) => {
|
|
118
|
-
let x = Math.abs(a);
|
|
119
|
-
let y = Math.abs(b);
|
|
120
|
-
while (y !== 0) {
|
|
121
|
-
const next = x % y;
|
|
122
|
-
x = y;
|
|
123
|
-
y = next;
|
|
124
|
-
}
|
|
125
|
-
return x === 0 ? 1 : x;
|
|
126
|
-
};
|
|
127
|
-
const divisor = gcd(numerator, denominator);
|
|
128
|
-
return new FractionImpl(numerator / divisor, denominator / divisor);
|
|
129
|
-
};
|
|
130
|
-
exports.normalizeFraction = normalizeFraction;
|
|
131
|
-
const reduceFraction = (fraction) => (0, exports.normalizeFraction)(fraction);
|
|
132
|
-
exports.reduceFraction = reduceFraction;
|
|
133
|
-
const simplifyFraction = (fraction) => {
|
|
134
|
-
const reduced = (0, exports.normalizeFraction)(fraction);
|
|
135
|
-
return new FractionImpl(reduced.numerator(), reduced.denominator(), { omitDenominatorWhenOne: true });
|
|
136
|
-
};
|
|
137
|
-
exports.simplifyFraction = simplifyFraction;
|
|
138
|
-
const fractionToFloat = (fraction) => fraction.numerator() / fraction.denominator();
|
|
139
|
-
exports.fractionToFloat = fractionToFloat;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContainerQueriesApi = void 0;
|
|
4
|
-
const helpers_1 = require("../containerQueries/helpers");
|
|
5
|
-
const validation_1 = require("../containerQueries/validation");
|
|
6
|
-
const containerQueries_1 = require("../containerQueries/containerQueries");
|
|
7
|
-
const modules_1 = require("../containerQueries/modules");
|
|
8
|
-
const factory_1 = require("../containerQueries/factory");
|
|
9
|
-
const vanilla_extract_1 = require("../libraryHelpers/vanilla-extract");
|
|
10
|
-
const createContainerQueriesApi = (core) => {
|
|
11
|
-
const validation = (0, validation_1.createContainerQueryValidation)({
|
|
12
|
-
assertCondition: core.assertCondition,
|
|
13
|
-
assertMatchingUnits: core.assertMatchingUnits,
|
|
14
|
-
});
|
|
15
|
-
const emitCoreFeatures = (0, containerQueries_1.createEmitCoreFeatures)(validation);
|
|
16
|
-
const emitBaseFeatures = (props, helpers) => {
|
|
17
|
-
emitCoreFeatures(props, helpers);
|
|
18
|
-
(0, modules_1.emitAspectRatioFeatures)(props, helpers);
|
|
19
|
-
(0, modules_1.emitBlockSizeFeatures)(props, helpers);
|
|
20
|
-
(0, modules_1.emitInlineSizeFeatures)(props, helpers);
|
|
21
|
-
(0, modules_1.emitStyleFeatures)(props, helpers);
|
|
22
|
-
(0, modules_1.emitCustomFeatures)(props, helpers);
|
|
23
|
-
};
|
|
24
|
-
const buildContainerQueryString = (0, helpers_1.createContainerQueryBuilder)({
|
|
25
|
-
emitBase: emitBaseFeatures,
|
|
26
|
-
});
|
|
27
|
-
const makeContainerQueryStyle = (queries) => (stylesByQuery) => {
|
|
28
|
-
const result = {};
|
|
29
|
-
Object.keys(stylesByQuery).forEach((key) => {
|
|
30
|
-
const styles = stylesByQuery[key];
|
|
31
|
-
const props = queries[key];
|
|
32
|
-
if (!styles || !props)
|
|
33
|
-
return;
|
|
34
|
-
result[buildContainerQueryString(props)] = styles;
|
|
35
|
-
});
|
|
36
|
-
const containerQuery = {
|
|
37
|
-
"@container": result,
|
|
38
|
-
};
|
|
39
|
-
return containerQuery;
|
|
40
|
-
};
|
|
41
|
-
const containerQueryFactory = (0, factory_1.createContainerQueryFactory)();
|
|
42
|
-
return {
|
|
43
|
-
buildContainerQueryString,
|
|
44
|
-
makeContainerQueryStyle,
|
|
45
|
-
containerQueryFactory,
|
|
46
|
-
emitCoreFeatures,
|
|
47
|
-
emitAspectRatioFeatures: modules_1.emitAspectRatioFeatures,
|
|
48
|
-
emitBlockSizeFeatures: modules_1.emitBlockSizeFeatures,
|
|
49
|
-
emitInlineSizeFeatures: modules_1.emitInlineSizeFeatures,
|
|
50
|
-
emitStyleFeatures: modules_1.emitStyleFeatures,
|
|
51
|
-
emitCustomFeatures: modules_1.emitCustomFeatures,
|
|
52
|
-
containerQueryOutputVanillaExtract: vanilla_extract_1.containerQueryOutputVanillaExtract,
|
|
53
|
-
createContainerQueryBuilder: helpers_1.createContainerQueryBuilder,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
exports.createContainerQueriesApi = createContainerQueriesApi;
|
|
@@ -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("../mediaQueries/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,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeToArray = void 0;
|
|
4
|
-
const normalizeToArray = (value) => {
|
|
5
|
-
if (value === undefined || value === null)
|
|
6
|
-
return [];
|
|
7
|
-
return Array.isArray(value) ? value : [value];
|
|
8
|
-
};
|
|
9
|
-
exports.normalizeToArray = normalizeToArray;
|
|
@@ -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;
|