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.
- package/dist/data/index.mjs +1 -1
- package/dist/declaration/index.d.mts +1 -1
- package/dist/declaration/index.mjs +1 -1
- package/dist/fontFace/index.d.mts +1 -1
- package/dist/property/index.d.mts +1 -1
- package/dist/property/index.mjs +1 -1
- package/dist/query/index.d.mts +1 -1
- package/dist/query/index.mjs +137 -3
- package/dist/query/index.mjs.map +1 -1
- package/dist/rule/index.d.mts +1 -1
- package/dist/rule/index.mjs +1 -1
- package/dist/shared/{color.internal-Dts5ycTm.mjs → color.internal-9fpSiiJk.mjs} +3 -3
- package/dist/shared/color.internal-9fpSiiJk.mjs.map +1 -0
- package/dist/shared/{declaration-1DlO_ltT.d.mts → declaration-B-6Ykgs_.d.mts} +2 -2
- package/dist/shared/{declaration.internal-wLB4ssxC.mjs → declaration.internal-BeasYIJ0.mjs} +2 -2
- package/dist/shared/{declaration.internal-wLB4ssxC.mjs.map → declaration.internal-BeasYIJ0.mjs.map} +1 -1
- package/dist/shared/{fontFaceRule-C7nYgH6X.d.mts → fontFaceRule-DdnLAuVw.d.mts} +2 -2
- package/dist/shared/mediaQuery-DsBivHi0.d.mts +333 -0
- package/dist/shared/{mediaQuery.internal-B6iuMd75.mjs → mediaQuery.internal-CKTmLVxL.mjs} +70 -6
- package/dist/shared/mediaQuery.internal-CKTmLVxL.mjs.map +1 -0
- package/dist/shared/{mediaRule-BDB4WCYy.d.mts → mediaRule-4kY2IOq-.d.mts} +3 -3
- package/dist/shared/{propertyRule-BbkFh9b9.d.mts → propertyRule-B5pf7NgH.d.mts} +2 -2
- package/dist/shared/{propertyRule.internal-Bc_HrfcL.mjs → propertyRule.internal-CRyFLwbn.mjs} +2 -2
- package/dist/shared/{propertyRule.internal-Bc_HrfcL.mjs.map → propertyRule.internal-CRyFLwbn.mjs.map} +1 -1
- package/dist/shared/{ruleSet.internal-DodzVMUU.mjs → ruleSet.internal-a5m40W9E.mjs} +3 -3
- package/dist/shared/{ruleSet.internal-DodzVMUU.mjs.map → ruleSet.internal-a5m40W9E.mjs.map} +1 -1
- package/dist/stylesheet/index.d.mts +29 -10
- package/dist/stylesheet/index.mjs +83 -21
- package/dist/stylesheet/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/color.internal-Dts5ycTm.mjs.map +0 -1
- package/dist/shared/mediaQuery-BYR1z-iD.d.mts +0 -145
- package/dist/shared/mediaQuery.internal-B6iuMd75.mjs.map +0 -1
package/dist/data/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { d as ident, u as dimension } from "../shared/calc-Cih4o2r7.mjs";
|
|
3
|
-
import { A as oklab$1, C as shorter$1, D as hwb$1, E as hsl$1, F as srgbLinear$1, I as xyz$1, L as xyzD50$1, M as prophotoRgb$1, N as rec2020$1, O as lab$1, P as srgb$3, R as xyzD65$1, S as longer$1, T as displayP3$1, _ as isNone$1, a as isColor$1, b as increasing$1, c as named$1, d as refs$1, g as of$1, h as transparent$1, i as from$1, j as oklch$3, k as lch$1, l as oklch$2, m as srgb$2, n as channels$1, o as lightDark$1, p as serialize$1, r as equals$1, s as mix$1, t as bind$1, u as ref$1, v as none$1, w as a98Rgb$1, x as interpolate$1, y as decreasing$1 } from "../shared/color.internal-
|
|
3
|
+
import { A as oklab$1, C as shorter$1, D as hwb$1, E as hsl$1, F as srgbLinear$1, I as xyz$1, L as xyzD50$1, M as prophotoRgb$1, N as rec2020$1, O as lab$1, P as srgb$3, R as xyzD65$1, S as longer$1, T as displayP3$1, _ as isNone$1, a as isColor$1, b as increasing$1, c as named$1, d as refs$1, g as of$1, h as transparent$1, i as from$1, j as oklch$3, k as lch$1, l as oklch$2, m as srgb$2, n as channels$1, o as lightDark$1, p as serialize$1, r as equals$1, s as mix$1, t as bind$1, u as ref$1, v as none$1, w as a98Rgb$1, x as interpolate$1, y as decreasing$1 } from "../shared/color.internal-9fpSiiJk.mjs";
|
|
4
4
|
//#region src/data/angle.internal.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
const rad$1 = (value, precision) => dimension(value, "rad", "angle", precision);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as declaration_d_exports } from "../shared/declaration-
|
|
1
|
+
import { r as declaration_d_exports } from "../shared/declaration-B-6Ykgs_.mjs";
|
|
2
2
|
export { declaration_d_exports as Declaration };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { a as refs$1, i as make$1, n as equals$1, r as isDeclaration$1, s as render$1, t as bind$1 } from "../shared/declaration.internal-
|
|
2
|
+
import { a as refs$1, i as make$1, n as equals$1, r as isDeclaration$1, s as render$1, t as bind$1 } from "../shared/declaration.internal-BeasYIJ0.mjs";
|
|
3
3
|
//#region src/declaration/declaration.ts
|
|
4
4
|
var declaration_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
bind: () => bind,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as fontFaceRule_d_exports } from "../shared/fontFaceRule-
|
|
1
|
+
import { n as fontFaceRule_d_exports } from "../shared/fontFaceRule-DdnLAuVw.mjs";
|
|
2
2
|
export { fontFaceRule_d_exports as FontFaceRule };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as propertyRule_d_exports, r as propertySyntax_d_exports } from "../shared/propertyRule-
|
|
1
|
+
import { n as propertyRule_d_exports, r as propertySyntax_d_exports } from "../shared/propertyRule-B5pf7NgH.mjs";
|
|
2
2
|
export { propertyRule_d_exports as PropertyRule, propertySyntax_d_exports as PropertySyntax };
|
package/dist/property/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { C as resolution$1, D as transformList$1, E as transformFunction$1, O as universal$1, S as render$3, T as time$1, _ as lengthPercentage$1, a as render$2, b as oneOf$1, c as commaListOf$1, d as image$1, f as integer$1, g as length$1, h as keywords$1, i as make$1, k as url$1, l as customIdent$1, m as keyword$1, n as inheritable$1, o as angle$1, p as isPropertySyntax$1, r as isPropertyRule$1, s as color$1, t as equals$2, u as equals$3, v as listOf$1, w as string$1, x as percentage$1, y as number$1 } from "../shared/propertyRule.internal-
|
|
2
|
+
import { C as resolution$1, D as transformList$1, E as transformFunction$1, O as universal$1, S as render$3, T as time$1, _ as lengthPercentage$1, a as render$2, b as oneOf$1, c as commaListOf$1, d as image$1, f as integer$1, g as length$1, h as keywords$1, i as make$1, k as url$1, l as customIdent$1, m as keyword$1, n as inheritable$1, o as angle$1, p as isPropertySyntax$1, r as isPropertyRule$1, s as color$1, t as equals$2, u as equals$3, v as listOf$1, w as string$1, x as percentage$1, y as number$1 } from "../shared/propertyRule.internal-CRyFLwbn.mjs";
|
|
3
3
|
//#region src/property/propertyRule.ts
|
|
4
4
|
var propertyRule_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
equals: () => equals$1,
|
package/dist/query/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as mediaQuery_d_exports } from "../shared/mediaQuery-
|
|
1
|
+
import { r as mediaQuery_d_exports } from "../shared/mediaQuery-DsBivHi0.mjs";
|
|
2
2
|
export { mediaQuery_d_exports as MediaQuery };
|
package/dist/query/index.mjs
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as getMinWidth$1, c as hasMinWidth$1, d as isMediaQuery$1, f as maxWidth$1, h as render$1, i as getMaxWidth$1, l as hasPrefersColorScheme$1, m as prefersColorScheme$1, o as getPrefersColorScheme$1, p as minWidth$1, r as equals$1, s as hasMaxWidth$1, t as and$1 } from "../shared/mediaQuery.internal-CKTmLVxL.mjs";
|
|
3
3
|
//#region src/query/mediaQuery.ts
|
|
4
4
|
var mediaQuery_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
and: () => and,
|
|
6
6
|
equals: () => equals,
|
|
7
|
+
getMaxWidth: () => getMaxWidth,
|
|
8
|
+
getMinWidth: () => getMinWidth,
|
|
9
|
+
getPrefersColorScheme: () => getPrefersColorScheme,
|
|
10
|
+
hasMaxWidth: () => hasMaxWidth,
|
|
11
|
+
hasMinWidth: () => hasMinWidth,
|
|
12
|
+
hasPrefersColorScheme: () => hasPrefersColorScheme,
|
|
7
13
|
isMediaQuery: () => isMediaQuery,
|
|
14
|
+
maxWidth: () => maxWidth,
|
|
8
15
|
minWidth: () => minWidth,
|
|
9
16
|
prefersColorScheme: () => prefersColorScheme,
|
|
10
17
|
render: () => render
|
|
@@ -23,8 +30,11 @@ const isMediaQuery = isMediaQuery$1;
|
|
|
23
30
|
/**
|
|
24
31
|
* Creates a viewport-width lower bound.
|
|
25
32
|
*
|
|
33
|
+
* The result carries the `MinWidth` brand, so `getMinWidth` returns a
|
|
34
|
+
* bare `number` on it and on any conjunction built from it.
|
|
35
|
+
*
|
|
26
36
|
* @param px - The threshold in CSS pixels. Must be a non-negative finite number.
|
|
27
|
-
* @returns A one-feature `MediaQuery`.
|
|
37
|
+
* @returns A one-feature `MediaQuery`, branded `MinWidth`.
|
|
28
38
|
* @throws `Error` when `px` is negative or not finite.
|
|
29
39
|
* @example
|
|
30
40
|
* ```ts
|
|
@@ -35,15 +45,139 @@ const isMediaQuery = isMediaQuery$1;
|
|
|
35
45
|
*/
|
|
36
46
|
const minWidth = minWidth$1;
|
|
37
47
|
/**
|
|
48
|
+
* Creates a viewport-width upper bound.
|
|
49
|
+
*
|
|
50
|
+
* The result carries the `MaxWidth` brand, so `getMaxWidth` returns a
|
|
51
|
+
* bare `number` on it and on any conjunction built from it.
|
|
52
|
+
*
|
|
53
|
+
* @param px - The threshold in CSS pixels. Must be a non-negative finite number.
|
|
54
|
+
* @returns A one-feature `MediaQuery`, branded `MaxWidth`.
|
|
55
|
+
* @throws `Error` when `px` is negative or not finite.
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* MediaQuery.render(MediaQuery.maxWidth(1024)) // '(max-width: 1024px)'
|
|
59
|
+
* MediaQuery.render(MediaQuery.maxWidth(1024), { mediaSyntax: 'range' }) // '(width <= 1024px)'
|
|
60
|
+
* ```
|
|
61
|
+
* @since 0.3.0
|
|
62
|
+
*/
|
|
63
|
+
const maxWidth = maxWidth$1;
|
|
64
|
+
/**
|
|
38
65
|
* Creates a `prefers-color-scheme` condition.
|
|
39
66
|
*
|
|
67
|
+
* The result carries the `PrefersColorScheme` brand, so
|
|
68
|
+
* `getPrefersColorScheme` returns a guaranteed scheme on it and on any
|
|
69
|
+
* conjunction built from it.
|
|
70
|
+
*
|
|
40
71
|
* @param scheme - The scheme to match, `'dark'` or `'light'`.
|
|
41
|
-
* @returns A one-feature `MediaQuery`.
|
|
72
|
+
* @returns A one-feature `MediaQuery`, branded `PrefersColorScheme`.
|
|
42
73
|
* @since 0.1.0
|
|
43
74
|
*/
|
|
44
75
|
const prefersColorScheme = prefersColorScheme$1;
|
|
45
76
|
const and = and$1;
|
|
46
77
|
/**
|
|
78
|
+
* Gets the query's `min-width` threshold.
|
|
79
|
+
*
|
|
80
|
+
* The return type keys on the `MinWidth` brand. Where the type proves a
|
|
81
|
+
* `min-width` feature is present — `minWidth`'s result, any conjunction
|
|
82
|
+
* keeping its brand, or a query narrowed by `hasMinWidth` — the result is
|
|
83
|
+
* a bare `number`. On any other query it is `number | undefined`.
|
|
84
|
+
*
|
|
85
|
+
* When several `min-width` features stack, the largest threshold is
|
|
86
|
+
* returned — the conjunction's effective lower bound, since every
|
|
87
|
+
* feature must hold.
|
|
88
|
+
*
|
|
89
|
+
* @param query - The query to read.
|
|
90
|
+
* @returns The largest `min-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `min-width` feature.
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* MediaQuery.getMinWidth(MediaQuery.minWidth(768)) // 768
|
|
94
|
+
* MediaQuery.getMinWidth(MediaQuery.prefersColorScheme('dark')) // undefined
|
|
95
|
+
* MediaQuery.minWidth(768).pipe(
|
|
96
|
+
* MediaQuery.and(MediaQuery.minWidth(1024)),
|
|
97
|
+
* MediaQuery.getMinWidth,
|
|
98
|
+
* ) // 1024
|
|
99
|
+
* ```
|
|
100
|
+
* @since 0.3.0
|
|
101
|
+
*/
|
|
102
|
+
const getMinWidth = getMinWidth$1;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the query's `max-width` threshold.
|
|
105
|
+
*
|
|
106
|
+
* The return type keys on the `MaxWidth` brand. Where the type proves a
|
|
107
|
+
* `max-width` feature is present — `maxWidth`'s result, any conjunction
|
|
108
|
+
* keeping its brand, or a query narrowed by `hasMaxWidth` — the result is
|
|
109
|
+
* a bare `number`. On any other query it is `number | undefined`.
|
|
110
|
+
*
|
|
111
|
+
* When several `max-width` features stack, the smallest threshold is
|
|
112
|
+
* returned — the conjunction's effective upper bound, since every
|
|
113
|
+
* feature must hold.
|
|
114
|
+
*
|
|
115
|
+
* @param query - The query to read.
|
|
116
|
+
* @returns The smallest `max-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `max-width` feature.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* MediaQuery.getMaxWidth(MediaQuery.maxWidth(1024)) // 1024
|
|
120
|
+
* MediaQuery.getMaxWidth(MediaQuery.minWidth(768)) // undefined
|
|
121
|
+
* ```
|
|
122
|
+
* @since 0.3.0
|
|
123
|
+
*/
|
|
124
|
+
const getMaxWidth = getMaxWidth$1;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the query's `prefers-color-scheme` value.
|
|
127
|
+
*
|
|
128
|
+
* The return type keys on the `PrefersColorScheme` brand. Where the type
|
|
129
|
+
* proves the feature is present, the result is a bare `'dark' | 'light'`.
|
|
130
|
+
* On any other query it may also be `undefined`.
|
|
131
|
+
*
|
|
132
|
+
* A query holding both schemes matches nothing; the accessor then
|
|
133
|
+
* returns `'dark'`, the alphabetically first in canonical order.
|
|
134
|
+
*
|
|
135
|
+
* @param query - The query to read.
|
|
136
|
+
* @returns The required scheme, or `undefined` when an unbranded query carries no `prefers-color-scheme` feature.
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* MediaQuery.getPrefersColorScheme(MediaQuery.prefersColorScheme('dark')) // 'dark'
|
|
140
|
+
* MediaQuery.getPrefersColorScheme(MediaQuery.minWidth(768)) // undefined
|
|
141
|
+
* ```
|
|
142
|
+
* @since 0.3.0
|
|
143
|
+
*/
|
|
144
|
+
const getPrefersColorScheme = getPrefersColorScheme$1;
|
|
145
|
+
/**
|
|
146
|
+
* Checks if the query carries a `min-width` feature, narrowing its type
|
|
147
|
+
* to `MediaQuery<MinWidth>` so `getMinWidth` returns a bare `number`.
|
|
148
|
+
*
|
|
149
|
+
* @param query - The query to check.
|
|
150
|
+
* @returns `true` if a `min-width` feature is present, `false` otherwise.
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* declare const query: MediaQuery.MediaQuery
|
|
154
|
+
* if (MediaQuery.hasMinWidth(query)) {
|
|
155
|
+
* MediaQuery.getMinWidth(query) // number, not number | undefined
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
* @since 0.3.0
|
|
159
|
+
*/
|
|
160
|
+
const hasMinWidth = hasMinWidth$1;
|
|
161
|
+
/**
|
|
162
|
+
* Checks if the query carries a `max-width` feature, narrowing its type
|
|
163
|
+
* to `MediaQuery<MaxWidth>` so `getMaxWidth` returns a bare `number`.
|
|
164
|
+
*
|
|
165
|
+
* @param query - The query to check.
|
|
166
|
+
* @returns `true` if a `max-width` feature is present, `false` otherwise.
|
|
167
|
+
* @since 0.3.0
|
|
168
|
+
*/
|
|
169
|
+
const hasMaxWidth = hasMaxWidth$1;
|
|
170
|
+
/**
|
|
171
|
+
* Checks if the query carries a `prefers-color-scheme` feature, narrowing
|
|
172
|
+
* its type to `MediaQuery<PrefersColorScheme>` so `getPrefersColorScheme`
|
|
173
|
+
* returns a guaranteed scheme.
|
|
174
|
+
*
|
|
175
|
+
* @param query - The query to check.
|
|
176
|
+
* @returns `true` if a `prefers-color-scheme` feature is present, `false` otherwise.
|
|
177
|
+
* @since 0.3.0
|
|
178
|
+
*/
|
|
179
|
+
const hasPrefersColorScheme = hasPrefersColorScheme$1;
|
|
180
|
+
/**
|
|
47
181
|
* Renders the query as CSS text: features in canonical order —
|
|
48
182
|
* `min-width` ascending, then `prefers-color-scheme` — joined with
|
|
49
183
|
* ` and `. The `mediaSyntax` option picks the width-feature spelling
|
package/dist/query/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["internal.isMediaQuery","internal.minWidth","internal.prefersColorScheme","internal.and","internal.render","internal.equals"],"sources":["../../src/query/mediaQuery.ts"],"sourcesContent":["import type { Pipeable } from '#util'\nimport type { MediaQueryTypeId } from './mediaQuery.internal.ts'\nimport * as internal from './mediaQuery.internal.ts'\n\n/**\n * A media query: a canonically ordered, deduplicated and-set of media\n * features.\n *\n * Feature constructors (`minWidth`, `prefersColorScheme`) return\n * one-feature queries; `and` merges. Conjunction is commutative and\n * idempotent, so construction sorts features canonically and drops exact\n * duplicates — structurally equal queries compare equal however they\n * were built. The canonical order is stable public API: `min-width`\n * features first (ascending by threshold), then `prefers-color-scheme`\n * (schemes alphabetically). Distinct features always all render, even\n * when one subsumes another (`minWidth(768)` and `minWidth(1024)`):\n * simplification changes no meaning but is not this type's job.\n *\n * `or` and `not` become new node kinds when a consumer needs them.\n *\n * @since 0.1.0\n */\nexport interface MediaQuery extends Pipeable {\n readonly [MediaQueryTypeId]: MediaQueryTypeId\n}\n\n/**\n * Options for `render` — and the base of the library's render-options\n * family: every other module's `RenderOptions` extends this interface\n * (directly or through `Declaration.RenderOptions` and\n * `RuleSet.RenderOptions`), so an options object built for a bigger\n * renderer is accepted by every smaller one. A key means the same thing\n * wherever it appears; renderers ignore inherited keys that don't apply\n * to them.\n *\n * @since 0.1.0\n */\nexport interface RenderOptions {\n /**\n * The width-feature spelling: classic prefix syntax\n * (`(min-width: 768px)`, the default) or modern range syntax\n * (`(width >= 768px)`). Text only — the model is semantic and the two\n * spellings mean the same thing.\n */\n readonly mediaSyntax?: 'prefix' | 'range'\n}\n\n/**\n * Checks if a value is a `MediaQuery`.\n *\n * True only for values built by this module's constructors, which carry\n * the brand.\n *\n * @param u - The value to check.\n * @returns `true` if the value is a `MediaQuery`, `false` otherwise.\n * @since 0.1.0\n */\nexport const isMediaQuery: (u: unknown) => u is MediaQuery = internal.isMediaQuery\n\n/**\n * Creates a viewport-width lower bound.\n *\n * @param px - The threshold in CSS pixels. Must be a non-negative finite number.\n * @returns A one-feature `MediaQuery`.\n * @throws `Error` when `px` is negative or not finite.\n * @example\n * ```ts\n * MediaQuery.render(MediaQuery.minWidth(768)) // '(min-width: 768px)'\n * MediaQuery.render(MediaQuery.minWidth(768), { mediaSyntax: 'range' }) // '(width >= 768px)'\n * ```\n * @since 0.1.0\n */\nexport const minWidth: (px: number) => MediaQuery = internal.minWidth\n\n/**\n * Creates a `prefers-color-scheme` condition.\n *\n * @param scheme - The scheme to match, `'dark'` or `'light'`.\n * @returns A one-feature `MediaQuery`.\n * @since 0.1.0\n */\nexport const prefersColorScheme: (scheme: 'dark' | 'light') => MediaQuery =\n internal.prefersColorScheme\n\nexport const and: {\n /**\n * Returns a function that conjoins `that` with its argument.\n *\n * @param that - The query to merge in.\n * @returns A function producing the conjunction.\n * @since 0.1.0\n */\n (that: MediaQuery): (self: MediaQuery) => MediaQuery\n /**\n * Conjoins two queries: the result matches where both match. Features\n * re-sort into canonical order and exact duplicates collapse, so `and`\n * is commutative and idempotent.\n *\n * @param self - The first query.\n * @param that - The second query.\n * @returns The conjunction.\n * @example\n * ```ts\n * MediaQuery.minWidth(1280).pipe(\n * MediaQuery.and(MediaQuery.prefersColorScheme('dark')),\n * MediaQuery.render,\n * ) // '(min-width: 1280px) and (prefers-color-scheme: dark)'\n * ```\n * @since 0.1.0\n */\n (self: MediaQuery, that: MediaQuery): MediaQuery\n} = internal.and\n\n/**\n * Renders the query as CSS text: features in canonical order —\n * `min-width` ascending, then `prefers-color-scheme` — joined with\n * ` and `. The `mediaSyntax` option picks the width-feature spelling\n * (default `'prefix'`).\n *\n * @param query - The query to render.\n * @param options - Optional syntax selection.\n * @returns Deterministic CSS text, without the `@media ` prefix.\n * @since 0.1.0\n */\nexport const render: (query: MediaQuery, options?: RenderOptions) => string = internal.render\n\nexport const equals: {\n /**\n * Returns a function that checks structural equality against `that`.\n *\n * @param that - The query to compare against.\n * @returns A function testing its argument for structural equality with `that`.\n * @since 0.1.0\n */\n (that: MediaQuery): (self: MediaQuery) => boolean\n /**\n * Structural equality over canonically ordered features: two queries\n * built from the same conditions compare equal regardless of\n * construction order.\n *\n * @param self - The first query.\n * @param that - The second query.\n * @returns `true` if the queries are structurally equal.\n * @since 0.1.0\n */\n (self: MediaQuery, that: MediaQuery): boolean\n} = internal.equals\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,eAAgDA;;;;;;;;;;;;;;AAe7D,MAAa,WAAuCC;;;;;;;;AASpD,MAAa,qBACXC;AAEF,MAAa,MA2BTC;;;;;;;;;;;;AAaJ,MAAa,SAAiEC;AAE9E,MAAa,SAoBTC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["internal.isMediaQuery","internal.minWidth","internal.maxWidth","internal.prefersColorScheme","internal.and","internal.getMinWidth","internal.getMaxWidth","internal.getPrefersColorScheme","internal.hasMinWidth","internal.hasMaxWidth","internal.hasPrefersColorScheme","internal.render","internal.equals"],"sources":["../../src/query/mediaQuery.ts"],"sourcesContent":["import type { Pipeable } from '#util'\nimport type { MediaQueryFeatures, MediaQueryTypeId } from './mediaQuery.internal.ts'\nimport * as internal from './mediaQuery.internal.ts'\n\ndeclare const MinWidthId: unique symbol\ndeclare const MaxWidthId: unique symbol\ndeclare const PrefersColorSchemeId: unique symbol\n\n/**\n * A media query: a canonically ordered, deduplicated and-set of media\n * features.\n *\n * Feature constructors (`minWidth`, `maxWidth`, `prefersColorScheme`)\n * return one-feature queries; `and` merges. Conjunction is commutative\n * and idempotent, so construction sorts features canonically and drops\n * exact duplicates — structurally equal queries compare equal however\n * they were built. The canonical order is stable public API: `min-width`\n * features first (ascending by threshold), then `max-width` (ascending),\n * then `prefers-color-scheme` (schemes alphabetically). Distinct features\n * always all render, even when one subsumes another (`minWidth(768)` and\n * `minWidth(1024)`): simplification changes no meaning but is not this\n * type's job.\n *\n * `Features` records, as intersected type-level brands, which feature\n * kinds are known to be present. It defaults to `unknown` — no claims.\n * Constructors brand their result (`minWidth` returns\n * `MediaQuery<MinWidth>`), `and` keeps both sides' brands, the `has*`\n * guards recover a brand from a plain query at runtime, and the `get*`\n * accessors key their return type on it to drop `undefined`. Brands are\n * type-level only: a query is identical at runtime whatever its type\n * knows.\n *\n * `or` and `not` become new node kinds when a consumer needs them.\n *\n * @since 0.1.0\n */\nexport interface MediaQuery<out Features = unknown> extends Pipeable {\n readonly [MediaQueryTypeId]: MediaQueryTypeId\n readonly [MediaQueryFeatures]?: Features\n}\n\n/**\n * The brand of a query known to carry a `min-width` feature. `minWidth`\n * stamps it, `and` keeps it through conjunction, `hasMinWidth` recovers\n * it at runtime, and `getMinWidth` returns a guaranteed `number` where it\n * is present. Composes by intersection with the other feature brands.\n *\n * @since 0.3.0\n */\nexport type MinWidth = { readonly [MinWidthId]: 'minWidth' }\n\n/**\n * The brand of a query known to carry a `max-width` feature. `maxWidth`\n * stamps it, `and` keeps it through conjunction, `hasMaxWidth` recovers\n * it at runtime, and `getMaxWidth` returns a guaranteed `number` where it\n * is present. Composes by intersection with the other feature brands.\n *\n * @since 0.3.0\n */\nexport type MaxWidth = { readonly [MaxWidthId]: 'maxWidth' }\n\n/**\n * The brand of a query known to carry a `prefers-color-scheme` feature.\n * `prefersColorScheme` stamps it, `and` keeps it through conjunction,\n * `hasPrefersColorScheme` recovers it at runtime, and\n * `getPrefersColorScheme` returns a guaranteed scheme where it is\n * present. Composes by intersection with the other feature brands.\n *\n * @since 0.3.0\n */\nexport type PrefersColorScheme = { readonly [PrefersColorSchemeId]: 'prefersColorScheme' }\n\n/**\n * Options for `render` — and the base of the library's render-options\n * family: every other module's `RenderOptions` extends this interface\n * (directly or through `Declaration.RenderOptions` and\n * `RuleSet.RenderOptions`), so an options object built for a bigger\n * renderer is accepted by every smaller one. A key means the same thing\n * wherever it appears; renderers ignore inherited keys that don't apply\n * to them.\n *\n * @since 0.1.0\n */\nexport interface RenderOptions {\n /**\n * The width-feature spelling: classic prefix syntax\n * (`(min-width: 768px)`, the default) or modern range syntax\n * (`(width >= 768px)`). Text only — the model is semantic and the two\n * spellings mean the same thing.\n */\n readonly mediaSyntax?: 'prefix' | 'range'\n}\n\n/**\n * Checks if a value is a `MediaQuery`.\n *\n * True only for values built by this module's constructors, which carry\n * the brand.\n *\n * @param u - The value to check.\n * @returns `true` if the value is a `MediaQuery`, `false` otherwise.\n * @since 0.1.0\n */\nexport const isMediaQuery: (u: unknown) => u is MediaQuery = internal.isMediaQuery\n\n/**\n * Creates a viewport-width lower bound.\n *\n * The result carries the `MinWidth` brand, so `getMinWidth` returns a\n * bare `number` on it and on any conjunction built from it.\n *\n * @param px - The threshold in CSS pixels. Must be a non-negative finite number.\n * @returns A one-feature `MediaQuery`, branded `MinWidth`.\n * @throws `Error` when `px` is negative or not finite.\n * @example\n * ```ts\n * MediaQuery.render(MediaQuery.minWidth(768)) // '(min-width: 768px)'\n * MediaQuery.render(MediaQuery.minWidth(768), { mediaSyntax: 'range' }) // '(width >= 768px)'\n * ```\n * @since 0.1.0\n */\nexport const minWidth: (px: number) => MediaQuery<MinWidth> = internal.minWidth\n\n/**\n * Creates a viewport-width upper bound.\n *\n * The result carries the `MaxWidth` brand, so `getMaxWidth` returns a\n * bare `number` on it and on any conjunction built from it.\n *\n * @param px - The threshold in CSS pixels. Must be a non-negative finite number.\n * @returns A one-feature `MediaQuery`, branded `MaxWidth`.\n * @throws `Error` when `px` is negative or not finite.\n * @example\n * ```ts\n * MediaQuery.render(MediaQuery.maxWidth(1024)) // '(max-width: 1024px)'\n * MediaQuery.render(MediaQuery.maxWidth(1024), { mediaSyntax: 'range' }) // '(width <= 1024px)'\n * ```\n * @since 0.3.0\n */\nexport const maxWidth: (px: number) => MediaQuery<MaxWidth> = internal.maxWidth\n\n/**\n * Creates a `prefers-color-scheme` condition.\n *\n * The result carries the `PrefersColorScheme` brand, so\n * `getPrefersColorScheme` returns a guaranteed scheme on it and on any\n * conjunction built from it.\n *\n * @param scheme - The scheme to match, `'dark'` or `'light'`.\n * @returns A one-feature `MediaQuery`, branded `PrefersColorScheme`.\n * @since 0.1.0\n */\nexport const prefersColorScheme: (scheme: 'dark' | 'light') => MediaQuery<PrefersColorScheme> =\n internal.prefersColorScheme\n\nexport const and: {\n /**\n * Returns a function that conjoins `that` with its argument.\n *\n * @param that - The query to merge in.\n * @returns A function producing the conjunction.\n * @since 0.1.0\n */\n <B>(that: MediaQuery<B>): <A>(self: MediaQuery<A>) => MediaQuery<A & B>\n /**\n * Conjoins two queries: the result matches where both match. Features\n * re-sort into canonical order and exact duplicates collapse, so `and`\n * is commutative and idempotent.\n *\n * Known features intersect: the result keeps every brand either side\n * carries, so a `MinWidth` query stays `MinWidth` through conjunction.\n *\n * @param self - The first query.\n * @param that - The second query.\n * @returns The conjunction, branded with both sides' known features.\n * @example\n * ```ts\n * MediaQuery.minWidth(1280).pipe(\n * MediaQuery.and(MediaQuery.prefersColorScheme('dark')),\n * MediaQuery.render,\n * ) // '(min-width: 1280px) and (prefers-color-scheme: dark)'\n * ```\n * @since 0.1.0\n */\n <A, B>(self: MediaQuery<A>, that: MediaQuery<B>): MediaQuery<A & B>\n} = internal.and\n\n/**\n * Gets the query's `min-width` threshold.\n *\n * The return type keys on the `MinWidth` brand. Where the type proves a\n * `min-width` feature is present — `minWidth`'s result, any conjunction\n * keeping its brand, or a query narrowed by `hasMinWidth` — the result is\n * a bare `number`. On any other query it is `number | undefined`.\n *\n * When several `min-width` features stack, the largest threshold is\n * returned — the conjunction's effective lower bound, since every\n * feature must hold.\n *\n * @param query - The query to read.\n * @returns The largest `min-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `min-width` feature.\n * @example\n * ```ts\n * MediaQuery.getMinWidth(MediaQuery.minWidth(768)) // 768\n * MediaQuery.getMinWidth(MediaQuery.prefersColorScheme('dark')) // undefined\n * MediaQuery.minWidth(768).pipe(\n * MediaQuery.and(MediaQuery.minWidth(1024)),\n * MediaQuery.getMinWidth,\n * ) // 1024\n * ```\n * @since 0.3.0\n */\nexport const getMinWidth: <T>(\n query: MediaQuery<T>,\n) => T extends MinWidth ? number : number | undefined = internal.getMinWidth\n\n/**\n * Gets the query's `max-width` threshold.\n *\n * The return type keys on the `MaxWidth` brand. Where the type proves a\n * `max-width` feature is present — `maxWidth`'s result, any conjunction\n * keeping its brand, or a query narrowed by `hasMaxWidth` — the result is\n * a bare `number`. On any other query it is `number | undefined`.\n *\n * When several `max-width` features stack, the smallest threshold is\n * returned — the conjunction's effective upper bound, since every\n * feature must hold.\n *\n * @param query - The query to read.\n * @returns The smallest `max-width` threshold in CSS pixels, or `undefined` when an unbranded query carries no `max-width` feature.\n * @example\n * ```ts\n * MediaQuery.getMaxWidth(MediaQuery.maxWidth(1024)) // 1024\n * MediaQuery.getMaxWidth(MediaQuery.minWidth(768)) // undefined\n * ```\n * @since 0.3.0\n */\nexport const getMaxWidth: <T>(\n query: MediaQuery<T>,\n) => T extends MaxWidth ? number : number | undefined = internal.getMaxWidth\n\n/**\n * Gets the query's `prefers-color-scheme` value.\n *\n * The return type keys on the `PrefersColorScheme` brand. Where the type\n * proves the feature is present, the result is a bare `'dark' | 'light'`.\n * On any other query it may also be `undefined`.\n *\n * A query holding both schemes matches nothing; the accessor then\n * returns `'dark'`, the alphabetically first in canonical order.\n *\n * @param query - The query to read.\n * @returns The required scheme, or `undefined` when an unbranded query carries no `prefers-color-scheme` feature.\n * @example\n * ```ts\n * MediaQuery.getPrefersColorScheme(MediaQuery.prefersColorScheme('dark')) // 'dark'\n * MediaQuery.getPrefersColorScheme(MediaQuery.minWidth(768)) // undefined\n * ```\n * @since 0.3.0\n */\nexport const getPrefersColorScheme: <T>(\n query: MediaQuery<T>,\n) => T extends PrefersColorScheme ? 'dark' | 'light' : 'dark' | 'light' | undefined =\n internal.getPrefersColorScheme\n\n/**\n * Checks if the query carries a `min-width` feature, narrowing its type\n * to `MediaQuery<MinWidth>` so `getMinWidth` returns a bare `number`.\n *\n * @param query - The query to check.\n * @returns `true` if a `min-width` feature is present, `false` otherwise.\n * @example\n * ```ts\n * declare const query: MediaQuery.MediaQuery\n * if (MediaQuery.hasMinWidth(query)) {\n * MediaQuery.getMinWidth(query) // number, not number | undefined\n * }\n * ```\n * @since 0.3.0\n */\nexport const hasMinWidth: (query: MediaQuery) => query is MediaQuery<MinWidth> =\n internal.hasMinWidth\n\n/**\n * Checks if the query carries a `max-width` feature, narrowing its type\n * to `MediaQuery<MaxWidth>` so `getMaxWidth` returns a bare `number`.\n *\n * @param query - The query to check.\n * @returns `true` if a `max-width` feature is present, `false` otherwise.\n * @since 0.3.0\n */\nexport const hasMaxWidth: (query: MediaQuery) => query is MediaQuery<MaxWidth> =\n internal.hasMaxWidth\n\n/**\n * Checks if the query carries a `prefers-color-scheme` feature, narrowing\n * its type to `MediaQuery<PrefersColorScheme>` so `getPrefersColorScheme`\n * returns a guaranteed scheme.\n *\n * @param query - The query to check.\n * @returns `true` if a `prefers-color-scheme` feature is present, `false` otherwise.\n * @since 0.3.0\n */\nexport const hasPrefersColorScheme: (query: MediaQuery) => query is MediaQuery<PrefersColorScheme> =\n internal.hasPrefersColorScheme\n\n/**\n * Renders the query as CSS text: features in canonical order —\n * `min-width` ascending, then `prefers-color-scheme` — joined with\n * ` and `. The `mediaSyntax` option picks the width-feature spelling\n * (default `'prefix'`).\n *\n * @param query - The query to render.\n * @param options - Optional syntax selection.\n * @returns Deterministic CSS text, without the `@media ` prefix.\n * @since 0.1.0\n */\nexport const render: (query: MediaQuery, options?: RenderOptions) => string = internal.render\n\nexport const equals: {\n /**\n * Returns a function that checks structural equality against `that`.\n *\n * @param that - The query to compare against.\n * @returns A function testing its argument for structural equality with `that`.\n * @since 0.1.0\n */\n (that: MediaQuery): (self: MediaQuery) => boolean\n /**\n * Structural equality over canonically ordered features: two queries\n * built from the same conditions compare equal regardless of\n * construction order.\n *\n * @param self - The first query.\n * @param that - The second query.\n * @returns `true` if the queries are structurally equal.\n * @since 0.1.0\n */\n (self: MediaQuery, that: MediaQuery): boolean\n} = internal.equals\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,MAAa,eAAgDA;;;;;;;;;;;;;;;;;AAkB7D,MAAa,WAAiDC;;;;;;;;;;;;;;;;;AAkB9D,MAAa,WAAiDC;;;;;;;;;;;;AAa9D,MAAa,qBACXC;AAEF,MAAa,MA8BTC;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BJ,MAAa,cAE2CC;;;;;;;;;;;;;;;;;;;;;;AAuBxD,MAAa,cAE2CC;;;;;;;;;;;;;;;;;;;;AAqBxD,MAAa,wBAGXC;;;;;;;;;;;;;;;;AAiBF,MAAa,cACXC;;;;;;;;;AAUF,MAAa,cACXC;;;;;;;;;;AAWF,MAAa,wBACXC;;;;;;;;;;;;AAaF,MAAa,SAAiEC;AAE9E,MAAa,SAoBTC"}
|
package/dist/rule/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ruleSet_d_exports, o as styleRule_d_exports, t as mediaRule_d_exports } from "../shared/mediaRule-
|
|
1
|
+
import { i as ruleSet_d_exports, o as styleRule_d_exports, t as mediaRule_d_exports } from "../shared/mediaRule-4kY2IOq-.mjs";
|
|
2
2
|
export { mediaRule_d_exports as MediaRule, ruleSet_d_exports as RuleSet, styleRule_d_exports as StyleRule };
|
package/dist/rule/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { _ as equals$3, a as forMediaQuery$1, b as refs$3, c as isRuleSet$1, d as render$4, f as equals$5, g as render$5, h as refs$5, i as equals$4, l as make$4, m as make$5, n as concat$1, o as forSelector$1, p as isStyleRule$1, r as empty$1, s as isEmpty$1, t as append$1, u as refs$4, v as isMediaRule$1, x as render$3, y as make$3 } from "../shared/ruleSet.internal-
|
|
2
|
+
import { _ as equals$3, a as forMediaQuery$1, b as refs$3, c as isRuleSet$1, d as render$4, f as equals$5, g as render$5, h as refs$5, i as equals$4, l as make$4, m as make$5, n as concat$1, o as forSelector$1, p as isStyleRule$1, r as empty$1, s as isEmpty$1, t as append$1, u as refs$4, v as isMediaRule$1, x as render$3, y as make$3 } from "../shared/ruleSet.internal-a5m40W9E.mjs";
|
|
3
3
|
//#region src/rule/mediaRule.ts
|
|
4
4
|
var mediaRule_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
equals: () => equals$2,
|
|
@@ -6,9 +6,9 @@ import { i as toSpec } from "./precision.internal-0lv1nEpF.mjs";
|
|
|
6
6
|
//#region src/data/colorSpace.internal.ts
|
|
7
7
|
const ColorSpaceTypeId = Symbol.for("fashionable/data/colorSpace");
|
|
8
8
|
var ColorSpaceImpl = class {
|
|
9
|
+
[ColorSpaceTypeId] = ColorSpaceTypeId;
|
|
9
10
|
token;
|
|
10
11
|
wrap;
|
|
11
|
-
[ColorSpaceTypeId] = ColorSpaceTypeId;
|
|
12
12
|
constructor(token, wrap) {
|
|
13
13
|
this.token = token;
|
|
14
14
|
this.wrap = wrap;
|
|
@@ -56,8 +56,8 @@ const dataOf = (space) => space;
|
|
|
56
56
|
//#region src/data/hueInterpolation.internal.ts
|
|
57
57
|
const HueInterpolationTypeId = Symbol.for("fashionable/data/hueInterpolation");
|
|
58
58
|
var HueInterpolationImpl = class {
|
|
59
|
-
strategy;
|
|
60
59
|
[HueInterpolationTypeId] = HueInterpolationTypeId;
|
|
60
|
+
strategy;
|
|
61
61
|
constructor(strategy) {
|
|
62
62
|
this.strategy = strategy;
|
|
63
63
|
}
|
|
@@ -447,4 +447,4 @@ const equals = dual(2, (self, that) => equals$1(self, that));
|
|
|
447
447
|
//#endregion
|
|
448
448
|
export { oklab as A, shorter as C, hwb as D, hsl as E, srgbLinear as F, xyz as I, xyzD50 as L, prophotoRgb as M, rec2020 as N, lab as O, srgb$1 as P, xyzD65 as R, longer as S, displayP3 as T, isNone as _, isColor as a, increasing as b, named as c, refs as d, refsOf as f, of as g, transparent as h, from as i, oklch$1 as j, lch as k, oklch as l, srgb as m, channels as n, lightDark as o, serialize as p, equals as r, mix as s, bind as t, ref as u, none as v, a98Rgb as w, interpolate as x, decreasing as y };
|
|
449
449
|
|
|
450
|
-
//# sourceMappingURL=color.internal-
|
|
450
|
+
//# sourceMappingURL=color.internal-9fpSiiJk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.internal-9fpSiiJk.mjs","names":["srgb","oklch","Calc.subtract","Calc.mod","Calc.add","Calc.multiply","Calc.sign","Equal.hashString","Equal.combine","Equal.EqualTypeId","Equal.HashTypeId","#hash","calcRefsOf","percentageOf","spaceDataOf","Equal.equals"],"sources":["../../src/data/colorSpace.internal.ts","../../src/data/hueInterpolation.internal.ts","../../src/data/keywords.internal.ts","../../src/data/percentage.internal.ts","../../src/data/color.internal.ts"],"sourcesContent":["import type { ColorSpace } from './colorSpace.ts'\n\nexport const ColorSpaceTypeId = Symbol.for('fashionable/data/colorSpace')\nexport type ColorSpaceTypeId = typeof ColorSpaceTypeId\n\n/**\n * Phantom key holding a `ColorSpace`'s `Trait` parameter. The runtime value\n * never has a value here — traits are type-level brands, so a space is\n * identical at runtime whatever its traits (the curvy trait pattern).\n *\n * @internal\n */\nexport const ColorSpaceTraits: unique symbol = Symbol.for('fashionable/data/colorSpace/traits')\nexport type ColorSpaceTraits = typeof ColorSpaceTraits\n\n/**\n * How a relative color built in this space serializes: a named color function\n * (`oklch(from ...)`) or the `color()` wrapper with a colorspace token\n * (`color(from ... srgb ...)`).\n *\n * @internal\n */\nexport type Wrap = 'function' | 'color'\n\n/**\n * The erased runtime of a color space: the token that names it (`in <token>`\n * for `mix`, the destination for `from`) and how a `from` wraps. Polar-ness is\n * a type-level trait, so it carries no runtime data.\n *\n * @internal\n */\nexport interface ColorSpaceData {\n readonly token: string\n readonly wrap: Wrap\n}\n\nclass ColorSpaceImpl {\n readonly [ColorSpaceTypeId]: ColorSpaceTypeId = ColorSpaceTypeId\n readonly token: string\n readonly wrap: Wrap\n\n constructor(token: string, wrap: Wrap) {\n this.token = token\n this.wrap = wrap\n }\n\n get [Symbol.toStringTag]() {\n return `ColorSpace(${this.token})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const srgb = new ColorSpaceImpl('srgb', 'color')\n/** @internal */\nexport const srgbLinear = new ColorSpaceImpl('srgb-linear', 'color')\n/** @internal */\nexport const displayP3 = new ColorSpaceImpl('display-p3', 'color')\n/** @internal */\nexport const a98Rgb = new ColorSpaceImpl('a98-rgb', 'color')\n/** @internal */\nexport const prophotoRgb = new ColorSpaceImpl('prophoto-rgb', 'color')\n/** @internal */\nexport const rec2020 = new ColorSpaceImpl('rec2020', 'color')\n/** @internal */\nexport const lab = new ColorSpaceImpl('lab', 'function')\n/** @internal */\nexport const oklab = new ColorSpaceImpl('oklab', 'function')\n/** @internal */\nexport const xyz = new ColorSpaceImpl('xyz', 'color')\n/** @internal */\nexport const xyzD50 = new ColorSpaceImpl('xyz-d50', 'color')\n/** @internal */\nexport const xyzD65 = new ColorSpaceImpl('xyz-d65', 'color')\n/** @internal */\nexport const hsl = new ColorSpaceImpl('hsl', 'function')\n/** @internal */\nexport const hwb = new ColorSpaceImpl('hwb', 'function')\n/** @internal */\nexport const lch = new ColorSpaceImpl('lch', 'function')\n/** @internal */\nexport const oklch = new ColorSpaceImpl('oklch', 'function')\n\n/** @internal */\nexport const dataOf = (space: ColorSpace<unknown>): ColorSpaceData =>\n space as unknown as ColorSpaceData\n","import { Calc } from '#calc'\nimport type { Input } from '#calc/calc'\nimport type { HueInterpolation } from './hueInterpolation.ts'\n\nexport const HueInterpolationTypeId = Symbol.for('fashionable/data/hueInterpolation')\nexport type HueInterpolationTypeId = typeof HueInterpolationTypeId\n\nclass HueInterpolationImpl {\n readonly [HueInterpolationTypeId]: HueInterpolationTypeId = HueInterpolationTypeId\n readonly strategy: string\n\n constructor(strategy: string) {\n this.strategy = strategy\n }\n\n get [Symbol.toStringTag]() {\n return `HueInterpolation(${this.strategy})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const shorter = new HueInterpolationImpl('shorter')\n\n/** @internal */\nexport const longer = new HueInterpolationImpl('longer')\n\n/** @internal */\nexport const increasing = new HueInterpolationImpl('increasing')\n\n/** @internal */\nexport const decreasing = new HueInterpolationImpl('decreasing')\n\n/** @internal */\nexport const strategyOf = (hue: HueInterpolation<string>): string =>\n (hue as unknown as HueInterpolationImpl).strategy\n\n/** @internal */\nexport const interpolate = (\n strategy: HueInterpolation<string>,\n from: Input<string>,\n to: Input<string>,\n t: Input<string>,\n): Calc.Calc<never> => {\n // CSS Color 4 hue fixup, branchless in degree-space (`mod` handles the\n // normalization): each strategy is a signed delta the browser adds to `from`\n // as `t` runs 0 to 1. `shorter` and `longer` are complementary arcs;\n // `increasing`/`decreasing` force the direction.\n const delta = Calc.subtract(to, from)\n const shortest = Calc.subtract(Calc.mod(Calc.add(delta, 180), 360), 180)\n const strat = strategyOf(strategy)\n const step =\n strat === 'increasing'\n ? Calc.mod(delta, 360)\n : strat === 'decreasing'\n ? Calc.subtract(Calc.mod(delta, 360), 360)\n : strat === 'longer'\n ? Calc.subtract(shortest, Calc.multiply(360, Calc.sign(shortest)))\n : shortest\n return Calc.add(from, Calc.multiply(step, t)) as unknown as Calc.Calc<never>\n}\n","import { Pipeable } from '#util'\nimport type { None } from './keywords.ts'\n\nexport const NoneTypeId = Symbol.for('fashionable/data/keywords/none')\nexport type NoneTypeId = typeof NoneTypeId\n\nclass NoneImpl extends Pipeable implements None {\n readonly [NoneTypeId]: NoneTypeId = NoneTypeId\n\n get [Symbol.toStringTag]() {\n return 'Keyword(none)'\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const none: None = new NoneImpl()\n\n/** @internal */\nexport const isNone = (u: unknown): u is None =>\n typeof u === 'object' && u !== null && NoneTypeId in u\n","import type { Calc } from '#calc/calc'\nimport { dimension } from '#calc/calc.internal'\nimport type { Precision } from '#calc/precision'\nimport type { Percent } from './units.ts'\n\n/** @internal */\nexport const of = (value: number, precision?: Precision): Calc<never, 'percentage', Percent> =>\n dimension(value, '%', 'percentage', precision)\n","import type { ApplyBindings, Bindings, Calc, Input, SerializeOptions } from '#calc/calc'\nimport {\n type CalcNode,\n collectBindings,\n identsOf,\n needsCalcWrap,\n nodeEquals,\n nodeHash,\n nodeOf,\n refsOf as calcRefsOf,\n serializeNode,\n substituteNode,\n toCalc,\n} from '#calc/calc.internal'\nimport { toSpec } from '#calc/precision.internal'\nimport * as Equal from '#internal/equal'\nimport { DEFAULT_FORMAT, type FormatSpec } from '#internal/format'\nimport { EMPTY_REFS, unionRefs } from '#internal/refs'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { Color, RelativeChannel } from './color.ts'\nimport { dataOf as spaceDataOf, type Wrap } from './colorSpace.internal.ts'\nimport type { ColorSpace } from './colorSpace.ts'\nimport { strategyOf } from './hueInterpolation.internal.ts'\nimport type { HueInterpolation } from './hueInterpolation.ts'\nimport { isNone } from './keywords.internal.ts'\nimport type { None } from './keywords.ts'\nimport { of as percentageOf } from './percentage.internal.ts'\nimport type { ChannelLeaf } from './units.ts'\n\nexport const ColorTypeId = Symbol.for('fashionable/color')\nexport type ColorTypeId = typeof ColorTypeId\n\n/**\n * A channel slot: a number expression, or CSS's missing-component\n * keyword. The `none` marker is a singleton, so channel operations\n * discriminate by reference.\n *\n * @internal\n */\nexport type ChannelNode = CalcNode | NoneChannel\n\ninterface NoneChannel {\n readonly _tag: 'NoneKeyword'\n}\n\nconst NONE_CHANNEL: NoneChannel = { _tag: 'NoneKeyword' }\n\nconst isNoneChannel = (channel: ChannelNode): channel is NoneChannel => channel === NONE_CHANNEL\n\n/** @internal */\nexport interface OklchNode {\n readonly _tag: 'Oklch'\n readonly lightness: ChannelNode\n readonly chroma: ChannelNode\n readonly hue: ChannelNode\n}\n\n/** @internal */\nexport interface SrgbNode {\n readonly _tag: 'Srgb'\n readonly red: ChannelNode\n readonly green: ChannelNode\n readonly blue: ChannelNode\n}\n\n/**\n * A named color (`transparent`, `rebeccapurple`): the name is the whole\n * value, so the node has no channels and nothing to bind.\n *\n * @internal\n */\nexport interface NamedColorNode {\n readonly _tag: 'Named'\n readonly name: string\n}\n\n/**\n * A scheme-conditional color: `light-dark(light, dark)`. Arms are whole\n * color nodes — positional, not commutative (the first slot is the\n * light scheme) — so the node operations recurse where the channel\n * functions stay flat.\n *\n * @internal\n */\nexport interface LightDarkNode {\n readonly _tag: 'LightDark'\n readonly light: ColorNode\n readonly dark: ColorNode\n}\n\n/**\n * The normalized interpolation method of a `color-mix()`: a colorspace\n * token plus, for polar spaces, an optional hue-interpolation strategy.\n * The type-level polar/rectangular split lives in `color.ts`; the node\n * carries the erased strings.\n *\n * @internal\n */\nexport interface MethodNode {\n readonly colorspace: string\n readonly hue: string | undefined\n}\n\n/**\n * A `color-mix(in method, c1 p1?, c2 p2?)`. The two arms are whole color\n * nodes, each with an optional percentage — a percentage-kind `CalcNode`,\n * never `none`, `undefined` when omitted. Arms are positional (they carry\n * their own percentages), so the node operations recurse, as `LightDark`\n * does.\n *\n * @internal\n */\nexport interface ColorMixNode {\n readonly _tag: 'ColorMix'\n readonly method: MethodNode\n readonly color1: ColorNode\n readonly percentage1: CalcNode | undefined\n readonly color2: ColorNode\n readonly percentage2: CalcNode | undefined\n}\n\n/**\n * A relative color: `oklch(from origin l c h [/ a])` or\n * `color(from origin srgb r g b [/ a])`. `token` names the destination space\n * and `wrap` selects its serialized form — a named function or the `color()`\n * wrapper — both read off the `ColorSpace` argument. `origin` is a whole color\n * node (recursed, as `LightDark` arms are). The three `channels` and the\n * optional `alpha` are calc slots whose expressions may read the origin's\n * channels through the `Channel` keywords — bare-identifier leaves that stay\n * put under bind and contribute no refs.\n *\n * @internal\n */\nexport interface RelativeNode {\n readonly _tag: 'Relative'\n readonly token: string\n readonly wrap: Wrap\n readonly origin: ColorNode\n readonly channels: readonly [ChannelNode, ChannelNode, ChannelNode]\n readonly alpha: ChannelNode | undefined\n}\n\n/**\n * A color-valued custom-property reference: `var(--name)` used as a whole\n * color. The reference is the whole value, so — like a `Named` — it has no\n * channels to descend into; it serializes `var(--name)` and reports `name` as\n * a ref. The channel-binding path cannot substitute a color into it, so its\n * ref rides through `bind` (restored structurally), the browser being the one\n * to resolve it.\n *\n * @internal\n */\nexport interface ColorRefNode {\n readonly _tag: 'ColorRef'\n readonly name: string\n}\n\n/** @internal */\nexport type ColorNode =\n | OklchNode\n | SrgbNode\n | LightDarkNode\n | NamedColorNode\n | ColorMixNode\n | RelativeNode\n | ColorRefNode\n\ntype ChannelFunctionNode = OklchNode | SrgbNode\n\nconst channelsOf = (node: ChannelFunctionNode): ReadonlyArray<ChannelNode> =>\n node._tag === 'Oklch'\n ? [node.lightness, node.chroma, node.hue]\n : [node.red, node.green, node.blue]\n\nconst mapChannel = (channel: ChannelNode, f: (channel: CalcNode) => CalcNode): ChannelNode =>\n isNoneChannel(channel) ? channel : f(channel)\n\nconst mapColorNode = (node: ColorNode, f: (channel: CalcNode) => CalcNode): ColorNode => {\n switch (node._tag) {\n case 'Oklch':\n return {\n _tag: 'Oklch',\n lightness: mapChannel(node.lightness, f),\n chroma: mapChannel(node.chroma, f),\n hue: mapChannel(node.hue, f),\n }\n case 'Srgb':\n return {\n _tag: 'Srgb',\n red: mapChannel(node.red, f),\n green: mapChannel(node.green, f),\n blue: mapChannel(node.blue, f),\n }\n case 'LightDark':\n return {\n _tag: 'LightDark',\n light: mapColorNode(node.light, f),\n dark: mapColorNode(node.dark, f),\n }\n case 'ColorMix':\n return {\n _tag: 'ColorMix',\n method: node.method,\n color1: mapColorNode(node.color1, f),\n percentage1: node.percentage1 === undefined ? undefined : f(node.percentage1),\n color2: mapColorNode(node.color2, f),\n percentage2: node.percentage2 === undefined ? undefined : f(node.percentage2),\n }\n case 'Relative':\n return {\n _tag: 'Relative',\n token: node.token,\n wrap: node.wrap,\n origin: mapColorNode(node.origin, f),\n channels: [\n mapChannel(node.channels[0], f),\n mapChannel(node.channels[1], f),\n mapChannel(node.channels[2], f),\n ],\n alpha: node.alpha === undefined ? undefined : mapChannel(node.alpha, f),\n }\n case 'ColorRef':\n case 'Named':\n return node\n }\n}\n\n// A single calc-expression slot — a channel or a percentage — wrapped in\n// `calc()` only when it is arithmetic; function forms and leaves stand alone.\nconst serializeCalcNode = (node: CalcNode, precision: FormatSpec): string => {\n const wrap = needsCalcWrap(node)\n const body = serializeNode(node, wrap, { precision })\n return wrap ? `calc(${body})` : body\n}\n\nconst serializeChannel = (channel: ChannelNode, precision: FormatSpec): string =>\n isNoneChannel(channel) ? 'none' : serializeCalcNode(channel, precision)\n\nconst serializeMethod = (method: MethodNode): string =>\n method.hue === undefined ? `in ${method.colorspace}` : `in ${method.colorspace} ${method.hue} hue`\n\nconst serializeMixArm = (\n color: ColorNode,\n percentage: CalcNode | undefined,\n precision: FormatSpec,\n): string => {\n const rendered = serializeColorNode(color, precision)\n return percentage === undefined\n ? rendered\n : `${rendered} ${serializeCalcNode(percentage, precision)}`\n}\n\nconst serializeColorNode = (node: ColorNode, precision: FormatSpec): string => {\n if (node._tag === 'Named') {\n return node.name\n }\n if (node._tag === 'LightDark') {\n return `light-dark(${serializeColorNode(node.light, precision)}, ${serializeColorNode(node.dark, precision)})`\n }\n if (node._tag === 'ColorMix') {\n return `color-mix(${serializeMethod(node.method)}, ${serializeMixArm(node.color1, node.percentage1, precision)}, ${serializeMixArm(node.color2, node.percentage2, precision)})`\n }\n if (node._tag === 'ColorRef') {\n return `var(--${node.name})`\n }\n if (node._tag === 'Relative') {\n const origin = serializeColorNode(node.origin, precision)\n const rendered = node.channels.map((channel) => serializeChannel(channel, precision)).join(' ')\n const alpha = node.alpha === undefined ? '' : ` / ${serializeChannel(node.alpha, precision)}`\n return node.wrap === 'function'\n ? `${node.token}(from ${origin} ${rendered}${alpha})`\n : `color(from ${origin} ${node.token} ${rendered}${alpha})`\n }\n const rendered = channelsOf(node)\n .map((channel) => serializeChannel(channel, precision))\n .join(' ')\n return node._tag === 'Oklch' ? `oklch(${rendered})` : `color(srgb ${rendered})`\n}\n\nconst channelEquals = (a: ChannelNode, b: ChannelNode): boolean => {\n if (isNoneChannel(a) || isNoneChannel(b)) {\n return a === b\n }\n return nodeEquals(a, b)\n}\n\nconst percentageEquals = (a: CalcNode | undefined, b: CalcNode | undefined): boolean =>\n a === undefined || b === undefined ? a === b : nodeEquals(a, b)\n\n// An optional channel — a relative color's alpha — where an omitted slot only\n// equals another omitted slot, never a present `none` or expression.\nconst alphaEquals = (a: ChannelNode | undefined, b: ChannelNode | undefined): boolean =>\n a === undefined || b === undefined ? a === b : channelEquals(a, b)\n\nconst colorNodeEquals = (a: ColorNode, b: ColorNode): boolean => {\n if (a._tag !== b._tag) {\n return false\n }\n if (a._tag === 'Named') {\n return a.name === (b as NamedColorNode).name\n }\n if (a._tag === 'LightDark') {\n const other = b as LightDarkNode\n return colorNodeEquals(a.light, other.light) && colorNodeEquals(a.dark, other.dark)\n }\n if (a._tag === 'ColorMix') {\n const other = b as ColorMixNode\n return (\n a.method.colorspace === other.method.colorspace &&\n a.method.hue === other.method.hue &&\n colorNodeEquals(a.color1, other.color1) &&\n percentageEquals(a.percentage1, other.percentage1) &&\n colorNodeEquals(a.color2, other.color2) &&\n percentageEquals(a.percentage2, other.percentage2)\n )\n }\n if (a._tag === 'ColorRef') {\n return a.name === (b as ColorRefNode).name\n }\n if (a._tag === 'Relative') {\n const other = b as RelativeNode\n return (\n a.token === other.token &&\n a.wrap === other.wrap &&\n colorNodeEquals(a.origin, other.origin) &&\n a.channels.every((channel, index) =>\n channelEquals(channel, other.channels[index] as ChannelNode),\n ) &&\n alphaEquals(a.alpha, other.alpha)\n )\n }\n const others = channelsOf(b as ChannelFunctionNode)\n return channelsOf(a).every((channel, index) =>\n channelEquals(channel, others[index] as ChannelNode),\n )\n}\n\nconst hashChannel = (channel: ChannelNode): number =>\n isNoneChannel(channel) ? Equal.hashString('none') : nodeHash(channel)\n\nconst colorNodeHash = (node: ColorNode): number => {\n let h = Equal.hashString(node._tag)\n if (node._tag === 'Named') {\n return Equal.combine(h, Equal.hashString(node.name))\n }\n if (node._tag === 'ColorRef') {\n return Equal.combine(h, Equal.hashString(node.name))\n }\n if (node._tag === 'LightDark') {\n h = Equal.combine(h, colorNodeHash(node.light))\n return Equal.combine(h, colorNodeHash(node.dark))\n }\n if (node._tag === 'ColorMix') {\n h = Equal.combine(h, Equal.hashString(node.method.colorspace))\n h = Equal.combine(h, node.method.hue === undefined ? 0 : Equal.hashString(node.method.hue))\n h = Equal.combine(h, colorNodeHash(node.color1))\n h = Equal.combine(h, node.percentage1 === undefined ? 0 : nodeHash(node.percentage1))\n h = Equal.combine(h, colorNodeHash(node.color2))\n return Equal.combine(h, node.percentage2 === undefined ? 0 : nodeHash(node.percentage2))\n }\n if (node._tag === 'Relative') {\n h = Equal.combine(h, Equal.hashString(node.token))\n h = Equal.combine(h, Equal.hashString(node.wrap))\n h = Equal.combine(h, colorNodeHash(node.origin))\n for (const channel of node.channels) {\n h = Equal.combine(h, hashChannel(channel))\n }\n return Equal.combine(h, node.alpha === undefined ? 0 : hashChannel(node.alpha))\n }\n for (const channel of channelsOf(node)) {\n h = Equal.combine(h, hashChannel(channel))\n }\n return h\n}\n\nclass ColorImpl extends Pipeable implements Color<string>, Equal.Equal {\n readonly [ColorTypeId]: ColorTypeId = ColorTypeId\n\n readonly node: ColorNode\n readonly refSet: ReadonlySet<string>\n #hash: number | undefined\n\n constructor(node: ColorNode, refSet: ReadonlySet<string>) {\n super()\n this.node = node\n this.refSet = refSet\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return isColor(that) && colorNodeEquals(this.node, nodeOfColor(that))\n }\n\n [Equal.HashTypeId](): number {\n this.#hash ??= Equal.combine(Equal.hashString('fashionable/color'), colorNodeHash(this.node))\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `Color(${serializeColorNode(this.node, DEFAULT_FORMAT)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isColor = (u: unknown): u is Color<string> =>\n typeof u === 'object' && u !== null && ColorTypeId in u\n\n/** @internal */\nexport const nodeOfColor = (color: Color<string>): ColorNode => (color as ColorImpl).node\n\n/** @internal */\nexport const refsOf = <R extends string>(color: Color<R>): ReadonlySet<R> =>\n (color as unknown as ColorImpl).refSet as ReadonlySet<R>\n\ninterface ResolvedChannel {\n readonly node: ChannelNode\n readonly refs: ReadonlySet<string>\n}\n\n// The erased channel input the constructors funnel through `toChannel`: a\n// number, `none`, or any number-kind expression — including one branded with a\n// relative-color channel keyword. The public signatures pin the precise refs\n// and scope the keywords to the space; this stays wide enough to accept all.\ntype RelativeChannelInput = RelativeChannel<string, ChannelLeaf<string>>\n\nconst toChannel = (input: RelativeChannelInput): ResolvedChannel => {\n if (isNone(input)) {\n return { node: NONE_CHANNEL, refs: EMPTY_REFS }\n }\n const calc = toCalc(input)\n return { node: nodeOf(calc), refs: calcRefsOf(calc) }\n}\n\n/** @internal */\nexport function oklch<L extends string = never, C extends string = never, H extends string = never>(\n lightness: Input<L> | None,\n chroma: Input<C> | None,\n hue: Input<H> | None,\n): Color<L | C | H> {\n const l = toChannel(lightness)\n const c = toChannel(chroma)\n const h = toChannel(hue)\n return new ColorImpl(\n { _tag: 'Oklch', lightness: l.node, chroma: c.node, hue: h.node },\n unionRefs(l.refs, c.refs, h.refs),\n ) as Color<L | C | H>\n}\n\n/** @internal */\nexport function srgb<R extends string = never, G extends string = never, B extends string = never>(\n red: Input<R> | None,\n green: Input<G> | None,\n blue: Input<B> | None,\n): Color<R | G | B> {\n const r = toChannel(red)\n const g = toChannel(green)\n const b = toChannel(blue)\n return new ColorImpl(\n { _tag: 'Srgb', red: r.node, green: g.node, blue: b.node },\n unionRefs(r.refs, g.refs, b.refs),\n ) as Color<R | G | B>\n}\n\n// The CSS-wide keywords are whole-declaration values, not colors —\n// `light-dark(inherit, …)` is invalid CSS — so `named` rejects them\n// (the `PropertySyntax.keyword` posture).\nconst CSS_WIDE_KEYWORDS = new Set([\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'default',\n])\n\n/** @internal */\nexport const named = (name: string): Color<never> => {\n invariant(name.length > 0, 'Named color must be a non-empty string')\n invariant(\n !CSS_WIDE_KEYWORDS.has(name.toLowerCase()),\n `Named color must not be a CSS-wide keyword, got '${name}'`,\n )\n return new ColorImpl({ _tag: 'Named', name }, EMPTY_REFS) as Color<never>\n}\n\n/** @internal */\nexport const transparent: Color<never> = named('transparent')\n\n/** @internal */\nexport const ref = <Name extends string>(name: Name): Color<Name> => {\n invariant(name.length > 0, 'Color reference name must be a non-empty string')\n return new ColorImpl({ _tag: 'ColorRef', name }, new Set([name])) as Color<Name>\n}\n\n/** @internal */\nexport function lightDark<A extends string = never, B extends string = never>(\n light: Color<A>,\n dark: Color<B>,\n): Color<A | B> {\n return new ColorImpl(\n { _tag: 'LightDark', light: nodeOfColor(light), dark: nodeOfColor(dark) },\n unionRefs(refsOf(light), refsOf(dark)),\n ) as Color<A | B>\n}\n\n// The erased mix arm: a whole color, or a [color, weight] tuple whose weight is\n// a percentage-kind expression (a bare number reads as a percent).\ntype MixArmInput =\n | Color<string>\n | readonly [Color<string>, number | Calc<string, 'percentage', unknown>]\n\ninterface ResolvedArm {\n readonly color: ColorNode\n readonly percentage: CalcNode | undefined\n readonly refs: ReadonlySet<string>\n}\n\nconst toArm = (arm: MixArmInput): ResolvedArm => {\n if (isColor(arm)) {\n return { color: nodeOfColor(arm), percentage: undefined, refs: refsOf(arm) }\n }\n const [color, percentage] = arm\n const pct = typeof percentage === 'number' ? percentageOf(percentage) : percentage\n return {\n color: nodeOfColor(color),\n percentage: nodeOf(pct),\n refs: unionRefs(refsOf(color), calcRefsOf(pct)),\n }\n}\n\n/** @internal */\nexport function mix(\n space: ColorSpace<unknown>,\n arg2: HueInterpolation<string> | MixArmInput,\n arg3: MixArmInput,\n arg4?: MixArmInput,\n): Color<never> {\n // (space, color1, color2), or (space, hue, color1, color2) — the hue form is\n // the one with a fourth argument\n const hasHue = arg4 !== undefined\n const hue = hasHue ? strategyOf(arg2 as HueInterpolation<string>) : undefined\n const a1 = toArm((hasHue ? arg3 : arg2) as MixArmInput)\n const a2 = toArm((hasHue ? arg4 : arg3) as MixArmInput)\n return new ColorImpl(\n {\n _tag: 'ColorMix',\n method: { colorspace: spaceDataOf(space).token, hue },\n color1: a1.color,\n percentage1: a1.percentage,\n color2: a2.color,\n percentage2: a2.percentage,\n },\n unionRefs(a1.refs, a2.refs),\n ) as Color<never>\n}\n\nconst relative = (\n token: string,\n wrap: Wrap,\n origin: Color<string>,\n channel1: RelativeChannelInput,\n channel2: RelativeChannelInput,\n channel3: RelativeChannelInput,\n alpha: RelativeChannelInput | undefined,\n): Color<string> => {\n const c1 = toChannel(channel1)\n const c2 = toChannel(channel2)\n const c3 = toChannel(channel3)\n const a = alpha === undefined ? undefined : toChannel(alpha)\n return new ColorImpl(\n {\n _tag: 'Relative',\n token,\n wrap,\n origin: nodeOfColor(origin),\n channels: [c1.node, c2.node, c3.node],\n alpha: a === undefined ? undefined : a.node,\n },\n unionRefs(refsOf(origin), c1.refs, c2.refs, c3.refs, a === undefined ? EMPTY_REFS : a.refs),\n )\n}\n\n/** @internal */\nexport function from(\n origin: Color<string>,\n space: ColorSpace<unknown>,\n channel1: RelativeChannelInput,\n channel2: RelativeChannelInput,\n channel3: RelativeChannelInput,\n alpha?: RelativeChannelInput,\n): Color<never> {\n const { token, wrap } = spaceDataOf(space)\n return relative(token, wrap, origin, channel1, channel2, channel3, alpha) as Color<never>\n}\n\n// The color-valued reference names in a node — the `ColorRef` origins the\n// channel-binding path cannot substitute, so `bind` restores them structurally\n// rather than trust `collectBindings` to have kept them (it strips any bound\n// key, including a color-ref name a caller passed a value for).\nconst colorRefNames = (node: ColorNode): ReadonlySet<string> => {\n switch (node._tag) {\n case 'ColorRef':\n return new Set([node.name])\n case 'LightDark':\n return unionRefs(colorRefNames(node.light), colorRefNames(node.dark))\n case 'ColorMix':\n return unionRefs(colorRefNames(node.color1), colorRefNames(node.color2))\n case 'Relative':\n return colorRefNames(node.origin)\n case 'Oklch':\n case 'Srgb':\n case 'Named':\n return EMPTY_REFS\n }\n}\n\nconst identsOfChannel = (channel: ChannelNode): ReadonlySet<string> =>\n isNoneChannel(channel) ? EMPTY_REFS : identsOf(channel)\n\n// The channel-keyword tokens a color reads — each channel slot's calc tree\n// walked and sub-colors recursed, the `Color` counterpart to `Calc.channels`.\n// Only relative colors introduce keywords; other nodes carry them solely\n// through a nested relative origin or arm.\nconst colorChannels = (node: ColorNode): ReadonlySet<string> => {\n switch (node._tag) {\n case 'Named':\n case 'ColorRef':\n return EMPTY_REFS\n case 'Oklch':\n return unionRefs(\n identsOfChannel(node.lightness),\n identsOfChannel(node.chroma),\n identsOfChannel(node.hue),\n )\n case 'Srgb':\n return unionRefs(\n identsOfChannel(node.red),\n identsOfChannel(node.green),\n identsOfChannel(node.blue),\n )\n case 'LightDark':\n return unionRefs(colorChannels(node.light), colorChannels(node.dark))\n case 'ColorMix':\n return unionRefs(\n colorChannels(node.color1),\n node.percentage1 === undefined ? EMPTY_REFS : identsOf(node.percentage1),\n colorChannels(node.color2),\n node.percentage2 === undefined ? EMPTY_REFS : identsOf(node.percentage2),\n )\n case 'Relative':\n return unionRefs(\n colorChannels(node.origin),\n identsOfChannel(node.channels[0]),\n identsOfChannel(node.channels[1]),\n identsOfChannel(node.channels[2]),\n node.alpha === undefined ? EMPTY_REFS : identsOfChannel(node.alpha),\n )\n }\n}\n\n/** @internal */\nexport const bind: {\n <const B extends Bindings>(\n bindings: B,\n ): <Refs extends string>(color: Color<Refs>) => Color<ApplyBindings<Refs, B>>\n <Refs extends string, const B extends Bindings>(\n color: Color<Refs>,\n bindings: B,\n ): Color<ApplyBindings<Refs, B>>\n} = dual(2, (color: Color<string>, bindings: Record<string, Input<string>>): Color<string> => {\n const collected = collectBindings(refsOf(color), bindings)\n const node = mapColorNode(nodeOfColor(color), (channel) =>\n substituteNode(channel, collected.nodeBindings),\n )\n return new ColorImpl(node, unionRefs(collected.refSet, colorRefNames(node)))\n})\n\n/** @internal */\nexport function serialize<Refs extends string>(\n color: Color<Refs>,\n options?: SerializeOptions<Refs>,\n): string {\n let node = nodeOfColor(color)\n if (options?.bindings !== undefined) {\n const collected = collectBindings(\n refsOf(color),\n options.bindings as Record<string, Input<string> | undefined>,\n )\n node = mapColorNode(node, (channel) => substituteNode(channel, collected.nodeBindings))\n }\n const precision = options?.precision === undefined ? DEFAULT_FORMAT : toSpec(options.precision)\n return serializeColorNode(node, precision)\n}\n\n/** @internal */\nexport function refs<Refs extends string>(color: Color<Refs>): ReadonlySet<Refs> {\n return refsOf(color)\n}\n\n/** @internal */\nexport function channels(color: Color<string>): ReadonlySet<string> {\n return colorChannels(nodeOfColor(color))\n}\n\n/** @internal */\nexport const equals = dual<\n (that: Color<string>) => (self: Color<string>) => boolean,\n (self: Color<string>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MAAM,GACzB,KAAK,gBAAgB,KAAA,IAAY,aAAa,SAAS,KAAK,WAAW,CACzE;EACF,KAAK,YACH,OAAO,UACL,cAAc,KAAK,MAAM,GACzB,gBAAgB,KAAK,SAAS,EAAE,GAChC,gBAAgB,KAAK,SAAS,EAAE,GAChC,gBAAgB,KAAK,SAAS,EAAE,GAChC,KAAK,UAAU,KAAA,IAAY,aAAa,gBAAgB,KAAK,KAAK,CACpE;CACJ;AACF;;AAGA,MAAa,OAQT,KAAK,IAAI,OAAsB,aAA2D;CAC5F,MAAM,YAAY,gBAAgB,OAAO,KAAK,GAAG,QAAQ;CACzD,MAAM,OAAO,aAAa,YAAY,KAAK,IAAI,YAC7C,eAAe,SAAS,UAAU,YAAY,CAChD;CACA,OAAO,IAAI,UAAU,MAAM,UAAU,UAAU,QAAQ,cAAc,IAAI,CAAC,CAAC;AAC7E,CAAC;;AAGD,SAAgB,UACd,OACA,SACQ;CACR,IAAI,OAAO,YAAY,KAAK;CAC5B,IAAI,SAAS,aAAa,KAAA,GAAW;EACnC,MAAM,YAAY,gBAChB,OAAO,KAAK,GACZ,QAAQ,QACV;EACA,OAAO,aAAa,OAAO,YAAY,eAAe,SAAS,UAAU,YAAY,CAAC;CACxF;CACA,MAAM,YAAY,SAAS,cAAc,KAAA,IAAY,iBAAiB,OAAO,QAAQ,SAAS;CAC9F,OAAO,mBAAmB,MAAM,SAAS;AAC3C;;AAGA,SAAgB,KAA0B,OAAuC;CAC/E,OAAO,OAAO,KAAK;AACrB;;AAGA,SAAgB,SAAS,OAA2C;CAClE,OAAO,cAAc,YAAY,KAAK,CAAC;AACzC;;AAGA,MAAa,SAAS,KAGpB,IAAI,MAAqB,SAAiCC,SAAa,MAAM,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Kind, c as Precision, n as Bindings, r as Calc, t as ApplyBindings } 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 "./mediaQuery-
|
|
4
|
+
import { n as RenderOptions$1 } from "./mediaQuery-DsBivHi0.mjs";
|
|
5
5
|
//#region src/declaration/declaration.internal.d.ts
|
|
6
6
|
declare const DeclarationTypeId: unique symbol;
|
|
7
7
|
type DeclarationTypeId = typeof DeclarationTypeId;
|
|
@@ -163,4 +163,4 @@ declare const equals: {
|
|
|
163
163
|
};
|
|
164
164
|
//#endregion
|
|
165
165
|
export { RenderOptions as n, declaration_d_exports as r, Declaration as t };
|
|
166
|
-
//# sourceMappingURL=declaration-
|
|
166
|
+
//# sourceMappingURL=declaration-B-6Ykgs_.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$1, n as HashTypeId, r as combine, s as hashString, t as EqualTypeId } from "./equal-U9G5LhtL.mjs";
|
|
3
3
|
import { C as EMPTY_REFS, S as toCalc, c as bind$1, p as isCalc, v as refsOf$1, y as serialize } from "./calc-Cih4o2r7.mjs";
|
|
4
|
-
import { f as refsOf$2, p as serialize$1, t as bind$2 } from "./color.internal-
|
|
4
|
+
import { f as refsOf$2, p as serialize$1, t as bind$2 } from "./color.internal-9fpSiiJk.mjs";
|
|
5
5
|
//#region src/declaration/declaration.internal.ts
|
|
6
6
|
const DeclarationTypeId = Symbol.for("fashionable/declaration");
|
|
7
7
|
const valueEquals = (a, b) => typeof a === "string" || typeof b === "string" ? a === b : equals$1(a, b);
|
|
@@ -70,4 +70,4 @@ const equals = dual(2, (self, that) => equals$1(self, that));
|
|
|
70
70
|
//#endregion
|
|
71
71
|
export { refs as a, renderWith as c, make as i, equals as n, refsOf as o, isDeclaration as r, render as s, bind as t };
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=declaration.internal-
|
|
73
|
+
//# sourceMappingURL=declaration.internal-BeasYIJ0.mjs.map
|
package/dist/shared/{declaration.internal-wLB4ssxC.mjs.map → declaration.internal-BeasYIJ0.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.internal-
|
|
1
|
+
{"version":3,"file":"declaration.internal-BeasYIJ0.mjs","names":["Equal.equals","Equal.hashString","Equal.hash","serializeCalc","serializeColor","calcRefsOf","colorRefsOf","Equal.EqualTypeId","Equal.HashTypeId","#hash","Equal.combine","bindCalc","bindColor"],"sources":["../../src/declaration/declaration.internal.ts"],"sourcesContent":["import type { ApplyBindings, Bindings, Input } from '#calc/calc'\nimport {\n bind as bindCalc,\n isCalc,\n refsOf as calcRefsOf,\n serialize as serializeCalc,\n toCalc,\n} from '#calc/calc.internal'\nimport type { Precision } from '#calc/precision'\nimport {\n bind as bindColor,\n refsOf as colorRefsOf,\n serialize as serializeColor,\n} from '#data/color.internal'\nimport * as Equal from '#internal/equal'\nimport { EMPTY_REFS } from '#internal/refs'\nimport { dual, invariant, Pipeable } from '#util'\nimport type { Declaration, RenderOptions, Value } from './declaration.ts'\n\nexport const DeclarationTypeId = Symbol.for('fashionable/declaration')\nexport type DeclarationTypeId = typeof DeclarationTypeId\n\nconst valueEquals = (a: Value<string>, b: Value<string>): boolean =>\n typeof a === 'string' || typeof b === 'string' ? a === b : Equal.equals(a, b)\n\nconst valueHash = (value: Value<string>): number =>\n typeof value === 'string' ? Equal.hashString(value) : Equal.hash(value)\n\nconst serializeValue = (value: Value<string>, precision?: Precision): string => {\n if (typeof value === 'string') {\n return value\n }\n const options = precision === undefined ? {} : { precision }\n return isCalc(value) ? serializeCalc(value, options) : serializeColor(value, options)\n}\n\nclass DeclarationImpl extends Pipeable implements Declaration<string>, Equal.Equal {\n readonly [DeclarationTypeId]: DeclarationTypeId = DeclarationTypeId\n\n readonly name: string\n readonly value: Value<string>\n readonly refSet: ReadonlySet<string>\n #hash: number | undefined\n\n constructor(name: string, value: Value<string>) {\n super()\n this.name = name\n this.value = value\n this.refSet =\n typeof value === 'string'\n ? EMPTY_REFS\n : isCalc(value)\n ? calcRefsOf(value)\n : colorRefsOf(value)\n }\n\n [Equal.EqualTypeId](that: unknown): boolean {\n return isDeclaration(that) && this.name === that.name && valueEquals(this.value, that.value)\n }\n\n [Equal.HashTypeId](): number {\n if (this.#hash === undefined) {\n let h = Equal.hashString('fashionable/declaration')\n h = Equal.combine(h, Equal.hashString(this.name))\n h = Equal.combine(h, valueHash(this.value))\n this.#hash = h\n }\n return this.#hash\n }\n\n get [Symbol.toStringTag]() {\n return `Declaration(${this.name}: ${serializeValue(this.value)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isDeclaration = (u: unknown): u is Declaration<string> =>\n typeof u === 'object' && u !== null && DeclarationTypeId in u\n\n/** @internal */\nexport const refsOf = <R extends string>(declaration: Declaration<R>): ReadonlySet<R> =>\n (declaration as unknown as DeclarationImpl).refSet as ReadonlySet<R>\n\n/** @internal */\nexport function make<Refs extends string = never>(\n name: string,\n value: Value<Refs> | number,\n): Declaration<Refs> {\n invariant(name.length > 0, 'Declaration name must be a non-empty string')\n return new DeclarationImpl(\n name,\n typeof value === 'number' ? toCalc(value) : value,\n ) as Declaration<Refs>\n}\n\n/** @internal */\nexport const bind: {\n <const B extends Bindings>(\n bindings: B,\n ): <Refs extends string>(declaration: Declaration<Refs>) => Declaration<ApplyBindings<Refs, B>>\n <Refs extends string, const B extends Bindings>(\n declaration: Declaration<Refs>,\n bindings: B,\n ): Declaration<ApplyBindings<Refs, B>>\n} = dual(\n 2,\n (\n declaration: Declaration<string>,\n bindings: Record<string, Input<string>>,\n ): Declaration<string> => {\n const value = declaration.value\n if (typeof value === 'string') {\n return declaration\n }\n return new DeclarationImpl(\n declaration.name,\n isCalc(value) ? bindCalc(value, bindings) : bindColor(value, bindings),\n )\n },\n)\n\n/** @internal */\nexport function refs<Refs extends string>(declaration: Declaration<Refs>): ReadonlySet<Refs> {\n return refsOf(declaration)\n}\n\n/** @internal */\nexport const renderWith = (declaration: Declaration<string>, precision?: Precision): string =>\n `${declaration.name}: ${serializeValue(declaration.value, precision)};`\n\n/** @internal */\nexport const render = (declaration: Declaration<string>, options?: RenderOptions): string =>\n renderWith(declaration, options?.precision)\n\n/** @internal */\nexport const equals = dual<\n (that: Declaration<string>) => (self: Declaration<string>) => boolean,\n (self: Declaration<string>, that: Declaration<string>) => boolean\n>(2, (self: Declaration<string>, that: Declaration<string>): boolean => Equal.equals(self, that))\n"],"mappings":";;;;;AAmBA,MAAa,oBAAoB,OAAO,IAAI,yBAAyB;AAGrE,MAAM,eAAe,GAAkB,MACrC,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW,MAAM,IAAIA,SAAa,GAAG,CAAC;AAE9E,MAAM,aAAa,UACjB,OAAO,UAAU,WAAWC,WAAiB,KAAK,IAAIC,KAAW,KAAK;AAExE,MAAM,kBAAkB,OAAsB,cAAkC;CAC9E,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,MAAM,UAAU,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;CAC3D,OAAO,OAAO,KAAK,IAAIC,UAAc,OAAO,OAAO,IAAIC,YAAe,OAAO,OAAO;AACtF;AAEA,IAAM,kBAAN,cAA8B,SAAqD;CACjF,CAAU,qBAAwC;CAElD;CACA;CACA;CACA;CAEA,YAAY,MAAc,OAAsB;EAC9C,MAAM;EACN,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,KAAK,SACH,OAAO,UAAU,WACb,aACA,OAAO,KAAK,IACVC,SAAW,KAAK,IAChBC,SAAY,KAAK;CAC3B;CAEA,CAACC,aAAmB,MAAwB;EAC1C,OAAO,cAAc,IAAI,KAAK,KAAK,SAAS,KAAK,QAAQ,YAAY,KAAK,OAAO,KAAK,KAAK;CAC7F;CAEA,CAACC,cAA4B;EAC3B,IAAI,KAAKC,UAAU,KAAA,GAAW;GAC5B,IAAI,IAAIR,WAAiB,yBAAyB;GAClD,IAAIS,QAAc,GAAGT,WAAiB,KAAK,IAAI,CAAC;GAChD,IAAIS,QAAc,GAAG,UAAU,KAAK,KAAK,CAAC;GAC1C,KAAKD,QAAQ;EACf;EACA,OAAO,KAAKA;CACd;CAEA,KAAK,OAAO,eAAe;EACzB,OAAO,eAAe,KAAK,KAAK,IAAI,eAAe,KAAK,KAAK,EAAE;CACjE;CAEA,KAAK,OAAO,IAAI,4BAA4B,KAAK;EAC/C,OAAO,KAAK,OAAO;CACrB;AACF;;AAGA,MAAa,iBAAiB,MAC5B,OAAO,MAAM,YAAY,MAAM,QAAQ,qBAAqB;;AAG9D,MAAa,UAA4B,gBACtC,YAA2C;;AAG9C,SAAgB,KACd,MACA,OACmB;CACnB,UAAU,KAAK,SAAS,GAAG,6CAA6C;CACxE,OAAO,IAAI,gBACT,MACA,OAAO,UAAU,WAAW,OAAO,KAAK,IAAI,KAC9C;AACF;;AAGA,MAAa,OAQT,KACF,IAEE,aACA,aACwB;CACxB,MAAM,QAAQ,YAAY;CAC1B,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,OAAO,IAAI,gBACT,YAAY,MACZ,OAAO,KAAK,IAAIE,OAAS,OAAO,QAAQ,IAAIC,OAAU,OAAO,QAAQ,CACvE;AACF,CACF;;AAGA,SAAgB,KAA0B,aAAmD;CAC3F,OAAO,OAAO,WAAW;AAC3B;;AAGA,MAAa,cAAc,aAAkC,cAC3D,GAAG,YAAY,KAAK,IAAI,eAAe,YAAY,OAAO,SAAS,EAAE;;AAGvE,MAAa,UAAU,aAAkC,YACvD,WAAW,aAAa,SAAS,SAAS;;AAG5C,MAAa,SAAS,KAGpB,IAAI,MAA2B,SAAuCZ,SAAa,MAAM,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Pipeable } from "./utils-BKm298I-.mjs";
|
|
2
|
-
import { n as RenderOptions$1 } from "./declaration-
|
|
2
|
+
import { n as RenderOptions$1 } from "./declaration-B-6Ykgs_.mjs";
|
|
3
3
|
//#region src/fontFace/fontFaceRule.internal.d.ts
|
|
4
4
|
declare const FontFaceRuleTypeId: unique symbol;
|
|
5
5
|
type FontFaceRuleTypeId = typeof FontFaceRuleTypeId;
|
|
@@ -291,4 +291,4 @@ declare const equals: {
|
|
|
291
291
|
};
|
|
292
292
|
//#endregion
|
|
293
293
|
export { fontFaceRule_d_exports as n, FontFaceRule as t };
|
|
294
|
-
//# sourceMappingURL=fontFaceRule-
|
|
294
|
+
//# sourceMappingURL=fontFaceRule-DdnLAuVw.d.mts.map
|