fashionable 0.2.0 → 0.3.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 (33) hide show
  1. package/dist/data/index.mjs +1 -1
  2. package/dist/declaration/index.d.mts +1 -1
  3. package/dist/declaration/index.mjs +1 -1
  4. package/dist/fontFace/index.d.mts +1 -1
  5. package/dist/property/index.d.mts +1 -1
  6. package/dist/property/index.mjs +1 -1
  7. package/dist/query/index.d.mts +1 -1
  8. package/dist/query/index.mjs +137 -3
  9. package/dist/query/index.mjs.map +1 -1
  10. package/dist/rule/index.d.mts +1 -1
  11. package/dist/rule/index.mjs +1 -1
  12. package/dist/shared/{color.internal-Dts5ycTm.mjs → color.internal-9fpSiiJk.mjs} +3 -3
  13. package/dist/shared/color.internal-9fpSiiJk.mjs.map +1 -0
  14. package/dist/shared/{declaration-1DlO_ltT.d.mts → declaration-B-6Ykgs_.d.mts} +2 -2
  15. package/dist/shared/{declaration.internal-wLB4ssxC.mjs → declaration.internal-BeasYIJ0.mjs} +2 -2
  16. package/dist/shared/{declaration.internal-wLB4ssxC.mjs.map → declaration.internal-BeasYIJ0.mjs.map} +1 -1
  17. package/dist/shared/{fontFaceRule-C7nYgH6X.d.mts → fontFaceRule-DdnLAuVw.d.mts} +2 -2
  18. package/dist/shared/mediaQuery-DsBivHi0.d.mts +333 -0
  19. package/dist/shared/{mediaQuery.internal-B6iuMd75.mjs → mediaQuery.internal-CKTmLVxL.mjs} +70 -6
  20. package/dist/shared/mediaQuery.internal-CKTmLVxL.mjs.map +1 -0
  21. package/dist/shared/{mediaRule-BDB4WCYy.d.mts → mediaRule-4kY2IOq-.d.mts} +3 -3
  22. package/dist/shared/{propertyRule-BbkFh9b9.d.mts → propertyRule-B5pf7NgH.d.mts} +2 -2
  23. package/dist/shared/{propertyRule.internal-Bc_HrfcL.mjs → propertyRule.internal-CRyFLwbn.mjs} +2 -2
  24. package/dist/shared/{propertyRule.internal-Bc_HrfcL.mjs.map → propertyRule.internal-CRyFLwbn.mjs.map} +1 -1
  25. package/dist/shared/{ruleSet.internal-DodzVMUU.mjs → ruleSet.internal-a5m40W9E.mjs} +3 -3
  26. package/dist/shared/{ruleSet.internal-DodzVMUU.mjs.map → ruleSet.internal-a5m40W9E.mjs.map} +1 -1
  27. package/dist/stylesheet/index.d.mts +29 -10
  28. package/dist/stylesheet/index.mjs +83 -21
  29. package/dist/stylesheet/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/shared/color.internal-Dts5ycTm.mjs.map +0 -1
  32. package/dist/shared/mediaQuery-BYR1z-iD.d.mts +0 -145
  33. package/dist/shared/mediaQuery.internal-B6iuMd75.mjs.map +0 -1
