css-calipers 0.9.3 → 0.9.4
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 +100 -0
- package/dist/cjs/comparisons/index.js +25 -0
- package/dist/cjs/containerQueries/containerQueries.js +115 -0
- package/dist/cjs/containerQueries/factory.js +123 -0
- package/dist/cjs/containerQueries/helpers.js +95 -0
- package/dist/cjs/containerQueries/index.js +16 -0
- package/dist/cjs/containerQueries/linting/aspectRatio.js +24 -0
- package/dist/cjs/containerQueries/linting/block.js +23 -0
- package/dist/cjs/containerQueries/linting/core.js +25 -0
- package/dist/cjs/containerQueries/linting/custom.js +11 -0
- package/dist/cjs/containerQueries/linting/inline.js +23 -0
- package/dist/cjs/containerQueries/linting/resolution.js +12 -0
- package/dist/cjs/containerQueries/linting/style.js +28 -0
- package/dist/cjs/containerQueries/linting.js +24 -0
- package/dist/cjs/containerQueries/moduleRegistry.js +5 -0
- package/dist/cjs/containerQueries/modules/aspectRatio.js +51 -0
- package/dist/cjs/containerQueries/modules/block.js +53 -0
- package/dist/cjs/containerQueries/modules/custom.js +43 -0
- package/dist/cjs/containerQueries/modules/index.js +21 -0
- package/dist/cjs/containerQueries/modules/inline.js +53 -0
- package/dist/cjs/containerQueries/modules/size.js +2 -0
- package/dist/cjs/containerQueries/modules/style.js +36 -0
- package/dist/cjs/containerQueries/types.js +2 -0
- package/dist/cjs/containerQueries/validation.js +191 -0
- package/dist/cjs/core.js +5 -278
- package/dist/cjs/factory.js +21 -0
- package/dist/cjs/fraction.js +139 -0
- package/dist/cjs/internal/buildMeasurementCreationError.js +16 -0
- package/dist/cjs/internal/buildMeasurementCreationError.tests.js +5 -0
- package/dist/cjs/internal/createComponentQueriesApi.js +56 -0
- package/dist/cjs/internal/createCoreApi.js +336 -0
- package/dist/cjs/internal/createMediaQueriesApi.js +74 -0
- package/dist/cjs/internal/createUnitsApi.js +18 -0
- package/dist/cjs/internal/errors.js +118 -5
- package/dist/cjs/internal/normalizeToArray.js +9 -0
- package/dist/cjs/libraryHelpers/vanilla-extract.js +6 -2
- package/dist/cjs/logicalOperators/index.js +18 -0
- package/dist/cjs/mediaQueries/factory.js +5 -4
- package/dist/cjs/mediaQueries/mediaQueries.js +7 -5
- package/dist/cjs/mediaQueries/modules/dimensions.js +10 -8
- package/dist/cjs/mediaQueries/modules/resolution.js +6 -4
- package/dist/cjs/mediaQueries/validation.js +128 -116
- package/dist/cjs/ratio.js +141 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/validation.js +20 -0
- package/dist/esm/comparisons/index.d.ts +23 -0
- package/dist/esm/comparisons/index.d.ts.map +1 -0
- package/dist/esm/comparisons/index.js +22 -0
- package/dist/esm/containerQueries/containerQueries.d.ts +36 -0
- package/dist/esm/containerQueries/containerQueries.d.ts.map +1 -0
- package/dist/esm/containerQueries/containerQueries.js +109 -0
- package/dist/esm/containerQueries/factory.d.ts +20 -0
- package/dist/esm/containerQueries/factory.d.ts.map +1 -0
- package/dist/esm/containerQueries/factory.js +119 -0
- package/dist/esm/containerQueries/helpers.d.ts +53 -0
- package/dist/esm/containerQueries/helpers.d.ts.map +1 -0
- package/dist/esm/containerQueries/helpers.js +82 -0
- package/dist/esm/containerQueries/index.d.ts +10 -0
- package/dist/esm/containerQueries/index.d.ts.map +1 -0
- package/dist/esm/containerQueries/index.js +4 -0
- package/dist/esm/containerQueries/linting/aspectRatio.d.ts +4 -0
- package/dist/esm/containerQueries/linting/aspectRatio.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/aspectRatio.js +19 -0
- package/dist/esm/containerQueries/linting/block.d.ts +4 -0
- package/dist/esm/containerQueries/linting/block.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/block.js +18 -0
- package/dist/esm/containerQueries/linting/core.d.ts +4 -0
- package/dist/esm/containerQueries/linting/core.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/core.js +20 -0
- package/dist/esm/containerQueries/linting/custom.d.ts +3 -0
- package/dist/esm/containerQueries/linting/custom.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/custom.js +7 -0
- package/dist/esm/containerQueries/linting/inline.d.ts +4 -0
- package/dist/esm/containerQueries/linting/inline.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/inline.js +18 -0
- package/dist/esm/containerQueries/linting/resolution.d.ts +1 -0
- package/dist/esm/containerQueries/linting/resolution.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/resolution.js +12 -0
- package/dist/esm/containerQueries/linting/style.d.ts +3 -0
- package/dist/esm/containerQueries/linting/style.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting/style.js +24 -0
- package/dist/esm/containerQueries/linting.d.ts +4 -0
- package/dist/esm/containerQueries/linting.d.ts.map +1 -0
- package/dist/esm/containerQueries/linting.js +20 -0
- package/dist/esm/containerQueries/moduleRegistry.d.ts +25 -0
- package/dist/esm/containerQueries/moduleRegistry.d.ts.map +1 -0
- package/dist/esm/containerQueries/moduleRegistry.js +1 -0
- package/dist/esm/containerQueries/modules/aspectRatio.d.ts +17 -0
- package/dist/esm/containerQueries/modules/aspectRatio.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/aspectRatio.js +47 -0
- package/dist/esm/containerQueries/modules/block.d.ts +20 -0
- package/dist/esm/containerQueries/modules/block.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/block.js +49 -0
- package/dist/esm/containerQueries/modules/custom.d.ts +13 -0
- package/dist/esm/containerQueries/modules/custom.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/custom.js +39 -0
- package/dist/esm/containerQueries/modules/index.d.ts +6 -0
- package/dist/esm/containerQueries/modules/index.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/index.js +5 -0
- package/dist/esm/containerQueries/modules/inline.d.ts +20 -0
- package/dist/esm/containerQueries/modules/inline.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/inline.js +49 -0
- package/dist/esm/containerQueries/modules/size.d.ts +41 -0
- package/dist/esm/containerQueries/modules/size.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/size.js +1 -0
- package/dist/esm/containerQueries/modules/style.d.ts +11 -0
- package/dist/esm/containerQueries/modules/style.d.ts.map +1 -0
- package/dist/esm/containerQueries/modules/style.js +32 -0
- package/dist/esm/containerQueries/types.d.ts +81 -0
- package/dist/esm/containerQueries/types.d.ts.map +1 -0
- package/dist/esm/containerQueries/types.js +1 -0
- package/dist/esm/containerQueries/validation.d.ts +41 -0
- package/dist/esm/containerQueries/validation.d.ts.map +1 -0
- package/dist/esm/containerQueries/validation.js +187 -0
- package/dist/esm/core.d.ts +27 -26
- package/dist/esm/core.d.ts.map +1 -1
- package/dist/esm/core.js +5 -266
- package/dist/esm/factory.d.ts +13 -0
- package/dist/esm/factory.d.ts.map +1 -0
- package/dist/esm/factory.js +17 -0
- package/dist/esm/fraction.d.ts +23 -0
- package/dist/esm/fraction.d.ts.map +1 -0
- package/dist/esm/fraction.js +129 -0
- package/dist/esm/internal/buildMeasurementCreationError.d.ts +12 -0
- package/dist/esm/internal/buildMeasurementCreationError.d.ts.map +1 -0
- package/dist/esm/internal/buildMeasurementCreationError.js +12 -0
- package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts +3 -0
- package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts.map +1 -0
- package/dist/esm/internal/buildMeasurementCreationError.tests.js +1 -0
- package/dist/esm/internal/createComponentQueriesApi.d.ts +34 -0
- package/dist/esm/internal/createComponentQueriesApi.d.ts.map +1 -0
- package/dist/esm/internal/createComponentQueriesApi.js +52 -0
- package/dist/esm/internal/createCoreApi.d.ts +289 -0
- package/dist/esm/internal/createCoreApi.d.ts.map +1 -0
- package/dist/esm/internal/createCoreApi.js +332 -0
- package/dist/esm/internal/createMediaQueriesApi.d.ts +35 -0
- package/dist/esm/internal/createMediaQueriesApi.d.ts.map +1 -0
- package/dist/esm/internal/createMediaQueriesApi.js +70 -0
- package/dist/esm/internal/createUnitsApi.d.ts +13 -0
- package/dist/esm/internal/createUnitsApi.d.ts.map +1 -0
- package/dist/esm/internal/createUnitsApi.js +14 -0
- package/dist/esm/internal/errors.d.ts +30 -0
- package/dist/esm/internal/errors.d.ts.map +1 -1
- package/dist/esm/internal/errors.js +113 -4
- package/dist/esm/internal/normalizeToArray.d.ts +2 -0
- package/dist/esm/internal/normalizeToArray.d.ts.map +1 -0
- package/dist/esm/internal/normalizeToArray.js +5 -0
- package/dist/esm/libraryHelpers/vanilla-extract.d.ts +2 -1
- package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +1 -1
- package/dist/esm/libraryHelpers/vanilla-extract.js +4 -1
- package/dist/esm/logicalOperators/index.d.ts +2 -0
- package/dist/esm/logicalOperators/index.d.ts.map +1 -0
- package/dist/esm/logicalOperators/index.js +17 -0
- package/dist/esm/mediaQueries/factory.d.ts +16 -1
- package/dist/esm/mediaQueries/factory.d.ts.map +1 -1
- package/dist/esm/mediaQueries/factory.js +3 -2
- package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts +2 -2
- package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts.map +1 -1
- package/dist/esm/mediaQueries/mediaQueries.d.ts +2 -0
- package/dist/esm/mediaQueries/mediaQueries.d.ts.map +1 -1
- package/dist/esm/mediaQueries/mediaQueries.js +4 -2
- package/dist/esm/mediaQueries/modules/dimensions.d.ts +2 -0
- package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +1 -1
- package/dist/esm/mediaQueries/modules/dimensions.js +4 -2
- package/dist/esm/mediaQueries/modules/resolution.d.ts +2 -0
- package/dist/esm/mediaQueries/modules/resolution.d.ts.map +1 -1
- package/dist/esm/mediaQueries/modules/resolution.js +4 -2
- package/dist/esm/mediaQueries/validation.d.ts +28 -8
- package/dist/esm/mediaQueries/validation.d.ts.map +1 -1
- package/dist/esm/mediaQueries/validation.js +126 -107
- package/dist/esm/ratio.d.ts +22 -0
- package/dist/esm/ratio.d.ts.map +1 -0
- package/dist/esm/ratio.js +131 -0
- package/dist/esm/types.d.ts +35 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/validation.d.ts +10 -0
- package/dist/esm/validation.d.ts.map +1 -0
- package/dist/esm/validation.js +15 -0
- package/dist/examples/containerQueries.example.js +54 -0
- package/dist/examples/examples/containerQueries.example.js +54 -0
- package/dist/examples/examples/factory-wrapper.example.js +33 -0
- package/dist/examples/examples/lineHeight-normalizer.example.js +81 -0
- package/dist/examples/examples/mediaQueries-multipleInstances.example.js +127 -0
- package/dist/examples/examples/mixedQueries.example.js +55 -0
- package/dist/examples/examples/validation-and-runtime-checks.example.js +85 -0
- package/dist/examples/examples/validation-unit-tests.example.js +35 -0
- package/dist/examples/factory-wrapper.example.js +33 -0
- package/dist/examples/lineHeight-normalizer.example.js +81 -0
- package/dist/examples/mediaQueries-multipleInstances.example.js +127 -0
- package/dist/examples/mixedQueries.example.js +60 -0
- package/dist/examples/src/comparisons/index.js +25 -0
- package/dist/examples/src/containerQueries/containerQueries.js +96 -0
- package/dist/examples/src/containerQueries/factory.js +123 -0
- package/dist/examples/src/containerQueries/helpers.js +94 -0
- package/dist/examples/src/containerQueries/index.js +16 -0
- package/dist/examples/src/containerQueries/linting/aspectRatio.js +20 -0
- package/dist/examples/src/containerQueries/linting/block.js +20 -0
- package/dist/examples/src/containerQueries/linting/core.js +19 -0
- package/dist/examples/src/containerQueries/linting/custom.js +11 -0
- package/dist/examples/src/containerQueries/linting/inline.js +20 -0
- package/dist/examples/src/containerQueries/linting/style.js +28 -0
- package/dist/examples/src/containerQueries/linting.js +24 -0
- package/dist/examples/src/containerQueries/moduleRegistry.js +5 -0
- package/dist/examples/src/containerQueries/modules/aspectRatio.js +33 -0
- package/dist/examples/src/containerQueries/modules/block.js +44 -0
- package/dist/examples/src/containerQueries/modules/custom.js +31 -0
- package/dist/examples/src/containerQueries/modules/index.js +21 -0
- package/dist/examples/src/containerQueries/modules/inline.js +44 -0
- package/dist/examples/src/containerQueries/modules/style.js +36 -0
- package/dist/examples/src/containerQueries/types.js +2 -0
- package/dist/examples/src/containerQueries/validation.js +177 -0
- package/dist/examples/src/core.js +16 -0
- package/dist/examples/src/factory.js +21 -0
- package/dist/examples/src/index.js +30 -0
- package/dist/examples/src/internal/buildMeasurementCreationError.js +16 -0
- package/dist/examples/src/internal/createCoreApi.js +336 -0
- package/dist/examples/src/internal/createMediaQueriesApi.js +74 -0
- package/dist/examples/src/internal/createUnitsApi.js +18 -0
- package/dist/examples/src/internal/errors.js +130 -0
- package/dist/examples/src/libraryHelpers/vanilla-extract.js +11 -0
- package/dist/examples/src/mediaQueries/factory.js +163 -0
- package/dist/examples/src/mediaQueries/helpers.js +88 -0
- package/dist/examples/src/mediaQueries/index.js +23 -0
- package/dist/examples/src/mediaQueries/linting/core.js +19 -0
- package/dist/examples/src/mediaQueries/linting/resolution.js +11 -0
- package/dist/examples/src/mediaQueries/linting.js +24 -0
- package/dist/examples/src/mediaQueries/mediaQueries.js +53 -0
- package/dist/examples/src/mediaQueries/moduleRegistry.js +5 -0
- package/dist/examples/src/mediaQueries/modules/custom.js +26 -0
- package/dist/examples/src/mediaQueries/modules/dimensions.js +61 -0
- package/dist/examples/src/mediaQueries/modules/display.js +20 -0
- package/dist/examples/src/mediaQueries/modules/environment.js +20 -0
- package/dist/examples/src/mediaQueries/modules/index.js +23 -0
- package/dist/examples/src/mediaQueries/modules/interaction.js +26 -0
- package/dist/examples/src/mediaQueries/modules/preferences.js +26 -0
- package/dist/examples/src/mediaQueries/modules/resolution.js +31 -0
- package/dist/examples/src/mediaQueries/types.js +2 -0
- package/dist/examples/src/mediaQueries/validation.js +128 -0
- package/dist/examples/src/ratio.js +141 -0
- package/dist/examples/src/types.js +2 -0
- package/dist/examples/src/unitDefinitions.js +67 -0
- package/dist/examples/src/units/absolute.js +11 -0
- package/dist/examples/src/units/angle.js +8 -0
- package/dist/examples/src/units/container.js +10 -0
- package/dist/examples/src/units/font-relative.js +16 -0
- package/dist/examples/src/units/frequency.js +6 -0
- package/dist/examples/src/units/grid.js +5 -0
- package/dist/examples/src/units/percent.js +7 -0
- package/dist/examples/src/units/resolution.js +7 -0
- package/dist/examples/src/units/time.js +6 -0
- package/dist/examples/src/units/viewport-dynamic.js +10 -0
- package/dist/examples/src/units/viewport-large.js +10 -0
- package/dist/examples/src/units/viewport-small.js +10 -0
- package/dist/examples/src/units/viewport.js +10 -0
- package/dist/examples/src/validation.js +20 -0
- package/dist/examples/validation-and-runtime-checks.example.js +85 -0
- package/dist/examples/validation-unit-tests.example.js +35 -0
- package/package.json +16 -5
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyContainerQueryValidation = exports.createContainerQueryBuilder = exports.createContainerQueryFeatureEmitterWithTracking = exports.createContainerQueryConditionEmitter = exports.createContainerQueryFeatureEmitter = exports.formatContainerQueryComparison = exports.buildContainerQueryStringFromParts = exports.buildContainerRange = exports.buildContainerComparison = exports.formatContainerQueryValue = void 0;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
const validation_1 = require("../validation");
|
|
6
|
+
const formatContainerQueryValue = (value) => ((0, core_1.hasCssMethod)(value) ? value.css() : String(value));
|
|
7
|
+
exports.formatContainerQueryValue = formatContainerQueryValue;
|
|
8
|
+
const buildContainerComparison = (comparison) => comparison;
|
|
9
|
+
exports.buildContainerComparison = buildContainerComparison;
|
|
10
|
+
const buildContainerRange = (min, max, options = {}) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : "min";
|
|
13
|
+
const operator = options.inclusive === false ? "<" : "<=";
|
|
14
|
+
if (mode === "max") {
|
|
15
|
+
return { min, max, maxOperator: operator };
|
|
16
|
+
}
|
|
17
|
+
return { min, max, minOperator: operator };
|
|
18
|
+
};
|
|
19
|
+
exports.buildContainerRange = buildContainerRange;
|
|
20
|
+
const buildContainerQueryStringFromParts = (parts) => parts.join(" and ");
|
|
21
|
+
exports.buildContainerQueryStringFromParts = buildContainerQueryStringFromParts;
|
|
22
|
+
const formatContainerQueryComparison = (name, operator, value) => {
|
|
23
|
+
return `(${name} ${operator} ${(0, exports.formatContainerQueryValue)(value)})`;
|
|
24
|
+
};
|
|
25
|
+
exports.formatContainerQueryComparison = formatContainerQueryComparison;
|
|
26
|
+
const createContainerQueryFeatureEmitter = (parts) => (name, value) => {
|
|
27
|
+
parts.push(`(${name}: ${(0, exports.formatContainerQueryValue)(value)})`);
|
|
28
|
+
};
|
|
29
|
+
exports.createContainerQueryFeatureEmitter = createContainerQueryFeatureEmitter;
|
|
30
|
+
const createContainerQueryConditionEmitter = (parts) => (condition) => {
|
|
31
|
+
parts.push(condition);
|
|
32
|
+
};
|
|
33
|
+
exports.createContainerQueryConditionEmitter = createContainerQueryConditionEmitter;
|
|
34
|
+
const createContainerQueryFeatureEmitterWithTracking = (parts, options = {}) => {
|
|
35
|
+
const { emitted, lintingMode = "throw" } = options;
|
|
36
|
+
return (name, value) => {
|
|
37
|
+
if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
|
|
38
|
+
if (lintingMode === "throw") {
|
|
39
|
+
throw new Error(`Container query feature "${name}" was emitted more than once.`);
|
|
40
|
+
}
|
|
41
|
+
if (lintingMode === "log") {
|
|
42
|
+
console.warn(`Container query feature "${name}" was emitted more than once; using the latest value.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
|
|
46
|
+
parts.push(`(${name}: ${(0, exports.formatContainerQueryValue)(value)})`);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
exports.createContainerQueryFeatureEmitterWithTracking = createContainerQueryFeatureEmitterWithTracking;
|
|
50
|
+
const createContainerQueryBuilder = (options) => {
|
|
51
|
+
return (config) => {
|
|
52
|
+
var _a, _b, _c, _d, _e;
|
|
53
|
+
const parts = [];
|
|
54
|
+
const emittedFeatures = new Set();
|
|
55
|
+
const helpers = {
|
|
56
|
+
addFeature: (0, exports.createContainerQueryFeatureEmitterWithTracking)(parts, {
|
|
57
|
+
emitted: emittedFeatures,
|
|
58
|
+
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",
|
|
59
|
+
}),
|
|
60
|
+
addCondition: (0, exports.createContainerQueryConditionEmitter)(parts),
|
|
61
|
+
config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
|
|
62
|
+
};
|
|
63
|
+
options.emitBase(config, helpers);
|
|
64
|
+
(_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
|
|
65
|
+
return (0, exports.buildContainerQueryStringFromParts)(parts);
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
exports.createContainerQueryBuilder = createContainerQueryBuilder;
|
|
69
|
+
const applyContainerQueryValidation = (config, helpers, validator, context) => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
if (!validator)
|
|
72
|
+
return true;
|
|
73
|
+
const normalized = (0, validation_1.normalizeValidationResult)(validator(config));
|
|
74
|
+
if (normalized.valid)
|
|
75
|
+
return true;
|
|
76
|
+
const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : "throw";
|
|
77
|
+
if (mode === "log") {
|
|
78
|
+
const suffix = normalized.message ? `: ${normalized.message}` : "";
|
|
79
|
+
const prefix = context
|
|
80
|
+
? `Container query ${context} validation failed`
|
|
81
|
+
: "Container query validation failed";
|
|
82
|
+
console.warn(`${prefix}${suffix}`);
|
|
83
|
+
}
|
|
84
|
+
if (mode === "allow")
|
|
85
|
+
return true;
|
|
86
|
+
if (mode === "log")
|
|
87
|
+
return true;
|
|
88
|
+
const suffix = normalized.message ? `: ${normalized.message}` : "";
|
|
89
|
+
const prefix = context
|
|
90
|
+
? `Container query ${context} validation failed`
|
|
91
|
+
: "Container query validation failed";
|
|
92
|
+
throw new Error(`${prefix}${suffix}`);
|
|
93
|
+
};
|
|
94
|
+
exports.applyContainerQueryValidation = applyContainerQueryValidation;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineContainerQueryModules = exports.createContainerQueryFactory = exports.containerQueryFactory = exports.formatContainerQueryValue = exports.buildContainerRange = exports.buildContainerComparison = exports.makeContainerQueryStyle = exports.buildContainerQueryString = exports.buildContainerConditionString = void 0;
|
|
4
|
+
var containerQueries_1 = require("./containerQueries");
|
|
5
|
+
Object.defineProperty(exports, "buildContainerConditionString", { enumerable: true, get: function () { return containerQueries_1.buildContainerConditionString; } });
|
|
6
|
+
Object.defineProperty(exports, "buildContainerQueryString", { enumerable: true, get: function () { return containerQueries_1.buildContainerQueryString; } });
|
|
7
|
+
Object.defineProperty(exports, "makeContainerQueryStyle", { enumerable: true, get: function () { return containerQueries_1.makeContainerQueryStyle; } });
|
|
8
|
+
var helpers_1 = require("./helpers");
|
|
9
|
+
Object.defineProperty(exports, "buildContainerComparison", { enumerable: true, get: function () { return helpers_1.buildContainerComparison; } });
|
|
10
|
+
Object.defineProperty(exports, "buildContainerRange", { enumerable: true, get: function () { return helpers_1.buildContainerRange; } });
|
|
11
|
+
Object.defineProperty(exports, "formatContainerQueryValue", { enumerable: true, get: function () { return helpers_1.formatContainerQueryValue; } });
|
|
12
|
+
var factory_1 = require("./factory");
|
|
13
|
+
Object.defineProperty(exports, "containerQueryFactory", { enumerable: true, get: function () { return factory_1.containerQueryFactory; } });
|
|
14
|
+
Object.defineProperty(exports, "createContainerQueryFactory", { enumerable: true, get: function () { return factory_1.createContainerQueryFactory; } });
|
|
15
|
+
var moduleRegistry_1 = require("./moduleRegistry");
|
|
16
|
+
Object.defineProperty(exports, "defineContainerQueryModules", { enumerable: true, get: function () { return moduleRegistry_1.defineContainerQueryModules; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintAspectRatioRangeCollapse = exports.lintAspectRatioRedundancy = void 0;
|
|
4
|
+
const ratio_1 = require("../../ratio");
|
|
5
|
+
const lintAspectRatioRedundancy = (props) => {
|
|
6
|
+
if (!props.aspectRatio)
|
|
7
|
+
return;
|
|
8
|
+
if (props.minAspectRatio || props.maxAspectRatio) {
|
|
9
|
+
throw new Error("aspectRatio should not be combined with minAspectRatio or maxAspectRatio");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.lintAspectRatioRedundancy = lintAspectRatioRedundancy;
|
|
13
|
+
const lintAspectRatioRangeCollapse = (props) => {
|
|
14
|
+
if (!props.minAspectRatio || !props.maxAspectRatio)
|
|
15
|
+
return;
|
|
16
|
+
if ((0, ratio_1.ratioToFloat)(props.minAspectRatio) === (0, ratio_1.ratioToFloat)(props.maxAspectRatio)) {
|
|
17
|
+
throw new Error("minAspectRatio and maxAspectRatio are equal; use aspectRatio instead");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.lintAspectRatioRangeCollapse = lintAspectRatioRangeCollapse;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintBlockRangeCollapse = exports.lintBlockRedundancy = void 0;
|
|
4
|
+
const lintBlockRedundancy = (props) => {
|
|
5
|
+
if (!props.blockSize)
|
|
6
|
+
return;
|
|
7
|
+
if (props.blockSizeRange) {
|
|
8
|
+
throw new Error("blockSize should not be combined with blockSizeRange");
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.lintBlockRedundancy = lintBlockRedundancy;
|
|
12
|
+
const lintBlockRangeCollapse = (props) => {
|
|
13
|
+
if (!props.blockSizeRange)
|
|
14
|
+
return;
|
|
15
|
+
const { min, max } = props.blockSizeRange;
|
|
16
|
+
if (min.equals(max)) {
|
|
17
|
+
throw new Error("blockSizeRange min and max are equal; use blockSize instead");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.lintBlockRangeCollapse = lintBlockRangeCollapse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintHeightExactRedundancy = exports.lintWidthExactRedundancy = void 0;
|
|
4
|
+
const lintWidthExactRedundancy = (props) => {
|
|
5
|
+
if (!props.minWidth || !props.maxWidth)
|
|
6
|
+
return;
|
|
7
|
+
if (props.minWidth.equals(props.maxWidth)) {
|
|
8
|
+
throw new Error("minWidth should not be combined with maxWidth when both are equal");
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.lintWidthExactRedundancy = lintWidthExactRedundancy;
|
|
12
|
+
const lintHeightExactRedundancy = (props) => {
|
|
13
|
+
if (!props.minHeight || !props.maxHeight)
|
|
14
|
+
return;
|
|
15
|
+
if (props.minHeight.equals(props.maxHeight)) {
|
|
16
|
+
throw new Error("minHeight should not be combined with maxHeight when both are equal");
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.lintHeightExactRedundancy = lintHeightExactRedundancy;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintCustomFeatures = void 0;
|
|
4
|
+
const lintCustomFeatures = (props) => {
|
|
5
|
+
if (!props.customFeatures)
|
|
6
|
+
return;
|
|
7
|
+
if (!Object.keys(props.customFeatures).length) {
|
|
8
|
+
throw new Error("customFeatures should not be empty.");
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.lintCustomFeatures = lintCustomFeatures;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintInlineRangeCollapse = exports.lintInlineRedundancy = void 0;
|
|
4
|
+
const lintInlineRedundancy = (props) => {
|
|
5
|
+
if (!props.inlineSize)
|
|
6
|
+
return;
|
|
7
|
+
if (props.inlineSizeRange) {
|
|
8
|
+
throw new Error("inlineSize should not be combined with inlineSizeRange");
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.lintInlineRedundancy = lintInlineRedundancy;
|
|
12
|
+
const lintInlineRangeCollapse = (props) => {
|
|
13
|
+
if (!props.inlineSizeRange)
|
|
14
|
+
return;
|
|
15
|
+
const { min, max } = props.inlineSizeRange;
|
|
16
|
+
if (min.equals(max)) {
|
|
17
|
+
throw new Error("inlineSizeRange min and max are equal; use inlineSize instead");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.lintInlineRangeCollapse = lintInlineRangeCollapse;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintStyleCondition = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
const isComparisonShape = (value) => {
|
|
6
|
+
if (typeof value !== "object" || value === null)
|
|
7
|
+
return false;
|
|
8
|
+
return "operator" in value && "value" in value;
|
|
9
|
+
};
|
|
10
|
+
const lintStyleCondition = (props) => {
|
|
11
|
+
if (!props.style)
|
|
12
|
+
return;
|
|
13
|
+
if (!Object.keys(props.style).length) {
|
|
14
|
+
throw new Error("style conditions must not be empty.");
|
|
15
|
+
}
|
|
16
|
+
Object.values(props.style).forEach((value) => {
|
|
17
|
+
if (value === undefined || value === null)
|
|
18
|
+
return;
|
|
19
|
+
if (Array.isArray(value))
|
|
20
|
+
return;
|
|
21
|
+
if ((0, core_1.hasCssMethod)(value))
|
|
22
|
+
return;
|
|
23
|
+
if (isComparisonShape(value)) {
|
|
24
|
+
throw new Error("style conditions must not contain comparisons.");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.lintStyleCondition = lintStyleCondition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runContainerQueryLint = void 0;
|
|
4
|
+
const runContainerQueryLint = (config, helpers, check, message = "Container 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.runContainerQueryLint = runContainerQueryLint;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitAspectRatioFeatures = void 0;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const validation_1 = require("../validation");
|
|
6
|
+
const linting_1 = require("../linting");
|
|
7
|
+
const aspectRatio_1 = require("../linting/aspectRatio");
|
|
8
|
+
const emitAspectRatioFeatures = (props, helpers, validate) => {
|
|
9
|
+
const { runContainerQueryValidation, validateAspectRatioValues } = validation_1.defaultContainerQueryValidation;
|
|
10
|
+
if (!runContainerQueryValidation(props, helpers, validateAspectRatioValues, "aspectRatio", "aspect ratio values must be valid ratio greater than 0")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, aspectRatio_1.lintAspectRatioRedundancy, "aspectRatio should not be combined with minAspectRatio or maxAspectRatio")) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, aspectRatio_1.lintAspectRatioRangeCollapse, "minAspectRatio and maxAspectRatio are equal; use aspectRatio instead")) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "aspectRatio")) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const { addFeature } = helpers;
|
|
23
|
+
if (props.aspectRatio) {
|
|
24
|
+
addFeature("aspect-ratio", props.aspectRatio);
|
|
25
|
+
}
|
|
26
|
+
if (props.minAspectRatio) {
|
|
27
|
+
addFeature("min-aspect-ratio", props.minAspectRatio);
|
|
28
|
+
}
|
|
29
|
+
if (props.maxAspectRatio) {
|
|
30
|
+
addFeature("max-aspect-ratio", props.maxAspectRatio);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.emitAspectRatioFeatures = emitAspectRatioFeatures;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitBlockSizeFeatures = void 0;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const validation_1 = require("../validation");
|
|
6
|
+
const linting_1 = require("../linting");
|
|
7
|
+
const block_1 = require("../linting/block");
|
|
8
|
+
const emitBlockComparison = (name, comparison, addCondition) => {
|
|
9
|
+
addCondition((0, helpers_1.formatContainerQueryComparison)(name, comparison.operator, comparison.value));
|
|
10
|
+
};
|
|
11
|
+
const emitBlockRange = (name, range, addCondition) => {
|
|
12
|
+
const min = (0, helpers_1.formatContainerQueryValue)(range.min);
|
|
13
|
+
const max = (0, helpers_1.formatContainerQueryValue)(range.max);
|
|
14
|
+
if ("minOperator" in range) {
|
|
15
|
+
addCondition(`(${min} ${range.minOperator} ${name})`);
|
|
16
|
+
addCondition(`(${name} <= ${max})`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
addCondition(`(${min} <= ${name})`);
|
|
20
|
+
addCondition(`(${name} ${range.maxOperator} ${max})`);
|
|
21
|
+
};
|
|
22
|
+
const emitBlockSizeFeatures = (props, helpers, validate) => {
|
|
23
|
+
const { runContainerQueryValidation, validateBlockSizeValues, } = validation_1.defaultContainerQueryValidation;
|
|
24
|
+
if (!runContainerQueryValidation(props, helpers, validateBlockSizeValues, "block", "block size values must be valid measurements greater than 0")) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, block_1.lintBlockRedundancy, "blockSize should not be combined with blockSizeRange")) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, block_1.lintBlockRangeCollapse, "blockSizeRange min and max are equal; use blockSize instead")) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "block")) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const { addCondition } = helpers;
|
|
37
|
+
if (props.blockSize) {
|
|
38
|
+
emitBlockComparison("block-size", props.blockSize, addCondition);
|
|
39
|
+
}
|
|
40
|
+
if (props.blockSizeRange) {
|
|
41
|
+
emitBlockRange("block-size", props.blockSizeRange, addCondition);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.emitBlockSizeFeatures = emitBlockSizeFeatures;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 emitCustomFeatures = (props, helpers, validate) => {
|
|
9
|
+
const { runContainerQueryValidation, validateCustomFeatures, } = validation_1.defaultContainerQueryValidation;
|
|
10
|
+
if (!runContainerQueryValidation(props, helpers, validateCustomFeatures, "custom", "custom features must be valid and non-empty")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, custom_1.lintCustomFeatures, "customFeatures should not be empty")) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "custom")) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { addFeature } = helpers;
|
|
20
|
+
if (!props.customFeatures)
|
|
21
|
+
return;
|
|
22
|
+
Object.entries(props.customFeatures).forEach(([name, value]) => {
|
|
23
|
+
if (value === undefined || value === null)
|
|
24
|
+
return;
|
|
25
|
+
const trimmedName = name.trim();
|
|
26
|
+
if (!trimmedName)
|
|
27
|
+
return;
|
|
28
|
+
addFeature(trimmedName, value);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.emitCustomFeatures = emitCustomFeatures;
|
|
@@ -0,0 +1,21 @@
|
|
|
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);
|
|
@@ -0,0 +1,44 @@
|
|
|
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 emitInlineComparison = (name, comparison, addCondition) => {
|
|
9
|
+
addCondition((0, helpers_1.formatContainerQueryComparison)(name, comparison.operator, comparison.value));
|
|
10
|
+
};
|
|
11
|
+
const emitInlineRange = (name, range, addCondition) => {
|
|
12
|
+
const min = (0, helpers_1.formatContainerQueryValue)(range.min);
|
|
13
|
+
const max = (0, helpers_1.formatContainerQueryValue)(range.max);
|
|
14
|
+
if ("minOperator" in range) {
|
|
15
|
+
addCondition(`(${min} ${range.minOperator} ${name})`);
|
|
16
|
+
addCondition(`(${name} <= ${max})`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
addCondition(`(${min} <= ${name})`);
|
|
20
|
+
addCondition(`(${name} ${range.maxOperator} ${max})`);
|
|
21
|
+
};
|
|
22
|
+
const emitInlineSizeFeatures = (props, helpers, validate) => {
|
|
23
|
+
const { runContainerQueryValidation, validateInlineSizeValues, } = validation_1.defaultContainerQueryValidation;
|
|
24
|
+
if (!runContainerQueryValidation(props, helpers, validateInlineSizeValues, "inline", "inline size values must be valid measurements greater than 0")) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, inline_1.lintInlineRedundancy, "inlineSize should not be combined with inlineSizeRange")) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!(0, linting_1.runContainerQueryLint)(props, helpers, inline_1.lintInlineRangeCollapse, "inlineSizeRange min and max are equal; use inlineSize instead")) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!(0, helpers_1.applyContainerQueryValidation)(props, helpers, validate, "inline")) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const { addCondition } = helpers;
|
|
37
|
+
if (props.inlineSize) {
|
|
38
|
+
emitInlineComparison("inline-size", props.inlineSize, addCondition);
|
|
39
|
+
}
|
|
40
|
+
if (props.inlineSizeRange) {
|
|
41
|
+
emitInlineRange("inline-size", props.inlineSizeRange, addCondition);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.emitInlineSizeFeatures = emitInlineSizeFeatures;
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|