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,27 +0,0 @@
1
- import { applyMediaQueryValidation } from '../helpers';
2
- import { defaultMediaQueryValidation, } from '../validation';
3
- import { runMediaQueryLint } from '../linting';
4
- import { lintResolutionRedundancy } from '../linting/resolution';
5
- export const createEmitResolutionFeatures = (validation) => (props, helpers, validate) => {
6
- const { runMediaQueryValidation, validateResolutionValues } = validation;
7
- if (!runMediaQueryValidation(props, helpers, validateResolutionValues, 'resolution', 'resolution values must be greater than 0')) {
8
- return;
9
- }
10
- if (!runMediaQueryLint(props, helpers, lintResolutionRedundancy, 'resolution should not be combined with minResolution or maxResolution')) {
11
- return;
12
- }
13
- if (!applyMediaQueryValidation(props, helpers, validate, 'resolution')) {
14
- return;
15
- }
16
- const { addFeature } = helpers;
17
- if (props.resolutionValue) {
18
- addFeature('resolution', props.resolutionValue);
19
- }
20
- if (props.minResolution) {
21
- addFeature('min-resolution', props.minResolution);
22
- }
23
- if (props.maxResolution) {
24
- addFeature('max-resolution', props.maxResolution);
25
- }
26
- };
27
- export const emitResolutionFeatures = createEmitResolutionFeatures(defaultMediaQueryValidation);
@@ -1,117 +0,0 @@
1
- import type { AtRule, Properties } from "csstype";
2
- export type Resolve<T> = {
3
- [Key in keyof T]: T[Key];
4
- } & {};
5
- export type CSSVarFunction = string;
6
- export type MapLeafNodes<T, Leaf> = T extends null ? null : T extends string ? Leaf : T extends object ? {
7
- [Key in keyof T]: MapLeafNodes<T[Key], Leaf>;
8
- } : Leaf;
9
- type CSSTypeProperties = Properties<number | (string & {})>;
10
- export type CSSProperties = {
11
- [Property in keyof CSSTypeProperties]: CSSTypeProperties[Property] | CSSVarFunction | Array<CSSVarFunction | CSSTypeProperties[Property]>;
12
- };
13
- export interface CSSKeyframes {
14
- [time: string]: CSSPropertiesWithVars;
15
- }
16
- export type CSSPropertiesWithVars = CSSProperties & {
17
- vars?: {
18
- [key: string]: string;
19
- };
20
- };
21
- export type SimplePseudo = `:${string}` | `::${string}`;
22
- type PseudoProperties = {
23
- [key in SimplePseudo]?: CSSPropertiesWithVars;
24
- };
25
- type CSSPropertiesAndPseudos = CSSPropertiesWithVars & PseudoProperties;
26
- type Query<Key extends string, StyleType> = {
27
- [key in Key]?: {
28
- [query: string]: Omit<StyleType, Key>;
29
- };
30
- };
31
- export type MediaQueries<StyleType> = Query<"@media", StyleType>;
32
- export type FeatureQueries<StyleType> = Query<"@supports", StyleType>;
33
- export type ContainerQueries<StyleType> = Query<"@container", StyleType>;
34
- export type Layers<StyleType> = Query<"@layer", StyleType>;
35
- export type StartingStyle<StyleType> = {
36
- "@starting-style"?: Omit<StyleType, "@starting-style">;
37
- };
38
- interface AllQueries<StyleType> extends MediaQueries<StyleType & AllQueries<StyleType>>, FeatureQueries<StyleType & AllQueries<StyleType>>, ContainerQueries<StyleType & AllQueries<StyleType>>, Layers<StyleType & AllQueries<StyleType>>, StartingStyle<StyleType> {
39
- }
40
- export type WithQueries<StyleType> = StyleType & AllQueries<StyleType>;
41
- export interface StyleWithSelectors extends CSSPropertiesAndPseudos {
42
- selectors?: SelectorMap;
43
- }
44
- export type StyleRule = WithQueries<StyleWithSelectors>;
45
- export interface SelectorMap {
46
- [selector: string]: WithQueries<StyleWithSelectors>;
47
- }
48
- export type GlobalStyleRule = WithQueries<CSSPropertiesWithVars>;
49
- export type GlobalFontFaceRule = Omit<AtRule.FontFaceFallback, "src"> & Required<Pick<AtRule.FontFaceFallback, "src">>;
50
- export type FontFaceRule = Omit<GlobalFontFaceRule, "fontFamily">;
51
- export type CSSStyleBlock = {
52
- type: "local";
53
- selector: string;
54
- rule: StyleRule;
55
- };
56
- export type CSSFontFaceBlock = {
57
- type: "fontFace";
58
- rule: GlobalFontFaceRule;
59
- };
60
- export type CSSKeyframesBlock = {
61
- type: "keyframes";
62
- name: string;
63
- rule: CSSKeyframes;
64
- };
65
- export type CSSSelectorBlock = {
66
- type: "selector" | "global";
67
- selector: string;
68
- rule: GlobalStyleRule;
69
- };
70
- export type CSSLayerDeclaration = {
71
- type: "layer";
72
- name: string;
73
- };
74
- export type CSSPropertyBlock = {
75
- type: "property";
76
- name: string;
77
- rule: AtRule.Property;
78
- };
79
- export type CSS = CSSStyleBlock | CSSFontFaceBlock | CSSKeyframesBlock | CSSSelectorBlock | CSSLayerDeclaration | CSSPropertyBlock;
80
- export type FileScope = {
81
- packageName?: string;
82
- filePath: string;
83
- };
84
- export interface Composition {
85
- identifier: string;
86
- classList: string;
87
- }
88
- type CustomIdentFunction = (params: {
89
- hash: string;
90
- filePath: string;
91
- debugId?: string;
92
- packageName?: string;
93
- }) => string;
94
- type IdentOption = "short" | "debug" | CustomIdentFunction;
95
- export interface Adapter {
96
- appendCss: (css: CSS, fileScope: FileScope) => void;
97
- registerClassName: (className: string, fileScope: FileScope) => void;
98
- registerComposition: (composition: Composition, fileScope: FileScope) => void;
99
- markCompositionUsed: (identifier: string) => void;
100
- onBeginFileScope?: (fileScope: FileScope) => void;
101
- onEndFileScope: (fileScope: FileScope) => void;
102
- getIdentOption: () => IdentOption;
103
- }
104
- export type NullableTokens = {
105
- [key: string]: string | NullableTokens | null;
106
- };
107
- export type Tokens = {
108
- [key: string]: string | Tokens;
109
- };
110
- export type ThemeVars<ThemeContract extends NullableTokens> = MapLeafNodes<ThemeContract, CSSVarFunction>;
111
- export type ClassNames = string | Array<ClassNames>;
112
- export type ComplexStyleRule = StyleRule | Array<StyleRule | ClassNames>;
113
- type _PropertySyntax = "<angle>" | "<color>" | "<custom-ident>" | "<image>" | "<integer>" | "<length-percentage>" | "<length>" | "<number>" | "<percentage>" | "<resolution>" | "<string>" | "<time>" | "<transform-function>" | "<transform-list>" | "<url>" | "*";
114
- type LooseAutocomplete<Suggestions extends string> = Suggestions | Omit<string, Suggestions>;
115
- export type PropertySyntax = LooseAutocomplete<_PropertySyntax>;
116
- export {};
117
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KACtB,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;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AAEpD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;AAEzE,KAAK,eAAe,GAChB,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,SAAS,GACT,WAAW,GACX,qBAAqB,GACrB,UAAU,GACV,UAAU,GACV,cAAc,GACd,cAAc,GACd,UAAU,GACV,QAAQ,GACR,sBAAsB,GACtB,kBAAkB,GAClB,OAAO,GACP,GAAG,CAAC;AAER,KAAK,iBAAiB,CAAC,WAAW,SAAS,MAAM,IAC7C,WAAW,GACX,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE9B,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import type { MediaQueryBuilderHelpers } from './helpers';
2
- import { assertCondition } from '../core';
3
- import type { IMediaQueryCore } from './mediaQueries';
4
- import type { IMediaQueryDimensions } from './modules/dimensions';
5
- import type { IMediaQueryResolutionRange } from './modules/resolution';
6
- export type MediaQueryValidationCheck<TConfig> = (config: TConfig) => void;
7
- export type MediaQueryCoreHelpers = {
8
- assertCondition: typeof assertCondition;
9
- };
10
- export type MediaQueryValidation = ReturnType<typeof createMediaQueryValidation>;
11
- export declare const createMediaQueryValidation: (core: MediaQueryCoreHelpers) => {
12
- runMediaQueryValidation: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, check?: MediaQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean;
13
- validateMinMaxWidth: (props: IMediaQueryCore) => void;
14
- validateWidthValuesPositive: (props: IMediaQueryCore & IMediaQueryDimensions) => void;
15
- validateMinMaxHeight: (props: IMediaQueryDimensions) => void;
16
- validateHeightValuesPositive: (props: IMediaQueryDimensions) => void;
17
- validateMinMaxAspectRatio: (props: IMediaQueryDimensions) => void;
18
- validateAspectRatioValuesPositive: (props: IMediaQueryDimensions) => void;
19
- validateResolutionValues: (props: IMediaQueryResolutionRange) => void;
20
- };
21
- declare const defaultMediaQueryValidation: {
22
- runMediaQueryValidation: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, check?: MediaQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean;
23
- validateMinMaxWidth: (props: IMediaQueryCore) => void;
24
- validateWidthValuesPositive: (props: IMediaQueryCore & IMediaQueryDimensions) => void;
25
- validateMinMaxHeight: (props: IMediaQueryDimensions) => void;
26
- validateHeightValuesPositive: (props: IMediaQueryDimensions) => void;
27
- validateMinMaxAspectRatio: (props: IMediaQueryDimensions) => void;
28
- validateAspectRatioValuesPositive: (props: IMediaQueryDimensions) => void;
29
- validateResolutionValues: (props: IMediaQueryResolutionRange) => void;
30
- };
31
- export declare const runMediaQueryValidation: <TConfig>(config: TConfig, helpers: MediaQueryBuilderHelpers, check?: MediaQueryValidationCheck<TConfig>, context?: string, fallbackMessage?: string) => boolean, validateMinMaxWidth: (props: IMediaQueryCore) => void, validateWidthValuesPositive: (props: IMediaQueryCore & IMediaQueryDimensions) => void, validateMinMaxHeight: (props: IMediaQueryDimensions) => void, validateHeightValuesPositive: (props: IMediaQueryDimensions) => void, validateMinMaxAspectRatio: (props: IMediaQueryDimensions) => void, validateAspectRatioValuesPositive: (props: IMediaQueryDimensions) => void, validateResolutionValues: (props: IMediaQueryResolutionRange) => void;
32
- export { defaultMediaQueryValidation };
33
- //# sourceMappingURL=validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EAIhB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACl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BAAqB,KAC7C,IAAI,EAmKP,oBAAoB,UA5IX,qBAAqB,KAC3B,IAAI,EA4IP,4BAA4B,UAjInB,qBAAqB,KAC3B,IAAI,EAiIP,yBAAyB,UA1GhB,qBAAqB,KAC3B,IAAI,EA0GP,iCAAiC,UApFxB,qBAAqB,KAC3B,IAAI,EAoFP,wBAAwB,UAjDf,0BAA0B,KAChC,IAiD0B,CAAC;AAEhC,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -1,130 +0,0 @@
1
- import { applyMediaQueryValidation } from './helpers';
2
- import { assertCondition, isRatio, ratioToFloat, } from '../core';
3
- const toValidationResult = (error, fallback) => {
4
- if (error instanceof Error && error.message)
5
- return error.message;
6
- return fallback;
7
- };
8
- export const createMediaQueryValidation = (core) => {
9
- const { assertCondition } = core;
10
- const runMediaQueryValidation = (config, helpers, check, context, fallbackMessage = 'Invalid media query configuration') => {
11
- if (!check)
12
- return true;
13
- try {
14
- check(config);
15
- return true;
16
- }
17
- catch (error) {
18
- const result = toValidationResult(error, fallbackMessage);
19
- return applyMediaQueryValidation(config, helpers, () => result, context);
20
- }
21
- };
22
- const validateMinMaxWidth = (props) => {
23
- if (!props.minWidth || !props.maxWidth)
24
- return;
25
- // Mixed units are valid CSS — each bound is evaluated independently — so we
26
- // only enforce ordering when the units match and the comparison is meaningful.
27
- if (props.minWidth.getUnit() !== props.maxWidth.getUnit())
28
- return;
29
- assertCondition(props.minWidth.getValue() <= props.maxWidth.getValue(), 'minWidth must be less than or equal to maxWidth');
30
- };
31
- const validateWidthValuesPositive = (props) => {
32
- const assertPositive = (value, label) => {
33
- assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
34
- };
35
- if (props.width) {
36
- assertPositive(props.width, 'width');
37
- }
38
- if (props.minWidth) {
39
- assertPositive(props.minWidth, 'minWidth');
40
- }
41
- if (props.maxWidth) {
42
- assertPositive(props.maxWidth, 'maxWidth');
43
- }
44
- };
45
- const validateMinMaxHeight = (props) => {
46
- if (!props.minHeight || !props.maxHeight)
47
- return;
48
- // Mixed units are valid CSS; only enforce ordering when units match.
49
- if (props.minHeight.getUnit() !== props.maxHeight.getUnit())
50
- return;
51
- assertCondition(props.minHeight.getValue() <= props.maxHeight.getValue(), 'minHeight must be less than or equal to maxHeight');
52
- };
53
- const validateHeightValuesPositive = (props) => {
54
- const assertPositive = (value, label) => {
55
- assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
56
- };
57
- if (props.height) {
58
- assertPositive(props.height, 'height');
59
- }
60
- if (props.minHeight) {
61
- assertPositive(props.minHeight, 'minHeight');
62
- }
63
- if (props.maxHeight) {
64
- assertPositive(props.maxHeight, 'maxHeight');
65
- }
66
- };
67
- const validateMinMaxAspectRatio = (props) => {
68
- if (!props.minAspectRatio || !props.maxAspectRatio)
69
- return;
70
- const assertRatio = (value, label) => {
71
- assertCondition(isRatio(value), `${label} must be a ratio created with r()`);
72
- };
73
- assertRatio(props.minAspectRatio, 'minAspectRatio');
74
- assertRatio(props.maxAspectRatio, 'maxAspectRatio');
75
- const minRatio = ratioToFloat(props.minAspectRatio);
76
- const maxRatio = ratioToFloat(props.maxAspectRatio);
77
- assertCondition(minRatio <= maxRatio, 'minAspectRatio must be less than or equal to maxAspectRatio');
78
- };
79
- const validateAspectRatioValuesPositive = (props) => {
80
- const assertRatio = (value, label) => {
81
- assertCondition(isRatio(value), `${label} must be a ratio created with r()`);
82
- };
83
- const assertValidPositive = (label, ratio) => {
84
- assertCondition(ratioToFloat(ratio) > 0, `${label} must be a valid ratio greater than 0`);
85
- };
86
- if (props.aspectRatio !== undefined) {
87
- assertRatio(props.aspectRatio, 'aspectRatio');
88
- assertValidPositive('aspectRatio', props.aspectRatio);
89
- }
90
- if (props.minAspectRatio !== undefined) {
91
- assertRatio(props.minAspectRatio, 'minAspectRatio');
92
- assertValidPositive('minAspectRatio', props.minAspectRatio);
93
- }
94
- if (props.maxAspectRatio !== undefined) {
95
- assertRatio(props.maxAspectRatio, 'maxAspectRatio');
96
- assertValidPositive('maxAspectRatio', props.maxAspectRatio);
97
- }
98
- };
99
- const validateResolutionValues = (props) => {
100
- const assertPositive = (value, label) => {
101
- assertCondition(value.getValue() > 0, `${label} must be greater than 0`);
102
- };
103
- if (props.resolutionValue) {
104
- assertPositive(props.resolutionValue, 'resolution');
105
- }
106
- if (props.minResolution) {
107
- assertPositive(props.minResolution, 'minResolution');
108
- }
109
- if (props.maxResolution) {
110
- assertPositive(props.maxResolution, 'maxResolution');
111
- }
112
- // Resolution bounds may use different units (dpi, dpcm, dppx, x) — all
113
- // valid CSS — so we no longer require min/max to share a unit.
114
- };
115
- return {
116
- runMediaQueryValidation,
117
- validateMinMaxWidth,
118
- validateWidthValuesPositive,
119
- validateMinMaxHeight,
120
- validateHeightValuesPositive,
121
- validateMinMaxAspectRatio,
122
- validateAspectRatioValuesPositive,
123
- validateResolutionValues,
124
- };
125
- };
126
- const defaultMediaQueryValidation = createMediaQueryValidation({
127
- assertCondition,
128
- });
129
- export const { runMediaQueryValidation, validateMinMaxWidth, validateWidthValuesPositive, validateMinMaxHeight, validateHeightValuesPositive, validateMinMaxAspectRatio, validateAspectRatioValuesPositive, validateResolutionValues, } = defaultMediaQueryValidation;
130
- export { defaultMediaQueryValidation };
@@ -1,14 +0,0 @@
1
- export interface ISciNotation {
2
- coefficient: () => number;
3
- exponent: () => number;
4
- getUnit: () => string;
5
- css: () => string;
6
- toString: () => string;
7
- valueOf: () => number;
8
- getValue: () => number;
9
- withCoefficient: (coefficient: number) => ISciNotation;
10
- withExponent: (exponent: number) => ISciNotation;
11
- }
12
- export declare function sciNotation(coefficient: number, exponent: number, unit?: string): ISciNotation;
13
- export declare const isSciNotation: (value: unknown) => value is ISciNotation;
14
- //# sourceMappingURL=sciNotation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sciNotation.d.ts","sourceRoot":"","sources":["../../src/sciNotation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,eAAe,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,CAAC;IACvD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,YAAY,CAAC;CAClD;AA4DD,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,SAAO,GACV,YAAY,CAEd;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAWvD,CAAC"}
@@ -1,69 +0,0 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _SciNotationImpl_coefficient, _SciNotationImpl_exponent, _SciNotationImpl_unit;
13
- class SciNotationImpl {
14
- constructor(coefficient, exponent, unit = 'px') {
15
- _SciNotationImpl_coefficient.set(this, void 0);
16
- _SciNotationImpl_exponent.set(this, void 0);
17
- _SciNotationImpl_unit.set(this, void 0);
18
- if (!Number.isFinite(coefficient) || !Number.isFinite(exponent)) {
19
- throw new Error('Scientific notation values must be finite numbers.');
20
- }
21
- if (!Number.isInteger(exponent)) {
22
- throw new Error('Scientific notation exponent must be an integer.');
23
- }
24
- __classPrivateFieldSet(this, _SciNotationImpl_coefficient, coefficient, "f");
25
- __classPrivateFieldSet(this, _SciNotationImpl_exponent, exponent, "f");
26
- __classPrivateFieldSet(this, _SciNotationImpl_unit, unit.toLowerCase(), "f");
27
- }
28
- coefficient() {
29
- return __classPrivateFieldGet(this, _SciNotationImpl_coefficient, "f");
30
- }
31
- exponent() {
32
- return __classPrivateFieldGet(this, _SciNotationImpl_exponent, "f");
33
- }
34
- getUnit() {
35
- return __classPrivateFieldGet(this, _SciNotationImpl_unit, "f");
36
- }
37
- valueOf() {
38
- return __classPrivateFieldGet(this, _SciNotationImpl_coefficient, "f") * 10 ** __classPrivateFieldGet(this, _SciNotationImpl_exponent, "f");
39
- }
40
- getValue() {
41
- return this.valueOf();
42
- }
43
- css() {
44
- return `${this.valueOf()}${__classPrivateFieldGet(this, _SciNotationImpl_unit, "f")}`;
45
- }
46
- toString() {
47
- return this.css();
48
- }
49
- withCoefficient(coefficient) {
50
- return new SciNotationImpl(coefficient, __classPrivateFieldGet(this, _SciNotationImpl_exponent, "f"), __classPrivateFieldGet(this, _SciNotationImpl_unit, "f"));
51
- }
52
- withExponent(exponent) {
53
- return new SciNotationImpl(__classPrivateFieldGet(this, _SciNotationImpl_coefficient, "f"), exponent, __classPrivateFieldGet(this, _SciNotationImpl_unit, "f"));
54
- }
55
- }
56
- _SciNotationImpl_coefficient = new WeakMap(), _SciNotationImpl_exponent = new WeakMap(), _SciNotationImpl_unit = new WeakMap();
57
- export function sciNotation(coefficient, exponent, unit = 'px') {
58
- return new SciNotationImpl(coefficient, exponent, unit);
59
- }
60
- export const isSciNotation = (value) => {
61
- return (typeof value === 'object' &&
62
- value !== null &&
63
- 'coefficient' in value &&
64
- 'exponent' in value &&
65
- 'getUnit' in value &&
66
- typeof value.coefficient === 'function' &&
67
- typeof value.exponent === 'function' &&
68
- typeof value.getUnit === 'function');
69
- };
@@ -1,35 +0,0 @@
1
- export type Resolve<T> = {
2
- [Key in keyof T]: T[Key];
3
- } & {};
4
- export type CSSVarFunction = string;
5
- export type MapLeafNodes<T, Leaf> = T extends null ? null : T extends string ? Leaf : T extends object ? {
6
- [Key in keyof T]: MapLeafNodes<T[Key], Leaf>;
7
- } : Leaf;
8
- export type NullableTokens = {
9
- [key: string]: string | NullableTokens | null;
10
- };
11
- export type Tokens = {
12
- [key: string]: string | Tokens;
13
- };
14
- export type ThemeVars<ThemeContract extends NullableTokens> = MapLeafNodes<ThemeContract, CSSVarFunction>;
15
- export type ClassNames = string | Array<ClassNames>;
16
- type _PropertySyntax = "<angle>" | "<color>" | "<custom-ident>" | "<image>" | "<integer>" | "<length-percentage>" | "<length>" | "<number>" | "<percentage>" | "<resolution>" | "<string>" | "<time>" | "<transform-function>" | "<transform-list>" | "<url>" | "*";
17
- type LooseAutocomplete<Suggestions extends string> = Suggestions | Omit<string, Suggestions>;
18
- export type PropertySyntax = LooseAutocomplete<_PropertySyntax>;
19
- export type QueryRule<Key extends string, StyleType> = {
20
- [key in Key]?: {
21
- [query: string]: Omit<StyleType, Key>;
22
- };
23
- };
24
- export type QueryMedia<StyleType> = QueryRule<"@media", StyleType>;
25
- export type QueryFeature<StyleType> = QueryRule<"@supports", StyleType>;
26
- export type QueryContainer<StyleType> = QueryRule<"@container", StyleType>;
27
- export type QueryLayer<StyleType> = QueryRule<"@layer", StyleType>;
28
- export type QueryStartingStyle<StyleType> = {
29
- "@starting-style"?: Omit<StyleType, "@starting-style">;
30
- };
31
- export interface QueryAll<StyleType> extends QueryMedia<StyleType & QueryAll<StyleType>>, QueryFeature<StyleType & QueryAll<StyleType>>, QueryContainer<StyleType & QueryAll<StyleType>>, QueryLayer<StyleType & QueryAll<StyleType>>, QueryStartingStyle<StyleType> {
32
- }
33
- export type WithQuery<StyleType> = StyleType & QueryAll<StyleType>;
34
- export {};
35
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KACtB,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;CACzB,GAAG,EAAE,CAAC;AAEP,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,IAAI,GAC9C,IAAI,GACJ,CAAC,SAAS,MAAM,GAChB,IAAI,GACJ,CAAC,SAAS,MAAM,GAChB;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;CAAE,GAChD,IAAI,CAAC;AAET,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,aAAa,SAAS,cAAc,IAAI,YAAY,CACxE,aAAa,EACb,cAAc,CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AAEpD,KAAK,eAAe,GAChB,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,SAAS,GACT,WAAW,GACX,qBAAqB,GACrB,UAAU,GACV,UAAU,GACV,cAAc,GACd,cAAc,GACd,UAAU,GACV,QAAQ,GACR,sBAAsB,GACtB,kBAAkB,GAClB,OAAO,GACP,GAAG,CAAC;AAER,KAAK,iBAAiB,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,CAAC"}
package/dist/esm/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export type ValidationResult = boolean | string | null | undefined | {
2
- valid: boolean;
3
- message?: string;
4
- };
5
- export declare const normalizeValidationResult: (result: ValidationResult) => {
6
- valid: boolean;
7
- message?: string;
8
- };
9
- export declare const toValidationResult: (error: unknown, fallback: string) => ValidationResult;
10
- //# sourceMappingURL=validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/validation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT;IACE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,eAAO,MAAM,yBAAyB,GACpC,QAAQ,gBAAgB,KACvB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAOpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,OAAO,EACd,UAAU,MAAM,KACf,gBAGF,CAAC"}
@@ -1,15 +0,0 @@
1
- export const normalizeValidationResult = (result) => {
2
- if (result === undefined || result === null)
3
- return { valid: true };
4
- if (typeof result === "boolean")
5
- return { valid: result };
6
- if (typeof result === "string") {
7
- return result ? { valid: false, message: result } : { valid: true };
8
- }
9
- return result;
10
- };
11
- export const toValidationResult = (error, fallback) => {
12
- if (error instanceof Error && error.message)
13
- return error.message;
14
- return fallback;
15
- };
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /**
3
- * Example-only file.
4
- *
5
- * This is not part of the public API surface and is not published in the
6
- * package. It shows how to nest media + container query outputs, including
7
- * optional vanilla-extract helpers.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const css_1 = require("@vanilla-extract/css");
11
- const factory_wrapper_example_1 = require("./factory-wrapper.example");
12
- const containerQueries_1 = require("../src/containerQueries");
13
- const media = (0, factory_wrapper_example_1.makeMediaQueryStyle)({
14
- desktop: { minWidth: (0, factory_wrapper_example_1.m)(1024) },
15
- });
16
- const container = (0, containerQueries_1.makeContainerQueryStyle)({
17
- wideCard: {
18
- inlineSize: { operator: ">=", value: (0, factory_wrapper_example_1.m)(28, "rem") },
19
- },
20
- });
21
- // const nestedStyles = media({
22
- // desktop: container({
23
- // wideCard: {
24
- // gridTemplateColumns: "1fr 2fr",
25
- // gridTemplateRows: "none",
26
- // alignItems: "stretch",
27
- // },
28
- // }),
29
- // });
30
- const sampleClasses = {
31
- container: (0, css_1.style)({
32
- display: "grid",
33
- }),
34
- logo: (0, css_1.style)({}),
35
- text: (0, css_1.style)({}),
36
- };
37
- const sampleComponent = `
38
- <div className={container}>
39
- <div className={logo}>Logo</div>
40
- <div className={text}>Some text here</div>
41
- </div>
42
- `;
43
- // const vanillaExtractStyles = mediaQueryOutputVanillaExtract(
44
- // media({
45
- // desktop: containerQueryOutputVanillaExtract(
46
- // container({
47
- // wideCard: {
48
- // gridTemplateColumns: "1fr 2fr",
49
- // gridTemplateRows: "none",
50
- // },
51
- // }),
52
- // ),
53
- // }),
54
- // );
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /**
3
- * Example-only file.
4
- *
5
- * This is not part of the public API surface and is not published in the
6
- * package. It shows how to nest media + container query outputs, including
7
- * optional vanilla-extract helpers.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const css_1 = require("@vanilla-extract/css");
11
- const factory_wrapper_example_1 = require("./factory-wrapper.example");
12
- const containerQueries_1 = require("../src/containerQueries");
13
- const media = (0, factory_wrapper_example_1.makeMediaQueryStyle)({
14
- desktop: { minWidth: (0, factory_wrapper_example_1.m)(1024) },
15
- });
16
- const container = (0, containerQueries_1.makeContainerQueryStyle)({
17
- wideCard: {
18
- inlineSize: { operator: ">=", value: (0, factory_wrapper_example_1.m)(28, "rem") },
19
- },
20
- });
21
- // const nestedStyles = media({
22
- // desktop: container({
23
- // wideCard: {
24
- // gridTemplateColumns: "1fr 2fr",
25
- // gridTemplateRows: "none",
26
- // alignItems: "stretch",
27
- // },
28
- // }),
29
- // });
30
- const sampleClasses = {
31
- container: (0, css_1.style)({
32
- display: "grid",
33
- }),
34
- logo: (0, css_1.style)({}),
35
- text: (0, css_1.style)({}),
36
- };
37
- const sampleComponent = `
38
- <div className={container}>
39
- <div className={logo}>Logo</div>
40
- <div className={text}>Some text here</div>
41
- </div>
42
- `;
43
- // const vanillaExtractStyles = mediaQueryOutputVanillaExtract(
44
- // media({
45
- // desktop: containerQueryOutputVanillaExtract(
46
- // container({
47
- // wideCard: {
48
- // gridTemplateColumns: "1fr 2fr",
49
- // gridTemplateRows: "none",
50
- // },
51
- // }),
52
- // ),
53
- // }),
54
- // );
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.m = exports.mVw = exports.mEm = exports.makeMediaQueryStyle = exports.buildMediaQueryString = exports.units = exports.mediaQueries = exports.assertCondition = exports.assertMatchingUnits = exports.mPercent = exports.mPx = void 0;
4
- const factory_1 = require("css-calipers/factory");
5
- /**
6
- * Example wrapper module.
7
- * Use the factory once, then re-export from here across your app.
8
- * This keeps a single import path and makes refactors cheaper.
9
- */
10
- const calipers = (0, factory_1.createCalipers)({
11
- errorConfig: { stackHints: 'on' },
12
- });
13
- exports.mPx = calipers.mPx, exports.mPercent = calipers.mPercent, exports.assertMatchingUnits = calipers.assertMatchingUnits, exports.assertCondition = calipers.assertCondition, exports.mediaQueries = calipers.mediaQueries, exports.units = calipers.units;
14
- exports.buildMediaQueryString = exports.mediaQueries.buildMediaQueryString, exports.makeMediaQueryStyle = exports.mediaQueries.makeMediaQueryStyle;
15
- exports.mEm = exports.units.mEm, exports.mVw = exports.units.mVw;
16
- /**
17
- * Benefit: you can make custom changes in one place without touching call sites.
18
- * Example wrapper below is intentionally demonstrative, not a recommended m change.
19
- */
20
- const m = (value, unitOrOptions, context) => {
21
- var _a;
22
- if (!unitOrOptions) {
23
- return calipers.m(value, '%', context);
24
- }
25
- if (typeof unitOrOptions === 'object') {
26
- return calipers.m(value, {
27
- ...unitOrOptions,
28
- unit: (_a = unitOrOptions.unit) !== null && _a !== void 0 ? _a : '%',
29
- });
30
- }
31
- return calipers.m(value, unitOrOptions, context);
32
- };
33
- exports.m = m;