@@ -0,0 +1,333 @@
1
+ import { t as Pipeable } from "./utils-BKm298I-.mjs";
2
+ //#region src/query/mediaQuery.internal.d.ts
3
+ declare const MediaQueryTypeId: unique symbol;
4
+ type MediaQueryTypeId = typeof MediaQueryTypeId;
5
+ /**
6
+ * Phantom key holding a `MediaQuery`'s `Features` parameter. The runtime
7
+ * never stores a value here — known features are type-level brands, so a
8
+ * query is identical at runtime whatever its type knows (the curvy trait
9
+ * pattern, as `ColorSpace` uses for polar-ness).
10
+ *
11
+ * @internal
12
+ */
13
+ declare const MediaQueryFeatures: unique symbol;
14
+ type MediaQueryFeatures = typeof MediaQueryFeatures;
15
+ declare namespace mediaQuery_d_exports {
16
+ export { MaxWidth, MediaQuery, MinWidth, PrefersColorScheme, RenderOptions, and, equals, getMaxWidth, getMinWidth, getPrefersColorScheme, hasMaxWidth, hasMinWidth, hasPrefersColorScheme, isMediaQuery, maxWidth, minWidth, prefersColorScheme, render };
17
+ }
18
+ declare const MinWidthId: unique symbol;
19
+ declare const MaxWidthId: unique symbol;
20
+ declare const PrefersColorSchemeId: unique symbol;
21
+ /**
22
+ * A media query: a canonically ordered, deduplicated and-set of media
23
+ * features.
24
+ *
25
+ * Feature constructors (`minWidth`, `maxWidth`, `prefersColorScheme`)
26
+ * return one-feature queries; `and` merges. Conjunction is commutative
27
+ * and idempotent, so construction sorts features canonically and drops
28
+ * exact duplicates — structurally equal queries compare equal however
29
+ * they were built. The canonical order is stable public API: `min-width`
30
+ * features first (ascending by threshold), then `max-width` (ascending),
31
+ * then `prefers-color-scheme` (schemes alphabetically). Distinct features
32
+ * always all render, even when one subsumes another (`minWidth(768)` and
33
+ * `minWidth(1024)`): simplification changes no meaning but is not this
34
+ * type's job.
35
+ *
36
+ * `Features` records, as intersected type-level brands, which feature
37
+ * kinds are known to be present. It defaults to `unknown` — no claims.
38
+ * Constructors brand their result (`minWidth` returns
39
+ * `MediaQuery<MinWidth>`), `and` keeps both sides' brands, the `has*`
40
+ * guards recover a brand from a plain query at runtime, and the `get*`
41
+ * accessors key their return type on it to drop `undefined`. Brands are
42
+ * type-level only: a query is identical at runtime whatever its type
43
+ * knows.
44
+ *
45
+ * `or` and `not` become new node kinds when a consumer needs them.
46
+ *
47
+ * @since 0.1.0
48
+ */
49
+ interface MediaQuery<out Features = unknown> extends Pipeable {
50
+ readonly [MediaQueryTypeId]: MediaQueryTypeId;
51
+ readonly [MediaQueryFeatures]?: Features;
52
+ }
53
+ /**
54
+ * The brand of a query known to carry a `min-width` feature. `minWidth`
55
+ * stamps it, `and` keeps it through conjunction, `hasMinWidth` recovers
56
+ * it at runtime, and `getMinWidth` returns a guaranteed `number` where it
57
+ * is present. Composes by intersection with the other feature brands.
58
+ *
59
+ * @since 0.3.0
60
+ */
61
+ type MinWidth = {
62
+ readonly [MinWidthId]: 'minWidth';
63
+ };
64
+ /**
65
+ * The brand of a query known to carry a `max-width` feature. `maxWidth`
66
+ * stamps it, `and` keeps it through conjunction, `hasMaxWidth` recovers
67
+ * it at runtime, and `getMaxWidth` returns a guaranteed `number` where it
68
+ * is present. Composes by intersection with the other feature brands.
69
+ *
70
+ * @since 0.3.0
71
+ */
72
+ type MaxWidth = {
73
+ readonly [MaxWidthId]: 'maxWidth';
74
+ };
75
+ /**
76
+ * The brand of a query known to carry a `prefers-color-scheme` feature.
77
+ * `prefersColorScheme` stamps it, `and` keeps it through conjunction,
78
+ * `hasPrefersColorScheme` recovers it at runtime, and
79
+ * `getPrefersColorScheme` returns a guaranteed scheme where it is
80
+ * present. Composes by intersection with the other feature brands.
81
+ *
82
+ * @since 0.3.0
83
+ */
84
+ type PrefersColorScheme = {
85
+ readonly [PrefersColorSchemeId]: 'prefersColorScheme';
86
+ };
87
+ /**
88
+ * Options for `render` — and the base of the library's render-options
89
+ * family: every other module's `RenderOptions` extends this interface
90
+ * (directly or through `Declaration.RenderOptions` and
91
+ * `RuleSet.RenderOptions`), so an options object built for a bigger
92
+ * renderer is accepted by every smaller one. A key means the same thing
93
+ * wherever it appears; renderers ignore inherited keys that don't apply
94
+ * to them.
95
+ *
96
+ * @since 0.1.0
97
+ */
98
+ interface RenderOptions {
99
+ /**
100
+ * The width-feature spelling: classic prefix syntax
101
+ * (`(min-width: 768px)`, the default) or modern range syntax
102
+ * (`(width >= 768px)`). Text only — the model is semantic and the two
103
+ * spellings mean the same thing.
104
+ */
105
+ readonly mediaSyntax?: 'prefix' | 'range';
106
+ }
107
+ /**
108
+ * Checks if a value is a `MediaQuery`.
109
+ *
110
+ * True only for values built by this module's constructors, which carry
111
+ * the brand.
112
+ *
113
+ * @param u - The value to check.
114
+ * @returns `true` if the value is a `MediaQuery`, `false` otherwise.
115
+ * @since 0.1.0
116
+ */
117
+ declare const isMediaQuery: (u: unknown) => u is MediaQuery;
118
+ /**
119
+ * Creates a viewport-width lower bound.
120
+ *
121
+ * The result carries the `MinWidth` brand, so `getMinWidth` returns a
122
+ * bare `number` on it and on any conjunction built from it.
123
+ *
124
+ * @param px - The threshold in CSS pixels. Must be a non-negative finite number.
125
+ * @returns A one-feature `MediaQuery`, branded `MinWidth`.
126
+ * @throws `Error` when `px` is negative or not finite.
127
+ * @example
128
+ * ```ts
129
+ * MediaQuery.render(MediaQuery.minWidth(768)) // '(min-width: 768px)'
130
+ * MediaQuery.render(MediaQuery.minWidth(768), { mediaSyntax: 'range' }) // '(width >= 768px)'
131
+ * ```
132
+ * @since 0.1.0
133
+ */
134
+ declare const minWidth: (px: number) => MediaQuery<MinWidth>;
135
+ /**
136
+ * Creates a viewport-width upper bound.
137
+ *
138
+ * The result carries the `MaxWidth` brand, so `getMaxWidth` returns a
139
+ * bare `number` on it and on any conjunction built from it.
140
+ *
141
+ * @param px - The threshold in CSS pixels. Must be a non-negative finite number.
142
+ * @returns A one-feature `MediaQuery`, branded `MaxWidth`.
143
+ * @throws `Error` when `px` is negative or not finite.
144
+ * @example
145
+ * ```ts
146
+ * MediaQuery.render(MediaQuery.maxWidth(1024)) // '(max-width: 1024px)'
147
+ * MediaQuery.render(MediaQuery.maxWidth(1024), { mediaSyntax: 'range' }) // '(width <= 1024px)'
148
+ * ```
149
+ * @since 0.3.0
150
+ */
151
+ declare const maxWidth: (px: number) => MediaQuery<MaxWidth>;
152
+ /**
153
+ * Creates a `prefers-color-scheme` condition.
154
+ *
155
+ * The result carries the `PrefersColorScheme` brand, so
156
+ * `getPrefersColorScheme` returns a guaranteed scheme on it and on any
157
+ * conjunction built from it.
158
+ *
159
+ * @param scheme - The scheme to match, `'dark'` or `'light'`.
160
+ * @returns A one-feature `MediaQuery`, branded `PrefersColorScheme`.
161
+ * @since 0.1.0
162
+ */
163
+ declare const prefersColorScheme: (scheme: 'dark' | 'light') => MediaQuery<PrefersColorScheme>;
164
+ declare const and: {
165
+ /**
166
+ * Returns a function that conjoins `that` with its argument.
167
+ *
168
+ * @param that - The query to merge in.
169
+ * @returns A function producing the conjunction.
170
+ * @since 0.1.0
171
+ */
172
+ <B>(that: MediaQuery<B>): <A>(self: MediaQuery<A>) => MediaQuery<A & B>;
173
+ /**
174
+ * Conjoins two queries: the result matches where both match. Features
175
+ * re-sort into canonical order and exact duplicates collapse, so `and`
176
+ * is commutative and idempotent.
177
+ *
178
+ * Known features intersect: the result keeps every brand either side
179
+ * carries, so a `MinWidth` query stays `MinWidth` through conjunction.
180
+ *
181
+ * @param self - The first query.
182
+ * @param that - The second query.
183
+ * @returns The conjunction, branded with both sides' known features.
184
+ * @example
185
+ * ```ts
186
+ * MediaQuery.minWidth(1280).pipe(
187
+ * MediaQuery.and(MediaQuery.prefersColorScheme('dark')),
188
+ * MediaQuery.render,
189
+ * ) // '(min-width: 1280px) and (prefers-color-scheme: dark)'
190
+ * ```
191
+ * @since 0.1.0
192
+ */
193
+ <A, B>(self: MediaQuery<A>, that: MediaQuery<B>): MediaQuery<A & B>;
194
+ };
195
+ /**
196
+ * Gets the query's `min-width` threshold.
197
+ *
198
+ * The return type keys on the `MinWidth` brand. Where the type proves a
199
+ * `min-width` feature is present — `minWidth`'s result, any conjunction
200
+ * keeping its brand, or a query narrowed by `hasMinWidth` — the result is
201
+ * a bare `number`. On any other query it is `number | undefined`.
202
+ *
203
+ * When several `min-width` features stack, the largest threshold is
204
+ * returned — the conjunction's effective lower bound, since every
205
+ * feature must hold.
206
+ *
207
+ * @param query - The query to read.
208
+ * @returns The largest `min-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `min-width` feature.
209
+ * @example
210
+ * ```ts
211
+ * MediaQuery.getMinWidth(MediaQuery.minWidth(768)) // 768
212
+ * MediaQuery.getMinWidth(MediaQuery.prefersColorScheme('dark')) // undefined
213
+ * MediaQuery.minWidth(768).pipe(
214
+ * MediaQuery.and(MediaQuery.minWidth(1024)),
215
+ * MediaQuery.getMinWidth,
216
+ * ) // 1024
217
+ * ```
218
+ * @since 0.3.0
219
+ */
220
+ declare const getMinWidth: <T>(query: MediaQuery<T>) => T extends MinWidth ? number : number | undefined;
221
+ /**
222
+ * Gets the query's `max-width` threshold.
223
+ *
224
+ * The return type keys on the `MaxWidth` brand. Where the type proves a
225
+ * `max-width` feature is present — `maxWidth`'s result, any conjunction
226
+ * keeping its brand, or a query narrowed by `hasMaxWidth` — the result is
227
+ * a bare `number`. On any other query it is `number | undefined`.
228
+ *
229
+ * When several `max-width` features stack, the smallest threshold is
230
+ * returned — the conjunction's effective upper bound, since every
231
+ * feature must hold.
232
+ *
233
+ * @param query - The query to read.
234
+ * @returns The smallest `max-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `max-width` feature.
235
+ * @example
236
+ * ```ts
237
+ * MediaQuery.getMaxWidth(MediaQuery.maxWidth(1024)) // 1024
238
+ * MediaQuery.getMaxWidth(MediaQuery.minWidth(768)) // undefined
239
+ * ```
240
+ * @since 0.3.0
241
+ */
242
+ declare const getMaxWidth: <T>(query: MediaQuery<T>) => T extends MaxWidth ? number : number | undefined;
243
+ /**
244
+ * Gets the query's `prefers-color-scheme` value.
245
+ *
246
+ * The return type keys on the `PrefersColorScheme` brand. Where the type
247
+ * proves the feature is present, the result is a bare `'dark' | 'light'`.
248
+ * On any other query it may also be `undefined`.
249
+ *
250
+ * A query holding both schemes matches nothing; the accessor then
251
+ * returns `'dark'`, the alphabetically first in canonical order.
252
+ *
253
+ * @param query - The query to read.
254
+ * @returns The required scheme, or `undefined` when an unbranded query carries no `prefers-color-scheme` feature.
255
+ * @example
256
+ * ```ts
257
+ * MediaQuery.getPrefersColorScheme(MediaQuery.prefersColorScheme('dark')) // 'dark'
258
+ * MediaQuery.getPrefersColorScheme(MediaQuery.minWidth(768)) // undefined
259
+ * ```
260
+ * @since 0.3.0
261
+ */
262
+ declare const getPrefersColorScheme: <T>(query: MediaQuery<T>) => T extends PrefersColorScheme ? 'dark' | 'light' : 'dark' | 'light' | undefined;
263
+ /**
264
+ * Checks if the query carries a `min-width` feature, narrowing its type
265
+ * to `MediaQuery<MinWidth>` so `getMinWidth` returns a bare `number`.
266
+ *
267
+ * @param query - The query to check.
268
+ * @returns `true` if a `min-width` feature is present, `false` otherwise.
269
+ * @example
270
+ * ```ts
271
+ * declare const query: MediaQuery.MediaQuery
272
+ * if (MediaQuery.hasMinWidth(query)) {
273
+ * MediaQuery.getMinWidth(query) // number, not number | undefined
274
+ * }
275
+ * ```
276
+ * @since 0.3.0
277
+ */
278
+ declare const hasMinWidth: (query: MediaQuery) => query is MediaQuery<MinWidth>;
279
+ /**
280
+ * Checks if the query carries a `max-width` feature, narrowing its type
281
+ * to `MediaQuery<MaxWidth>` so `getMaxWidth` returns a bare `number`.
282
+ *
283
+ * @param query - The query to check.
284
+ * @returns `true` if a `max-width` feature is present, `false` otherwise.
285
+ * @since 0.3.0
286
+ */
287
+ declare const hasMaxWidth: (query: MediaQuery) => query is MediaQuery<MaxWidth>;
288
+ /**
289
+ * Checks if the query carries a `prefers-color-scheme` feature, narrowing
290
+ * its type to `MediaQuery<PrefersColorScheme>` so `getPrefersColorScheme`
291
+ * returns a guaranteed scheme.
292
+ *
293
+ * @param query - The query to check.
294
+ * @returns `true` if a `prefers-color-scheme` feature is present, `false` otherwise.
295
+ * @since 0.3.0
296
+ */
297
+ declare const hasPrefersColorScheme: (query: MediaQuery) => query is MediaQuery<PrefersColorScheme>;
298
+ /**
299
+ * Renders the query as CSS text: features in canonical order —
300
+ * `min-width` ascending, then `prefers-color-scheme` — joined with
301
+ * ` and `. The `mediaSyntax` option picks the width-feature spelling
302
+ * (default `'prefix'`).
303
+ *
304
+ * @param query - The query to render.
305
+ * @param options - Optional syntax selection.
306
+ * @returns Deterministic CSS text, without the `@media ` prefix.
307
+ * @since 0.1.0
308
+ */
309
+ declare const render: (query: MediaQuery, options?: RenderOptions) => string;
310
+ declare const equals: {
311
+ /**
312
+ * Returns a function that checks structural equality against `that`.
313
+ *
314
+ * @param that - The query to compare against.
315
+ * @returns A function testing its argument for structural equality with `that`.
316
+ * @since 0.1.0
317
+ */
318
+ (that: MediaQuery): (self: MediaQuery) => boolean;
319
+ /**
320
+ * Structural equality over canonically ordered features: two queries
321
+ * built from the same conditions compare equal regardless of
322
+ * construction order.
323
+ *
324
+ * @param self - The first query.
325
+ * @param that - The second query.
326
+ * @returns `true` if the queries are structurally equal.
327
+ * @since 0.1.0
328
+ */
329
+ (self: MediaQuery, that: MediaQuery): boolean;
330
+ };
331
+ //#endregion
332
+ export { RenderOptions as n, mediaQuery_d_exports as r, MediaQuery as t };
333
+ //# sourceMappingURL=mediaQuery-DsBivHi0.d.mts.map
@@ -6,25 +6,26 @@ const MediaQueryTypeId = Symbol.for("fashionable/query/mediaQuery");
6
6
  const featureRank = (feature) => {
7
7
  switch (feature._tag) {
8
8
  case "MinWidth": return 0;
9
- case "PrefersColorScheme": return 1;
9
+ case "MaxWidth": return 1;
10
+ case "PrefersColorScheme": return 2;
10
11
  }
11
12
  };
