css-calipers 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/README.md +100 -0
  2. package/dist/cjs/comparisons/index.js +25 -0
  3. package/dist/cjs/containerQueries/containerQueries.js +115 -0
  4. package/dist/cjs/containerQueries/factory.js +123 -0
  5. package/dist/cjs/containerQueries/helpers.js +95 -0
  6. package/dist/cjs/containerQueries/index.js +16 -0
  7. package/dist/cjs/containerQueries/linting/aspectRatio.js +24 -0
  8. package/dist/cjs/containerQueries/linting/block.js +23 -0
  9. package/dist/cjs/containerQueries/linting/core.js +25 -0
  10. package/dist/cjs/containerQueries/linting/custom.js +11 -0
  11. package/dist/cjs/containerQueries/linting/inline.js +23 -0
  12. package/dist/cjs/containerQueries/linting/resolution.js +12 -0
  13. package/dist/cjs/containerQueries/linting/style.js +28 -0
  14. package/dist/cjs/containerQueries/linting.js +24 -0
  15. package/dist/cjs/containerQueries/moduleRegistry.js +5 -0
  16. package/dist/cjs/containerQueries/modules/aspectRatio.js +51 -0
  17. package/dist/cjs/containerQueries/modules/block.js +53 -0
  18. package/dist/cjs/containerQueries/modules/custom.js +43 -0
  19. package/dist/cjs/containerQueries/modules/index.js +21 -0
  20. package/dist/cjs/containerQueries/modules/inline.js +53 -0
  21. package/dist/cjs/containerQueries/modules/size.js +2 -0
  22. package/dist/cjs/containerQueries/modules/style.js +36 -0
  23. package/dist/cjs/containerQueries/types.js +2 -0
  24. package/dist/cjs/containerQueries/validation.js +191 -0
  25. package/dist/cjs/core.js +5 -278
  26. package/dist/cjs/factory.js +21 -0
  27. package/dist/cjs/fraction.js +139 -0
  28. package/dist/cjs/internal/buildMeasurementCreationError.js +16 -0
  29. package/dist/cjs/internal/buildMeasurementCreationError.tests.js +5 -0
  30. package/dist/cjs/internal/createComponentQueriesApi.js +56 -0
  31. package/dist/cjs/internal/createCoreApi.js +336 -0
  32. package/dist/cjs/internal/createMediaQueriesApi.js +74 -0
  33. package/dist/cjs/internal/createUnitsApi.js +18 -0
  34. package/dist/cjs/internal/errors.js +118 -5
  35. package/dist/cjs/internal/normalizeToArray.js +9 -0
  36. package/dist/cjs/libraryHelpers/vanilla-extract.js +6 -2
  37. package/dist/cjs/logicalOperators/index.js +18 -0
  38. package/dist/cjs/mediaQueries/factory.js +5 -4
  39. package/dist/cjs/mediaQueries/mediaQueries.js +7 -5
  40. package/dist/cjs/mediaQueries/modules/dimensions.js +10 -8
  41. package/dist/cjs/mediaQueries/modules/resolution.js +6 -4
  42. package/dist/cjs/mediaQueries/validation.js +128 -116
  43. package/dist/cjs/ratio.js +141 -0
  44. package/dist/cjs/types.js +2 -0
  45. package/dist/cjs/validation.js +20 -0
  46. package/dist/esm/comparisons/index.d.ts +23 -0
  47. package/dist/esm/comparisons/index.d.ts.map +1 -0
  48. package/dist/esm/comparisons/index.js +22 -0
  49. package/dist/esm/containerQueries/containerQueries.d.ts +36 -0
  50. package/dist/esm/containerQueries/containerQueries.d.ts.map +1 -0
  51. package/dist/esm/containerQueries/containerQueries.js +109 -0
  52. package/dist/esm/containerQueries/factory.d.ts +20 -0
  53. package/dist/esm/containerQueries/factory.d.ts.map +1 -0
  54. package/dist/esm/containerQueries/factory.js +119 -0
  55. package/dist/esm/containerQueries/helpers.d.ts +53 -0
  56. package/dist/esm/containerQueries/helpers.d.ts.map +1 -0
  57. package/dist/esm/containerQueries/helpers.js +82 -0
  58. package/dist/esm/containerQueries/index.d.ts +10 -0
  59. package/dist/esm/containerQueries/index.d.ts.map +1 -0
  60. package/dist/esm/containerQueries/index.js +4 -0
  61. package/dist/esm/containerQueries/linting/aspectRatio.d.ts +4 -0
  62. package/dist/esm/containerQueries/linting/aspectRatio.d.ts.map +1 -0
  63. package/dist/esm/containerQueries/linting/aspectRatio.js +19 -0
  64. package/dist/esm/containerQueries/linting/block.d.ts +4 -0
  65. package/dist/esm/containerQueries/linting/block.d.ts.map +1 -0
  66. package/dist/esm/containerQueries/linting/block.js +18 -0
  67. package/dist/esm/containerQueries/linting/core.d.ts +4 -0
  68. package/dist/esm/containerQueries/linting/core.d.ts.map +1 -0
  69. package/dist/esm/containerQueries/linting/core.js +20 -0
  70. package/dist/esm/containerQueries/linting/custom.d.ts +3 -0
  71. package/dist/esm/containerQueries/linting/custom.d.ts.map +1 -0
  72. package/dist/esm/containerQueries/linting/custom.js +7 -0
  73. package/dist/esm/containerQueries/linting/inline.d.ts +4 -0
  74. package/dist/esm/containerQueries/linting/inline.d.ts.map +1 -0
  75. package/dist/esm/containerQueries/linting/inline.js +18 -0
  76. package/dist/esm/containerQueries/linting/resolution.d.ts +1 -0
  77. package/dist/esm/containerQueries/linting/resolution.d.ts.map +1 -0
  78. package/dist/esm/containerQueries/linting/resolution.js +12 -0
  79. package/dist/esm/containerQueries/linting/style.d.ts +3 -0
  80. package/dist/esm/containerQueries/linting/style.d.ts.map +1 -0
  81. package/dist/esm/containerQueries/linting/style.js +24 -0
  82. package/dist/esm/containerQueries/linting.d.ts +4 -0
  83. package/dist/esm/containerQueries/linting.d.ts.map +1 -0
  84. package/dist/esm/containerQueries/linting.js +20 -0
  85. package/dist/esm/containerQueries/moduleRegistry.d.ts +25 -0
  86. package/dist/esm/containerQueries/moduleRegistry.d.ts.map +1 -0
  87. package/dist/esm/containerQueries/moduleRegistry.js +1 -0
  88. package/dist/esm/containerQueries/modules/aspectRatio.d.ts +17 -0
  89. package/dist/esm/containerQueries/modules/aspectRatio.d.ts.map +1 -0
  90. package/dist/esm/containerQueries/modules/aspectRatio.js +47 -0
  91. package/dist/esm/containerQueries/modules/block.d.ts +20 -0
  92. package/dist/esm/containerQueries/modules/block.d.ts.map +1 -0
  93. package/dist/esm/containerQueries/modules/block.js +49 -0
  94. package/dist/esm/containerQueries/modules/custom.d.ts +13 -0
  95. package/dist/esm/containerQueries/modules/custom.d.ts.map +1 -0
  96. package/dist/esm/containerQueries/modules/custom.js +39 -0
  97. package/dist/esm/containerQueries/modules/index.d.ts +6 -0
  98. package/dist/esm/containerQueries/modules/index.d.ts.map +1 -0
  99. package/dist/esm/containerQueries/modules/index.js +5 -0
  100. package/dist/esm/containerQueries/modules/inline.d.ts +20 -0
  101. package/dist/esm/containerQueries/modules/inline.d.ts.map +1 -0
  102. package/dist/esm/containerQueries/modules/inline.js +49 -0
  103. package/dist/esm/containerQueries/modules/size.d.ts +41 -0
  104. package/dist/esm/containerQueries/modules/size.d.ts.map +1 -0
  105. package/dist/esm/containerQueries/modules/size.js +1 -0
  106. package/dist/esm/containerQueries/modules/style.d.ts +11 -0
  107. package/dist/esm/containerQueries/modules/style.d.ts.map +1 -0
  108. package/dist/esm/containerQueries/modules/style.js +32 -0
  109. package/dist/esm/containerQueries/types.d.ts +81 -0
  110. package/dist/esm/containerQueries/types.d.ts.map +1 -0
  111. package/dist/esm/containerQueries/types.js +1 -0
  112. package/dist/esm/containerQueries/validation.d.ts +41 -0
  113. package/dist/esm/containerQueries/validation.d.ts.map +1 -0
  114. package/dist/esm/containerQueries/validation.js +187 -0
  115. package/dist/esm/core.d.ts +27 -26
  116. package/dist/esm/core.d.ts.map +1 -1
  117. package/dist/esm/core.js +5 -266
  118. package/dist/esm/factory.d.ts +13 -0
  119. package/dist/esm/factory.d.ts.map +1 -0
  120. package/dist/esm/factory.js +17 -0
  121. package/dist/esm/fraction.d.ts +23 -0
  122. package/dist/esm/fraction.d.ts.map +1 -0
  123. package/dist/esm/fraction.js +129 -0
  124. package/dist/esm/internal/buildMeasurementCreationError.d.ts +12 -0
  125. package/dist/esm/internal/buildMeasurementCreationError.d.ts.map +1 -0
  126. package/dist/esm/internal/buildMeasurementCreationError.js +12 -0
  127. package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts +3 -0
  128. package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts.map +1 -0
  129. package/dist/esm/internal/buildMeasurementCreationError.tests.js +1 -0
  130. package/dist/esm/internal/createComponentQueriesApi.d.ts +34 -0
  131. package/dist/esm/internal/createComponentQueriesApi.d.ts.map +1 -0
  132. package/dist/esm/internal/createComponentQueriesApi.js +52 -0
  133. package/dist/esm/internal/createCoreApi.d.ts +289 -0
  134. package/dist/esm/internal/createCoreApi.d.ts.map +1 -0
  135. package/dist/esm/internal/createCoreApi.js +332 -0
  136. package/dist/esm/internal/createMediaQueriesApi.d.ts +35 -0
  137. package/dist/esm/internal/createMediaQueriesApi.d.ts.map +1 -0
  138. package/dist/esm/internal/createMediaQueriesApi.js +70 -0
  139. package/dist/esm/internal/createUnitsApi.d.ts +13 -0
  140. package/dist/esm/internal/createUnitsApi.d.ts.map +1 -0
  141. package/dist/esm/internal/createUnitsApi.js +14 -0
  142. package/dist/esm/internal/errors.d.ts +30 -0
  143. package/dist/esm/internal/errors.d.ts.map +1 -1
  144. package/dist/esm/internal/errors.js +113 -4
  145. package/dist/esm/internal/normalizeToArray.d.ts +2 -0
  146. package/dist/esm/internal/normalizeToArray.d.ts.map +1 -0
  147. package/dist/esm/internal/normalizeToArray.js +5 -0
  148. package/dist/esm/libraryHelpers/vanilla-extract.d.ts +2 -1
  149. package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +1 -1
  150. package/dist/esm/libraryHelpers/vanilla-extract.js +4 -1
  151. package/dist/esm/logicalOperators/index.d.ts +2 -0
  152. package/dist/esm/logicalOperators/index.d.ts.map +1 -0
  153. package/dist/esm/logicalOperators/index.js +17 -0
  154. package/dist/esm/mediaQueries/factory.d.ts +16 -1
  155. package/dist/esm/mediaQueries/factory.d.ts.map +1 -1
  156. package/dist/esm/mediaQueries/factory.js +3 -2
  157. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts +2 -2
  158. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts.map +1 -1
  159. package/dist/esm/mediaQueries/mediaQueries.d.ts +2 -0
  160. package/dist/esm/mediaQueries/mediaQueries.d.ts.map +1 -1
  161. package/dist/esm/mediaQueries/mediaQueries.js +4 -2
  162. package/dist/esm/mediaQueries/modules/dimensions.d.ts +2 -0
  163. package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +1 -1
  164. package/dist/esm/mediaQueries/modules/dimensions.js +4 -2
  165. package/dist/esm/mediaQueries/modules/resolution.d.ts +2 -0
  166. package/dist/esm/mediaQueries/modules/resolution.d.ts.map +1 -1
  167. package/dist/esm/mediaQueries/modules/resolution.js +4 -2
  168. package/dist/esm/mediaQueries/validation.d.ts +28 -8
  169. package/dist/esm/mediaQueries/validation.d.ts.map +1 -1
  170. package/dist/esm/mediaQueries/validation.js +126 -107
  171. package/dist/esm/ratio.d.ts +22 -0
  172. package/dist/esm/ratio.d.ts.map +1 -0
  173. package/dist/esm/ratio.js +131 -0
  174. package/dist/esm/types.d.ts +35 -0
  175. package/dist/esm/types.d.ts.map +1 -0
  176. package/dist/esm/types.js +1 -0
  177. package/dist/esm/validation.d.ts +10 -0
  178. package/dist/esm/validation.d.ts.map +1 -0
  179. package/dist/esm/validation.js +15 -0
  180. package/dist/examples/containerQueries.example.js +54 -0
  181. package/dist/examples/examples/containerQueries.example.js +54 -0
  182. package/dist/examples/examples/factory-wrapper.example.js +33 -0
  183. package/dist/examples/examples/lineHeight-normalizer.example.js +81 -0
  184. package/dist/examples/examples/mediaQueries-multipleInstances.example.js +127 -0
  185. package/dist/examples/examples/mixedQueries.example.js +55 -0
  186. package/dist/examples/examples/validation-and-runtime-checks.example.js +85 -0
  187. package/dist/examples/examples/validation-unit-tests.example.js +35 -0
  188. package/dist/examples/factory-wrapper.example.js +33 -0
  189. package/dist/examples/lineHeight-normalizer.example.js +81 -0
  190. package/dist/examples/mediaQueries-multipleInstances.example.js +127 -0
  191. package/dist/examples/mixedQueries.example.js +60 -0
  192. package/dist/examples/src/comparisons/index.js +25 -0
  193. package/dist/examples/src/containerQueries/containerQueries.js +96 -0
  194. package/dist/examples/src/containerQueries/factory.js +123 -0
  195. package/dist/examples/src/containerQueries/helpers.js +94 -0
  196. package/dist/examples/src/containerQueries/index.js +16 -0
  197. package/dist/examples/src/containerQueries/linting/aspectRatio.js +20 -0
  198. package/dist/examples/src/containerQueries/linting/block.js +20 -0
  199. package/dist/examples/src/containerQueries/linting/core.js +19 -0
  200. package/dist/examples/src/containerQueries/linting/custom.js +11 -0
  201. package/dist/examples/src/containerQueries/linting/inline.js +20 -0
  202. package/dist/examples/src/containerQueries/linting/style.js +28 -0
  203. package/dist/examples/src/containerQueries/linting.js +24 -0
  204. package/dist/examples/src/containerQueries/moduleRegistry.js +5 -0
  205. package/dist/examples/src/containerQueries/modules/aspectRatio.js +33 -0
  206. package/dist/examples/src/containerQueries/modules/block.js +44 -0
  207. package/dist/examples/src/containerQueries/modules/custom.js +31 -0
  208. package/dist/examples/src/containerQueries/modules/index.js +21 -0
  209. package/dist/examples/src/containerQueries/modules/inline.js +44 -0
  210. package/dist/examples/src/containerQueries/modules/style.js +36 -0
  211. package/dist/examples/src/containerQueries/types.js +2 -0
  212. package/dist/examples/src/containerQueries/validation.js +177 -0
  213. package/dist/examples/src/core.js +16 -0
  214. package/dist/examples/src/factory.js +21 -0
  215. package/dist/examples/src/index.js +30 -0
  216. package/dist/examples/src/internal/buildMeasurementCreationError.js +16 -0
  217. package/dist/examples/src/internal/createCoreApi.js +336 -0
  218. package/dist/examples/src/internal/createMediaQueriesApi.js +74 -0
  219. package/dist/examples/src/internal/createUnitsApi.js +18 -0
  220. package/dist/examples/src/internal/errors.js +130 -0
  221. package/dist/examples/src/libraryHelpers/vanilla-extract.js +11 -0
  222. package/dist/examples/src/mediaQueries/factory.js +163 -0
  223. package/dist/examples/src/mediaQueries/helpers.js +88 -0
  224. package/dist/examples/src/mediaQueries/index.js +23 -0
  225. package/dist/examples/src/mediaQueries/linting/core.js +19 -0
  226. package/dist/examples/src/mediaQueries/linting/resolution.js +11 -0
  227. package/dist/examples/src/mediaQueries/linting.js +24 -0
  228. package/dist/examples/src/mediaQueries/mediaQueries.js +53 -0
  229. package/dist/examples/src/mediaQueries/moduleRegistry.js +5 -0
  230. package/dist/examples/src/mediaQueries/modules/custom.js +26 -0
  231. package/dist/examples/src/mediaQueries/modules/dimensions.js +61 -0
  232. package/dist/examples/src/mediaQueries/modules/display.js +20 -0
  233. package/dist/examples/src/mediaQueries/modules/environment.js +20 -0
  234. package/dist/examples/src/mediaQueries/modules/index.js +23 -0
  235. package/dist/examples/src/mediaQueries/modules/interaction.js +26 -0
  236. package/dist/examples/src/mediaQueries/modules/preferences.js +26 -0
  237. package/dist/examples/src/mediaQueries/modules/resolution.js +31 -0
  238. package/dist/examples/src/mediaQueries/types.js +2 -0
  239. package/dist/examples/src/mediaQueries/validation.js +128 -0
  240. package/dist/examples/src/ratio.js +141 -0
  241. package/dist/examples/src/types.js +2 -0
  242. package/dist/examples/src/unitDefinitions.js +67 -0
  243. package/dist/examples/src/units/absolute.js +11 -0
  244. package/dist/examples/src/units/angle.js +8 -0
  245. package/dist/examples/src/units/container.js +10 -0
  246. package/dist/examples/src/units/font-relative.js +16 -0
  247. package/dist/examples/src/units/frequency.js +6 -0
  248. package/dist/examples/src/units/grid.js +5 -0
  249. package/dist/examples/src/units/percent.js +7 -0
  250. package/dist/examples/src/units/resolution.js +7 -0
  251. package/dist/examples/src/units/time.js +6 -0
  252. package/dist/examples/src/units/viewport-dynamic.js +10 -0
  253. package/dist/examples/src/units/viewport-large.js +10 -0
  254. package/dist/examples/src/units/viewport-small.js +10 -0
  255. package/dist/examples/src/units/viewport.js +10 -0
  256. package/dist/examples/src/validation.js +20 -0
  257. package/dist/examples/validation-and-runtime-checks.example.js +85 -0
  258. package/dist/examples/validation-unit-tests.example.js +35 -0
  259. package/package.json +16 -5
