css-calipers 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/README.md +21 -25
  2. package/dist/cjs/factory.js +0 -3
  3. package/dist/esm/factory.d.ts +0 -2
  4. package/dist/esm/factory.d.ts.map +1 -1
  5. package/dist/esm/factory.js +0 -3
  6. package/package.json +5 -18
  7. package/RELEASING.md +0 -62
  8. package/dist/cjs/comparisons/index.js +0 -25
  9. package/dist/cjs/containerQueries/containerQueries.js +0 -115
  10. package/dist/cjs/containerQueries/factory.js +0 -123
  11. package/dist/cjs/containerQueries/helpers.js +0 -95
  12. package/dist/cjs/containerQueries/index.js +0 -16
  13. package/dist/cjs/containerQueries/linting/aspectRatio.js +0 -24
  14. package/dist/cjs/containerQueries/linting/block.js +0 -23
  15. package/dist/cjs/containerQueries/linting/core.js +0 -25
  16. package/dist/cjs/containerQueries/linting/custom.js +0 -11
  17. package/dist/cjs/containerQueries/linting/inline.js +0 -23
  18. package/dist/cjs/containerQueries/linting/resolution.js +0 -12
  19. package/dist/cjs/containerQueries/linting/style.js +0 -28
  20. package/dist/cjs/containerQueries/linting.js +0 -24
  21. package/dist/cjs/containerQueries/moduleRegistry.js +0 -5
  22. package/dist/cjs/containerQueries/modules/aspectRatio.js +0 -51
  23. package/dist/cjs/containerQueries/modules/block.js +0 -53
  24. package/dist/cjs/containerQueries/modules/custom.js +0 -43
  25. package/dist/cjs/containerQueries/modules/index.js +0 -21
  26. package/dist/cjs/containerQueries/modules/inline.js +0 -53
  27. package/dist/cjs/containerQueries/modules/size.js +0 -2
  28. package/dist/cjs/containerQueries/modules/style.js +0 -36
  29. package/dist/cjs/containerQueries/types.js +0 -2
  30. package/dist/cjs/containerQueries/validation.js +0 -191
  31. package/dist/cjs/fraction.js +0 -139
  32. package/dist/cjs/internal/createComponentQueriesApi.js +0 -56
  33. package/dist/cjs/internal/createMediaQueriesApi.js +0 -73
  34. package/dist/cjs/internal/normalizeToArray.js +0 -9
  35. package/dist/cjs/libraryHelpers/vanilla-extract.js +0 -11
  36. package/dist/cjs/logicalOperators/index.js +0 -18
  37. package/dist/cjs/mediaQueries/factory.js +0 -187
  38. package/dist/cjs/mediaQueries/helpers.js +0 -97
  39. package/dist/cjs/mediaQueries/index.js +0 -23
  40. package/dist/cjs/mediaQueries/libraryHelpers/vanilla-extract.js +0 -77
  41. package/dist/cjs/mediaQueries/linting/core.js +0 -19
  42. package/dist/cjs/mediaQueries/linting/resolution.js +0 -11
  43. package/dist/cjs/mediaQueries/linting.js +0 -24
  44. package/dist/cjs/mediaQueries/mediaQueries.js +0 -53
  45. package/dist/cjs/mediaQueries/mediaQueryFactory.js +0 -120
  46. package/dist/cjs/mediaQueries/moduleRegistry.js +0 -5
  47. package/dist/cjs/mediaQueries/modules/custom.js +0 -26
  48. package/dist/cjs/mediaQueries/modules/dimensions.js +0 -61
  49. package/dist/cjs/mediaQueries/modules/display.js +0 -20
  50. package/dist/cjs/mediaQueries/modules/environment.js +0 -20
  51. package/dist/cjs/mediaQueries/modules/index.js +0 -23
  52. package/dist/cjs/mediaQueries/modules/interaction.js +0 -26
  53. package/dist/cjs/mediaQueries/modules/preferences.js +0 -26
  54. package/dist/cjs/mediaQueries/modules/resolution.js +0 -31
  55. package/dist/cjs/mediaQueries/types.js +0 -2
  56. package/dist/cjs/mediaQueries/validation.js +0 -134
  57. package/dist/cjs/sciNotation.js +0 -74
  58. package/dist/cjs/types.js +0 -2
  59. package/dist/cjs/validation.js +0 -20
  60. package/dist/esm/comparisons/index.d.ts +0 -23
  61. package/dist/esm/comparisons/index.d.ts.map +0 -1
  62. package/dist/esm/comparisons/index.js +0 -22
  63. package/dist/esm/containerQueries/containerQueries.d.ts +0 -36
  64. package/dist/esm/containerQueries/containerQueries.d.ts.map +0 -1
  65. package/dist/esm/containerQueries/containerQueries.js +0 -109
  66. package/dist/esm/containerQueries/factory.d.ts +0 -20
  67. package/dist/esm/containerQueries/factory.d.ts.map +0 -1
  68. package/dist/esm/containerQueries/factory.js +0 -119
  69. package/dist/esm/containerQueries/helpers.d.ts +0 -53
  70. package/dist/esm/containerQueries/helpers.d.ts.map +0 -1
  71. package/dist/esm/containerQueries/helpers.js +0 -82
  72. package/dist/esm/containerQueries/index.d.ts +0 -10
  73. package/dist/esm/containerQueries/index.d.ts.map +0 -1
  74. package/dist/esm/containerQueries/index.js +0 -4
  75. package/dist/esm/containerQueries/linting/aspectRatio.d.ts +0 -4
  76. package/dist/esm/containerQueries/linting/aspectRatio.d.ts.map +0 -1
  77. package/dist/esm/containerQueries/linting/aspectRatio.js +0 -19
  78. package/dist/esm/containerQueries/linting/block.d.ts +0 -4
  79. package/dist/esm/containerQueries/linting/block.d.ts.map +0 -1
  80. package/dist/esm/containerQueries/linting/block.js +0 -18
  81. package/dist/esm/containerQueries/linting/core.d.ts +0 -4
  82. package/dist/esm/containerQueries/linting/core.d.ts.map +0 -1
  83. package/dist/esm/containerQueries/linting/core.js +0 -20
  84. package/dist/esm/containerQueries/linting/custom.d.ts +0 -3
  85. package/dist/esm/containerQueries/linting/custom.d.ts.map +0 -1
  86. package/dist/esm/containerQueries/linting/custom.js +0 -7
  87. package/dist/esm/containerQueries/linting/inline.d.ts +0 -4
  88. package/dist/esm/containerQueries/linting/inline.d.ts.map +0 -1
  89. package/dist/esm/containerQueries/linting/inline.js +0 -18
  90. package/dist/esm/containerQueries/linting/resolution.d.ts +0 -1
  91. package/dist/esm/containerQueries/linting/resolution.d.ts.map +0 -1
  92. package/dist/esm/containerQueries/linting/resolution.js +0 -12
  93. package/dist/esm/containerQueries/linting/style.d.ts +0 -3
  94. package/dist/esm/containerQueries/linting/style.d.ts.map +0 -1
  95. package/dist/esm/containerQueries/linting/style.js +0 -24
  96. package/dist/esm/containerQueries/linting.d.ts +0 -4
  97. package/dist/esm/containerQueries/linting.d.ts.map +0 -1
  98. package/dist/esm/containerQueries/linting.js +0 -20
  99. package/dist/esm/containerQueries/moduleRegistry.d.ts +0 -25
  100. package/dist/esm/containerQueries/moduleRegistry.d.ts.map +0 -1
  101. package/dist/esm/containerQueries/moduleRegistry.js +0 -1
  102. package/dist/esm/containerQueries/modules/aspectRatio.d.ts +0 -17
  103. package/dist/esm/containerQueries/modules/aspectRatio.d.ts.map +0 -1
  104. package/dist/esm/containerQueries/modules/aspectRatio.js +0 -47
  105. package/dist/esm/containerQueries/modules/block.d.ts +0 -20
  106. package/dist/esm/containerQueries/modules/block.d.ts.map +0 -1
  107. package/dist/esm/containerQueries/modules/block.js +0 -49
  108. package/dist/esm/containerQueries/modules/custom.d.ts +0 -13
  109. package/dist/esm/containerQueries/modules/custom.d.ts.map +0 -1
  110. package/dist/esm/containerQueries/modules/custom.js +0 -39
  111. package/dist/esm/containerQueries/modules/index.d.ts +0 -6
  112. package/dist/esm/containerQueries/modules/index.d.ts.map +0 -1
  113. package/dist/esm/containerQueries/modules/index.js +0 -5
  114. package/dist/esm/containerQueries/modules/inline.d.ts +0 -20
  115. package/dist/esm/containerQueries/modules/inline.d.ts.map +0 -1
  116. package/dist/esm/containerQueries/modules/inline.js +0 -49
  117. package/dist/esm/containerQueries/modules/size.d.ts +0 -41
  118. package/dist/esm/containerQueries/modules/size.d.ts.map +0 -1
  119. package/dist/esm/containerQueries/modules/size.js +0 -1
  120. package/dist/esm/containerQueries/modules/style.d.ts +0 -11
  121. package/dist/esm/containerQueries/modules/style.d.ts.map +0 -1
  122. package/dist/esm/containerQueries/modules/style.js +0 -32
  123. package/dist/esm/containerQueries/types.d.ts +0 -81
  124. package/dist/esm/containerQueries/types.d.ts.map +0 -1
  125. package/dist/esm/containerQueries/types.js +0 -1
  126. package/dist/esm/containerQueries/validation.d.ts +0 -41
  127. package/dist/esm/containerQueries/validation.d.ts.map +0 -1
  128. package/dist/esm/containerQueries/validation.js +0 -187
  129. package/dist/esm/fraction.d.ts +0 -23
  130. package/dist/esm/fraction.d.ts.map +0 -1
  131. package/dist/esm/fraction.js +0 -129
  132. package/dist/esm/internal/createComponentQueriesApi.d.ts +0 -34
  133. package/dist/esm/internal/createComponentQueriesApi.d.ts.map +0 -1
  134. package/dist/esm/internal/createComponentQueriesApi.js +0 -52
  135. package/dist/esm/internal/createMediaQueriesApi.d.ts +0 -35
  136. package/dist/esm/internal/createMediaQueriesApi.d.ts.map +0 -1
  137. package/dist/esm/internal/createMediaQueriesApi.js +0 -69
  138. package/dist/esm/internal/normalizeToArray.d.ts +0 -2
  139. package/dist/esm/internal/normalizeToArray.d.ts.map +0 -1
  140. package/dist/esm/internal/normalizeToArray.js +0 -5
  141. package/dist/esm/libraryHelpers/vanilla-extract.d.ts +0 -4
  142. package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +0 -1
  143. package/dist/esm/libraryHelpers/vanilla-extract.js +0 -6
  144. package/dist/esm/logicalOperators/index.d.ts +0 -2
  145. package/dist/esm/logicalOperators/index.d.ts.map +0 -1
  146. package/dist/esm/logicalOperators/index.js +0 -17
  147. package/dist/esm/mediaQueries/factory.d.ts +0 -45
  148. package/dist/esm/mediaQueries/factory.d.ts.map +0 -1
  149. package/dist/esm/mediaQueries/factory.js +0 -183
  150. package/dist/esm/mediaQueries/helpers.d.ts +0 -40
  151. package/dist/esm/mediaQueries/helpers.d.ts.map +0 -1
  152. package/dist/esm/mediaQueries/helpers.js +0 -87
  153. package/dist/esm/mediaQueries/index.d.ts +0 -8
  154. package/dist/esm/mediaQueries/index.d.ts.map +0 -1
  155. package/dist/esm/mediaQueries/index.js +0 -7
  156. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts +0 -5
  157. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts.map +0 -1
  158. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.js +0 -71
  159. package/dist/esm/mediaQueries/linting/core.d.ts +0 -5
  160. package/dist/esm/mediaQueries/linting/core.d.ts.map +0 -1
  161. package/dist/esm/mediaQueries/linting/core.js +0 -14
  162. package/dist/esm/mediaQueries/linting/resolution.d.ts +0 -3
  163. package/dist/esm/mediaQueries/linting/resolution.d.ts.map +0 -1
  164. package/dist/esm/mediaQueries/linting/resolution.js +0 -7
  165. package/dist/esm/mediaQueries/linting.d.ts +0 -4
  166. package/dist/esm/mediaQueries/linting.d.ts.map +0 -1
  167. package/dist/esm/mediaQueries/linting.js +0 -20
  168. package/dist/esm/mediaQueries/mediaQueries.d.ts +0 -23
  169. package/dist/esm/mediaQueries/mediaQueries.d.ts.map +0 -1
  170. package/dist/esm/mediaQueries/mediaQueries.js +0 -48
  171. package/dist/esm/mediaQueries/moduleRegistry.d.ts +0 -27
  172. package/dist/esm/mediaQueries/moduleRegistry.d.ts.map +0 -1
  173. package/dist/esm/mediaQueries/moduleRegistry.js +0 -1
  174. package/dist/esm/mediaQueries/modules/custom.d.ts +0 -10
  175. package/dist/esm/mediaQueries/modules/custom.d.ts.map +0 -1
  176. package/dist/esm/mediaQueries/modules/custom.js +0 -22
  177. package/dist/esm/mediaQueries/modules/dimensions.d.ts +0 -19
  178. package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +0 -1
  179. package/dist/esm/mediaQueries/modules/dimensions.js +0 -57
  180. package/dist/esm/mediaQueries/modules/display.d.ts +0 -9
  181. package/dist/esm/mediaQueries/modules/display.d.ts.map +0 -1
  182. package/dist/esm/mediaQueries/modules/display.js +0 -16
  183. package/dist/esm/mediaQueries/modules/environment.d.ts +0 -9
  184. package/dist/esm/mediaQueries/modules/environment.d.ts.map +0 -1
  185. package/dist/esm/mediaQueries/modules/environment.js +0 -16
  186. package/dist/esm/mediaQueries/modules/index.d.ts +0 -8
  187. package/dist/esm/mediaQueries/modules/index.d.ts.map +0 -1
  188. package/dist/esm/mediaQueries/modules/index.js +0 -7
  189. package/dist/esm/mediaQueries/modules/interaction.d.ts +0 -11
  190. package/dist/esm/mediaQueries/modules/interaction.d.ts.map +0 -1
  191. package/dist/esm/mediaQueries/modules/interaction.js +0 -22
  192. package/dist/esm/mediaQueries/modules/preferences.d.ts +0 -11
  193. package/dist/esm/mediaQueries/modules/preferences.d.ts.map +0 -1
  194. package/dist/esm/mediaQueries/modules/preferences.js +0 -22
  195. package/dist/esm/mediaQueries/modules/resolution.d.ts +0 -12
  196. package/dist/esm/mediaQueries/modules/resolution.d.ts.map +0 -1
  197. package/dist/esm/mediaQueries/modules/resolution.js +0 -27
  198. package/dist/esm/mediaQueries/types.d.ts +0 -117
  199. package/dist/esm/mediaQueries/types.d.ts.map +0 -1
  200. package/dist/esm/mediaQueries/types.js +0 -1
  201. package/dist/esm/mediaQueries/validation.d.ts +0 -33
  202. package/dist/esm/mediaQueries/validation.d.ts.map +0 -1
  203. package/dist/esm/mediaQueries/validation.js +0 -130
  204. package/dist/esm/sciNotation.d.ts +0 -14
  205. package/dist/esm/sciNotation.d.ts.map +0 -1
  206. package/dist/esm/sciNotation.js +0 -69
  207. package/dist/esm/types.d.ts +0 -35
  208. package/dist/esm/types.d.ts.map +0 -1
  209. package/dist/esm/types.js +0 -1
  210. package/dist/esm/validation.d.ts +0 -10
  211. package/dist/esm/validation.d.ts.map +0 -1
  212. package/dist/esm/validation.js +0 -15
  213. package/dist/examples/containerQueries.example.js +0 -54
  214. package/dist/examples/examples/containerQueries.example.js +0 -54
  215. package/dist/examples/examples/factory-wrapper.example.js +0 -33
  216. package/dist/examples/examples/lineHeight-normalizer.example.js +0 -81
  217. package/dist/examples/examples/mediaQueries-multipleInstances.example.js +0 -127
  218. package/dist/examples/examples/mixedQueries.example.js +0 -55
  219. package/dist/examples/examples/validation-and-runtime-checks.example.js +0 -85
  220. package/dist/examples/examples/validation-unit-tests.example.js +0 -35
  221. package/dist/examples/factory-wrapper.example.js +0 -33
  222. package/dist/examples/lineHeight-normalizer.example.js +0 -81
  223. package/dist/examples/mediaQueries-multipleInstances.example.js +0 -127
  224. package/dist/examples/mixedQueries.example.js +0 -60
  225. package/dist/examples/src/comparisons/index.js +0 -25
  226. package/dist/examples/src/containerQueries/containerQueries.js +0 -96
  227. package/dist/examples/src/containerQueries/factory.js +0 -123
  228. package/dist/examples/src/containerQueries/helpers.js +0 -94
  229. package/dist/examples/src/containerQueries/index.js +0 -16
  230. package/dist/examples/src/containerQueries/linting/aspectRatio.js +0 -20
  231. package/dist/examples/src/containerQueries/linting/block.js +0 -20
  232. package/dist/examples/src/containerQueries/linting/core.js +0 -19
  233. package/dist/examples/src/containerQueries/linting/custom.js +0 -11
  234. package/dist/examples/src/containerQueries/linting/inline.js +0 -20
  235. package/dist/examples/src/containerQueries/linting/style.js +0 -28
  236. package/dist/examples/src/containerQueries/linting.js +0 -24
  237. package/dist/examples/src/containerQueries/moduleRegistry.js +0 -5
  238. package/dist/examples/src/containerQueries/modules/aspectRatio.js +0 -33
  239. package/dist/examples/src/containerQueries/modules/block.js +0 -44
  240. package/dist/examples/src/containerQueries/modules/custom.js +0 -31
  241. package/dist/examples/src/containerQueries/modules/index.js +0 -21
  242. package/dist/examples/src/containerQueries/modules/inline.js +0 -44
  243. package/dist/examples/src/containerQueries/modules/style.js +0 -36
  244. package/dist/examples/src/containerQueries/types.js +0 -2
  245. package/dist/examples/src/containerQueries/validation.js +0 -177
  246. package/dist/examples/src/core.js +0 -16
  247. package/dist/examples/src/factory.js +0 -21
  248. package/dist/examples/src/index.js +0 -30
  249. package/dist/examples/src/internal/buildMeasurementCreationError.js +0 -16
  250. package/dist/examples/src/internal/createCoreApi.js +0 -336
  251. package/dist/examples/src/internal/createMediaQueriesApi.js +0 -74
  252. package/dist/examples/src/internal/createUnitsApi.js +0 -18
  253. package/dist/examples/src/internal/errors.js +0 -130
  254. package/dist/examples/src/libraryHelpers/vanilla-extract.js +0 -11
  255. package/dist/examples/src/mediaQueries/factory.js +0 -163
  256. package/dist/examples/src/mediaQueries/helpers.js +0 -88
  257. package/dist/examples/src/mediaQueries/index.js +0 -23
  258. package/dist/examples/src/mediaQueries/linting/core.js +0 -19
  259. package/dist/examples/src/mediaQueries/linting/resolution.js +0 -11
  260. package/dist/examples/src/mediaQueries/linting.js +0 -24
  261. package/dist/examples/src/mediaQueries/mediaQueries.js +0 -53
  262. package/dist/examples/src/mediaQueries/moduleRegistry.js +0 -5
  263. package/dist/examples/src/mediaQueries/modules/custom.js +0 -26
  264. package/dist/examples/src/mediaQueries/modules/dimensions.js +0 -61
  265. package/dist/examples/src/mediaQueries/modules/display.js +0 -20
  266. package/dist/examples/src/mediaQueries/modules/environment.js +0 -20
  267. package/dist/examples/src/mediaQueries/modules/index.js +0 -23
  268. package/dist/examples/src/mediaQueries/modules/interaction.js +0 -26
  269. package/dist/examples/src/mediaQueries/modules/preferences.js +0 -26
  270. package/dist/examples/src/mediaQueries/modules/resolution.js +0 -31
  271. package/dist/examples/src/mediaQueries/types.js +0 -2
  272. package/dist/examples/src/mediaQueries/validation.js +0 -128
  273. package/dist/examples/src/ratio.js +0 -141
  274. package/dist/examples/src/types.js +0 -2
  275. package/dist/examples/src/unitDefinitions.js +0 -67
  276. package/dist/examples/src/units/absolute.js +0 -11
  277. package/dist/examples/src/units/angle.js +0 -8
  278. package/dist/examples/src/units/container.js +0 -10
  279. package/dist/examples/src/units/font-relative.js +0 -16
  280. package/dist/examples/src/units/frequency.js +0 -6
  281. package/dist/examples/src/units/grid.js +0 -5
  282. package/dist/examples/src/units/percent.js +0 -7
  283. package/dist/examples/src/units/resolution.js +0 -7
  284. package/dist/examples/src/units/time.js +0 -6
  285. package/dist/examples/src/units/viewport-dynamic.js +0 -10
  286. package/dist/examples/src/units/viewport-large.js +0 -10
  287. package/dist/examples/src/units/viewport-small.js +0 -10
  288. package/dist/examples/src/units/viewport.js +0 -10
  289. package/dist/examples/src/validation.js +0 -20
  290. package/dist/examples/validation-and-runtime-checks.example.js +0 -85
  291. package/dist/examples/validation-unit-tests.example.js +0 -35