12
13
  const compareFeatures = (a, b) => {
13
14
  const rank = featureRank(a) - featureRank(b);
14
15
  if (rank !== 0) return rank;
15
- if (a._tag === "MinWidth") return a.px - b.px;
16
+ if (a._tag === "MinWidth" || a._tag === "MaxWidth") return a.px - b.px;
16
17
  const x = a.scheme;
17
18
  const y = b.scheme;
18
19
  return x < y ? -1 : x > y ? 1 : 0;
19
20
  };
20
21
  const featureEquals = (a, b) => {
21
22
  if (a._tag !== b._tag) return false;
22
- if (a._tag === "MinWidth") return a.px === b.px;
23
+ if (a._tag === "MinWidth" || a._tag === "MaxWidth") return a.px === b.px;
23
24
  return a.scheme === b.scheme;
24
25
  };
25
26
  const featureHash = (feature) => {
26
27
  const h = hashString(feature._tag);
27
- if (feature._tag === "MinWidth") return combine(h, hashNumber(feature.px));
28
+ if (feature._tag === "MinWidth" || feature._tag === "MaxWidth") return combine(h, hashNumber(feature.px));
28
29
  return combine(h, hashString(feature.scheme));
29
30
  };
30
31
  const renderFeature = (feature, syntax) => {
@@ -33,6 +34,10 @@ const renderFeature = (feature, syntax) => {
33
34
  const px = formatDecimals(feature.px, 5);
34
35
  return syntax === "prefix" ? `(min-width: ${px}px)` : `(width >= ${px}px)`;
35
36
  }
37
+ case "MaxWidth": {
38
+ const px = formatDecimals(feature.px, 5);
39
+ return syntax === "prefix" ? `(max-width: ${px}px)` : `(width <= ${px}px)`;
40
+ }
36
41
  case "PrefersColorScheme": return `(prefers-color-scheme: ${feature.scheme})`;
37
42
  }
38
43
  };
@@ -84,6 +89,14 @@ const minWidth = (px) => {
84
89
  }]);
85
90
  };
86
91
  /** @internal */
