css-calipers 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +21 -25
  2. package/dist/cjs/factory.js +0 -3
  3. package/dist/cjs/internal/createCoreApi.js +30 -9
  4. package/dist/esm/core.d.ts +21 -17
  5. package/dist/esm/core.d.ts.map +1 -1
  6. package/dist/esm/factory.d.ts +0 -2
  7. package/dist/esm/factory.d.ts.map +1 -1
  8. package/dist/esm/factory.js +0 -3
  9. package/dist/esm/internal/createCoreApi.d.ts +7 -11
  10. package/dist/esm/internal/createCoreApi.d.ts.map +1 -1
  11. package/dist/esm/internal/createCoreApi.js +30 -9
  12. package/package.json +11 -24
  13. package/RELEASING.md +0 -62
  14. package/dist/cjs/comparisons/index.js +0 -25
  15. package/dist/cjs/containerQueries/containerQueries.js +0 -115
  16. package/dist/cjs/containerQueries/factory.js +0 -123
  17. package/dist/cjs/containerQueries/helpers.js +0 -95
  18. package/dist/cjs/containerQueries/index.js +0 -16
  19. package/dist/cjs/containerQueries/linting/aspectRatio.js +0 -24
  20. package/dist/cjs/containerQueries/linting/block.js +0 -23
  21. package/dist/cjs/containerQueries/linting/core.js +0 -25
  22. package/dist/cjs/containerQueries/linting/custom.js +0 -11
  23. package/dist/cjs/containerQueries/linting/inline.js +0 -23
  24. package/dist/cjs/containerQueries/linting/resolution.js +0 -12
  25. package/dist/cjs/containerQueries/linting/style.js +0 -28
  26. package/dist/cjs/containerQueries/linting.js +0 -24
  27. package/dist/cjs/containerQueries/moduleRegistry.js +0 -5
  28. package/dist/cjs/containerQueries/modules/aspectRatio.js +0 -51
  29. package/dist/cjs/containerQueries/modules/block.js +0 -53
  30. package/dist/cjs/containerQueries/modules/custom.js +0 -43
  31. package/dist/cjs/containerQueries/modules/index.js +0 -21
  32. package/dist/cjs/containerQueries/modules/inline.js +0 -53
  33. package/dist/cjs/containerQueries/modules/size.js +0 -2
  34. package/dist/cjs/containerQueries/modules/style.js +0 -36
  35. package/dist/cjs/containerQueries/types.js +0 -2
  36. package/dist/cjs/containerQueries/validation.js +0 -191
  37. package/dist/cjs/fraction.js +0 -139
  38. package/dist/cjs/internal/createComponentQueriesApi.js +0 -56
  39. package/dist/cjs/internal/createMediaQueriesApi.js +0 -74
  40. package/dist/cjs/internal/normalizeToArray.js +0 -9
  41. package/dist/cjs/libraryHelpers/vanilla-extract.js +0 -11
  42. package/dist/cjs/logicalOperators/index.js +0 -18
  43. package/dist/cjs/mediaQueries/factory.js +0 -187
  44. package/dist/cjs/mediaQueries/helpers.js +0 -97
  45. package/dist/cjs/mediaQueries/index.js +0 -23
  46. package/dist/cjs/mediaQueries/libraryHelpers/vanilla-extract.js +0 -77
  47. package/dist/cjs/mediaQueries/linting/core.js +0 -19
  48. package/dist/cjs/mediaQueries/linting/resolution.js +0 -11
  49. package/dist/cjs/mediaQueries/linting.js +0 -24
  50. package/dist/cjs/mediaQueries/mediaQueries.js +0 -53
  51. package/dist/cjs/mediaQueries/mediaQueryFactory.js +0 -120
  52. package/dist/cjs/mediaQueries/moduleRegistry.js +0 -5
  53. package/dist/cjs/mediaQueries/modules/custom.js +0 -26
  54. package/dist/cjs/mediaQueries/modules/dimensions.js +0 -61
  55. package/dist/cjs/mediaQueries/modules/display.js +0 -20
  56. package/dist/cjs/mediaQueries/modules/environment.js +0 -20
  57. package/dist/cjs/mediaQueries/modules/index.js +0 -23
  58. package/dist/cjs/mediaQueries/modules/interaction.js +0 -26
  59. package/dist/cjs/mediaQueries/modules/preferences.js +0 -26
  60. package/dist/cjs/mediaQueries/modules/resolution.js +0 -31
  61. package/dist/cjs/mediaQueries/types.js +0 -2
  62. package/dist/cjs/mediaQueries/validation.js +0 -131
  63. package/dist/cjs/types.js +0 -2
  64. package/dist/cjs/validation.js +0 -20
  65. package/dist/esm/comparisons/index.d.ts +0 -23
  66. package/dist/esm/comparisons/index.d.ts.map +0 -1
  67. package/dist/esm/comparisons/index.js +0 -22
  68. package/dist/esm/containerQueries/containerQueries.d.ts +0 -36
  69. package/dist/esm/containerQueries/containerQueries.d.ts.map +0 -1
  70. package/dist/esm/containerQueries/containerQueries.js +0 -109
  71. package/dist/esm/containerQueries/factory.d.ts +0 -20
  72. package/dist/esm/containerQueries/factory.d.ts.map +0 -1
  73. package/dist/esm/containerQueries/factory.js +0 -119
  74. package/dist/esm/containerQueries/helpers.d.ts +0 -53
  75. package/dist/esm/containerQueries/helpers.d.ts.map +0 -1
  76. package/dist/esm/containerQueries/helpers.js +0 -82
  77. package/dist/esm/containerQueries/index.d.ts +0 -10
  78. package/dist/esm/containerQueries/index.d.ts.map +0 -1
  79. package/dist/esm/containerQueries/index.js +0 -4
  80. package/dist/esm/containerQueries/linting/aspectRatio.d.ts +0 -4
  81. package/dist/esm/containerQueries/linting/aspectRatio.d.ts.map +0 -1
  82. package/dist/esm/containerQueries/linting/aspectRatio.js +0 -19
  83. package/dist/esm/containerQueries/linting/block.d.ts +0 -4
  84. package/dist/esm/containerQueries/linting/block.d.ts.map +0 -1
  85. package/dist/esm/containerQueries/linting/block.js +0 -18
  86. package/dist/esm/containerQueries/linting/core.d.ts +0 -4
  87. package/dist/esm/containerQueries/linting/core.d.ts.map +0 -1
  88. package/dist/esm/containerQueries/linting/core.js +0 -20
  89. package/dist/esm/containerQueries/linting/custom.d.ts +0 -3
  90. package/dist/esm/containerQueries/linting/custom.d.ts.map +0 -1
  91. package/dist/esm/containerQueries/linting/custom.js +0 -7
  92. package/dist/esm/containerQueries/linting/inline.d.ts +0 -4
  93. package/dist/esm/containerQueries/linting/inline.d.ts.map +0 -1
  94. package/dist/esm/containerQueries/linting/inline.js +0 -18
  95. package/dist/esm/containerQueries/linting/resolution.d.ts +0 -1
  96. package/dist/esm/containerQueries/linting/resolution.d.ts.map +0 -1
  97. package/dist/esm/containerQueries/linting/resolution.js +0 -12
  98. package/dist/esm/containerQueries/linting/style.d.ts +0 -3
  99. package/dist/esm/containerQueries/linting/style.d.ts.map +0 -1
  100. package/dist/esm/containerQueries/linting/style.js +0 -24
  101. package/dist/esm/containerQueries/linting.d.ts +0 -4
  102. package/dist/esm/containerQueries/linting.d.ts.map +0 -1
  103. package/dist/esm/containerQueries/linting.js +0 -20
  104. package/dist/esm/containerQueries/moduleRegistry.d.ts +0 -25
  105. package/dist/esm/containerQueries/moduleRegistry.d.ts.map +0 -1
  106. package/dist/esm/containerQueries/moduleRegistry.js +0 -1
  107. package/dist/esm/containerQueries/modules/aspectRatio.d.ts +0 -17
  108. package/dist/esm/containerQueries/modules/aspectRatio.d.ts.map +0 -1
  109. package/dist/esm/containerQueries/modules/aspectRatio.js +0 -47
  110. package/dist/esm/containerQueries/modules/block.d.ts +0 -20
  111. package/dist/esm/containerQueries/modules/block.d.ts.map +0 -1
  112. package/dist/esm/containerQueries/modules/block.js +0 -49
  113. package/dist/esm/containerQueries/modules/custom.d.ts +0 -13
  114. package/dist/esm/containerQueries/modules/custom.d.ts.map +0 -1
  115. package/dist/esm/containerQueries/modules/custom.js +0 -39
  116. package/dist/esm/containerQueries/modules/index.d.ts +0 -6
  117. package/dist/esm/containerQueries/modules/index.d.ts.map +0 -1
  118. package/dist/esm/containerQueries/modules/index.js +0 -5
  119. package/dist/esm/containerQueries/modules/inline.d.ts +0 -20
  120. package/dist/esm/containerQueries/modules/inline.d.ts.map +0 -1
  121. package/dist/esm/containerQueries/modules/inline.js +0 -49
  122. package/dist/esm/containerQueries/modules/size.d.ts +0 -41
  123. package/dist/esm/containerQueries/modules/size.d.ts.map +0 -1
  124. package/dist/esm/containerQueries/modules/size.js +0 -1
  125. package/dist/esm/containerQueries/modules/style.d.ts +0 -11
  126. package/dist/esm/containerQueries/modules/style.d.ts.map +0 -1
  127. package/dist/esm/containerQueries/modules/style.js +0 -32
  128. package/dist/esm/containerQueries/types.d.ts +0 -81
  129. package/dist/esm/containerQueries/types.d.ts.map +0 -1
  130. package/dist/esm/containerQueries/types.js +0 -1
  131. package/dist/esm/containerQueries/validation.d.ts +0 -41
  132. package/dist/esm/containerQueries/validation.d.ts.map +0 -1
  133. package/dist/esm/containerQueries/validation.js +0 -187
  134. package/dist/esm/fraction.d.ts +0 -23
  135. package/dist/esm/fraction.d.ts.map +0 -1
  136. package/dist/esm/fraction.js +0 -129
  137. package/dist/esm/internal/createComponentQueriesApi.d.ts +0 -34
  138. package/dist/esm/internal/createComponentQueriesApi.d.ts.map +0 -1
  139. package/dist/esm/internal/createComponentQueriesApi.js +0 -52
  140. package/dist/esm/internal/createMediaQueriesApi.d.ts +0 -35
  141. package/dist/esm/internal/createMediaQueriesApi.d.ts.map +0 -1
  142. package/dist/esm/internal/createMediaQueriesApi.js +0 -70
  143. package/dist/esm/internal/normalizeToArray.d.ts +0 -2
  144. package/dist/esm/internal/normalizeToArray.d.ts.map +0 -1
  145. package/dist/esm/internal/normalizeToArray.js +0 -5
  146. package/dist/esm/libraryHelpers/vanilla-extract.d.ts +0 -4
  147. package/dist/esm/libraryHelpers/vanilla-extract.d.ts.map +0 -1
  148. package/dist/esm/libraryHelpers/vanilla-extract.js +0 -6
  149. package/dist/esm/logicalOperators/index.d.ts +0 -2
  150. package/dist/esm/logicalOperators/index.d.ts.map +0 -1
  151. package/dist/esm/logicalOperators/index.js +0 -17
  152. package/dist/esm/mediaQueries/factory.d.ts +0 -45
  153. package/dist/esm/mediaQueries/factory.d.ts.map +0 -1
  154. package/dist/esm/mediaQueries/factory.js +0 -183
  155. package/dist/esm/mediaQueries/helpers.d.ts +0 -40
  156. package/dist/esm/mediaQueries/helpers.d.ts.map +0 -1
  157. package/dist/esm/mediaQueries/helpers.js +0 -87
  158. package/dist/esm/mediaQueries/index.d.ts +0 -8
  159. package/dist/esm/mediaQueries/index.d.ts.map +0 -1
  160. package/dist/esm/mediaQueries/index.js +0 -7
  161. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts +0 -5
  162. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.d.ts.map +0 -1
  163. package/dist/esm/mediaQueries/libraryHelpers/vanilla-extract.js +0 -71
  164. package/dist/esm/mediaQueries/linting/core.d.ts +0 -5
  165. package/dist/esm/mediaQueries/linting/core.d.ts.map +0 -1
  166. package/dist/esm/mediaQueries/linting/core.js +0 -14
  167. package/dist/esm/mediaQueries/linting/resolution.d.ts +0 -3
  168. package/dist/esm/mediaQueries/linting/resolution.d.ts.map +0 -1
  169. package/dist/esm/mediaQueries/linting/resolution.js +0 -7
  170. package/dist/esm/mediaQueries/linting.d.ts +0 -4
  171. package/dist/esm/mediaQueries/linting.d.ts.map +0 -1
  172. package/dist/esm/mediaQueries/linting.js +0 -20
  173. package/dist/esm/mediaQueries/mediaQueries.d.ts +0 -23
  174. package/dist/esm/mediaQueries/mediaQueries.d.ts.map +0 -1
  175. package/dist/esm/mediaQueries/mediaQueries.js +0 -48
  176. package/dist/esm/mediaQueries/moduleRegistry.d.ts +0 -27
  177. package/dist/esm/mediaQueries/moduleRegistry.d.ts.map +0 -1
  178. package/dist/esm/mediaQueries/moduleRegistry.js +0 -1
  179. package/dist/esm/mediaQueries/modules/custom.d.ts +0 -10
  180. package/dist/esm/mediaQueries/modules/custom.d.ts.map +0 -1
  181. package/dist/esm/mediaQueries/modules/custom.js +0 -22
  182. package/dist/esm/mediaQueries/modules/dimensions.d.ts +0 -19
  183. package/dist/esm/mediaQueries/modules/dimensions.d.ts.map +0 -1
  184. package/dist/esm/mediaQueries/modules/dimensions.js +0 -57
  185. package/dist/esm/mediaQueries/modules/display.d.ts +0 -9
  186. package/dist/esm/mediaQueries/modules/display.d.ts.map +0 -1
  187. package/dist/esm/mediaQueries/modules/display.js +0 -16
  188. package/dist/esm/mediaQueries/modules/environment.d.ts +0 -9
  189. package/dist/esm/mediaQueries/modules/environment.d.ts.map +0 -1
  190. package/dist/esm/mediaQueries/modules/environment.js +0 -16
  191. package/dist/esm/mediaQueries/modules/index.d.ts +0 -8
  192. package/dist/esm/mediaQueries/modules/index.d.ts.map +0 -1
  193. package/dist/esm/mediaQueries/modules/index.js +0 -7
  194. package/dist/esm/mediaQueries/modules/interaction.d.ts +0 -11
  195. package/dist/esm/mediaQueries/modules/interaction.d.ts.map +0 -1
  196. package/dist/esm/mediaQueries/modules/interaction.js +0 -22
  197. package/dist/esm/mediaQueries/modules/preferences.d.ts +0 -11
  198. package/dist/esm/mediaQueries/modules/preferences.d.ts.map +0 -1
  199. package/dist/esm/mediaQueries/modules/preferences.js +0 -22
  200. package/dist/esm/mediaQueries/modules/resolution.d.ts +0 -12
  201. package/dist/esm/mediaQueries/modules/resolution.d.ts.map +0 -1
  202. package/dist/esm/mediaQueries/modules/resolution.js +0 -27
  203. package/dist/esm/mediaQueries/types.d.ts +0 -117
  204. package/dist/esm/mediaQueries/types.d.ts.map +0 -1
  205. package/dist/esm/mediaQueries/types.js +0 -1
  206. package/dist/esm/mediaQueries/validation.d.ts +0 -34
  207. package/dist/esm/mediaQueries/validation.d.ts.map +0 -1
  208. package/dist/esm/mediaQueries/validation.js +0 -127
  209. package/dist/esm/types.d.ts +0 -35
  210. package/dist/esm/types.d.ts.map +0 -1
  211. package/dist/esm/types.js +0 -1
  212. package/dist/esm/validation.d.ts +0 -10
  213. package/dist/esm/validation.d.ts.map +0 -1
  214. package/dist/esm/validation.js +0 -15
  215. package/dist/examples/containerQueries.example.js +0 -54
  216. package/dist/examples/examples/containerQueries.example.js +0 -54
  217. package/dist/examples/examples/factory-wrapper.example.js +0 -33
  218. package/dist/examples/examples/lineHeight-normalizer.example.js +0 -81
  219. package/dist/examples/examples/mediaQueries-multipleInstances.example.js +0 -127
  220. package/dist/examples/examples/mixedQueries.example.js +0 -55
  221. package/dist/examples/examples/validation-and-runtime-checks.example.js +0 -85
  222. package/dist/examples/examples/validation-unit-tests.example.js +0 -35
  223. package/dist/examples/factory-wrapper.example.js +0 -33
  224. package/dist/examples/lineHeight-normalizer.example.js +0 -81
  225. package/dist/examples/mediaQueries-multipleInstances.example.js +0 -127
  226. package/dist/examples/mixedQueries.example.js +0 -60
  227. package/dist/examples/src/comparisons/index.js +0 -25
  228. package/dist/examples/src/containerQueries/containerQueries.js +0 -96
  229. package/dist/examples/src/containerQueries/factory.js +0 -123
  230. package/dist/examples/src/containerQueries/helpers.js +0 -94
  231. package/dist/examples/src/containerQueries/index.js +0 -16
  232. package/dist/examples/src/containerQueries/linting/aspectRatio.js +0 -20
  233. package/dist/examples/src/containerQueries/linting/block.js +0 -20
  234. package/dist/examples/src/containerQueries/linting/core.js +0 -19
  235. package/dist/examples/src/containerQueries/linting/custom.js +0 -11
  236. package/dist/examples/src/containerQueries/linting/inline.js +0 -20
  237. package/dist/examples/src/containerQueries/linting/style.js +0 -28
  238. package/dist/examples/src/containerQueries/linting.js +0 -24
  239. package/dist/examples/src/containerQueries/moduleRegistry.js +0 -5
  240. package/dist/examples/src/containerQueries/modules/aspectRatio.js +0 -33
  241. package/dist/examples/src/containerQueries/modules/block.js +0 -44
  242. package/dist/examples/src/containerQueries/modules/custom.js +0 -31
  243. package/dist/examples/src/containerQueries/modules/index.js +0 -21
  244. package/dist/examples/src/containerQueries/modules/inline.js +0 -44
  245. package/dist/examples/src/containerQueries/modules/style.js +0 -36
  246. package/dist/examples/src/containerQueries/types.js +0 -2
  247. package/dist/examples/src/containerQueries/validation.js +0 -177
  248. package/dist/examples/src/core.js +0 -16
  249. package/dist/examples/src/factory.js +0 -21
  250. package/dist/examples/src/index.js +0 -30
  251. package/dist/examples/src/internal/buildMeasurementCreationError.js +0 -16
  252. package/dist/examples/src/internal/createCoreApi.js +0 -336
  253. package/dist/examples/src/internal/createMediaQueriesApi.js +0 -74
  254. package/dist/examples/src/internal/createUnitsApi.js +0 -18
  255. package/dist/examples/src/internal/errors.js +0 -130
  256. package/dist/examples/src/libraryHelpers/vanilla-extract.js +0 -11
  257. package/dist/examples/src/mediaQueries/factory.js +0 -163
  258. package/dist/examples/src/mediaQueries/helpers.js +0 -88
  259. package/dist/examples/src/mediaQueries/index.js +0 -23
  260. package/dist/examples/src/mediaQueries/linting/core.js +0 -19
  261. package/dist/examples/src/mediaQueries/linting/resolution.js +0 -11
  262. package/dist/examples/src/mediaQueries/linting.js +0 -24
  263. package/dist/examples/src/mediaQueries/mediaQueries.js +0 -53
  264. package/dist/examples/src/mediaQueries/moduleRegistry.js +0 -5
  265. package/dist/examples/src/mediaQueries/modules/custom.js +0 -26
  266. package/dist/examples/src/mediaQueries/modules/dimensions.js +0 -61
  267. package/dist/examples/src/mediaQueries/modules/display.js +0 -20
  268. package/dist/examples/src/mediaQueries/modules/environment.js +0 -20
  269. package/dist/examples/src/mediaQueries/modules/index.js +0 -23
  270. package/dist/examples/src/mediaQueries/modules/interaction.js +0 -26
  271. package/dist/examples/src/mediaQueries/modules/preferences.js +0 -26
  272. package/dist/examples/src/mediaQueries/modules/resolution.js +0 -31
  273. package/dist/examples/src/mediaQueries/types.js +0 -2
  274. package/dist/examples/src/mediaQueries/validation.js +0 -128
  275. package/dist/examples/src/ratio.js +0 -141
  276. package/dist/examples/src/types.js +0 -2
  277. package/dist/examples/src/unitDefinitions.js +0 -67
  278. package/dist/examples/src/units/absolute.js +0 -11
  279. package/dist/examples/src/units/angle.js +0 -8
  280. package/dist/examples/src/units/container.js +0 -10
  281. package/dist/examples/src/units/font-relative.js +0 -16
  282. package/dist/examples/src/units/frequency.js +0 -6
  283. package/dist/examples/src/units/grid.js +0 -5
  284. package/dist/examples/src/units/percent.js +0 -7
  285. package/dist/examples/src/units/resolution.js +0 -7
  286. package/dist/examples/src/units/time.js +0 -6
  287. package/dist/examples/src/units/viewport-dynamic.js +0 -10
  288. package/dist/examples/src/units/viewport-large.js +0 -10
  289. package/dist/examples/src/units/viewport-small.js +0 -10
  290. package/dist/examples/src/units/viewport.js +0 -10
  291. package/dist/examples/src/validation.js +0 -20
  292. package/dist/examples/validation-and-runtime-checks.example.js +0 -85
  293. package/dist/examples/validation-unit-tests.example.js +0 -35
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // export type ContentQueryVariable =
4
- // ContainerQueryModuleKeysMap[keyof ContainerQueryModuleKeysMap];
5
- // export type ContentQueryComparisonValue = IMeasurement | number | string;
6
- // export type Comparison<
7
- // Variable = ContentQueryVariable,
8
- // Value = ContentQueryComparisonValue
9
- // > = {
10
- // variable: Variable;
11
- // operator: IComparisonOperator;
12
- // value: Value;
13
- // };
14
- // export type ComparisonValue<Value = ContentQueryComparisonValue> = {
15
- // operator: IComparisonOperator;
16
- // value: Value;
17
- // readonly __comparisonBrand: unique symbol;
18
- // };
@@ -1,187 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mediaQueryFactory = exports.createMediaQueryFactory = void 0;
4
- const helpers_1 = require("./helpers");
5
- const mediaQueries_1 = require("./mediaQueries");
6
- const modules_1 = require("./modules");
7
- const ALL_MEDIA_QUERY_MODULES = [
8
- 'core',
9
- 'dimensions',
10
- 'resolution',
11
- 'interaction',
12
- 'preferences',
13
- 'display',
14
- 'environment',
15
- 'custom',
16
- ];
17
- const MODULE_KEYS = {
18
- core: ['type', 'minWidth', 'maxWidth'],
19
- dimensions: [
20
- 'width',
21
- 'height',
22
- 'minHeight',
23
- 'maxHeight',
24
- 'aspectRatio',
25
- 'minAspectRatio',
26
- 'maxAspectRatio',
27
- 'orientation',
28
- ],
29
- resolution: ['resolutionValue', 'minResolution', 'maxResolution'],
30
- interaction: ['hover', 'anyHover', 'pointer', 'anyPointer', 'update'],
31
- preferences: [
32
- 'colorScheme',
33
- 'reducedMotion',
34
- 'reducedData',
35
- 'contrast',
36
- 'forcedColors',
37
- ],
38
- display: ['colorGamut', 'dynamicRange', 'invertedColors'],
39
- environment: ['scripting', 'overflowBlock', 'overflowInline'],
40
- custom: ['customFeatures'],
41
- };
42
- const MODULE_EMITTERS = {
43
- core: mediaQueries_1.emitCoreFeatures,
44
- dimensions: modules_1.emitDimensionsFeatures,
45
- resolution: modules_1.emitResolutionFeatures,
46
- interaction: modules_1.emitInteractionFeatures,
47
- preferences: modules_1.emitPreferencesFeatures,
48
- display: modules_1.emitDisplayFeatures,
49
- environment: modules_1.emitEnvironmentFeatures,
50
- custom: modules_1.emitCustomFeatures,
51
- };
52
- const ALL_MODULE_KEYS = MODULE_KEYS;
53
- const KEY_TO_MODULE = Object.fromEntries(Object.keys(ALL_MODULE_KEYS).flatMap((moduleId) => ALL_MODULE_KEYS[moduleId].map((key) => [key, moduleId])));
54
- const guardUnsupportedProps = (props, modules, config, label) => {
55
- const allowed = new Set();
56
- modules.forEach((moduleId) => {
57
- ALL_MODULE_KEYS[moduleId].forEach((key) => {
58
- allowed.add(key);
59
- });
60
- });
61
- Object.keys(props).forEach((key) => {
62
- var _a, _b;
63
- if (props[key] === undefined)
64
- return;
65
- if (allowed.has(key))
66
- return;
67
- const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
68
- const moduleHint = KEY_TO_MODULE[key];
69
- const moduleSuffix = moduleHint
70
- ? ` Add "${moduleHint}" to modules.`
71
- : '';
72
- const message = `Media query factory "${label}" received unsupported feature "${key}".${moduleSuffix}`;
73
- if (mode === 'log') {
74
- console.warn(message);
75
- return;
76
- }
77
- if (mode === 'allow')
78
- return;
79
- throw new Error(message);
80
- });
81
- };
82
- const normalizeCustomResult = (result) => {
83
- if (result === undefined || result === null)
84
- return { valid: true };
85
- if (typeof result === 'boolean')
86
- return { valid: result };
87
- if (typeof result === 'string') {
88
- return result ? { valid: false, message: result } : { valid: true };
89
- }
90
- return result;
91
- };
92
- const runCustomValidator = (props, config) => {
93
- var _a, _b;
94
- const custom = config.custom;
95
- if (!(custom === null || custom === void 0 ? void 0 : custom.validator))
96
- return;
97
- const normalized = normalizeCustomResult(custom.validator(props));
98
- if (normalized.valid)
99
- return;
100
- const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
101
- const suffix = normalized.message ? `: ${normalized.message}` : '';
102
- const message = `Media query factory "${config.label}" custom validator "${custom.key}" failed${suffix}`;
103
- if (mode === 'log') {
104
- console.warn(message);
105
- return;
106
- }
107
- if (mode === 'allow')
108
- return;
109
- throw new Error(message);
110
- };
111
- const runCustomLinter = (props, config) => {
112
- var _a, _b;
113
- const custom = config.custom;
114
- if (!(custom === null || custom === void 0 ? void 0 : custom.linter))
115
- return;
116
- const normalized = normalizeCustomResult(custom.linter(props));
117
- if (normalized.valid)
118
- return;
119
- const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.lintingMode) !== null && _b !== void 0 ? _b : 'throw';
120
- const suffix = normalized.message ? `: ${normalized.message}` : '';
121
- const message = `Media query factory "${config.label}" custom linter "${custom.key}" flagged${suffix}`;
122
- if (mode === 'log') {
123
- console.warn(message);
124
- return;
125
- }
126
- if (mode === 'allow')
127
- return;
128
- throw new Error(message);
129
- };
130
- const createMediaQueryFactory = (emitters) => (options) => {
131
- var _a;
132
- const modules = (_a = options.config.modules) !== null && _a !== void 0 ? _a : ALL_MEDIA_QUERY_MODULES;
133
- const buildMediaQuery = (0, helpers_1.createMediaQueryBuilder)({
134
- emitBase: (props, helpers) => {
135
- guardUnsupportedProps(props, modules, options.config, options.config.label);
136
- runCustomValidator(props, options.config);
137
- runCustomLinter(props, options.config);
138
- modules.forEach((moduleId) => {
139
- emitters[moduleId](props, helpers);
140
- });
141
- },
142
- resolveType: (props) => props.type,
143
- config: options.config,
144
- });
145
- const handleUnknownQueryKey = (key, config) => {
146
- var _a, _b;
147
- const mode = (_b = (_a = config.errorHandling) === null || _a === void 0 ? void 0 : _a.invalidValueMode) !== null && _b !== void 0 ? _b : 'throw';
148
- const message = `Media query factory "${config.label}" received unknown query key "${key}".`;
149
- if (mode === 'log') {
150
- console.warn(message);
151
- return;
152
- }
153
- if (mode === 'allow')
154
- return;
155
- throw new Error(message);
156
- };
157
- return (stylesByQuery) => {
158
- const result = {};
159
- Object.keys(stylesByQuery).forEach((key) => {
160
- const styles = stylesByQuery[key];
161
- if (!styles)
162
- return;
163
- if (Object.prototype.hasOwnProperty.call(options.queries, key)) {
164
- return;
165
- }
166
- handleUnknownQueryKey(String(key), options.config);
167
- });
168
- Object.keys(stylesByQuery).forEach((key) => {
169
- const styles = stylesByQuery[key];
170
- const props = options.queries[key];
171
- if (!styles || !props)
172
- return;
173
- result[buildMediaQuery(props)] = styles;
174
- });
175
- const mediaQuery = {
176
- '@media': result,
177
- };
178
- const processed = options.config.preProcessor
179
- ? options.config.preProcessor(mediaQuery)
180
- : mediaQuery;
181
- return options.config.output
182
- ? options.config.output(processed)
183
- : processed;
184
- };
185
- };
186
- exports.createMediaQueryFactory = createMediaQueryFactory;
187
- exports.mediaQueryFactory = (0, exports.createMediaQueryFactory)(MODULE_EMITTERS);
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildMediaQueryFromFeatures = exports.applyMediaQueryValidation = exports.createMediaQueryBuilder = exports.createMediaQueryFeatureEmitterWithTracking = exports.createMediaQueryFeatureEmitter = exports.buildMediaQueryStringFromParts = exports.formatMediaQueryValue = void 0;
4
- const core_1 = require("../core");
5
- const formatMediaQueryValue = (value) => ((0, core_1.hasCssMethod)(value) ? value.css() : String(value));
6
- exports.formatMediaQueryValue = formatMediaQueryValue;
7
- const buildMediaQueryStringFromParts = (mediaType, parts) => (parts.length ? `${mediaType} and ${parts.join(' and ')}` : mediaType);
8
- exports.buildMediaQueryStringFromParts = buildMediaQueryStringFromParts;
9
- const createMediaQueryFeatureEmitter = (parts) => (name, value) => {
10
- parts.push(`(${name}: ${(0, exports.formatMediaQueryValue)(value)})`);
11
- };
12
- exports.createMediaQueryFeatureEmitter = createMediaQueryFeatureEmitter;
13
- const createMediaQueryFeatureEmitterWithTracking = (parts, options = {}) => {
14
- const { emitted, lintingMode = 'throw' } = options;
15
- return (name, value) => {
16
- if (emitted === null || emitted === void 0 ? void 0 : emitted.has(name)) {
17
- if (lintingMode === 'throw') {
18
- throw new Error(`Media query feature "${name}" was emitted more than once.`);
19
- }
20
- if (lintingMode === 'log') {
21
- console.warn(`Media query feature "${name}" was emitted more than once; using the latest value.`);
22
- }
23
- }
24
- emitted === null || emitted === void 0 ? void 0 : emitted.add(name);
25
- parts.push(`(${name}: ${(0, exports.formatMediaQueryValue)(value)})`);
26
- };
27
- };
28
- exports.createMediaQueryFeatureEmitterWithTracking = createMediaQueryFeatureEmitterWithTracking;
29
- const createMediaQueryBuilder = (options) => {
30
- return (config) => {
31
- var _a, _b, _c, _d, _e, _f, _g;
32
- const parts = [];
33
- const emittedFeatures = new Set();
34
- const helpers = {
35
- addFeature: (0, exports.createMediaQueryFeatureEmitterWithTracking)(parts, {
36
- emitted: emittedFeatures,
37
- 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',
38
- }),
39
- config: (_d = options.config) !== null && _d !== void 0 ? _d : {},
40
- };
41
- options.emitBase(config, helpers);
42
- (_e = options.emitExtensions) === null || _e === void 0 ? void 0 : _e.call(options, config, helpers);
43
- const mediaType = (_g = (_f = options.resolveType) === null || _f === void 0 ? void 0 : _f.call(options, config)) !== null && _g !== void 0 ? _g : 'screen';
44
- return (0, exports.buildMediaQueryStringFromParts)(mediaType, parts);
45
- };
46
- };
47
- exports.createMediaQueryBuilder = createMediaQueryBuilder;
48
- const normalizeValidationResult = (result) => {
49
- if (result === undefined || result === null)
50
- return { valid: true };
51
- if (typeof result === 'boolean')
52
- return { valid: result };
53
- if (typeof result === 'string') {
54
- return result ? { valid: false, message: result } : { valid: true };
55
- }
56
- return result;
57
- };
58
- const applyMediaQueryValidation = (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
- ? `Media query ${context} validation failed`
70
- : 'Media 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
- ? `Media query ${context} validation failed`
80
- : 'Media query validation failed';
81
- throw new Error(`${prefix}${suffix}`);
82
- };
83
- exports.applyMediaQueryValidation = applyMediaQueryValidation;
84
- const buildMediaQueryFromFeatures = (features, mediaType = 'screen') => {
85
- const parts = [];
86
- const addFeature = (0, exports.createMediaQueryFeatureEmitterWithTracking)(parts, {
87
- emitted: new Set(),
88
- lintingMode: 'throw',
89
- });
90
- Object.entries(features).forEach(([name, value]) => {
91
- if (value === undefined || value === null)
92
- return;
93
- addFeature(name, value);
94
- });
95
- return (0, exports.buildMediaQueryStringFromParts)(mediaType, parts);
96
- };
97
- exports.buildMediaQueryFromFeatures = buildMediaQueryFromFeatures;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./helpers"), exports);
19
- __exportStar(require("./factory"), exports);
20
- __exportStar(require("./mediaQueries"), exports);
21
- __exportStar(require("./modules"), exports);
22
- __exportStar(require("./moduleRegistry"), exports);
23
- __exportStar(require("./libraryHelpers/vanilla-extract"), exports);
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.preprocessorVanillaExtract = exports.outputVanillaExtract = exports.mediaQueryOutputVanillaExtract = void 0;
4
- const mediaQueryOutputVanillaExtract = (media) => ("@media" in media
5
- ? {
6
- "&": media,
7
- }
8
- : media);
9
- exports.mediaQueryOutputVanillaExtract = mediaQueryOutputVanillaExtract;
10
- const outputVanillaExtract = (media) => (0, exports.mediaQueryOutputVanillaExtract)(media);
11
- exports.outputVanillaExtract = outputVanillaExtract;
12
- const preprocessorVanillaExtract = (media) => {
13
- const result = {};
14
- const mediaQueries = media["@media"];
15
- if (!mediaQueries) {
16
- return {
17
- "&": media,
18
- };
19
- }
20
- const mergeRule = (base, next) => {
21
- if (!base)
22
- return next;
23
- const merged = { ...base, ...next };
24
- const baseMedia = base["@media"];
25
- const nextMedia = next["@media"];
26
- if (baseMedia && nextMedia) {
27
- merged["@media"] = { ...baseMedia, ...nextMedia };
28
- }
29
- return merged;
30
- };
31
- const combineSelectors = (parent, child) => {
32
- if (child.includes("&")) {
33
- return child.replace(/&/g, parent);
34
- }
35
- return `${parent} ${child}`.trim();
36
- };
37
- const collectSelectors = (rule, parentSelector, acc) => {
38
- const { selectors, ...rest } = rule;
39
- const hasBase = Object.keys(rest).length > 0;
40
- if (hasBase) {
41
- acc[parentSelector] = mergeRule(acc[parentSelector], rest);
42
- }
43
- if (!selectors)
44
- return;
45
- Object.keys(selectors).forEach((selector) => {
46
- const selectorRule = selectors[selector];
47
- if (!selectorRule)
48
- return;
49
- const combined = combineSelectors(parentSelector, selector);
50
- collectSelectors(selectorRule, combined, acc);
51
- });
52
- };
53
- Object.keys(mediaQueries).forEach((query) => {
54
- const rule = mediaQueries[query];
55
- if (!rule)
56
- return;
57
- const perQuery = {};
58
- collectSelectors(rule, "&", perQuery);
59
- Object.keys(perQuery).forEach((selector) => {
60
- var _a, _b;
61
- const selectorRule = perQuery[selector];
62
- if (!selectorRule || Object.keys(selectorRule).length === 0)
63
- return;
64
- const existing = (_a = result[selector]) !== null && _a !== void 0 ? _a : { "@media": {} };
65
- const existingMedia = (_b = existing["@media"]) !== null && _b !== void 0 ? _b : {};
66
- result[selector] = {
67
- ...existing,
68
- "@media": {
69
- ...existingMedia,
70
- [query]: selectorRule,
71
- },
72
- };
73
- });
74
- });
75
- return result;
76
- };
77
- exports.preprocessorVanillaExtract = preprocessorVanillaExtract;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintHeightRedundancy = exports.lintWidthRedundancy = void 0;
4
- const lintWidthRedundancy = (props) => {
5
- if (!props.width)
6
- return;
7
- if (props.minWidth || props.maxWidth) {
8
- throw new Error('width should not be combined with minWidth or maxWidth');
9
- }
10
- };
11
- exports.lintWidthRedundancy = lintWidthRedundancy;
12
- const lintHeightRedundancy = (props) => {
13
- if (!props.height)
14
- return;
15
- if (props.minHeight || props.maxHeight) {
16
- throw new Error('height should not be combined with minHeight or maxHeight');
17
- }
18
- };
19
- exports.lintHeightRedundancy = lintHeightRedundancy;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintResolutionRedundancy = void 0;
4
- const lintResolutionRedundancy = (props) => {
5
- if (!props.resolutionValue)
6
- return;
7
- if (props.minResolution || props.maxResolution) {
8
- throw new Error('resolution should not be combined with minResolution or maxResolution');
9
- }
10
- };
11
- exports.lintResolutionRedundancy = lintResolutionRedundancy;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runMediaQueryLint = void 0;
4
- const runMediaQueryLint = (config, helpers, check, message = 'Media 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.runMediaQueryLint = runMediaQueryLint;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeMediaQueryStyle = exports.buildMediaQueryString = exports.emitCoreFeatures = exports.createEmitCoreFeatures = void 0;
4
- const helpers_1 = require("./helpers");
5
- const validation_1 = require("./validation");
6
- const modules_1 = require("./modules");
7
- const createEmitCoreFeatures = (validation) => (props, helpers) => {
8
- const { runMediaQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, } = validation;
9
- if (!runMediaQueryValidation(props, helpers, validateMinMaxWidth, "core", "minWidth must be less than or equal to maxWidth")) {
10
- return;
11
- }
12
- if (!runMediaQueryValidation(props, helpers, validateWidthValuesPositive, "core", "width values must be greater than 0")) {
13
- return;
14
- }
15
- const { addFeature } = helpers;
16
- if (props.minWidth) {
17
- addFeature("min-width", props.minWidth);
18
- }
19
- if (props.maxWidth) {
20
- addFeature("max-width", props.maxWidth);
21
- }
22
- };
23
- exports.createEmitCoreFeatures = createEmitCoreFeatures;
24
- exports.emitCoreFeatures = (0, exports.createEmitCoreFeatures)(validation_1.defaultMediaQueryValidation);
25
- const emitBaseFeatures = (props, helpers) => {
26
- (0, exports.emitCoreFeatures)(props, helpers);
27
- (0, modules_1.emitDimensionsFeatures)(props, helpers);
28
- (0, modules_1.emitResolutionFeatures)(props, helpers);
29
- (0, modules_1.emitInteractionFeatures)(props, helpers);
30
- (0, modules_1.emitPreferencesFeatures)(props, helpers);
31
- (0, modules_1.emitDisplayFeatures)(props, helpers);
32
- (0, modules_1.emitEnvironmentFeatures)(props, helpers);
33
- (0, modules_1.emitCustomFeatures)(props, helpers);
34
- };
35
- exports.buildMediaQueryString = (0, helpers_1.createMediaQueryBuilder)({
36
- emitBase: emitBaseFeatures,
37
- resolveType: (props) => props.type,
38
- });
39
- const makeMediaQueryStyle = (queries) => (stylesByQuery) => {
40
- const result = {};
41
- Object.keys(stylesByQuery).forEach((key) => {
42
- const styles = stylesByQuery[key];
43
- const props = queries[key];
44
- if (!styles || !props)
45
- return;
46
- result[(0, exports.buildMediaQueryString)(props)] = styles;
47
- });
48
- const mediaQuery = {
49
- "@media": result,
50
- };
51
- return mediaQuery;
52
- };
53
- exports.makeMediaQueryStyle = makeMediaQueryStyle;
@@ -1,120 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queriesToStrings = queriesToStrings;
4
- exports.useMediaQuery = useMediaQuery;
5
- exports.useMediaFromMap = useMediaFromMap;
6
- exports.makeClientFns = makeClientFns;
7
- const react_1 = require("react");
8
- const mediaQueries_1 = require("./mediaQueries");
9
- function toQueryString(q) {
10
- return (0, mediaQueries_1.buildMediaQueryString)(q);
11
- }
12
- function queriesToStrings(queries) {
13
- return Object.fromEntries(Object.entries(queries).map(([k, v,]) => [
14
- k,
15
- typeof v === 'string' ? v : toQueryString(v),
16
- ]));
17
- }
18
- // ---------- Core hooks ----------
19
- /**
20
- * SSR-safe: undefined on server, boolean on client; subscribes to
21
- * changes.
22
- */
23
- function useMediaQuery(queryString) {
24
- const [matches, setMatches,] = (0, react_1.useState)(undefined);
25
- (0, react_1.useEffect)(() => {
26
- var _a;
27
- if (typeof window === 'undefined')
28
- return;
29
- const mql = window.matchMedia(queryString);
30
- const onChange = () => setMatches(mql.matches);
31
- const frameId = requestAnimationFrame(() => {
32
- setMatches(mql.matches);
33
- });
34
- (_a = mql.addEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
35
- return () => {
36
- var _a;
37
- (_a = mql.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
38
- cancelAnimationFrame(frameId);
39
- };
40
- }, [
41
- queryString,
42
- ]);
43
- return matches;
44
- }
45
- // Aggregate hook with guarded updates to avoid loops
46
- function useMediaFromMap(strings) {
47
- const shallowEqual = (0, react_1.useCallback)((a, b) => {
48
- const ak = Object.keys(a);
49
- const bk = Object.keys(b);
50
- if (ak.length !== bk.length)
51
- return false;
52
- for (const k of ak)
53
- if (a[k] !== b[k])
54
- return false;
55
- return true;
56
- }, []);
57
- // Stable, sorted list of [key, queryString]
58
- const entries = (0, react_1.useMemo)(() => {
59
- const e = Object.entries(strings);
60
- e.sort((a, b) => a[0].localeCompare(b[0]));
61
- return e;
62
- }, [
63
- strings,
64
- ]);
65
- const [matches, setMatches,] = (0, react_1.useState)(() => Object.create(null));
66
- (0, react_1.useEffect)(() => {
67
- if (typeof window === 'undefined')
68
- return;
69
- const mqls = entries.map(([k, qs,]) => [
70
- k,
71
- window.matchMedia(qs),
72
- ]);
73
- // Initial snapshot — only set if changed
74
- const initial = Object.fromEntries(mqls.map(([k, mql,]) => [
75
- k,
76
- mql.matches,
77
- ]));
78
- const frameId = requestAnimationFrame(() => {
79
- setMatches((prev) => shallowEqual(prev, initial) ? prev : initial);
80
- });
81
- // Subscribe with guarded setState
82
- const handlers = mqls.map(([k, mql,]) => {
83
- var _a;
84
- const onChange = () => setMatches((prev) => {
85
- const next = {
86
- ...prev,
87
- [k]: mql.matches,
88
- };
89
- return shallowEqual(prev, next) ? prev : next;
90
- });
91
- (_a = mql.addEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
92
- return [
93
- mql,
94
- onChange,
95
- ];
96
- });
97
- return () => {
98
- var _a;
99
- cancelAnimationFrame(frameId);
100
- for (const [mql, onChange,] of handlers) {
101
- (_a = mql.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(mql, 'change', onChange);
102
- }
103
- };
104
- }, [
105
- entries,
106
- shallowEqual,
107
- ]);
108
- return matches;
109
- }
110
- // ---------- Client-only predicates ----------
111
- /** For event handlers/effects only; don't call in SSR render paths. */
112
- function makeClientFns(strings) {
113
- const out = {};
114
- Object.keys(strings).forEach((k) => {
115
- out[k] = () => typeof window !== 'undefined'
116
- ? window.matchMedia(strings[k]).matches
117
- : false;
118
- });
119
- return out;
120
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineMediaQueryModules = void 0;
4
- const defineMediaQueryModules = (...modules) => modules;
5
- exports.defineMediaQueryModules = defineMediaQueryModules;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitCustomFeatures = void 0;
4
- const core_1 = require("../../core");
5
- const helpers_1 = require("../helpers");
6
- const emitCustomFeatures = (props, helpers, validate) => {
7
- if (!(0, helpers_1.applyMediaQueryValidation)(props, helpers, validate, 'custom')) {
8
- return;
9
- }
10
- const { addFeature } = helpers;
11
- if (!props.customFeatures)
12
- return;
13
- Object.entries(props.customFeatures).forEach(([name, value]) => {
14
- if (value === undefined || value === null)
15
- return;
16
- const trimmedName = name.trim();
17
- if (!trimmedName) {
18
- throw new Error('Custom feature name must be non-empty.');
19
- }
20
- if (typeof value === 'object' && !(0, core_1.hasCssMethod)(value)) {
21
- throw new Error(`Custom feature "${trimmedName}" must be a primitive or a measurement.`);
22
- }
23
- addFeature(trimmedName, value);
24
- });
25
- };
26
- exports.emitCustomFeatures = emitCustomFeatures;