@@ -1,82 +0,0 @@
1
- import { hasCssMethod } from "../core";
2
- import { normalizeValidationResult } from "../validation";
3
- export const formatContainerQueryValue = (value) => (hasCssMethod(value) ? value.css() : String(value));
4
- export const buildContainerComparison = (comparison) => comparison;
5
- export const buildContainerRange = (min, max, options = {}) => {
6
- var _a;
7
- const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : "min";
8
- const operator = options.inclusive === false ? "<" : "<=";
9
- if (mode === "max") {
10
- return { min, max, maxOperator: operator };
11
- }
12
- return { min, max, minOperator: operator };
13
- };
14
- export const buildContainerQueryStringFromParts = (parts) => parts.join(" and ");
15
- export const formatContainerQueryComparison = (name, operator, value) => {
16
- return `(${name} ${operator} ${formatContainerQueryValue(value)})`;
17
- };
18
- export const createContainerQueryFeatureEmitter = (parts) => (name, value) => {
19
- parts.push(`(${name}: ${formatContainerQueryValue(value)})`);
20
- };
21
- export const createContainerQueryConditionEmitter = (parts) => (condition) => {
22
- parts.push(condition);
23
- };
24
- export const createContainerQueryFeatureEmitterWithTracking = (parts, options = {}) => {
25
- const { emitted, lintingMode = "throw" } = options;
26
- return (name, value) => {
27
- if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
28
- if (lintingMode === "throw") {
29
- throw new Error(`Container query feature "${name}" was emitted more than once.`);
30
- }
31
- if (lintingMode === "log") {
32
- console.warn(`Container query feature "${name}" was emitted more than once; using the latest value.`);
33
- }
34
- }
35
- emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
36
- parts.push(`(${name}: ${formatContainerQueryValue(value)})`);
37
- };
38
- };
39
- export const createContainerQueryBuilder = (options) => {
40
- return (config) => {
41
- var _a, _b, _c, _d, _e;
42
- const parts = [];
43
- const emittedFeatures = new Set();
44
- const helpers = {
45
- addFeature: createContainerQueryFeatureEmitterWithTracking(parts, {
46
- emitted: emittedFeatures,
47
- 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",
48
- }),
49
- addFeatureUnsafe: createContainerQueryFeatureEmitter(parts),
50
- addCondition: createContainerQueryConditionEmitter(parts),
51
- config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
52
- };
53
- options.emitBase(config, helpers);
54
- (_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
55
- return buildContainerQueryStringFromParts(parts);
56
- };
57
- };
58
- export const applyContainerQueryValidation = (config, helpers, validator, context) => {
59
- var _a, _b;
60
- if (!validator)
61
- return true;
62
- const normalized = normalizeValidationResult(validator(config));
63
- if (normalized.valid)
64
- return true;
65
- const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : "throw";
66
- if (mode === "log") {
67
- const suffix = normalized.message ? `: ${normalized.message}` : "";
68
- const prefix = context
69
- ? `Container query ${context} validation failed`
70
- : "Container query validation failed";
71
- console.warn(`${prefix}${suffix}`);
72
- }
73
- if (mode === "allow")
74
- return true;
75
- if (mode === "log")
76
- return true;
77
- const suffix = normalized.message ? `: ${normalized.message}` : "";
78
- const prefix = context
79
- ? `Container query ${context} validation failed`
80
- : "Container query validation failed";
81
- throw new Error(`${prefix}${suffix}`);
82
- };
@@ -1,10 +0,0 @@
1
- export { buildContainerConditionString, buildContainerQueryString, makeContainerQueryStyle, } from "./containerQueries";
2
- export { buildContainerComparison, buildContainerRange, formatContainerQueryValue, } from "./helpers";
3
- export { containerQueryFactory, createContainerQueryFactory } from "./factory";
4
- export { defineContainerQueryModules } from "./moduleRegistry";
5
- export type * from "./types";
6
- export type * from "./containerQueries";
7
- export type * from "./factory";
8
- export type * from "./modules";
9
- export type * from "./moduleRegistry";
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/containerQueries/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,kBAAkB,CAAC"}
@@ -1,4 +0,0 @@
1
- export { buildContainerConditionString, buildContainerQueryString, makeContainerQueryStyle, } from "./containerQueries";
2
- export { buildContainerComparison, buildContainerRange, formatContainerQueryValue, } from "./helpers";
3
- export { containerQueryFactory, createContainerQueryFactory } from "./factory";
4
- export { defineContainerQueryModules } from "./moduleRegistry";
@@ -1,4 +0,0 @@
1
- import type { IContainerQueryAspectRatio } from "../modules/aspectRatio";
2
- export declare const lintAspectRatioRedundancy: (props: IContainerQueryAspectRatio) => void;
3
- export declare const lintAspectRatioRangeCollapse: (props: IContainerQueryAspectRatio) => void;
4
- //# sourceMappingURL=aspectRatio.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aspectRatio.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/aspectRatio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,eAAO,MAAM,yBAAyB,GACpC,OAAO,0BAA0B,KAChC,IAOF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,OAAO,0BAA0B,KAChC,IAeF,CAAC"}
@@ -1,19 +0,0 @@
1
- import { ratioToFloat } from "../../ratio";
2
- export const lintAspectRatioRedundancy = (props) => {
3
- if (!props.aspectRatio)
4
- return;
5
- if (props.minAspectRatio || props.maxAspectRatio) {
6
- throw new Error("aspectRatio should not be combined with minAspectRatio or maxAspectRatio");
7
- }
8
- };
9
- export const lintAspectRatioRangeCollapse = (props) => {
10
- if (!props.minAspectRatio || !props.maxAspectRatio)
11
- return;
12
- if (Array.isArray(props.minAspectRatio) ||
13
- Array.isArray(props.maxAspectRatio)) {
14
- return;
15
- }
16
- if (ratioToFloat(props.minAspectRatio) === ratioToFloat(props.maxAspectRatio)) {
17
- throw new Error("minAspectRatio and maxAspectRatio are equal; use aspectRatio instead");
18
- }
19
- };
@@ -1,4 +0,0 @@
1
- import type { IContainerQueryBlock } from "../modules/block";
2
- export declare const lintBlockRedundancy: (props: IContainerQueryBlock) => void;
3
- export declare const lintBlockRangeCollapse: (props: IContainerQueryBlock) => void;
4
- //# sourceMappingURL=block.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,eAAO,MAAM,mBAAmB,GAC9B,OAAO,oBAAoB,KAC1B,IAOF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,OAAO,oBAAoB,KAC1B,IAUF,CAAC"}
@@ -1,18 +0,0 @@
1
- import { normalizeToArray } from "../../internal/normalizeToArray";
2
- export const lintBlockRedundancy = (props) => {
3
- if (!props.blockSize)
4
- return;
5
- if (props.blockSizeRange) {
6
- throw new Error("blockSize should not be combined with blockSizeRange");
7
- }
8
- };
9
- export const lintBlockRangeCollapse = (props) => {
10
- if (!props.blockSizeRange)
11
- return;
12
- normalizeToArray(props.blockSizeRange).forEach((range) => {
13
- const { min, max } = range;
14
- if (min.equals(max)) {
15
- throw new Error("blockSizeRange min and max are equal; use blockSize instead");
16
- }
17
- });
18
- };
@@ -1,4 +0,0 @@
1
- import type { IContainerQueryCore } from "../containerQueries";
2
- export declare const lintWidthExactRedundancy: (props: IContainerQueryCore) => void;
3
- export declare const lintHeightExactRedundancy: (props: IContainerQueryCore) => void;
4
- //# sourceMappingURL=core.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,eAAO,MAAM,wBAAwB,GACnC,OAAO,mBAAmB,KACzB,IAUF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,OAAO,mBAAmB,KACzB,IAUF,CAAC"}
@@ -1,20 +0,0 @@
1
- export const lintWidthExactRedundancy = (props) => {
2
- if (!props.minWidth || !props.maxWidth)
3
- return;
4
- if (Array.isArray(props.minWidth) || Array.isArray(props.maxWidth)) {
5
- return;
6
- }
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
- export const lintHeightExactRedundancy = (props) => {
12
- if (!props.minHeight || !props.maxHeight)
13
- return;
14
- if (Array.isArray(props.minHeight) || Array.isArray(props.maxHeight)) {
15
- return;
16
- }
17
- if (props.minHeight.equals(props.maxHeight)) {
18
- throw new Error("minHeight should not be combined with maxHeight when both are equal");
19
- }
20
- };
@@ -1,3 +0,0 @@
1
- import type { IContainerQueryCustomFeatures } from "../modules/custom";
2
- export declare const lintCustomFeatures: (props: IContainerQueryCustomFeatures) => void;
3
- //# sourceMappingURL=custom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,eAAO,MAAM,kBAAkB,GAC7B,OAAO,6BAA6B,KACnC,IAKF,CAAC"}
@@ -1,7 +0,0 @@
1
- export const lintCustomFeatures = (props) => {
2
- if (!props.customFeatures)
3
- return;
4
- if (!Object.keys(props.customFeatures).length) {
5
- throw new Error("customFeatures should not be empty.");
6
- }
7
- };
@@ -1,4 +0,0 @@
1
- import type { IContainerQueryInline } from "../modules/inline";
2
- export declare const lintInlineRedundancy: (props: IContainerQueryInline) => void;
3
- export declare const lintInlineRangeCollapse: (props: IContainerQueryInline) => void;
4
- //# sourceMappingURL=inline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/inline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D,eAAO,MAAM,oBAAoB,GAC/B,OAAO,qBAAqB,KAC3B,IAOF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,OAAO,qBAAqB,KAC3B,IAUF,CAAC"}
@@ -1,18 +0,0 @@
1
- import { normalizeToArray } from "../../internal/normalizeToArray";
2
- export const lintInlineRedundancy = (props) => {
3
- if (!props.inlineSize)
4
- return;
5
- if (props.inlineSizeRange) {
6
- throw new Error("inlineSize should not be combined with inlineSizeRange");
7
- }
8
- };
9
- export const lintInlineRangeCollapse = (props) => {
10
- if (!props.inlineSizeRange)
11
- return;
12
- normalizeToArray(props.inlineSizeRange).forEach((range) => {
13
- const { min, max } = range;
14
- if (min.equals(max)) {
15
- throw new Error("inlineSizeRange min and max are equal; use inlineSize instead");
16
- }
17
- });
18
- };
@@ -1 +0,0 @@
1
- //# sourceMappingURL=resolution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/resolution.ts"],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- // import type { IMediaQueryResolutionRange } from '../modules/resolution';
3
- // export const lintResolutionRedundancy = (
4
- // props: IMediaQueryResolutionRange,
5
- // ): void => {
6
- // if (!props.resolutionValue) return;
7
- // if (props.minResolution || props.maxResolution) {
8
- // throw new Error(
9
- // 'resolution should not be combined with minResolution or maxResolution',
10
- // );
11
- // }
12
- // };
@@ -1,3 +0,0 @@
1
- import type { IContainerQueryStyle } from "../modules/style";
2
- export declare const lintStyleCondition: (props: IContainerQueryStyle) => void;
3
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/containerQueries/linting/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAO7D,eAAO,MAAM,kBAAkB,GAC7B,OAAO,oBAAoB,KAC1B,IAiBF,CAAC"}
@@ -1,24 +0,0 @@
1
- import { hasCssMethod } from "../../core";
2
- const isComparisonShape = (value) => {
3
- if (typeof value !== "object" || value === null)
4
- return false;
5
- return "operator" in value && "value" in value;
6
- };
7
- export const lintStyleCondition = (props) => {
8
- if (!props.style)
9
- return;
10
- if (!Object.keys(props.style).length) {
11
- throw new Error("style conditions must not be empty.");
12
- }
13
- Object.values(props.style).forEach((value) => {
14
- if (value === undefined || value === null)
15
- return;
16
- if (Array.isArray(value))
17
- return;
18
- if (hasCssMethod(value))
19
- return;
20
- if (isComparisonShape(value)) {
21
- throw new Error("style conditions must not contain comparisons.");
22
- }
23
- });
24
- };
@@ -1,4 +0,0 @@
1
- import type { ContainerQueryBuilderHelpers } from "./helpers";
2
- export type ContainerQueryLintCheck<TConfig> = (config: TConfig) => void;
3
- export declare const runContainerQueryLint: <TConfig>(config: TConfig, helpers: ContainerQueryBuilderHelpers, check?: ContainerQueryLintCheck<TConfig>, message?: string) => boolean;
4
- //# sourceMappingURL=linting.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linting.d.ts","sourceRoot":"","sources":["../../../src/containerQueries/linting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,uBAAuB,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAEzE,eAAO,MAAM,qBAAqB,GAAI,OAAO,EAC3C,QAAQ,OAAO,EACf,SAAS,4BAA4B,EACrC,QAAQ,uBAAuB,CAAC,OAAO,CAAC,EACxC,gBAAuC,KACtC,OAiBF,CAAC"}
@@ -1,20 +0,0 @@
1
- export const runContainerQueryLint = (config, helpers, check, message = "Container query lint failed") => {
2
- var _a, _b;
3
- if (!check)
4
- return true;
5
- const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : "throw";
6
- if (mode === "allow")
7
- return true;
8
- if (mode === "log") {
9
- try {
10
- check(config);
11
- return true;
12
- }
13
- catch {
14
- console.warn(message);
15
- return true;
16
- }
17
- }
18
- check(config);
19
- return true;
20
- };
@@ -1,25 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- export const defineContainerQueryModules = (...modules) => modules;
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,47 +0,0 @@
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
- };
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,49 +0,0 @@
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
- };
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,39 +0,0 @@
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
- };
@@ -1,6 +0,0 @@
1
- export * from "./aspectRatio";
2
- export * from "./block";
3
- export * from "./custom";
4
- export * from "./inline";
5
- export * from "./style";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,5 +0,0 @@
1
- export * from "./aspectRatio";
2
- export * from "./block";
3
- export * from "./custom";
4
- export * from "./inline";
5
- export * from "./style";
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}