92
+ const maxWidth = (px) => {
93
+ invariant(Number.isFinite(px) && px >= 0, `max-width threshold must be a non-negative finite number of pixels, got ${px}`);
94
+ return new MediaQueryImpl([{
95
+ _tag: "MaxWidth",
96
+ px
97
+ }]);
98
+ };
99
+ /** @internal */
87
100
  const prefersColorScheme = (scheme) => new MediaQueryImpl([{
88
101
  _tag: "PrefersColorScheme",
89
102
  scheme
@@ -91,10 +104,61 @@ const prefersColorScheme = (scheme) => new MediaQueryImpl([{
91
104
  /** @internal */
92
105
  const and = dual(2, (self, that) => new MediaQueryImpl(canonicalize([...featuresOf(self), ...featuresOf(that)])));
93
106
  /** @internal */
107
+ function getMinWidth(query) {
108
+ return featuresOf(query).findLast((feature) => feature._tag === "MinWidth")?.px;
109
+ }
110
+ /** @internal */
111
+ function getMaxWidth(query) {
112
+ return featuresOf(query).find((feature) => feature._tag === "MaxWidth")?.px;
113
+ }
114
+ /** @internal */
115
+ function getPrefersColorScheme(query) {
116
+ return featuresOf(query).find((feature) => feature._tag === "PrefersColorScheme")?.scheme;
117
+ }
118
+ /** @internal */
119
+ const hasMinWidth = (query) => featuresOf(query).some((feature) => feature._tag === "MinWidth");
120
+ /** @internal */
121
+ const hasMaxWidth = (query) => featuresOf(query).some((feature) => feature._tag === "MaxWidth");
122
+ /** @internal */
123
+ const hasPrefersColorScheme = (query) => featuresOf(query).some((feature) => feature._tag === "PrefersColorScheme");
124
+ const EMPTY_FEATURES = [];
125
+ const optionalFeaturesOf = (query) => query === void 0 ? EMPTY_FEATURES : featuresOf(query);
126
+ const featureImplies = (source, target) => {
127
+ switch (target._tag) {
128
+ case "MinWidth": return source._tag === "MinWidth" && source.px >= target.px;
129
+ case "MaxWidth": return source._tag === "MaxWidth" && source.px <= target.px;
130
+ case "PrefersColorScheme": return source._tag === "PrefersColorScheme" && source.scheme === target.scheme;
131
+ }
132
+ };
133
+ /** @internal */
134
+ const implies = (self, that) => {
135
+ const source = optionalFeaturesOf(self);
136
+ return optionalFeaturesOf(that).every((target) => source.some((feature) => featureImplies(feature, target)));
137
+ };
138
+ /** @internal */
139
+ const coSatisfiable = (self, that) => {
140
+ let lower = 0;
141
+ let upper = Number.POSITIVE_INFINITY;
142
+ let scheme;
143
+ for (const feature of [...optionalFeaturesOf(self), ...optionalFeaturesOf(that)]) switch (feature._tag) {
144
+ case "MinWidth":
145
+ lower = Math.max(lower, feature.px);
146
+ break;
147
+ case "MaxWidth":
148
+ upper = Math.min(upper, feature.px);
149
+ break;
150
+ case "PrefersColorScheme":
151
+ if (scheme !== void 0 && scheme !== feature.scheme) return false;
152
+ scheme = feature.scheme;
153
+ break;
154
+ }
155
+ return lower <= upper;
156
+ };
157
+ /** @internal */
94
158
  const render = (query, options) => renderImpl(query, options?.mediaSyntax ?? "prefix");
95
159
  /** @internal */
96
160
  const equals = dual(2, (self, that) => equals$1(self, that));
97
161
  //#endregion
98
- export { prefersColorScheme as a, minWidth as i, equals as n, render as o, isMediaQuery as r, and as t };
162
+ export { getMinWidth as a, hasMinWidth as c, isMediaQuery as d, maxWidth as f, render as h, getMaxWidth as i, hasPrefersColorScheme as l, prefersColorScheme as m, coSatisfiable as n, getPrefersColorScheme as o, minWidth as p, equals as r, hasMaxWidth as s, and as t, implies as u };
99
163
 
100
- //# sourceMappingURL=mediaQuery.internal-B6iuMd75.mjs.map
164
+ //# sourceMappingURL=mediaQuery.internal-CKTmLVxL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQuery.internal-CKTmLVxL.mjs","names":["Equal.hashString","Equal.combine","Equal.hashNumber","Equal.EqualTypeId","Equal.HashTypeId","#hash","Equal.equals"],"sources":["../../src/query/mediaQuery.internal.ts"],"sourcesContent":["import * as Equal from '#internal/equal'\nimport { formatDecimals } from '#internal/format'\nimport { dual, invariant, Pipeable } from '#util'\nimport type {\n MaxWidth,\n MediaQuery,\n MinWidth,\n PrefersColorScheme,\n RenderOptions,\n} from './mediaQuery.ts'\n\nexport const MediaQueryTypeId = Symbol.for('fashionable/query/mediaQuery')\nexport type MediaQueryTypeId = typeof MediaQueryTypeId\n\n/**\n * Phantom key holding a `MediaQuery`'s `Features` parameter. The runtime\n * never stores a value here — known features are type-level brands, so a\n * query is identical at runtime whatever its type knows (the curvy trait\n * pattern, as `ColorSpace` uses for polar-ness).\n *\n * @internal\n */\nexport const MediaQueryFeatures: unique symbol = Symbol.for('fashionable/query/mediaQuery/features')\nexport type MediaQueryFeatures = typeof MediaQueryFeatures\n\n// ---------------------------------------------------------------------------\n// feature ADT\n// ---------------------------------------------------------------------------\n\n/** @internal */\nexport type MediaFeature =\n | { readonly _tag: 'MinWidth'; readonly px: number }\n | { readonly _tag: 'MaxWidth'; readonly px: number }\n | { readonly _tag: 'PrefersColorScheme'; readonly scheme: 'dark' | 'light' }\n\n// Feature kinds order by definition rank, then within kind: widths\n// ascending by threshold, scheme values alphabetically. Conjunction is\n// commutative and idempotent, so the model sorts and dedups at\n// construction; equal queries compare equal however they were built.\n// max-width slots beside min-width — a new kind reshuffles no existing\n// output, so it takes the rank that reads best, not the end of the ladder.\nconst featureRank = (feature: MediaFeature): number => {\n switch (feature._tag) {\n case 'MinWidth':\n return 0\n case 'MaxWidth':\n return 1\n case 'PrefersColorScheme':\n return 2\n }\n}\n\nconst compareFeatures = (a: MediaFeature, b: MediaFeature): number => {\n const rank = featureRank(a) - featureRank(b)\n if (rank !== 0) {\n return rank\n }\n if (a._tag === 'MinWidth' || a._tag === 'MaxWidth') {\n return a.px - (b as typeof a).px\n }\n const x = (a as Extract<MediaFeature, { _tag: 'PrefersColorScheme' }>).scheme\n const y = (b as Extract<MediaFeature, { _tag: 'PrefersColorScheme' }>).scheme\n return x < y ? -1 : x > y ? 1 : 0\n}\n\nconst featureEquals = (a: MediaFeature, b: MediaFeature): boolean => {\n if (a._tag !== b._tag) {\n return false\n }\n if (a._tag === 'MinWidth' || a._tag === 'MaxWidth') {\n return a.px === (b as typeof a).px\n }\n return a.scheme === (b as typeof a).scheme\n}\n\nconst featureHash = (feature: MediaFeature): number => {\n const h = Equal.hashString(feature._tag)\n if (feature._tag === 'MinWidth' || feature._tag === 'MaxWidth') {\n return Equal.combine(h, Equal.hashNumber(feature.px))\n }\n return Equal.combine(h, Equal.hashString(feature.scheme))\n}\n\nconst renderFeature = (feature: MediaFeature, syntax: 'prefix' | 'range'): string => {\n switch (feature._tag) {\n case 'MinWidth': {\n const px = formatDecimals(feature.px, 5)\n return syntax === 'prefix' ? `(min-width: ${px}px)` : `(width >= ${px}px)`\n }\n case 'MaxWidth': {\n const px = formatDecimals(feature.px, 5)\n return syntax === 'prefix' ? `(max-width: ${px}px)` : `(width <= ${px}px)`\n }\n case 'PrefersColorScheme':\n return `(prefers-color-scheme: ${feature.scheme})`\n }\n}\n\nconst canonicalize = (features: ReadonlyArray<MediaFeature>): ReadonlyArray<MediaFeature> => {\n const sorted = [...features].toSorted(compareFeatures)\n const deduped: Array<MediaFeature> = []\n for (const feature of sorted) {\n const last = deduped[deduped.length - 1]\n if (last === undefined || !featureEquals(last, feature)) {\n deduped.push(feature)\n }\n }\n return deduped\n}\n\n// ---------------------------------------------------------------------------\n// the value\n// ---------------------------------------------------------------------------\n\nclass MediaQueryImpl extends Pipeable implements MediaQuery, Equal.Equal {\n readonly [MediaQueryTypeId]: MediaQueryTypeId = MediaQueryTypeId\n\n readonly features: ReadonlyArray<MediaFeature>\n #hash: number | undefined\n\n constructor(features: ReadonlyArray<MediaFeature>) {\n super()\n this.features = features\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return (\n isMediaQuery(that) &&\n this.features.length === featuresOf(that).length &&\n this.features.every((feature, index) =>\n featureEquals(feature, featuresOf(that)[index] as MediaFeature),\n )\n )\n }\n\n [Equal.HashTypeId](): number {\n if (this.#hash === undefined) {\n let h = Equal.hashString('fashionable/query/mediaQuery')\n for (const feature of this.features) {\n h = Equal.combine(h, featureHash(feature))\n }\n this.#hash = h\n }\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `MediaQuery(${renderImpl(this, 'prefix')})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isMediaQuery = (u: unknown): u is MediaQuery =>\n typeof u === 'object' && u !== null && MediaQueryTypeId in u\n\nconst featuresOf = (query: MediaQuery): ReadonlyArray<MediaFeature> =>\n (query as MediaQueryImpl).features\n\nconst renderImpl = (query: MediaQuery, syntax: 'prefix' | 'range'): string =>\n featuresOf(query)\n .map((feature) => renderFeature(feature, syntax))\n .join(' and ')\n\n// ---------------------------------------------------------------------------\n// constructors, combinators, projections\n// ---------------------------------------------------------------------------\n\n/** @internal */\nexport const minWidth = (px: number): MediaQuery<MinWidth> => {\n invariant(\n Number.isFinite(px) && px >= 0,\n `min-width threshold must be a non-negative finite number of pixels, got ${px}`,\n )\n return new MediaQueryImpl([{ _tag: 'MinWidth', px }])\n}\n\n/** @internal */\nexport const maxWidth = (px: number): MediaQuery<MaxWidth> => {\n invariant(\n Number.isFinite(px) && px >= 0,\n `max-width threshold must be a non-negative finite number of pixels, got ${px}`,\n )\n return new MediaQueryImpl([{ _tag: 'MaxWidth', px }])\n}\n\n/** @internal */\nexport const prefersColorScheme = (scheme: 'dark' | 'light'): MediaQuery<PrefersColorScheme> =>\n new MediaQueryImpl([{ _tag: 'PrefersColorScheme', scheme }])\n\n// `MediaQuery<never>` is the bottom of the covariant trait parameter, so\n// the erased implementation assigns to every public trait instantiation\n// (the same move as `Color<never>` under `mix`).\n/** @internal */\nexport const and = dual<\n (that: MediaQuery) => (self: MediaQuery) => MediaQuery<never>,\n (self: MediaQuery, that: MediaQuery) => MediaQuery<never>\n>(\n 2,\n (self: MediaQuery, that: MediaQuery): MediaQuery<never> =>\n new MediaQueryImpl(canonicalize([...featuresOf(self), ...featuresOf(that)])),\n)\n\n// Accessors are single generic signatures, not two-overload sets: an\n// overloaded function contributes only its last signature to inference\n// when passed higher-order (a pipe tail), which would erase the brand\n// guarantee exactly where it earns its keep. The conditional return\n// survives both positions.\n/** @internal */\nexport function getMinWidth<T>(\n query: MediaQuery<T>,\n): T extends MinWidth ? number : number | undefined\n/** @internal */\nexport function getMinWidth(query: MediaQuery): number | undefined {\n // Min-widths sort ascending in canonical order, so the last one is the\n // conjunction's effective lower bound (every feature must hold).\n return featuresOf(query).findLast((feature) => feature._tag === 'MinWidth')?.px\n}\n\n/** @internal */\nexport function getMaxWidth<T>(\n query: MediaQuery<T>,\n): T extends MaxWidth ? number : number | undefined\n/** @internal */\nexport function getMaxWidth(query: MediaQuery): number | undefined {\n // Max-widths sort ascending in canonical order, so the first one is the\n // conjunction's effective upper bound (every feature must hold).\n return featuresOf(query).find((feature) => feature._tag === 'MaxWidth')?.px\n}\n\n/** @internal */\nexport function getPrefersColorScheme<T>(\n query: MediaQuery<T>,\n): T extends PrefersColorScheme ? 'dark' | 'light' : 'dark' | 'light' | undefined\n/** @internal */\nexport function getPrefersColorScheme(query: MediaQuery): 'dark' | 'light' | undefined {\n return featuresOf(query).find((feature) => feature._tag === 'PrefersColorScheme')?.scheme\n}\n\n/** @internal */\nexport const hasMinWidth = (query: MediaQuery): query is MediaQuery<MinWidth> =>\n featuresOf(query).some((feature) => feature._tag === 'MinWidth')\n\n/** @internal */\nexport const hasMaxWidth = (query: MediaQuery): query is MediaQuery<MaxWidth> =>\n featuresOf(query).some((feature) => feature._tag === 'MaxWidth')\n\n/** @internal */\nexport const hasPrefersColorScheme = (query: MediaQuery): query is MediaQuery<PrefersColorScheme> =>\n featuresOf(query).some((feature) => feature._tag === 'PrefersColorScheme')\n\n// ---------------------------------------------------------------------------\n// query relations\n// ---------------------------------------------------------------------------\n\n// Conjunction reasoning for the shadow-safe strict coalesce check\n// (stylesheet.internal.ts). Both relations treat `undefined` as the empty\n// conjunction: a bare declaration applies in every state. They read the\n// canonical and-set part-wise rather than through the accessors — the\n// accessors report effective bounds, which cannot see a degenerate\n// `dark and light` query, and a setter that never applies must not count\n// as re-establishing a value.\n\nconst EMPTY_FEATURES: ReadonlyArray<MediaFeature> = []\n\nconst optionalFeaturesOf = (query: MediaQuery | undefined): ReadonlyArray<MediaFeature> =>\n query === undefined ? EMPTY_FEATURES : featuresOf(query)\n\nconst featureImplies = (source: MediaFeature, target: MediaFeature): boolean => {\n switch (target._tag) {\n case 'MinWidth':\n return source._tag === 'MinWidth' && source.px >= target.px\n case 'MaxWidth':\n return source._tag === 'MaxWidth' && source.px <= target.px\n case 'PrefersColorScheme':\n return source._tag === 'PrefersColorScheme' && source.scheme === target.scheme\n }\n}\n\n// `self` implies `that` when `that` holds in every state where `self`\n// holds: every part of `that` is implied by some part of `self` — a\n// larger min-width, a smaller max-width, the same scheme.\n/** @internal */\nexport const implies = (self: MediaQuery | undefined, that: MediaQuery | undefined): boolean => {\n const source = optionalFeaturesOf(self)\n return optionalFeaturesOf(that).every((target) =>\n source.some((feature) => featureImplies(feature, target)),\n )\n}\n\n// The conjunction of both queries is satisfiable in some state: no\n// conflicting scheme values, and a non-empty width interval — the largest\n// min-width at most the smallest max-width, both bounds inclusive. Either\n// side's internal contradiction (dark and light, an empty interval) makes\n// the pair unsatisfiable, as it must.\n/** @internal */\nexport const coSatisfiable = (\n self: MediaQuery | undefined,\n that: MediaQuery | undefined,\n): boolean => {\n let lower = 0\n let upper = Number.POSITIVE_INFINITY\n let scheme: 'dark' | 'light' | undefined\n for (const feature of [...optionalFeaturesOf(self), ...optionalFeaturesOf(that)]) {\n switch (feature._tag) {\n case 'MinWidth':\n lower = Math.max(lower, feature.px)\n break\n case 'MaxWidth':\n upper = Math.min(upper, feature.px)\n break\n case 'PrefersColorScheme':\n if (scheme !== undefined && scheme !== feature.scheme) {\n return false\n }\n scheme = feature.scheme\n break\n }\n }\n return lower <= upper\n}\n\n/** @internal */\nexport const render = (query: MediaQuery, options?: RenderOptions): string =>\n renderImpl(query, options?.mediaSyntax ?? 'prefix')\n\n/** @internal */\nexport const equals = dual<\n (that: MediaQuery) => (self: MediaQuery) => bo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AsB,UAC1B,UAAU,KAAA,IAAY,iBAAiB,WAAW,KAAK;AAEzD,MAAM,kBAAkB,QAAsB,WAAkC;CAC9E,QAAQ,OAAO,MAAf;EACE,KAAK,YACH,OAAO,OAAO,SAAS,cAAc,OAAO,MAAM,OAAO;EAC3D,KAAK,YACH,OAAO,OAAO,SAAS,cAAc,OAAO,MAAM,OAAO;EAC3D,KAAK,sBACH,OAAO,OAAO,SAAS,wBAAwB,OAAO,WAAW,OAAO;CAC5E;AACF;;AAMA,MAAa,WAAW,MAA8B,SAA0C;CAC9F,MAAM,SAAS,mBAAmB,IAAI;CACtC,OAAO,mBAAmB,IAAI,CAAC,CAAC,OAAO,WACrC,OAAO,MAAM,YAAY,eAAe,SAAS,MAAM,CAAC,CAC1D;AACF;;AAQA,MAAa,iBACX,MACA,SACY;CACZ,IAAI,QAAQ;CACZ,IAAI,QAAQ,OAAO;CACnB,IAAI;CACJ,KAAK,MAAM,WAAW,CAAC,GAAG,mBAAmB,IAAI,GAAG,GAAG,mBAAmB,IAAI,CAAC,GAC7E,QAAQ,QAAQ,MAAhB;EACE,KAAK;GACH,QAAQ,KAAK,IAAI,OAAO,QAAQ,EAAE;GAClC;EACF,KAAK;GACH,QAAQ,KAAK,IAAI,OAAO,QAAQ,EAAE;GAClC;EACF,KAAK;GACH,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,QAC7C,OAAO;GAET,SAAS,QAAQ;GACjB;CACJ;CAEF,OAAO,SAAS;AAClB;;AAGA,MAAa,UAAU,OAAmB,YACxC,WAAW,OAAO,SAAS,eAAe,QAAQ;;AAGpD,MAAa,SAAS,KAGpB,IAAI,MAAkB,SAA8BC,SAAa,MAAM,IAAI,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { t as Pipeable } from "./utils-BKm298I-.mjs";
2
- import { t as MediaQuery } from "./mediaQuery-BYR1z-iD.mjs";
3
- import { n as RenderOptions$3, t as Declaration } from "./declaration-1DlO_ltT.mjs";
2
+ import { t as MediaQuery } from "./mediaQuery-DsBivHi0.mjs";
3
+ import { n as RenderOptions$3, t as Declaration } from "./declaration-B-6Ykgs_.mjs";
4
4
  import { t as Selector } from "./selector-HZY-W6l6.mjs";
5
5
  //#region src/rule/styleRule.internal.d.ts
6
6
  declare const StyleRuleTypeId: unique symbol;
@@ -555,4 +555,4 @@ declare const equals: {
555
555
  };
556
556
  //#endregion
557
557
  export { StyleRule as a, ruleSet_d_exports as i, RenderOptions$1 as n, styleRule_d_exports as o, RuleSet as r, mediaRule_d_exports as t };
558
- //# sourceMappingURL=mediaRule-BDB4WCYy.d.mts.map
558
+ //# sourceMappingURL=mediaRule-4kY2IOq-.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { _ as Percentage, a as Kind, d as Angle, r as Calc, u as AbsoluteLength } from "./index-BvtwY4FQ.mjs";
2
2
  import { t as Pipeable } from "./utils-BKm298I-.mjs";
3
3
  import { t as Color } from "./color-BvNJ2YqL.mjs";
4
- import { n as RenderOptions$1 } from "./declaration-1DlO_ltT.mjs";
4
+ import { n as RenderOptions$1 } from "./declaration-B-6Ykgs_.mjs";
5
5
  //#region src/property/propertySyntax.internal.d.ts
6
6
  declare const PropertySyntaxTypeId: unique symbol;
7
7
  type PropertySyntaxTypeId = typeof PropertySyntaxTypeId;
@@ -463,4 +463,4 @@ declare const equals: {
463
463
  };
464
464
  //#endregion
465
465
  export { propertyRule_d_exports as n, propertySyntax_d_exports as r, PropertyRule as t };
466
- //# sourceMappingURL=propertyRule-BbkFh9b9.d.mts.map
466
+ //# sourceMappingURL=propertyRule-B5pf7NgH.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { Pipeable, dual, invariant } from "../utils.mjs";
2
2
  import { a as hash, i as equals$2, n as HashTypeId, r as combine, s as hashString, t as EqualTypeId } from "./equal-U9G5LhtL.mjs";
3
3
  import { S as toCalc, p as isCalc, v as refsOf, y as serialize } from "./calc-Cih4o2r7.mjs";
4
- import { f as refsOf$1, p as serialize$1 } from "./color.internal-Dts5ycTm.mjs";
4
+ import { f as refsOf$1, p as serialize$1 } from "./color.internal-9fpSiiJk.mjs";
5
5
  import { n as renderBlock, t as quote } from "./render-BqcFH9Vr.mjs";
6
6
  //#region src/property/propertySyntax.internal.ts
7
7
  const PropertySyntaxTypeId = Symbol.for("fashionable/property/propertySyntax");
@@ -243,4 +243,4 @@ const equals = dual(2, (self, that) => equals$2(self, that));
243
243
  //#endregion
244
244
  export { resolution as C, transformList as D, transformFunction as E, universal as O, render$1 as S, time as T, lengthPercentage as _, render as a, oneOf as b, commaListOf as c, image as d, integer as f, length as g, keywords as h, make as i, url as k, customIdent as l, keyword as m, inheritable as n, angle as o, isPropertySyntax as p, isPropertyRule as r, color as s, equals as t, equals$1 as u, listOf as v, string as w, percentage as x, number as y };
245
245
 
246
- //# sourceMappingURL=propertyRule.internal-Bc_HrfcL.mjs.map
246
+ //# sourceMappingURL=propertyRule.internal-CRyFLwbn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"propertyRule.internal-Bc_HrfcL.mjs","names":["Equal.hashString","Equal.combine","Equal.EqualTypeId","Equal.HashTypeId","#hash","render","equals","Equal.equals","Equal.equals","Equal.hashString","Equal.hash","serializeCalc","serializeColor","Equal.EqualTypeId","Equal.HashTypeId","#hash","Equal.combine","calcRefsOf","colorRefsOf","renderSyntax"],"sources":["../../src/property/propertySyntax.internal.ts","../../src/property/propertyRule.internal.ts"],"sourcesContent":["import type { Calc } from '#calc/calc'\nimport type { Color } from '#data/color'\nimport * as Equal from '#internal/equal'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { PropertySyntax, Universal, ValueOf } from './propertySyntax.ts'\n\nexport const PropertySyntaxTypeId = Symbol.for('fashionable/property/propertySyntax')\nexport type PropertySyntaxTypeId = typeof PropertySyntaxTypeId\n\ntype SyntaxNode =\n | { readonly _tag: 'Universal' }\n | { readonly _tag: 'DataType'; readonly name: string }\n | { readonly _tag: 'Keyword'; readonly name: string }\n | {\n readonly _tag: 'List'\n readonly component: SyntaxNode\n readonly separator: 'space' | 'comma'\n }\n | { readonly _tag: 'OneOf'; readonly components: ReadonlyArray<SyntaxNode> }\n\nconst renderNode = (node: SyntaxNode): string => {\n switch (node._tag) {\n case 'Universal':\n return '*'\n case 'DataType':\n return `<${node.name}>`\n case 'Keyword':\n return node.name\n case 'List':\n return `${renderNode(node.component)}${node.separator === 'space' ? '+' : '#'}`\n case 'OneOf':\n return node.components.map(renderNode).join(' | ')\n }\n}\n\nconst nodeEquals = (a: SyntaxNode, b: SyntaxNode): boolean => {\n if (a._tag !== b._tag) {\n return false\n }\n switch (a._tag) {\n case 'Universal':\n return true\n case 'DataType':\n case 'Keyword':\n return a.name === (b as typeof a).name\n case 'List': {\n const other = b as typeof a\n return a.separator === other.separator && nodeEquals(a.component, other.component)\n }\n case 'OneOf': {\n const other = b as typeof a\n return (\n a.components.length === other.components.length &&\n a.components.every((component, index) =>\n nodeEquals(component, other.components[index] as SyntaxNode),\n )\n )\n }\n }\n}\n\nconst nodeHash = (node: SyntaxNode): number => {\n let h = Equal.hashString(node._tag)\n switch (node._tag) {\n case 'Universal':\n return h\n case 'DataType':\n case 'Keyword':\n return Equal.combine(h, Equal.hashString(node.name))\n case 'List':\n h = Equal.combine(h, Equal.hashString(node.separator))\n return Equal.combine(h, nodeHash(node.component))\n case 'OneOf':\n for (const component of node.components) {\n h = Equal.combine(h, nodeHash(component))\n }\n return h\n }\n}\n\nclass PropertySyntaxImpl extends Pipeable implements PropertySyntax, Equal.Equal {\n readonly [PropertySyntaxTypeId]: PropertySyntaxTypeId = PropertySyntaxTypeId\n\n readonly node: SyntaxNode\n #hash: number | undefined\n\n constructor(node: SyntaxNode) {\n super()\n this.node = node\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return isPropertySyntax(that) && nodeEquals(this.node, nodeOf(that))\n }\n\n [Equal.HashTypeId](): number {\n this.#hash ??= Equal.combine(\n Equal.hashString('fashionable/property/propertySyntax'),\n nodeHash(this.node),\n )\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `PropertySyntax(${renderNode(this.node)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isPropertySyntax = (u: unknown): u is PropertySyntax =>\n typeof u === 'object' && u !== null && PropertySyntaxTypeId in u\n\nconst nodeOf = (syntax: PropertySyntax<unknown>): SyntaxNode => (syntax as PropertySyntaxImpl).node\n\n/** @internal */\nexport const isUniversal = (syntax: PropertySyntax<unknown>): boolean =>\n nodeOf(syntax)._tag === 'Universal'\n\nconst dataType = <V>(name: string): PropertySyntax<V> =>\n new PropertySyntaxImpl({ _tag: 'DataType', name }) as PropertySyntax<V>\n\n/** @internal */\nexport const universal: Universal = new PropertySyntaxImpl({\n _tag: 'Universal',\n}) as unknown as Universal\n\n/** @internal */\nexport const angle: PropertySyntax<string> = dataType('angle')\n/** @internal */\nexport const color: PropertySyntax<string | Color<never>> = dataType('color')\n/** @internal */\nexport const customIdent: PropertySyntax<string> = dataType('custom-ident')\n/** @internal */\nexport const image: PropertySyntax<string> = dataType('image')\n/** @internal */\nexport const integer: PropertySyntax<number | Calc<never>> = dataType('integer')\n/** @internal */\nexport const length: PropertySyntax<string> = dataType('length')\n/** @internal */\nexport const lengthPercentage: PropertySyntax<string> = dataType('length-percentage')\n/** @internal */\nexport const number: PropertySyntax<number | Calc<never>> = dataType('number')\n/** @internal */\nexport const percentage: PropertySyntax<string> = dataType('percentage')\n/** @internal */\nexport const resolution: PropertySyntax<string> = dataType('resolution')\n/** @internal */\nexport const string: PropertySyntax<string> = dataType('string')\n/** @internal */\nexport const time: PropertySyntax<string> = dataType('time')\n/** @internal */\nexport const transformFunction: PropertySyntax<string> = dataType('transform-function')\n/** @internal */\nexport const transformList: PropertySyntax<string> = dataType('transform-list')\n/** @internal */\nexport const url: PropertySyntax<string> = dataType('url')\n\nconst CSS_WIDE_KEYWORDS: ReadonlySet<string> = new Set([\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'default',\n])\n\n/** @internal */\nexport const keyword = <const K extends string>(name: K): PropertySyntax<K> => {\n invariant(name.length > 0, 'Keyword must be a non-empty string')\n invariant(\n !CSS_WIDE_KEYWORDS.has(name.toLowerCase()),\n `Keyword must not be a CSS-wide keyword, got '${name}'`,\n )\n return new PropertySyntaxImpl({ _tag: 'Keyword', name }) as PropertySyntax<K>\n}\n\n/** @internal */\nexport const keywords = <const Names extends readonly [string, ...ReadonlyArray<string>]>(\n ...names: Names\n): PropertySyntax<Names[number]> => {\n const syntaxes = names.map((name) => keyword(name))\n if (syntaxes.length === 1) {\n return syntaxes[0] as PropertySyntax<Names[number]>\n }\n return new PropertySyntaxImpl({\n _tag: 'OneOf',\n components: syntaxes.map(nodeOf),\n }) as PropertySyntax<Names[number]>\n}\n\n/** @internal */\nexport function oneOf<\n const Components extends readonly [\n PropertySyntax<unknown>,\n PropertySyntax<unknown>,\n ...ReadonlyArray<PropertySyntax<unknown>>,\n ],\n>(...components: Components): PropertySyntax<ValueOf<Components[number]>> {\n const nodes = components.flatMap((component) => {\n const node = nodeOf(component)\n return node._tag === 'OneOf' ? node.components : [node]\n })\n for (const node of nodes) {\n invariant(\n node._tag !== 'Universal',\n 'The universal syntax stands alone — it cannot join a combination',\n )\n }\n return new PropertySyntaxImpl({ _tag: 'OneOf', components: nodes }) as PropertySyntax<\n ValueOf<Components[number]>\n >\n}\n\nconst requireMultipliable = (node: SyntaxNode): void => {\n invariant(node._tag !== 'Universal', 'The universal syntax cannot be multiplied')\n invariant(node._tag !== 'OneOf', 'A multiplier applies to a single component, not a combination')\n invariant(node._tag !== 'List', 'A component takes at most one multiplier')\n invariant(\n node._tag !== 'DataType' || node.name !== 'transform-list',\n '<transform-list> is pre-multiplied and takes no multiplier',\n )\n}\n\nconst listWith =\n (separator: 'space' | 'comma') =>\n <V>(component: PropertySyntax<V>): PropertySyntax<V | (string & {})> => {\n const node = nodeOf(component)\n requireMultipliable(node)\n return new PropertySyntaxImpl({ _tag: 'List', component: node, separator }) as PropertySyntax<\n V | (string & {})\n >\n }\n\n/** @internal */\nexport const listOf: <V>(component: PropertySyntax<V>) => PropertySyntax<V | (string & {})> =\n listWith('space')\n\n/** @internal */\nexport const commaListOf: <V>(component: PropertySyntax<V>) => PropertySyntax<V | (string & {})> =\n listWith('comma')\n\n/** @internal */\nexport const render = (syntax: PropertySyntax): string => renderNode(nodeOf(syntax))\n\n/** @internal */\nexport const equals = dual<\n (that: PropertySyntax) => (self: PropertySyntax) => boolean,\n (self: PropertySyntax, that: PropertySyntax) => boolean\n>(2, (self: PropertySyntax, that: PropertySyntax): boolean => Equal.equals(self, that))\n","import type { Calc } from '#calc/calc'\nimport {\n isCalc,\n refsOf as calcRefsOf,\n serialize as serializeCalc,\n toCalc,\n} from '#calc/calc.internal'\nimport { refsOf as colorRefsOf, serialize as serializeColor } from '#data/color.internal'\nimport * as Equal from '#internal/equal'\nimport { DEFAULT_INDENT, quote, renderBlock } from '#internal/render'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { PropertyRule, RenderOptions, Value } from './propertyRule.ts'\nimport { isUniversal, render as renderSyntax, universal } from './propertySyntax.internal.ts'\nimport type { PropertySyntax } from './propertySyntax.ts'\n\nexport const PropertyRuleTypeId = Symbol.for('fashionable/property/propertyRule')\nexport type PropertyRuleTypeId = typeof PropertyRuleTypeId\n\nconst valueEquals = (a: Value | undefined, b: Value | undefined): boolean => {\n if (a === undefined || b === undefined || typeof a === 'string' || typeof b === 'string') {\n return a === b\n }\n return Equal.equals(a, b)\n}\n\nconst valueHash = (value: Value | undefined): number => {\n if (value === undefined) {\n return 0\n }\n return typeof value === 'string' ? Equal.hashString(value) : Equal.hash(value)\n}\n\nconst serializeValue = (value: Value, options?: RenderOptions): string => {\n if (typeof value === 'string') {\n return value\n }\n const serializeOptions = options?.precision === undefined ? {} : { precision: options.precision }\n return isCalc(value)\n ? serializeCalc(value, serializeOptions)\n : serializeColor(value, serializeOptions)\n}\n\nclass PropertyRuleImpl extends Pipeable implements PropertyRule, Equal.Equal {\n readonly [PropertyRuleTypeId]: PropertyRuleTypeId = PropertyRuleTypeId\n\n readonly name: `--${string}`\n readonly syntax: PropertySyntax\n readonly inherits: boolean\n readonly initialValue: Value | undefined\n #hash: number | undefined\n\n constructor(\n name: `--${string}`,\n syntax: PropertySyntax,\n inherits: boolean,\n initialValue: Value | undefined,\n ) {\n super()\n this.name = name\n this.syntax = syntax\n this.inherits = inherits\n this.initialValue = initialValue\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return (\n isPropertyRule(that) &&\n this.name === that.name &&\n Equal.equals(this.syntax, that.syntax) &&\n this.inherits === that.inherits &&\n valueEquals(this.initialValue, that.initialValue)\n )\n }\n\n [Equal.HashTypeId](): number {\n if (this.#hash === undefined) {\n let h = Equal.hashString('fashionable/property/propertyRule')\n h = Equal.combine(h, Equal.hashString(this.name))\n h = Equal.combine(h, Equal.hash(this.syntax))\n h = Equal.combine(h, this.inherits ? 1 : 0)\n h = Equal.combine(h, valueHash(this.initialValue))\n this.#hash = h\n }\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `PropertyRule(${this.name})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isPropertyRule = (u: unknown): u is PropertyRule =>\n typeof u === 'object' && u !== null && PropertyRuleTypeId in u\n\n/** @internal */\nexport const make = (\n name: `--${string}`,\n syntax: PropertySyntax = universal,\n initialValue?: Value | number,\n): PropertyRule => {\n invariant(\n name.startsWith('--') && name.length > 2,\n 'Property rule name must be a custom property name (--name)',\n )\n const value =\n typeof initialValue === 'number' ? (toCalc(initialValue) as Calc<never>) : initialValue\n invariant(\n isUniversal(syntax) || value !== undefined,\n '@property requires an initial-value unless its syntax is the universal syntax',\n )\n if (value !== undefined && typeof value !== 'string') {\n const refs = isCalc(value) ? calcRefsOf(value) : colorRefsOf(value)\n invariant(\n refs.size === 0,\n '@property initial values must be computationally independent — no unbound references',\n )\n }\n return new PropertyRuleImpl(name, syntax, false, value)\n}\n\n/** @internal */\nexport const inheritable = (rule: PropertyRule): PropertyRule =>\n rule.inherits ? rule : new PropertyRuleImpl(rule.name, rule.syntax, true, rule.initialValue)\n\n/** @internal */\nexport const render = (rule: PropertyRule, options?: RenderOptions): string => {\n const indent = options?.indent ?? DEFAULT_INDENT\n const declarations: Array<string> = [\n `syntax: ${quote(renderSyntax(rule.syntax))}`,\n `inherits: ${rule.inherits ? 'true' : 'false'}`,\n ]\n if (rule.initialValue !== undefined) {\n declarations.push(`initial-value: ${serializeValue(rule.initialValue, options)}`)\n }\n return renderBlock(`@property ${rule.name}`, declarations, indent)\n}\n\n/** @internal */\nexport const equals = dual<\n (that: PropertyRule) => (self: PropertyRule) => boolean,\n (self: PropertyRule, that: PropertyRule) => boolean\n>(2, (self: PropertyRule, that: PropertyRule): boolean => Equal.equals(self, that))\n"],"mappings":";;;;;;AAMA,MAAa,uBAAuB,OAAO,IAAI,qCAAqC;AAcpF,MAAM,cAAc,SAA6B;CAC/C,QAAQ,KAAK,MAAb;EACE,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO,IAAI,KAAK,KAAK;EACvB,KAAK,WACH,OAAO,KAAK;EACd,KAAK,QACH,OAAO,GAAG,WAAW,KAAK,SAAS,IAAI,KAAK,cAAc,UAAU,MAAM;EAC5E,KAAK,SACH,OAAO,KAAK,WAAW,IAAI,UAAU,CAAC,CAAC,KAAK,KAAK;CACrD;AACF;AAEA,MAAM,cAAc,GAAe,MAA2B;CAC5D,IAAI,EAAE,SAAS,EAAE,MACf,OAAO;CAET,QAAQ,EAAE,MAAV;EACE,KAAK,aACH,OAAO;EACT,KAAK;EACL,KAAK,WACH,OAAO,EAAE,SAAU,EAAe;EACpC,KAAK,QAAQ;GACX,MAAM,QAAQ;GACd,OAAO,EAAE,cAAc,MAAM,aAAa,WAAW,EAAE,WAAW,MAAM,SAAS;EACnF;EACA,KAAK,SAAS;GACZ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I,UAAU,KAAA,KAAa,OAAO,UAAU,UAE1C,WADa,OAAO,KAAK,IAAIE,OAAW,KAAK,IAAIC,SAAY,KAAK,EAAA,CAE3D,SAAS,GACd,sFACF;CAEF,OAAO,IAAI,iBAAiB,MAAM,QAAQ,OAAO,KAAK;AACxD;;AAGA,MAAa,eAAe,SAC1B,KAAK,WAAW,OAAO,IAAI,iBAAiB,KAAK,MAAM,KAAK,QAAQ,MAAM,KAAK,YAAY;;AAG7F,MAAa,UAAU,MAAoB,YAAoC;CAC7E,MAAM,SAAS,SAAS,UAAA;CACxB,MAAM,eAA8B,CAClC,WAAW,MAAMC,SAAa,KAAK,MAAM,CAAC,KAC1C,aAAa,KAAK,WAAW,SAAS,SACxC;CACA,IAAI,KAAK,iBAAiB,KAAA,GACxB,aAAa,KAAK,kBAAkB,eAAe,KAAK,cAAc,OAAO,GAAG;CAElF,OAAO,YAAY,aAAa,KAAK,QAAQ,cAAc,MAAM;AACnE;;AAGA,MAAa,SAAS,KAGpB,IAAI,MAAoB,SAAgCX,SAAa,MAAM,IAAI,CAAC"}
1
+ {"version":3,"file":"propertyRule.internal-CRyFLwbn.mjs","names":["Equal.hashString","Equal.combine","Equal.EqualTypeId","Equal.HashTypeId","#hash","render","equals","Equal.equals","Equal.equals","Equal.hashString","Equal.hash","serializeCalc","serializeColor","Equal.EqualTypeId","Equal.HashTypeId","#hash","Equal.combine","calcRefsOf","colorRefsOf","renderSyntax"],"sources":["../../src/property/propertySyntax.internal.ts","../../src/property/propertyRule.internal.ts"],"sourcesContent":["import type { Calc } from '#calc/calc'\nimport type { Color } from '#data/color'\nimport * as Equal from '#internal/equal'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { PropertySyntax, Universal, ValueOf } from './propertySyntax.ts'\n\nexport const PropertySyntaxTypeId = Symbol.for('fashionable/property/propertySyntax')\nexport type PropertySyntaxTypeId = typeof PropertySyntaxTypeId\n\ntype SyntaxNode =\n | { readonly _tag: 'Universal' }\n | { readonly _tag: 'DataType'; readonly name: string }\n | { readonly _tag: 'Keyword'; readonly name: string }\n | {\n readonly _tag: 'List'\n readonly component: SyntaxNode\n readonly separator: 'space' | 'comma'\n }\n | { readonly _tag: 'OneOf'; readonly components: ReadonlyArray<SyntaxNode> }\n\nconst renderNode = (node: SyntaxNode): string => {\n switch (node._tag) {\n case 'Universal':\n return '*'\n case 'DataType':\n return `<${node.name}>`\n case 'Keyword':\n return node.name\n case 'List':\n return `${renderNode(node.component)}${node.separator === 'space' ? '+' : '#'}`\n case 'OneOf':\n return node.components.map(renderNode).join(' | ')\n }\n}\n\nconst nodeEquals = (a: SyntaxNode, b: SyntaxNode): boolean => {\n if (a._tag !== b._tag) {\n return false\n }\n switch (a._tag) {\n case 'Universal':\n return true\n case 'DataType':\n case 'Keyword':\n return a.name === (b as typeof a).name\n case 'List': {\n const other = b as typeof a\n return a.separator === other.separator && nodeEquals(a.component, other.component)\n }\n case 'OneOf': {\n const other = b as typeof a\n return (\n a.components.length === other.components.length &&\n a.components.every((component, index) =>\n nodeEquals(component, other.components[index] as SyntaxNode),\n )\n )\n }\n }\n}\n\nconst nodeHash = (node: SyntaxNode): number => {\n let h = Equal.hashString(node._tag)\n switch (node._tag) {\n case 'Universal':\n return h\n case 'DataType':\n case 'Keyword':\n return Equal.combine(h, Equal.hashString(node.name))\n case 'List':\n h = Equal.combine(h, Equal.hashString(node.separator))\n return Equal.combine(h, nodeHash(node.component))\n case 'OneOf':\n for (const component of node.components) {\n h = Equal.combine(h, nodeHash(component))\n }\n return h\n }\n}\n\nclass PropertySyntaxImpl extends Pipeable implements PropertySyntax, Equal.Equal {\n readonly [PropertySyntaxTypeId]: PropertySyntaxTypeId = PropertySyntaxTypeId\n\n readonly node: SyntaxNode\n #hash: number | undefined\n\n constructor(node: SyntaxNode) {\n super()\n this.node = node\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return isPropertySyntax(that) && nodeEquals(this.node, nodeOf(that))\n }\n\n [Equal.HashTypeId](): number {\n this.#hash ??= Equal.combine(\n Equal.hashString('fashionable/property/propertySyntax'),\n nodeHash(this.node),\n )\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `PropertySyntax(${renderNode(this.node)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isPropertySyntax = (u: unknown): u is PropertySyntax =>\n typeof u === 'object' && u !== null && PropertySyntaxTypeId in u\n\nconst nodeOf = (syntax: PropertySyntax<unknown>): SyntaxNode => (syntax as PropertySyntaxImpl).node\n\n/** @internal */\nexport const isUniversal = (syntax: PropertySyntax<unknown>): boolean =>\n nodeOf(syntax)._tag === 'Universal'\n\nconst dataType = <V>(name: string): PropertySyntax<V> =>\n new PropertySyntaxImpl({ _tag: 'DataType', name }) as PropertySyntax<V>\n\n/** @internal */\nexport const universal: Universal = new PropertySyntaxImpl({\n _tag: 'Universal',\n}) as unknown as Universal\n\n/** @internal */\nexport const angle: PropertySyntax<string> = dataType('angle')\n/** @internal */\nexport const color: PropertySyntax<string | Color<never>> = dataType('color')\n/** @internal */\nexport const customIdent: PropertySyntax<string> = dataType('custom-ident')\n/** @internal */\nexport const image: PropertySyntax<string> = dataType('image')\n/** @internal */\nexport const integer: PropertySyntax<number | Calc<never>> = dataType('integer')\n/** @internal */\nexport const length: PropertySyntax<string> = dataType('length')\n/** @internal */\nexport const lengthPercentage: PropertySyntax<string> = dataType('length-percentage')\n/** @internal */\nexport const number: PropertySyntax<number | Calc<never>> = dataType('number')\n/** @internal */\nexport const percentage: PropertySyntax<string> = dataType('percentage')\n/** @internal */\nexport const resolution: PropertySyntax<string> = dataType('resolution')\n/** @internal */\nexport const string: PropertySyntax<string> = dataType('string')\n/** @internal */\nexport const time: PropertySyntax<string> = dataType('time')\n/** @internal */\nexport const transformFunction: PropertySyntax<string> = dataType('transform-function')\n/** @internal */\nexport const transformList: PropertySyntax<string> = dataType('transform-list')\n/** @internal */\nexport const url: PropertySyntax<string> = dataType('url')\n\nconst CSS_WIDE_KEYWORDS: ReadonlySet<string> = new Set([\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'default',\n])\n\n/** @internal */\nexport const keyword = <const K extends string>(name: K): PropertySyntax<K> => {\n invariant(name.length > 0, 'Keyword must be a non-empty string')\n invariant(\n !CSS_WIDE_KEYWORDS.has(name.toLowerCase()),\n `Keyword must not be a CSS-wide keyword, got '${name}'`,\n )\n return new PropertySyntaxImpl({ _tag: 'Keyword', name }) as PropertySyntax<K>\n}\n\n/** @internal */\nexport const keywords = <const Names extends readonly [string, ...ReadonlyArray<string>]>(\n ...names: Names\n): PropertySyntax<Names[number]> => {\n const syntaxes = names.map((name) => keyword(name))\n if (syntaxes.length === 1) {\n return syntaxes[0] as PropertySyntax<Names[number]>\n }\n return new PropertySyntaxImpl({\n _tag: 'OneOf',\n components: syntaxes.map(nodeOf),\n }) as PropertySyntax<Names[number]>\n}\n\n/** @internal */\nexport function oneOf<\n const Components extends readonly [\n PropertySyntax<unknown>,\n PropertySyntax<unknown>,\n ...ReadonlyArray<PropertySyntax<unknown>>,\n ],\n>(...components: Components): PropertySyntax<ValueOf<Components[number]>> {\n const nodes = components.flatMap((component) => {\n const node = nodeOf(component)\n return node._tag === 'OneOf' ? node.components : [node]\n })\n for (const node of nodes) {\n invariant(\n node._tag !== 'Universal',\n 'The universal syntax stands alone — it cannot join a combination',\n )\n }\n return new PropertySyntaxImpl({ _tag: 'OneOf', components: nodes }) as PropertySyntax<\n ValueOf<Components[number]>\n >\n}\n\nconst requireMultipliable = (node: SyntaxNode): void => {\n invariant(node._tag !== 'Universal', 'The universal syntax cannot be multiplied')\n invariant(node._tag !== 'OneOf', 'A multiplier applies to a single component, not a combination')\n invariant(node._tag !== 'List', 'A component takes at most one multiplier')\n invariant(\n node._tag !== 'DataType' || node.name !== 'transform-list',\n '<transform-list> is pre-multiplied and takes no multiplier',\n )\n}\n\nconst listWith =\n (separator: 'space' | 'comma') =>\n <V>(component: PropertySyntax<V>): PropertySyntax<V | (string & {})> => {\n const node = nodeOf(component)\n requireMultipliable(node)\n return new PropertySyntaxImpl({ _tag: 'List', component: node, separator }) as PropertySyntax<\n V | (string & {})\n >\n }\n\n/** @internal */\nexport const listOf: <V>(component: PropertySyntax<V>) => PropertySyntax<V | (string & {})> =\n listWith('space')\n\n/** @internal */\nexport const commaListOf: <V>(component: PropertySyntax<V>) => PropertySyntax<V | (string & {})> =\n listWith('comma')\n\n/** @internal */\nexport const render = (syntax: PropertySyntax): string => renderNode(nodeOf(syntax))\n\n/** @internal */\nexport const equals = dual<\n (that: PropertySyntax) => (self: PropertySyntax) => boolean,\n (self: PropertySyntax, that: PropertySyntax) => boolean\n>(2, (self: PropertySyntax, that: PropertySyntax): boolean => Equal.equals(self, that))\n","import type { Calc } from '#calc/calc'\nimport {\n isCalc,\n refsOf as calcRefsOf,\n serialize as serializeCalc,\n toCalc,\n} from '#calc/calc.internal'\nimport { refsOf as colorRefsOf, serialize as serializeColor } from '#data/color.internal'\nimport * as Equal from '#internal/equal'\nimport { DEFAULT_INDENT, quote, renderBlock } from '#internal/render'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { PropertyRule, RenderOptions, Value } from './propertyRule.ts'\nimport { isUniversal, render as renderSyntax, universal } from './propertySyntax.internal.ts'\nimport type { PropertySyntax } from './propertySyntax.ts'\n\nexport const PropertyRuleTypeId = Symbol.for('fashionable/property/propertyRule')\nexport type PropertyRuleTypeId = typeof PropertyRuleTypeId\n\nconst valueEquals = (a: Value | undefined, b: Value | undefined): boolean => {\n if (a === undefined || b === undefined || typeof a === 'string' || typeof b === 'string') {\n return a === b\n }\n return Equal.equals(a, b)\n}\n\nconst valueHash = (value: Value | undefined): number => {\n if (value === undefined) {\n return 0\n }\n return typeof value === 'string' ? Equal.hashString(value) : Equal.hash(value)\n}\n\nconst serializeValue = (value: Value, options?: RenderOptions): string => {\n if (typeof value === 'string') {\n return value\n }\n const serializeOptions = options?.precision === undefined ? {} : { precision: options.precision }\n return isCalc(value)\n ? serializeCalc(value, serializeOptions)\n : serializeColor(value, serializeOptions)\n}\n\nclass PropertyRuleImpl extends Pipeable implements PropertyRule, Equal.Equal {\n readonly [PropertyRuleTypeId]: PropertyRuleTypeId = PropertyRuleTypeId\n\n readonly name: `--${string}`\n readonly syntax: PropertySyntax\n readonly inherits: boolean\n readonly initialValue: Value | undefined\n #hash: number | undefined\n\n constructor(\n name: `--${string}`,\n syntax: PropertySyntax,\n inherits: boolean,\n initialValue: Value | undefined,\n ) {\n super()\n this.name = name\n this.syntax = syntax\n this.inherits = inherits\n this.initialValue = initialValue\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return (\n isPropertyRule(that) &&\n this.name === that.name &&\n Equal.equals(this.syntax, that.syntax) &&\n this.inherits === that.inherits &&\n valueEquals(this.initialValue, that.initialValue)\n )\n }\n\n [Equal.HashTypeId](): number {\n if (this.#hash === undefined) {\n let h = Equal.hashString('fashionable/property/propertyRule')\n h = Equal.combine(h, Equal.hashString(this.name))\n h = Equal.combine(h, Equal.hash(this.syntax))\n h = Equal.combine(h, this.inherits ? 1 : 0)\n h = Equal.combine(h, valueHash(this.initialValue))\n this.#hash = h\n }\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `PropertyRule(${this.name})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isPropertyRule = (u: unknown): u is PropertyRule =>\n typeof u === 'object' && u !== null && PropertyRuleTypeId in u\n\n/** @internal */\nexport const make = (\n name: `--${string}`,\n syntax: PropertySyntax = universal,\n initialValue?: Value | number,\n): PropertyRule => {\n invariant(\n name.startsWith('--') && name.length > 2,\n 'Property rule name must be a custom property name (--name)',\n )\n const value =\n typeof initialValue === 'number' ? (toCalc(initialValue) as Calc<never>) : initialValue\n invariant(\n isUniversal(syntax) || value !== undefined,\n '@property requires an initial-value unless its syntax is the universal syntax',\n )\n if (value !== undefined && typeof value !== 'string') {\n const refs = isCalc(value) ? calcRefsOf(value) : colorRefsOf(value)\n invariant(\n refs.size === 0,\n '@property initial values must be computationally independent — no unbound references',\n )\n }\n return new PropertyRuleImpl(name, syntax, false, value)\n}\n\n/** @internal */\nexport const inheritable = (rule: PropertyRule): PropertyRule =>\n rule.inherits ? rule : new PropertyRuleImpl(rule.name, rule.syntax, true, rule.initialValue)\n\n/** @internal */\nexport const render = (rule: PropertyRule, options?: RenderOptions): string => {\n const indent = options?.indent ?? DEFAULT_INDENT\n const declarations: Array<string> = [\n `syntax: ${quote(renderSyntax(rule.syntax))}`,\n `inherits: ${rule.inherits ? 'true' : 'false'}`,\n ]\n if (rule.initialValue !== undefined) {\n declarations.push(`initial-value: ${serializeValue(rule.initialValue, options)}`)\n }\n return renderBlock(`@property ${rule.name}`, declarations, indent)\n}\n\n/** @internal */\nexport const equals = dual<\n (that: PropertyRule) => (self: PropertyRule) => boolean,\n (self: PropertyRule, that: PropertyRule) => boolean\n>(2, (self: PropertyRule, that: PropertyRule): boolean => Equal.equals(self, that))\n"],"mappings":";;;;;;AAMA,MAAa,uBAAuB,OAAO,IAAI,qCAAqC;AAcpF,MAAM,cAAc,SAA6B;CAC/C,QAAQ,KAAK,MAAb;EACE,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO,IAAI,KAAK,KAAK;EACvB,KAAK,WACH,OAAO,KAAK;EACd,KAAK,QACH,OAAO,GAAG,WAAW,KAAK,SAAS,IAAI,KAAK,cAAc,UAAU,MAAM;EAC5E,KAAK,SACH,OAAO,KAAK,WAAW,IAAI,UAAU,CAAC,CAAC,KAAK,KAAK;CACrD;AACF;AAEA,MAAM,cAAc,GAAe,MAA2B;CAC5D,IAAI,EAAE,SAAS,EAAE,MACf,OAAO;CAET,QAAQ,EAAE,MAAV;EACE,KAAK,aACH,OAAO;EACT,KAAK;EACL,KAAK,WACH,OAAO,EAAE,SAAU,EAAe;EACpC,KAAK,QAAQ;GACX,MAAM,QAAQ;GACd,OAAO,E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