package/README.md CHANGED
@@ -257,6 +257,104 @@ For concrete uses of these errors in tests and dev-only guards, see
257
257
 
258
258
  ---
259
259
 
260
+ ## Common errors
261
+
262
+ ### Non-finite measurement value
263
+
264
+ Example
265
+
266
+ ```
267
+ css-calipers.m: Non-finite measurement value: undefined [code=CALIPERS_E_NONFINITE | helper=m | inputs=value=undefined, unit=px | stack=...]
268
+ ```
269
+
270
+ What it means
271
+ - A measurement was constructed with undefined, NaN, or Infinity.
272
+
273
+ How to fix
274
+ - Provide a real numeric value and a unit (m(12), m(12, "px")).
275
+ - Add a context label so the error points to the calling helper or token (m(12, { context: "tokens.cardWidth" })).
276
+
277
+ ### Unit mismatch
278
+
279
+ Example
280
+
281
+ ```
282
+ css-calipers.assertMatchingUnits: measurement unit mismatch: px vs em [code=CALIPERS_E_UNIT_MISMATCH]
283
+ ```
284
+
285
+ What it means
286
+ - You mixed units without an explicit conversion.
287
+
288
+ How to fix
289
+ - Normalize units at the source (convert em to px or vice versa).
290
+ - Add an assertMatchingUnits call where the values enter your system.
291
+
292
+ ### Divide by zero
293
+
294
+ Example
295
+
296
+ ```
297
+ css-calipers.Measurement.divide: Cannot divide 10px by zero [code=CALIPERS_E_DIVIDE_BY_ZERO]
298
+ ```
299
+
300
+ What it means
301
+ - You attempted to divide by zero in a measurement operation.
302
+
303
+ How to fix
304
+ - Guard inputs before dividing or replace zero with a safe fallback.
305
+
306
+ ### Clamp bounds
307
+
308
+ Example
309
+
310
+ ```
311
+ css-calipers.Measurement.clamp: clamp: min (20px) must be <= max (12px) [code=CALIPERS_E_CLAMP_INVALID_RANGE]
312
+ ```
313
+
314
+ What it means
315
+ - The clamp minimum is greater than the clamp maximum.
316
+
317
+ How to fix
318
+ - Ensure min and max come from the same source or swap them before calling clamp.
319
+
320
+ ### Stack hints and configuration
321
+
322
+ For m and unit helpers, errors include a trimmed stack hint in non-production by default.
323
+ You can disable or force stack hints globally:
324
+
325
+ ```
326
+ import { setErrorConfig } from "css-calipers";
327
+
328
+ // Disable stack hints everywhere (for production).
329
+ setErrorConfig({ stackHints: "off" });
330
+
331
+ // Force stack hints everywhere (useful in dev or tests).
332
+ setErrorConfig({ stackHints: "on" });
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Factory entrypoint (optional)
338
+
339
+ If you want instance-scoped configuration and a single re-export surface, use
340
+ the factory entrypoint. The instance includes core helpers, unit helpers, and
341
+ mediaQueries.
342
+
343
+ ```
344
+ import { createCalipers } from "css-calipers/factory";
345
+
346
+ const calipers = createCalipers({
347
+ errorConfig: { stackHints: "on" },
348
+ });
349
+
350
+ export const { m, mPx, mediaQueries, units } = calipers;
351
+ ```
352
+
353
+ See [examples/factory-wrapper.example.ts](examples/factory-wrapper.example.ts)
354
+ for a wrapper module you can re-export across your project.
355
+
356
+ ---
357
+
260
358
  ## Co-existing with other systems
261
359
 
262
360
  You don’t have to convert everything at once, or at all. If it fits your setup,
@@ -371,3 +469,5 @@ The `examples/` folder contains a few non-published usage sketches:
371
469
  - [examples/validation-and-runtime-checks.example.ts](examples/validation-and-runtime-checks.example.ts) &mdash;
372
470
  dev-only validation around shared tokens in two different consumers (HTML
373
471
  string and style object) using the same line-height measurement.
472
+ - [examples/factory-wrapper.example.ts](examples/factory-wrapper.example.ts) &mdash;
473
+ instance-scoped factory wrapper that re-exports the helpers.
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compare = void 0;
4
+ exports.compare = {
5
+ eq: (value) => ({
6
+ operator: "=",
7
+ value,
8
+ }),
9
+ lt: (value) => ({
10
+ operator: "<",
11
+ value,
12
+ }),
13
+ lte: (value) => ({
14
+ operator: "<=",
15
+ value,
16
+ }),
17
+ gt: (value) => ({
18
+ operator: ">",
19
+ value,
20
+ }),
21
+ gte: (value) => ({
22
+ operator: ">=",
23
+ value,
24
+ }),
25
+ };
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeContainerQueryStyle = exports.buildContainerConditionString = exports.buildContainerQueryString = exports.emitCoreFeatures = exports.createEmitCoreFeatures = void 0;
4
+ const modules_1 = require("./modules");
5
+ const linting_1 = require("./linting");
6
+ const core_1 = require("./linting/core");
7
+ const validation_1 = require("./validation");
8
+ const helpers_1 = require("./helpers");
9
+ const createEmitCoreFeatures = (validation) => (props, helpers) => {
10
+ const allowQueryArrays = helpers.config.allowQueryArrays !== false;
11
+ const assertNoArray = (value, label) => {
12
+ if (Array.isArray(value) && !allowQueryArrays) {
13
+ throw new Error(`${label} does not allow arrays.`);
14
+ }
15
+ };
16
+ const emitFeature = (name, value) => {
17
+ if (Array.isArray(value)) {
18
+ value.forEach((entry) => {
19
+ var _a;
20
+ ((_a = helpers.addFeatureUnsafe) !== null && _a !== void 0 ? _a : helpers.addFeature)(name, entry);
21
+ });
22
+ return;
23
+ }
24
+ helpers.addFeature(name, value);
25
+ };
26
+ const { runContainerQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, validateMinMaxHeight, validateHeightValuesPositive, } = validation;
27
+ if (!runContainerQueryValidation(props, helpers, validateMinMaxWidth, "core", "minWidth must be less than or equal to maxWidth")) {
28
+ return;
29
+ }
30
+ if (!runContainerQueryValidation(props, helpers, validateMinMaxHeight, "core", "minHeight must be less than or equal to maxHeight")) {
31
+ return;
32
+ }
33
+ if (!runContainerQueryValidation(props, helpers, validateWidthValuesPositive, "core", "width values must be greater than 0")) {
34
+ return;
35
+ }
36
+ if (!runContainerQueryValidation(props, helpers, validateHeightValuesPositive, "core", "height values must be greater than 0")) {
37
+ return;
38
+ }
39
+ if (!(0, linting_1.runContainerQueryLint)(props, helpers, core_1.lintWidthExactRedundancy, "minWidth should not be combined with maxWidth when both are equal")) {
40
+ return;
41
+ }
42
+ if (!(0, linting_1.runContainerQueryLint)(props, helpers, core_1.lintHeightExactRedundancy, "minHeight should not be combined with maxHeight when both are equal")) {
43
+ return;
44
+ }
45
+ if (props.minWidth !== undefined) {
46
+ assertNoArray(props.minWidth, "minWidth");
47
+ emitFeature("min-width", props.minWidth);
48
+ }
49
+ if (props.maxWidth !== undefined) {
50
+ assertNoArray(props.maxWidth, "maxWidth");
51
+ emitFeature("max-width", props.maxWidth);
52
+ }
53
+ if (props.minHeight !== undefined) {
54
+ assertNoArray(props.minHeight, "minHeight");
55
+ emitFeature("min-height", props.minHeight);
56
+ }
57
+ if (props.maxHeight !== undefined) {
58
+ assertNoArray(props.maxHeight, "maxHeight");
59
+ emitFeature("max-height", props.maxHeight);
60
+ }
61
+ };
62
+ exports.createEmitCoreFeatures = createEmitCoreFeatures;
63
+ exports.emitCoreFeatures = (0, exports.createEmitCoreFeatures)(validation_1.defaultContainerQueryValidation);
64
+ const emitBaseFeatures = (props, helpers) => {
65
+ (0, exports.emitCoreFeatures)(props, helpers);
66
+ (0, modules_1.emitAspectRatioFeatures)(props, helpers);
67
+ (0, modules_1.emitInlineSizeFeatures)(props, helpers);
68
+ (0, modules_1.emitBlockSizeFeatures)(props, helpers);
69
+ (0, modules_1.emitStyleFeatures)(props, helpers);
70
+ (0, modules_1.emitCustomFeatures)(props, helpers);
71
+ };
72
+ exports.buildContainerQueryString = (0, helpers_1.createContainerQueryBuilder)({
73
+ emitBase: emitBaseFeatures,
74
+ });
75
+ const wrapContainerCondition = (value) => {
76
+ const trimmed = value.trim();
77
+ if (trimmed.includes(" and ") ||
78
+ trimmed.includes(" or ") ||
79
+ trimmed.startsWith("not ")) {
80
+ return `(${trimmed})`;
81
+ }
82
+ return trimmed;
83
+ };
84
+ const buildContainerConditionString = (condition) => {
85
+ if ("and" in condition) {
86
+ return condition.and
87
+ .map((entry) => wrapContainerCondition((0, exports.buildContainerConditionString)(entry)))
88
+ .join(" and ");
89
+ }
90
+ if ("or" in condition) {
91
+ return condition.or
92
+ .map((entry) => wrapContainerCondition((0, exports.buildContainerConditionString)(entry)))
93
+ .join(" or ");
94
+ }
95
+ if ("not" in condition) {
96
+ return `not ${wrapContainerCondition((0, exports.buildContainerConditionString)(condition.not))}`;
97
+ }
98
+ return (0, exports.buildContainerQueryString)(condition);
99
+ };
100
+ exports.buildContainerConditionString = buildContainerConditionString;
101
+ const makeContainerQueryStyle = (queries) => (stylesByQuery) => {
102
+ const result = {};
103
+ Object.keys(stylesByQuery).forEach((key) => {
104
+ const styles = stylesByQuery[key];
105
+ const props = queries[key];
106
+ if (!styles || !props)
107
+ return;
108
+ result[(0, exports.buildContainerQueryString)(props)] = styles;
109
+ });
110
+ const containerQuery = {
111
+ "@container": result,
112
+ };
113
+ return containerQuery;
114
+ };
115
+ exports.makeContainerQueryStyle = makeContainerQueryStyle;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.containerQueryFactory = exports.createContainerQueryFactory = void 0;
4
+ const containerQueries_1 = require("./containerQueries");
5
+ const ALL_CONTAINER_QUERY_MODULES = [
6
+ "core",
7
+ "inline",
8
+ "block",
9
+ "aspectRatio",
10
+ "style",
11
+ "custom",
12
+ ];
13
+ const MODULE_KEYS = {
14
+ core: ["minWidth", "maxWidth", "minHeight", "maxHeight"],
15
+ inline: ["inlineSize", "inlineSizeRange"],
16
+ block: ["blockSize", "blockSizeRange"],
17
+ aspectRatio: ["aspectRatio", "minAspectRatio", "maxAspectRatio"],
18
+ style: ["style"],
19
+ custom: ["customFeatures"],
20
+ };
21
+ const KEY_TO_MODULE = Object.fromEntries(Object.keys(MODULE_KEYS).flatMap((moduleId) => MODULE_KEYS[moduleId].map((key) => [key, moduleId])));
22
+ const collectConditionKeys = (condition, keys) => {
23
+ if ("and" in condition) {
24
+ condition.and.forEach((entry) => collectConditionKeys(entry, keys));
25
+ return;
26
+ }
27
+ if ("or" in condition) {
28
+ condition.or.forEach((entry) => collectConditionKeys(entry, keys));
29
+ return;
30
+ }
31
+ if ("not" in condition) {
32
+ collectConditionKeys(condition.not, keys);
33
+ return;
34
+ }
35
+ Object.keys(condition).forEach((key) => keys.add(key));
36
+ };
37
+ const collectAndConditionKeys = (condition, keys) => {
38
+ if ("and" in condition) {
39
+ condition.and.forEach((entry) => collectAndConditionKeys(entry, keys));
40
+ return;
41
+ }
42
+ if ("or" in condition || "not" in condition) {
43
+ return;
44
+ }
45
+ Object.keys(condition).forEach((key) => keys.push(key));
46
+ };
47
+ const guardUnsupportedCondition = (condition, modules, config, label) => {
48
+ const allowed = new Set();
49
+ modules.forEach((moduleId) => {
50
+ MODULE_KEYS[moduleId].forEach((key) => {
51
+ allowed.add(key);
52
+ });
53
+ });
54
+ const conditionKeys = new Set();
55
+ collectConditionKeys(condition, conditionKeys);
56
+ conditionKeys.forEach((key) => {
57
+ var _a, _b;
58
+ if (allowed.has(key))
59
+ return;
60
+ const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : "throw";
61
+ const moduleHint = KEY_TO_MODULE[key];
62
+ const moduleSuffix = moduleHint
63
+ ? ` Add "${moduleHint}" to modules.`
64
+ : "";
65
+ const message = `Container query factory "${label}" received unsupported feature "${key}".${moduleSuffix}`;
66
+ if (mode === "log") {
67
+ console.warn(message);
68
+ return;
69
+ }
70
+ if (mode === "allow")
71
+ return;
72
+ throw new Error(message);
73
+ });
74
+ };
75
+ const guardDuplicateConditions = (condition, config, label) => {
76
+ var _a, _b;
77
+ const keys = [];
78
+ collectAndConditionKeys(condition, keys);
79
+ const seen = new Set();
80
+ const duplicates = new Set();
81
+ keys.forEach((key) => {
82
+ if (seen.has(key)) {
83
+ duplicates.add(key);
84
+ return;
85
+ }
86
+ seen.add(key);
87
+ });
88
+ if (!duplicates.size)
89
+ return;
90
+ const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : "throw";
91
+ const message = `Container query factory "${label}" received duplicate condition "${Array.from(duplicates).join('", "')}".`;
92
+ if (mode === "log") {
93
+ console.warn(message);
94
+ return;
95
+ }
96
+ if (mode === "allow")
97
+ return;
98
+ throw new Error(message);
99
+ };
100
+ const createContainerQueryFactory = () => (options) => {
101
+ var _a;
102
+ const modules = (_a = options.config.modules) !== null && _a !== void 0 ? _a : ALL_CONTAINER_QUERY_MODULES;
103
+ return (stylesByQuery) => {
104
+ const result = {};
105
+ Object.keys(stylesByQuery).forEach((key) => {
106
+ const styles = stylesByQuery[key];
107
+ const rule = options.queries[key];
108
+ if (!styles || !(rule === null || rule === void 0 ? void 0 : rule.query))
109
+ return;
110
+ guardUnsupportedCondition(rule.query.condition, modules, options.config, options.config.label);
111
+ guardDuplicateConditions(rule.query.condition, options.config, options.config.label);
112
+ result[(0, containerQueries_1.buildContainerConditionString)(rule.query.condition)] = styles;
113
+ });
114
+ const containerQuery = {
115
+ "@container": result,
116
+ };
117
+ return options.config.output
118
+ ? options.config.output(containerQuery)
119
+ : containerQuery;
120
+ };
121
+ };
122
+ exports.createContainerQueryFactory = createContainerQueryFactory;
123
+ exports.containerQueryFactory = (0, exports.createContainerQueryFactory)();
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyContainerQueryValidation = exports.createContainerQueryBuilder = exports.createContainerQueryFeatureEmitterWithTracking = exports.createContainerQueryConditionEmitter = exports.createContainerQueryFeatureEmitter = exports.formatContainerQueryComparison = exports.buildContainerQueryStringFromParts = exports.buildContainerRange = exports.buildContainerComparison = exports.formatContainerQueryValue = void 0;
4
+ const core_1 = require("../core");
5
+ const validation_1 = require("../validation");
6
+ const formatContainerQueryValue = (value) => ((0, core_1.hasCssMethod)(value) ? value.css() : String(value));
7
+ exports.formatContainerQueryValue = formatContainerQueryValue;
8
+ const buildContainerComparison = (comparison) => comparison;
9
+ exports.buildContainerComparison = buildContainerComparison;
10
+ const buildContainerRange = (min, max, options = {}) => {
11
+ var _a;
12
+ const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : "min";
13
+ const operator = options.inclusive === false ? "<" : "<=";
14
+ if (mode === "max") {
15
+ return { min, max, maxOperator: operator };
16
+ }
17
+ return { min, max, minOperator: operator };
18
+ };
19
+ exports.buildContainerRange = buildContainerRange;
20
+ const buildContainerQueryStringFromParts = (parts) => parts.join(" and ");
21
+ exports.buildContainerQueryStringFromParts = buildContainerQueryStringFromParts;
22
+ const formatContainerQueryComparison = (name, operator, value) => {
23
+ return `(${name} ${operator} ${(0, exports.formatContainerQueryValue)(value)})`;
24
+ };
25
+ exports.formatContainerQueryComparison = formatContainerQueryComparison;
26
+ const createContainerQueryFeatureEmitter = (parts) => (name, value) => {
27
+ parts.push(`(${name}: ${(0, exports.formatContainerQueryValue)(value)})`);
28
+ };
29
+ exports.createContainerQueryFeatureEmitter = createContainerQueryFeatureEmitter;
30
+ const createContainerQueryConditionEmitter = (parts) => (condition) => {
31
+ parts.push(condition);
32
+ };
33
+ exports.createContainerQueryConditionEmitter = createContainerQueryConditionEmitter;
34
+ const createContainerQueryFeatureEmitterWithTracking = (parts, options = {}) => {
35
+ const { emitted, lintingMode = "throw" } = options;
36
+ return (name, value) => {
37
+ if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
38
+ if (lintingMode === "throw") {
39
+ throw new Error(`Container query feature "${name}" was emitted more than once.`);
40
+ }
41
+ if (lintingMode === "log") {
42
+ console.warn(`Container query feature "${name}" was emitted more than once; using the latest value.`);
43
+ }
44
+ }
45
+ emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
46
+ parts.push(`(${name}: ${(0, exports.formatContainerQueryValue)(value)})`);
47
+ };
48
+ };
49
+ exports.createContainerQueryFeatureEmitterWithTracking = createContainerQueryFeatureEmitterWithTracking;
50
+ const createContainerQueryBuilder = (options) => {
51
+ return (config) => {
52
+ var _a, _b, _c, _d, _e;
53
+ const parts = [];
54
+ const emittedFeatures = new Set();
55
+ const helpers = {
56
+ addFeature: (0, exports.createContainerQueryFeatureEmitterWithTracking)(parts, {
57
+ emitted: emittedFeatures,
58
+ lintingMode: (_c = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.errorHandling) === null || _b === void 0 ? void 0 : _b.lintingMode) !== null && _c !== void 0 ? _c : "throw",
59
+ }),
60
+ addFeatureUnsafe: (0, exports.createContainerQueryFeatureEmitter)(parts),
61
+ addCondition: (0, exports.createContainerQueryConditionEmitter)(parts),
62
+ config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
63
+ };
64
+ options.emitBase(config, helpers);
65
+ (_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
66
+ return (0, exports.buildContainerQueryStringFromParts)(parts);
67
+ };
68
+ };
69
+ exports.createContainerQueryBuilder = createContainerQueryBuilder;
70
+ const applyContainerQueryValidation = (config, helpers, validator, context) => {
71
+ var _a, _b;
72
+ if (!validator)
73
+ return true;
74
+ const normalized = (0, validation_1.normalizeValidationResult)(validator(config));
75
+ if (normalized.valid)
76
+ return true;
77
+ const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : "throw";
78
+ if (mode === "log") {
79
+ const suffix = normalized.message ? `: ${normalized.message}` : "";
80
+ const prefix = context
81
+ ? `Container query ${context} validation failed`
82
+ : "Container query validation failed";
83
+ console.warn(`${prefix}${suffix}`);
84
+ }
85
+ if (mode === "allow")
86
+ return true;
87
+ if (mode === "log")
88
+ return true;
89
+ const suffix = normalized.message ? `: ${normalized.message}` : "";
90
+ const prefix = context
91
+ ? `Container query ${context} validation failed`
92
+ : "Container query validation failed";
93
+ throw new Error(`${prefix}${suffix}`);
94
+ };
95
+ exports.applyContainerQueryValidation = applyContainerQueryValidation;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineContainerQueryModules = exports.createContainerQueryFactory = exports.containerQueryFactory = exports.formatContainerQueryValue = exports.buildContainerRange = exports.buildContainerComparison = exports.makeContainerQueryStyle = exports.buildContainerQueryString = exports.buildContainerConditionString = void 0;
4
+ var containerQueries_1 = require("./containerQueries");
5
+ Object.defineProperty(exports, "buildContainerConditionString", { enumerable: true, get: function () { return containerQueries_1.buildContainerConditionString; } });
6
+ Object.defineProperty(exports, "buildContainerQueryString", { enumerable: true, get: function () { return containerQueries_1.buildContainerQueryString; } });
7
+ Object.defineProperty(exports, "makeContainerQueryStyle", { enumerable: true, get: function () { return containerQueries_1.makeContainerQueryStyle; } });
8
+ var helpers_1 = require("./helpers");
9
+ Object.defineProperty(exports, "buildContainerComparison", { enumerable: true, get: function () { return helpers_1.buildContainerComparison; } });
10
+ Object.defineProperty(exports, "buildContainerRange", { enumerable: true, get: function () { return helpers_1.buildContainerRange; } });
11
+ Object.defineProperty(exports, "formatContainerQueryValue", { enumerable: true, get: function () { return helpers_1.formatContainerQueryValue; } });
12
+ var factory_1 = require("./factory");
13
+ Object.defineProperty(exports, "containerQueryFactory", { enumerable: true, get: function () { return factory_1.containerQueryFactory; } });
14
+ Object.defineProperty(exports, "createContainerQueryFactory", { enumerable: true, get: function () { return factory_1.createContainerQueryFactory; } });
15
+ var moduleRegistry_1 = require("./moduleRegistry");
16
+ Object.defineProperty(exports, "defineContainerQueryModules", { enumerable: true, get: function () { return moduleRegistry_1.defineContainerQueryModules; } });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintAspectRatioRangeCollapse = exports.lintAspectRatioRedundancy = void 0;
4
+ const ratio_1 = require("../../ratio");
5
+ const lintAspectRatioRedundancy = (props) => {
6
+ if (!props.aspectRatio)
7
+ return;
8
+ if (props.minAspectRatio || props.maxAspectRatio) {
9
+ throw new Error("aspectRatio should not be combined with minAspectRatio or maxAspectRatio");
10
+ }
11
+ };
12
+ exports.lintAspectRatioRedundancy = lintAspectRatioRedundancy;
13
+ const lintAspectRatioRangeCollapse = (props) => {
14
+ if (!props.minAspectRatio || !props.maxAspectRatio)
15
+ return;
16
+ if (Array.isArray(props.minAspectRatio) ||
17
+ Array.isArray(props.maxAspectRatio)) {
18
+ return;
19
+ }
20
+ if ((0, ratio_1.ratioToFloat)(props.minAspectRatio) === (0, ratio_1.ratioToFloat)(props.maxAspectRatio)) {
21
+ throw new Error("minAspectRatio and maxAspectRatio are equal; use aspectRatio instead");
22
+ }
23
+ };
24
+ exports.lintAspectRatioRangeCollapse = lintAspectRatioRangeCollapse;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintBlockRangeCollapse = exports.lintBlockRedundancy = void 0;
4
+ const normalizeToArray_1 = require("../../internal/normalizeToArray");
5
+ const lintBlockRedundancy = (props) => {
6
+ if (!props.blockSize)
7
+ return;
8
+ if (props.blockSizeRange) {
9
+ throw new Error("blockSize should not be combined with blockSizeRange");
10
+ }
11
+ };
12
+ exports.lintBlockRedundancy = lintBlockRedundancy;
13
+ const lintBlockRangeCollapse = (props) => {
14
+ if (!props.blockSizeRange)
15
+ return;
16
+ (0, normalizeToArray_1.normalizeToArray)(props.blockSizeRange).forEach((range) => {
17
+ const { min, max } = range;
18
+ if (min.equals(max)) {
19
+ throw new Error("blockSizeRange min and max are equal; use blockSize instead");
20
+ }
21
+ });
22
+ };
23
+ exports.lintBlockRangeCollapse = lintBlockRangeCollapse;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintHeightExactRedundancy = exports.lintWidthExactRedundancy = void 0;
4
+ const lintWidthExactRedundancy = (props) => {
5
+ if (!props.minWidth || !props.maxWidth)
6
+ return;
7
+ if (Array.isArray(props.minWidth) || Array.isArray(props.maxWidth)) {
8
+ return;
9
+ }
10
+ if (props.minWidth.equals(props.maxWidth)) {
11
+ throw new Error("minWidth should not be combined with maxWidth when both are equal");
12
+ }
13
+ };
14
+ exports.lintWidthExactRedundancy = lintWidthExactRedundancy;
15
+ const lintHeightExactRedundancy = (props) => {
16
+ if (!props.minHeight || !props.maxHeight)
17
+ return;
18
+ if (Array.isArray(props.minHeight) || Array.isArray(props.maxHeight)) {
19
+ return;
20
+ }
21
+ if (props.minHeight.equals(props.maxHeight)) {
22
+ throw new Error("minHeight should not be combined with maxHeight when both are equal");
23
+ }
24
+ };
25
+ exports.lintHeightExactRedundancy = lintHeightExactRedundancy;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintCustomFeatures = void 0;
4
+ const lintCustomFeatures = (props) => {
5
+ if (!props.customFeatures)
6
+ return;
7
+ if (!Object.keys(props.customFeatures).length) {
8
+ throw new Error("customFeatures should not be empty.");
9
+ }
10
+ };
11
+ exports.lintCustomFeatures = lintCustomFeatures;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintInlineRangeCollapse = exports.lintInlineRedundancy = void 0;
4
+ const normalizeToArray_1 = require("../../internal/normalizeToArray");
5
+ const lintInlineRedundancy = (props) => {
6
+ if (!props.inlineSize)
7
+ return;
8
+ if (props.inlineSizeRange) {
9
+ throw new Error("inlineSize should not be combined with inlineSizeRange");
10
+ }
11
+ };
12
+ exports.lintInlineRedundancy = lintInlineRedundancy;
13
+ const lintInlineRangeCollapse = (props) => {
14
+ if (!props.inlineSizeRange)
15
+ return;
16
+ (0, normalizeToArray_1.normalizeToArray)(props.inlineSizeRange).forEach((range) => {
17
+ const { min, max } = range;
18
+ if (min.equals(max)) {
19
+ throw new Error("inlineSizeRange min and max are equal; use inlineSize instead");
20
+ }
21
+ });
22
+ };
23
+ exports.lintInlineRangeCollapse = lintInlineRangeCollapse;
@@ -0,0 +1,12 @@
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
+ // };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintStyleCondition = void 0;
4
+ const core_1 = require("../../core");
5
+ const isComparisonShape = (value) => {
6
+ if (typeof value !== "object" || value === null)
7
+ return false;
8
+ return "operator" in value && "value" in value;
9
+ };
10
+ const lintStyleCondition = (props) => {
11
+ if (!props.style)
12
+ return;
13
+ if (!Object.keys(props.style).length) {
14
+ throw new Error("style conditions must not be empty.");
15
+ }
16
+ Object.values(props.style).forEach((value) => {
17
+ if (value === undefined || value === null)
18
+ return;
19
+ if (Array.isArray(value))
20
+ return;
21
+ if ((0, core_1.hasCssMethod)(value))
22
+ return;
23
+ if (isComparisonShape(value)) {
24
+ throw new Error("style conditions must not contain comparisons.");
25
+ }
26
+ });
27
+ };
28
+ exports.lintStyleCondition = lintStyleCondition;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runContainerQueryLint = void 0;
4
+ const runContainerQueryLint = (config, helpers, check, message = "Container query lint failed") => {
5
+ var _a, _b;
6
+ if (!check)
7
+ return true;
8
+ const mode = (_b = (_a = helpers.config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : "throw";
9
+ if (mode === "allow")
10
+ return true;
11
+ if (mode === "log") {
12
+ try {
13
+ check(config);
14
+ return true;
15
+ }
16
+ catch {
17
+ console.warn(message);
18
+ return true;
19
+ }
20
+ }
21
+ check(config);
22
+ return true;
23
+ };
24
+ exports.runContainerQueryLint = runContainerQueryLint;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineContainerQueryModules = void 0;
4
+ const defineContainerQueryModules = (...modules) => modules;
5
+ exports.defineContainerQueryModules = defineContainerQueryModules;