css-calipers 0.9.2 → 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/package.json +3 -0
- 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 +17 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IContainerQueryCore } from "./containerQueries";
|
|
2
|
+
import type { IContainerQueryBlock, IContainerQueryInline, IContainerQueryAspectRatio, IContainerQueryStyle } from "./modules";
|
|
3
|
+
import { IContainerQueryCustomFeatures } from "./modules/custom";
|
|
4
|
+
export type ContainerQueryModuleId = "core" | "inline" | "block" | "aspectRatio" | "style" | "custom";
|
|
5
|
+
export type ContainerQueryModulePropsMap = {
|
|
6
|
+
core: IContainerQueryCore;
|
|
7
|
+
block: IContainerQueryBlock;
|
|
8
|
+
custom: IContainerQueryCustomFeatures;
|
|
9
|
+
inline: IContainerQueryInline;
|
|
10
|
+
aspectRatio: IContainerQueryAspectRatio;
|
|
11
|
+
style: IContainerQueryStyle;
|
|
12
|
+
};
|
|
13
|
+
export type ContentQueryValues = IContainerQueryCore[keyof IContainerQueryCore] | IContainerQueryInline[keyof IContainerQueryInline] | IContainerQueryBlock[keyof IContainerQueryBlock] | IContainerQueryAspectRatio[keyof IContainerQueryAspectRatio] | IContainerQueryStyle[keyof IContainerQueryStyle] | IContainerQueryCustomFeatures[keyof IContainerQueryCustomFeatures];
|
|
14
|
+
export type ContainerQueryModuleKeysMap = {
|
|
15
|
+
core: "minWidth" | "maxWidth" | "minHeight" | "maxHeight";
|
|
16
|
+
inline: "inlineSize" | "inlineSizeRange";
|
|
17
|
+
block: "blockSize" | "blockSizeRange";
|
|
18
|
+
aspectRatio: "aspectRatio" | "minAspectRatio" | "maxAspectRatio";
|
|
19
|
+
style: "style";
|
|
20
|
+
custom: "customFeatures";
|
|
21
|
+
};
|
|
22
|
+
export type ContainerQueryModuleKeys<M extends ContainerQueryModuleId> = ContainerQueryModuleKeysMap[M];
|
|
23
|
+
export type ContainerQueryModulesList = readonly ContainerQueryModuleId[];
|
|
24
|
+
export declare const defineContainerQueryModules: <T extends ContainerQueryModulesList>(...modules: T) => T;
|
|
25
|
+
//# sourceMappingURL=moduleRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleRegistry.d.ts","sourceRoot":"","sources":["../../../src/containerQueries/moduleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,QAAQ,GACR,OAAO,GACP,aAAa,GACb,OAAO,GACP,QAAQ,CAAC;AAEb,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,6BAA6B,CAAC;IACtC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,0BAA0B,CAAC;IACxC,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,CAAC,MAAM,mBAAmB,CAAC,GAC9C,qBAAqB,CAAC,MAAM,qBAAqB,CAAC,GAClD,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,GAChD,0BAA0B,CAAC,MAAM,0BAA0B,CAAC,GAC5D,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,GAChD,6BAA6B,CAAC,MAAM,6BAA6B,CAAC,CAAC;AAEvE,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;IAC1D,MAAM,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACzC,KAAK,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACtC,WAAW,EAAE,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;IACjE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,sBAAsB,IACnE,2BAA2B,CAAC,CAAC,CAAC,CAAC;AAEjC,MAAM,MAAM,yBAAyB,GAAG,SAAS,sBAAsB,EAAE,CAAC;AAE1E,eAAO,MAAM,2BAA2B,GACtC,CAAC,SAAS,yBAAyB,EAEnC,GAAG,SAAS,CAAC,KACZ,CAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defineContainerQueryModules = (...modules) => modules;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentQueryVariable, IComparisonOperator } from "../../comparisons";
|
|
2
|
+
import type { IRatio } from "../../ratio";
|
|
3
|
+
import type { ContainerQueryBuilderHelpers, ContainerQueryValidator } from "../helpers";
|
|
4
|
+
export interface IContainerQueryAspectRatio {
|
|
5
|
+
aspectRatio?: IRatio | IRatio[];
|
|
6
|
+
minAspectRatio?: IRatio | IRatio[];
|
|
7
|
+
maxAspectRatio?: IRatio | IRatio[];
|
|
8
|
+
}
|
|
9
|
+
export type ContainerQueryAspectRatioValidator = ContainerQueryValidator<IContainerQueryAspectRatio>;
|
|
10
|
+
export type AspectRatioComparisonVariable = "aspectRatio" | "minAspectRatio" | "maxAspectRatio";
|
|
11
|
+
export type ComparisonAspectRatio<Variable = ContentQueryVariable, Value = IRatio> = {
|
|
12
|
+
variable: Variable;
|
|
13
|
+
operator: IComparisonOperator;
|
|
14
|
+
value: Value;
|
|
15
|
+
};
|
|
16
|
+
export declare const emitAspectRatioFeatures: (props: IContainerQueryAspectRatio, helpers: ContainerQueryBuilderHelpers, validate?: ContainerQueryAspectRatioValidator) => void;
|
|
17
|
+
//# sourceMappingURL=aspectRatio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspectRatio.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/aspectRatio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AASpB,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,kCAAkC,GAC5C,uBAAuB,CAAC,0BAA0B,CAAC,CAAC;AAEtD,MAAM,MAAM,6BAA6B,GACrC,aAAa,GACb,gBAAgB,GAChB,gBAAgB,CAAC;AAErB,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,GAAG,oBAAoB,EAC/B,KAAK,GAAG,MAAM,IACZ;IACF,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,OAAO,0BAA0B,EACjC,SAAS,4BAA4B,EACrC,WAAW,kCAAkC,KAC5C,IAsEF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { applyContainerQueryValidation } from "../helpers";
|
|
2
|
+
import { defaultContainerQueryValidation } from "../validation";
|
|
3
|
+
import { runContainerQueryLint } from "../linting";
|
|
4
|
+
import { lintAspectRatioRangeCollapse, lintAspectRatioRedundancy, } from "../linting/aspectRatio";
|
|
5
|
+
export const emitAspectRatioFeatures = (props, helpers, validate) => {
|
|
6
|
+
const allowQueryArrays = helpers.config.allowQueryArrays !== false;
|
|
7
|
+
const assertNoArray = (value, label) => {
|
|
8
|
+
if (Array.isArray(value) && !allowQueryArrays) {
|
|
9
|
+
throw new Error(`${label} does not allow arrays.`);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const { runContainerQueryValidation, validateAspectRatioValues } = defaultContainerQueryValidation;
|
|
13
|
+
if (!runContainerQueryValidation(props, helpers, validateAspectRatioValues, "aspectRatio", "aspect ratio values must be valid ratio greater than 0")) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!runContainerQueryLint(props, helpers, lintAspectRatioRedundancy, "aspectRatio should not be combined with minAspectRatio or maxAspectRatio")) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!runContainerQueryLint(props, helpers, lintAspectRatioRangeCollapse, "minAspectRatio and maxAspectRatio are equal; use aspectRatio instead")) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!applyContainerQueryValidation(props, helpers, validate, "aspectRatio")) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const emitFeature = (name, value) => {
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
value.forEach((entry) => {
|
|
28
|
+
var _a;
|
|
29
|
+
((_a = helpers.addFeatureUnsafe) !== null && _a !== void 0 ? _a : helpers.addFeature)(name, entry);
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
helpers.addFeature(name, value);
|
|
34
|
+
};
|
|
35
|
+
if (props.aspectRatio !== undefined) {
|
|
36
|
+
assertNoArray(props.aspectRatio, "aspectRatio");
|
|
37
|
+
emitFeature("aspect-ratio", props.aspectRatio);
|
|
38
|
+
}
|
|
39
|
+
if (props.minAspectRatio !== undefined) {
|
|
40
|
+
assertNoArray(props.minAspectRatio, "minAspectRatio");
|
|
41
|
+
emitFeature("min-aspect-ratio", props.minAspectRatio);
|
|
42
|
+
}
|
|
43
|
+
if (props.maxAspectRatio !== undefined) {
|
|
44
|
+
assertNoArray(props.maxAspectRatio, "maxAspectRatio");
|
|
45
|
+
emitFeature("max-aspect-ratio", props.maxAspectRatio);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Comparison, IComparisonOperator } from "../../comparisons";
|
|
2
|
+
import type { IMeasurement } from "../../core";
|
|
3
|
+
import type { ContainerQueryBuilderHelpers, ContainerQueryValidator } from "../helpers";
|
|
4
|
+
import type { CSSComparison, CSSRange } from "../types";
|
|
5
|
+
import { SizeComparisonValue } from "../containerQueries";
|
|
6
|
+
export interface IContainerQueryBlock {
|
|
7
|
+
blockSize?: CSSComparison<IMeasurement> | CSSComparison<IMeasurement>[];
|
|
8
|
+
blockSizeRange?: CSSRange<IMeasurement> | CSSRange<IMeasurement>[];
|
|
9
|
+
}
|
|
10
|
+
export type ContainerQueryBlockValidator = ContainerQueryValidator<IContainerQueryBlock>;
|
|
11
|
+
export type CSSContainerBlockSizeFeature = IContainerQueryBlock;
|
|
12
|
+
export type BlockComparisonVariable = "blockSize";
|
|
13
|
+
export type BlockComparison = Comparison<BlockComparisonVariable, SizeComparisonValue>;
|
|
14
|
+
export type ComparisonBlock<Variable = IContainerQueryBlock[keyof IContainerQueryBlock], Value = IMeasurement> = {
|
|
15
|
+
variable: Variable;
|
|
16
|
+
operator: IComparisonOperator;
|
|
17
|
+
value: Value;
|
|
18
|
+
};
|
|
19
|
+
export declare const emitBlockSizeFeatures: (props: IContainerQueryBlock, helpers: ContainerQueryBuilderHelpers, validate?: ContainerQueryBlockValidator) => void;
|
|
20
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAYpB,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;IACxE,cAAc,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;CACpE;AAED,MAAM,MAAM,4BAA4B,GACtC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;AAEhD,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAEhE,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,UAAU,CACtC,uBAAuB,EACvB,mBAAmB,CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,CACzB,QAAQ,GAAG,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,EAC3D,KAAK,GAAG,YAAY,IAClB;IACF,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAiCF,eAAO,MAAM,qBAAqB,GAChC,OAAO,oBAAoB,EAC3B,SAAS,4BAA4B,EACrC,WAAW,4BAA4B,KACtC,IA4DF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { applyContainerQueryValidation, formatContainerQueryComparison, formatContainerQueryValue, } from "../helpers";
|
|
2
|
+
import { defaultContainerQueryValidation } from "../validation";
|
|
3
|
+
import { runContainerQueryLint } from "../linting";
|
|
4
|
+
import { lintBlockRangeCollapse, lintBlockRedundancy, } from "../linting/block";
|
|
5
|
+
import { normalizeToArray } from "../../internal/normalizeToArray";
|
|
6
|
+
const emitBlockComparison = (name, comparison, addCondition) => {
|
|
7
|
+
addCondition(formatContainerQueryComparison(name, comparison.operator, comparison.value));
|
|
8
|
+
};
|
|
9
|
+
const emitBlockRange = (name, range, addCondition) => {
|
|
10
|
+
const min = formatContainerQueryValue(range.min);
|
|
11
|
+
const max = formatContainerQueryValue(range.max);
|
|
12
|
+
if ("minOperator" in range) {
|
|
13
|
+
addCondition(`(${min} ${range.minOperator} ${name})`);
|
|
14
|
+
addCondition(`(${name} <= ${max})`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
addCondition(`(${min} <= ${name})`);
|
|
18
|
+
addCondition(`(${name} ${range.maxOperator} ${max})`);
|
|
19
|
+
};
|
|
20
|
+
export const emitBlockSizeFeatures = (props, helpers, validate) => {
|
|
21
|
+
const allowQueryArrays = helpers.config.allowQueryArrays !== false;
|
|
22
|
+
const assertNoArray = (value, label) => {
|
|
23
|
+
if (Array.isArray(value) && !allowQueryArrays) {
|
|
24
|
+
throw new Error(`${label} does not allow arrays.`);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const { runContainerQueryValidation, validateBlockSizeValues, } = defaultContainerQueryValidation;
|
|
28
|
+
if (!runContainerQueryValidation(props, helpers, validateBlockSizeValues, "block", "block size values must be valid measurements greater than 0")) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!runContainerQueryLint(props, helpers, lintBlockRedundancy, "blockSize should not be combined with blockSizeRange")) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!runContainerQueryLint(props, helpers, lintBlockRangeCollapse, "blockSizeRange min and max are equal; use blockSize instead")) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!applyContainerQueryValidation(props, helpers, validate, "block")) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { addCondition } = helpers;
|
|
41
|
+
assertNoArray(props.blockSize, "blockSize");
|
|
42
|
+
normalizeToArray(props.blockSize).forEach((value) => {
|
|
43
|
+
emitBlockComparison("block-size", value, addCondition);
|
|
44
|
+
});
|
|
45
|
+
assertNoArray(props.blockSizeRange, "blockSizeRange");
|
|
46
|
+
normalizeToArray(props.blockSizeRange).forEach((value) => {
|
|
47
|
+
emitBlockRange("block-size", value, addCondition);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IMeasurement } from "../../core";
|
|
2
|
+
import type { ContainerQueryBuilderHelpers, ContainerQueryValidator } from "../helpers";
|
|
3
|
+
type ContainerQueryFeatureEntry = string | number | IMeasurement;
|
|
4
|
+
type ContainerQueryFeatureValue = ContainerQueryFeatureEntry | ContainerQueryFeatureEntry[];
|
|
5
|
+
export interface IContainerQueryCustomFeatures {
|
|
6
|
+
customFeatures?: Record<string, ContainerQueryFeatureValue>;
|
|
7
|
+
}
|
|
8
|
+
export type ContainerQueryCustomFeaturesValidator = ContainerQueryValidator<IContainerQueryCustomFeatures>;
|
|
9
|
+
export declare const emitCustomFeatures: (props: IContainerQueryCustomFeatures, helpers: ContainerQueryBuilderHelpers, options?: {
|
|
10
|
+
allowQueryArrays?: boolean;
|
|
11
|
+
}, validate?: ContainerQueryCustomFeaturesValidator) => void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=custom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAOpB,KAAK,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AACjE,KAAK,0BAA0B,GAC3B,0BAA0B,GAC1B,0BAA0B,EAAE,CAAC;AAEjC,MAAM,WAAW,6BAA6B;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;CAC7D;AAED,MAAM,MAAM,qCAAqC,GAC/C,uBAAuB,CAAC,6BAA6B,CAAC,CAAC;AAEzD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,6BAA6B,EACpC,SAAS,4BAA4B,EACrC,UAAU;IACR,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,EACD,WAAW,qCAAqC,KAC/C,IAqDF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { applyContainerQueryValidation } from "../helpers";
|
|
2
|
+
import { defaultContainerQueryValidation } from "../validation";
|
|
3
|
+
import { runContainerQueryLint } from "../linting";
|
|
4
|
+
import { lintCustomFeatures } from "../linting/custom";
|
|
5
|
+
import { normalizeToArray } from "../../internal/normalizeToArray";
|
|
6
|
+
export const emitCustomFeatures = (props, helpers, options, validate) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const { runContainerQueryValidation, validateCustomFeatures } = defaultContainerQueryValidation;
|
|
9
|
+
if (!runContainerQueryValidation(props, helpers, validateCustomFeatures, "custom", "custom features must be valid and non-empty")) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!runContainerQueryLint(props, helpers, lintCustomFeatures, "customFeatures should not be empty")) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!applyContainerQueryValidation(props, helpers, validate, "custom")) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const { addFeatureUnsafe, addFeature } = helpers;
|
|
19
|
+
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;
|
|
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
|
+
if (Array.isArray(value) && !allowQueryArrays) {
|
|
29
|
+
throw new Error(`Custom feature "${trimmedName}" does not allow arrays.`);
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
normalizeToArray(value).forEach((entry) => {
|
|
33
|
+
(addFeatureUnsafe !== null && addFeatureUnsafe !== void 0 ? addFeatureUnsafe : addFeature)(trimmedName, entry);
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
addFeature(trimmedName, value);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSComparison, CSSRange } from "../types";
|
|
2
|
+
import type { Comparison, IComparisonOperator } from "../../comparisons";
|
|
3
|
+
import type { IMeasurement } from "../../core";
|
|
4
|
+
import type { SizeComparisonValue } from "../containerQueries";
|
|
5
|
+
import type { ContainerQueryBuilderHelpers, ContainerQueryValidator } from "../helpers";
|
|
6
|
+
export interface IContainerQueryInline {
|
|
7
|
+
inlineSize?: CSSComparison<IMeasurement> | CSSComparison<IMeasurement>[];
|
|
8
|
+
inlineSizeRange?: CSSRange<IMeasurement> | CSSRange<IMeasurement>[];
|
|
9
|
+
}
|
|
10
|
+
export type ContainerQueryInlineValidator = ContainerQueryValidator<IContainerQueryInline>;
|
|
11
|
+
export type CSSContainerInlineSizeFeature = IContainerQueryInline;
|
|
12
|
+
export type InlineComparisonVariable = "inlineSize";
|
|
13
|
+
export type InlineComparison = Comparison<InlineComparisonVariable, SizeComparisonValue>;
|
|
14
|
+
export type ComparisonInline<Variable = IContainerQueryInline[keyof IContainerQueryInline], Value = IMeasurement> = {
|
|
15
|
+
variable: Variable;
|
|
16
|
+
operator: IComparisonOperator;
|
|
17
|
+
value: Value;
|
|
18
|
+
};
|
|
19
|
+
export declare const emitInlineSizeFeatures: (props: IContainerQueryInline, helpers: ContainerQueryBuilderHelpers, validate?: ContainerQueryInlineValidator) => void;
|
|
20
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/inline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAcpB,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;IACzE,eAAe,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;CACrE;AAED,MAAM,MAAM,6BAA6B,GACvC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;AAEjD,MAAM,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAElE,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CACvC,wBAAwB,EACxB,mBAAmB,CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,QAAQ,GAAG,qBAAqB,CAAC,MAAM,qBAAqB,CAAC,EAC7D,KAAK,GAAG,YAAY,IAClB;IACF,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAiCF,eAAO,MAAM,sBAAsB,GACjC,OAAO,qBAAqB,EAC5B,SAAS,4BAA4B,EACrC,WAAW,6BAA6B,KACvC,IA4DF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { applyContainerQueryValidation, formatContainerQueryComparison, formatContainerQueryValue, } from "../helpers";
|
|
2
|
+
import { defaultContainerQueryValidation } from "../validation";
|
|
3
|
+
import { runContainerQueryLint } from "../linting";
|
|
4
|
+
import { lintInlineRangeCollapse, lintInlineRedundancy, } from "../linting/inline";
|
|
5
|
+
import { normalizeToArray } from "../../internal/normalizeToArray";
|
|
6
|
+
const emitInlineComparison = (name, comparison, addCondition) => {
|
|
7
|
+
addCondition(formatContainerQueryComparison(name, comparison.operator, comparison.value));
|
|
8
|
+
};
|
|
9
|
+
const emitInlineRange = (name, range, addCondition) => {
|
|
10
|
+
const min = formatContainerQueryValue(range.min);
|
|
11
|
+
const max = formatContainerQueryValue(range.max);
|
|
12
|
+
if ("minOperator" in range) {
|
|
13
|
+
addCondition(`(${min} ${range.minOperator} ${name})`);
|
|
14
|
+
addCondition(`(${name} <= ${max})`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
addCondition(`(${min} <= ${name})`);
|
|
18
|
+
addCondition(`(${name} ${range.maxOperator} ${max})`);
|
|
19
|
+
};
|
|
20
|
+
export const emitInlineSizeFeatures = (props, helpers, validate) => {
|
|
21
|
+
const allowQueryArrays = helpers.config.allowQueryArrays !== false;
|
|
22
|
+
const assertNoArray = (value, label) => {
|
|
23
|
+
if (Array.isArray(value) && !allowQueryArrays) {
|
|
24
|
+
throw new Error(`${label} does not allow arrays.`);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const { runContainerQueryValidation, validateInlineSizeValues, } = defaultContainerQueryValidation;
|
|
28
|
+
if (!runContainerQueryValidation(props, helpers, validateInlineSizeValues, "inline", "inline size values must be valid measurements greater than 0")) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!runContainerQueryLint(props, helpers, lintInlineRedundancy, "inlineSize should not be combined with inlineSizeRange")) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!runContainerQueryLint(props, helpers, lintInlineRangeCollapse, "inlineSizeRange min and max are equal; use inlineSize instead")) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!applyContainerQueryValidation(props, helpers, validate, "inline")) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { addCondition } = helpers;
|
|
41
|
+
assertNoArray(props.inlineSize, "inlineSize");
|
|
42
|
+
normalizeToArray(props.inlineSize).forEach((value) => {
|
|
43
|
+
emitInlineComparison("inline-size", value, addCondition);
|
|
44
|
+
});
|
|
45
|
+
assertNoArray(props.inlineSizeRange, "inlineSizeRange");
|
|
46
|
+
normalizeToArray(props.inlineSizeRange).forEach((value) => {
|
|
47
|
+
emitInlineRange("inline-size", value, addCondition);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IMeasurement } from '../../core';
|
|
2
|
+
export type CSSComparisonOperator = '<' | '<=' | '>' | '>=' | '=';
|
|
3
|
+
export type CSSComparison<T> = {
|
|
4
|
+
operator: CSSComparisonOperator;
|
|
5
|
+
value: T;
|
|
6
|
+
};
|
|
7
|
+
export type CSSRangeBoundaryOperator = '<' | '<=';
|
|
8
|
+
export type CSSRange<T> = {
|
|
9
|
+
min: T;
|
|
10
|
+
max: T;
|
|
11
|
+
minOperator?: CSSRangeBoundaryOperator;
|
|
12
|
+
maxOperator?: CSSRangeBoundaryOperator;
|
|
13
|
+
};
|
|
14
|
+
export type CSSContainerSizeFeature = {
|
|
15
|
+
minWidth: IMeasurement;
|
|
16
|
+
} | {
|
|
17
|
+
maxWidth: IMeasurement;
|
|
18
|
+
} | {
|
|
19
|
+
minHeight: IMeasurement;
|
|
20
|
+
} | {
|
|
21
|
+
maxHeight: IMeasurement;
|
|
22
|
+
} | {
|
|
23
|
+
width: CSSComparison<IMeasurement>;
|
|
24
|
+
} | {
|
|
25
|
+
height: CSSComparison<IMeasurement>;
|
|
26
|
+
} | {
|
|
27
|
+
inlineSize: CSSComparison<IMeasurement>;
|
|
28
|
+
} | {
|
|
29
|
+
blockSize: CSSComparison<IMeasurement>;
|
|
30
|
+
} | {
|
|
31
|
+
widthRange: CSSRange<IMeasurement>;
|
|
32
|
+
} | {
|
|
33
|
+
heightRange: CSSRange<IMeasurement>;
|
|
34
|
+
} | {
|
|
35
|
+
inlineSizeRange: CSSRange<IMeasurement>;
|
|
36
|
+
} | {
|
|
37
|
+
blockSizeRange: CSSRange<IMeasurement>;
|
|
38
|
+
} | {
|
|
39
|
+
orientation: 'portrait' | 'landscape';
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,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type { CSSContainerStyleCondition } from "../types";
|
|
2
|
+
import type { ContainerQueryBuilderHelpers, ContainerQueryValidator } from "../helpers";
|
|
3
|
+
export interface IContainerQueryStyle {
|
|
4
|
+
style?: CSSContainerStyleCondition;
|
|
5
|
+
}
|
|
6
|
+
export type IContainerQueryStyleVariables = IContainerQueryStyle["style"];
|
|
7
|
+
export type ContainerQueryStyleValidator = ContainerQueryValidator<IContainerQueryStyle>;
|
|
8
|
+
export type CSSContainerStyleFeature = IContainerQueryStyle;
|
|
9
|
+
export type ComparisonStyle = false;
|
|
10
|
+
export declare const emitStyleFeatures: (props: IContainerQueryStyle, helpers: ContainerQueryBuilderHelpers, validate?: ContainerQueryStyleValidator) => void;
|
|
11
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/modules/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AASpB,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,0BAA0B,CAAC;CACpC;AAED,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAE1E,MAAM,MAAM,4BAA4B,GACtC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC;AAEpC,eAAO,MAAM,iBAAiB,GAC5B,OAAO,oBAAoB,EAC3B,SAAS,4BAA4B,EACrC,WAAW,4BAA4B,KACtC,IAqDF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { applyContainerQueryValidation, formatContainerQueryValue, } from "../helpers";
|
|
2
|
+
import { defaultContainerQueryValidation } from "../validation";
|
|
3
|
+
import { runContainerQueryLint } from "../linting";
|
|
4
|
+
import { lintStyleCondition } from "../linting/style";
|
|
5
|
+
export const emitStyleFeatures = (props, helpers, validate) => {
|
|
6
|
+
const { runContainerQueryValidation, validateStyleValues, } = defaultContainerQueryValidation;
|
|
7
|
+
if (!runContainerQueryValidation(props, helpers, validateStyleValues, "style", "style conditions must be valid and non-empty")) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (!runContainerQueryLint(props, helpers, lintStyleCondition, "style conditions must be valid and non-empty")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!applyContainerQueryValidation(props, helpers, validate, "style")) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!props.style)
|
|
17
|
+
return;
|
|
18
|
+
const { addCondition } = helpers;
|
|
19
|
+
Object.entries(props.style).forEach(([name, value]) => {
|
|
20
|
+
if (value === undefined || value === null)
|
|
21
|
+
return;
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
value.forEach((entry) => {
|
|
24
|
+
if (entry === undefined || entry === null)
|
|
25
|
+
return;
|
|
26
|
+
addCondition(`(style(${name}: ${formatContainerQueryValue(entry)}))`);
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
addCondition(`(style(${name}: ${formatContainerQueryValue(value)}))`);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Properties } from "csstype";
|
|
2
|
+
import type { IRatio } from "../ratio";
|
|
3
|
+
import type { ComparisonValue } from "../comparisons";
|
|
4
|
+
import type { IMeasurement } from "../core";
|
|
5
|
+
export type CSSContainerType = "inline-size" | "size" | "normal";
|
|
6
|
+
export type CSSContainerName = string;
|
|
7
|
+
type CSSTypeProperties = Properties<number | (string & {})>;
|
|
8
|
+
export type CSSContainerProperties = {
|
|
9
|
+
[Property in keyof CSSTypeProperties]: CSSTypeProperties[Property] | IMeasurement | Array<CSSTypeProperties[Property] | IMeasurement>;
|
|
10
|
+
};
|
|
11
|
+
type CSSRangeOperator = "<" | "<=";
|
|
12
|
+
export type CSSComparison<TValue> = ComparisonValue<TValue>;
|
|
13
|
+
export type CSSRange<TValue> = ({
|
|
14
|
+
min: TValue;
|
|
15
|
+
max: TValue;
|
|
16
|
+
minOperator: CSSRangeOperator;
|
|
17
|
+
} & {
|
|
18
|
+
readonly __rangeBrand: unique symbol;
|
|
19
|
+
}) | ({
|
|
20
|
+
min: TValue;
|
|
21
|
+
max: TValue;
|
|
22
|
+
maxOperator: CSSRangeOperator;
|
|
23
|
+
} & {
|
|
24
|
+
readonly __rangeBrand: unique symbol;
|
|
25
|
+
});
|
|
26
|
+
export type CSSContainerCoreCondition = {
|
|
27
|
+
minWidth?: IMeasurement | IMeasurement[];
|
|
28
|
+
maxWidth?: IMeasurement | IMeasurement[];
|
|
29
|
+
minHeight?: IMeasurement | IMeasurement[];
|
|
30
|
+
maxHeight?: IMeasurement | IMeasurement[];
|
|
31
|
+
};
|
|
32
|
+
export type CSSContainerInlineCondition = {
|
|
33
|
+
inlineSize?: CSSComparison<IMeasurement> | CSSComparison<IMeasurement>[];
|
|
34
|
+
inlineSizeRange?: CSSRange<IMeasurement> | CSSRange<IMeasurement>[];
|
|
35
|
+
};
|
|
36
|
+
export type CSSContainerBlockCondition = {
|
|
37
|
+
blockSize?: CSSComparison<IMeasurement> | CSSComparison<IMeasurement>[];
|
|
38
|
+
blockSizeRange?: CSSRange<IMeasurement> | CSSRange<IMeasurement>[];
|
|
39
|
+
};
|
|
40
|
+
export type CSSContainerAspectRatioCondition = {
|
|
41
|
+
aspectRatio?: IRatio | IRatio[];
|
|
42
|
+
minAspectRatio?: IRatio | IRatio[];
|
|
43
|
+
maxAspectRatio?: IRatio | IRatio[];
|
|
44
|
+
};
|
|
45
|
+
export type CSSContainerStyleCondition = CSSContainerProperties;
|
|
46
|
+
export type CSSContainerCustomFeatures = Record<string, string | number | IMeasurement | Array<string | number | IMeasurement>>;
|
|
47
|
+
export type CSSContainerCustomCondition = {
|
|
48
|
+
customFeatures?: CSSContainerCustomFeatures;
|
|
49
|
+
};
|
|
50
|
+
export type CSSContainerConditionBase = CSSContainerCoreCondition & CSSContainerInlineCondition & CSSContainerBlockCondition & CSSContainerAspectRatioCondition & CSSContainerCustomCondition & {
|
|
51
|
+
style?: CSSContainerStyleCondition;
|
|
52
|
+
};
|
|
53
|
+
export type CSSContainerCondition = CSSContainerConditionBase | {
|
|
54
|
+
and: CSSContainerCondition[];
|
|
55
|
+
} | {
|
|
56
|
+
or: CSSContainerCondition[];
|
|
57
|
+
} | {
|
|
58
|
+
not: CSSContainerCondition;
|
|
59
|
+
};
|
|
60
|
+
export interface CSSContainerQuery {
|
|
61
|
+
name?: CSSContainerName;
|
|
62
|
+
condition: CSSContainerCondition;
|
|
63
|
+
}
|
|
64
|
+
export interface CSSContainerQueryContainer {
|
|
65
|
+
type?: CSSContainerType;
|
|
66
|
+
name?: CSSContainerName;
|
|
67
|
+
}
|
|
68
|
+
export interface CSSContainerQueryRuleInput {
|
|
69
|
+
container?: CSSContainerQueryContainer;
|
|
70
|
+
query?: CSSContainerQuery;
|
|
71
|
+
}
|
|
72
|
+
export interface CSSContainerQueryRuleOutput extends CSSContainerQueryRuleInput {
|
|
73
|
+
styles: CSSContainerProperties;
|
|
74
|
+
}
|
|
75
|
+
export type CSSContainerQueryRule = CSSContainerQueryRuleOutput;
|
|
76
|
+
export type CSSContainerQueryProps = CSSContainerQueryRuleInput["query"];
|
|
77
|
+
export type CSSContainerQueries = Record<string, CSSContainerQueryRuleInput>;
|
|
78
|
+
export type ContainerQueryComparison = CSSComparison<IMeasurement>;
|
|
79
|
+
export type ContainerQueryRange = CSSRange<IMeasurement>;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/containerQ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AAgC,GAChC,2BAA2B,GAAG;IAC5B,KAAK,CAAC,EAAE,0BAA0B,CAAC;CACpC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAC7B,yBAAyB,GACzB;IAAE,GAAG,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAChC;IAAE,EAAE,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC/B;IAAE,GAAG,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,qBAAqB,CAAC;CAClC;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,2BACf,SAAQ,0BAA0B;IAClC,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAEhE,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;AAE7E,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AACnE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ContainerQueryBuilderHelpers } from "./helpers";
|
|
2
|
+
import { assertCondition, assertMatchingUnits } from "../core";
|
|
3
|
+
import type { IContainerQueryCore } from "./containerQueries";
|
|
4
|
+
import type { IContainerQueryBlock } from "./modules/block";
|
|
5
|
+
import type { IContainerQueryCustomFeatures } from "./modules/custom";
|
|
6
|
+
import type { IContainerQueryInline } from "./modules/inline";
|
|
7
|
+
import type { IContainerQueryAspectRatio } from "./modules/aspectRatio";
|
|
8
|
+
import type { IContainerQueryStyle } from "./modules/style";
|
|
9
|
+
export type ContainerQueryValidationCheck<TConfig> = (config: TConfig) => void;
|
|
10
|
+
export type ContainerQueryCoreHelpers = {
|
|
11
|
+
assertCondition: typeof assertCondition;
|
|
12
|
+
assertMatchingUnits: typeof assertMatchingUnits;
|
|
13
|
+
};
|
|
14
|
+
export type ContainerQueryValidation = ReturnType<typeof createContainerQueryValidation>;
|
|
15
|
+
export declare const createContainerQueryValidation: (core: ContainerQueryCoreHelpers) => {
|
|
16
|
+
runContainerQueryValidation: <TConfig>(config: TConfig, helpers: ContainerQueryBuilderHelpers, check?: ContainerQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean;
|
|
17
|
+
validateMinMaxWidth: (props: IContainerQueryCore) => void;
|
|
18
|
+
validateWidthValuesPositive: (props: IContainerQueryCore) => void;
|
|
19
|
+
validateMinMaxHeight: (props: IContainerQueryCore) => void;
|
|
20
|
+
validateHeightValuesPositive: (props: IContainerQueryCore) => void;
|
|
21
|
+
validateInlineSizeValues: (props: IContainerQueryInline) => void;
|
|
22
|
+
validateBlockSizeValues: (props: IContainerQueryBlock) => void;
|
|
23
|
+
validateAspectRatioValues: (props: IContainerQueryAspectRatio) => void;
|
|
24
|
+
validateStyleValues: (props: IContainerQueryStyle) => void;
|
|
25
|
+
validateCustomFeatures: (props: IContainerQueryCustomFeatures) => void;
|
|
26
|
+
};
|
|
27
|
+
declare const defaultContainerQueryValidation: {
|
|
28
|
+
runContainerQueryValidation: <TConfig>(config: TConfig, helpers: ContainerQueryBuilderHelpers, check?: ContainerQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean;
|
|
29
|
+
validateMinMaxWidth: (props: IContainerQueryCore) => void;
|
|
30
|
+
validateWidthValuesPositive: (props: IContainerQueryCore) => void;
|
|
31
|
+
validateMinMaxHeight: (props: IContainerQueryCore) => void;
|
|
32
|
+
validateHeightValuesPositive: (props: IContainerQueryCore) => void;
|
|
33
|
+
validateInlineSizeValues: (props: IContainerQueryInline) => void;
|
|
34
|
+
validateBlockSizeValues: (props: IContainerQueryBlock) => void;
|
|
35
|
+
validateAspectRatioValues: (props: IContainerQueryAspectRatio) => void;
|
|
36
|
+
validateStyleValues: (props: IContainerQueryStyle) => void;
|
|
37
|
+
validateCustomFeatures: (props: IContainerQueryCustomFeatures) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const runContainerQueryValidation: <TConfig>(config: TConfig, helpers: ContainerQueryBuilderHelpers, check?: ContainerQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean, validateMinMaxWidth: (props: IContainerQueryCore) => void, validateWidthValuesPositive: (props: IContainerQueryCore) => void, validateMinMaxHeight: (props: IContainerQueryCore) => void, validateHeightValuesPositive: (props: IContainerQueryCore) => void, validateInlineSizeValues: (props: IContainerQueryInline) => void, validateBlockSizeValues: (props: IContainerQueryBlock) => void, validateAspectRatioValues: (props: IContainerQueryAspectRatio) => void, validateStyleValues: (props: IContainerQueryStyle) => void, validateCustomFeatures: (props: IContainerQueryCustomFeatures) => void;
|
|
40
|
+
export { defaultContainerQueryValidation };
|
|
41
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/containerQueries/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,EACL,eAAe,EACf,mBAAmB,EAMpB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,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