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
@@ -1 +0,0 @@
1
- {"version":3,"file":"color.internal-Dts5ycTm.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\n constructor(\n readonly token: string,\n readonly 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\n constructor(readonly strategy: string) {}\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>, that: Color<string>) => boolean\n>(2, (self: Color<string>, that: Color<string>): boolean => Equal.equals(self, that))\n"],"mappings":";;;;;;AAEA,MAAa,mBAAmB,OAAO,IAAI,6BAA6B;AAkCxE,IAAM,iBAAN,MAAqB;CAIR;CACA;CAJX,CAAU,oBAAsC;CAEhD,YACE,OACA,MACA;EAFS,KAAA,QAAA;EACA,KAAA,OAAA;CACR;CAEH,KAAK,OAAO,eAAe;EACzB,OAAO,cAAc,KAAK,MAAM;CAClC;CAEA,KAAK,OAAO,IAAI,4BAA4B,KAAK;EAC/C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,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,145 +0,0 @@
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
- declare namespace mediaQuery_d_exports {
6
- export { MediaQuery, RenderOptions, and, equals, isMediaQuery, minWidth, prefersColorScheme, render };
7
- }
8
- /**
9
- * A media query: a canonically ordered, deduplicated and-set of media
10
- * features.
11
- *
12
- * Feature constructors (`minWidth`, `prefersColorScheme`) return
13
- * one-feature queries; `and` merges. Conjunction is commutative and
14
- * idempotent, so construction sorts features canonically and drops exact
15
- * duplicates — structurally equal queries compare equal however they
16
- * were built. The canonical order is stable public API: `min-width`
17
- * features first (ascending by threshold), then `prefers-color-scheme`
18
- * (schemes alphabetically). Distinct features always all render, even
19
- * when one subsumes another (`minWidth(768)` and `minWidth(1024)`):
20
- * simplification changes no meaning but is not this type's job.
21
- *
22
- * `or` and `not` become new node kinds when a consumer needs them.
23
- *
24
- * @since 0.1.0
25
- */
26
- interface MediaQuery extends Pipeable {
27
- readonly [MediaQueryTypeId]: MediaQueryTypeId;
28
- }
29
- /**
30
- * Options for `render` — and the base of the library's render-options
31
- * family: every other module's `RenderOptions` extends this interface
32
- * (directly or through `Declaration.RenderOptions` and
33
- * `RuleSet.RenderOptions`), so an options object built for a bigger
34
- * renderer is accepted by every smaller one. A key means the same thing
35
- * wherever it appears; renderers ignore inherited keys that don't apply
36
- * to them.
37
- *
38
- * @since 0.1.0
39
- */
40
- interface RenderOptions {
41
- /**
42
- * The width-feature spelling: classic prefix syntax
43
- * (`(min-width: 768px)`, the default) or modern range syntax
44
- * (`(width >= 768px)`). Text only — the model is semantic and the two
45
- * spellings mean the same thing.
46
- */
47
- readonly mediaSyntax?: 'prefix' | 'range';
48
- }
49
- /**
50
- * Checks if a value is a `MediaQuery`.
51
- *
52
- * True only for values built by this module's constructors, which carry
53
- * the brand.
54
- *
55
- * @param u - The value to check.
56
- * @returns `true` if the value is a `MediaQuery`, `false` otherwise.
57
- * @since 0.1.0
58
- */
59
- declare const isMediaQuery: (u: unknown) => u is MediaQuery;
60
- /**
61
- * Creates a viewport-width lower bound.
62
- *
63
- * @param px - The threshold in CSS pixels. Must be a non-negative finite number.
64
- * @returns A one-feature `MediaQuery`.
65
- * @throws `Error` when `px` is negative or not finite.
66
- * @example
67
- * ```ts
68
- * MediaQuery.render(MediaQuery.minWidth(768)) // '(min-width: 768px)'
69
- * MediaQuery.render(MediaQuery.minWidth(768), { mediaSyntax: 'range' }) // '(width >= 768px)'
70
- * ```
71
- * @since 0.1.0
72
- */
73
- declare const minWidth: (px: number) => MediaQuery;
74
- /**
75
- * Creates a `prefers-color-scheme` condition.
76
- *
77
- * @param scheme - The scheme to match, `'dark'` or `'light'`.
78
- * @returns A one-feature `MediaQuery`.
79
- * @since 0.1.0
80
- */
81
- declare const prefersColorScheme: (scheme: 'dark' | 'light') => MediaQuery;
82
- declare const and: {
83
- /**
84
- * Returns a function that conjoins `that` with its argument.
85
- *
86
- * @param that - The query to merge in.
87
- * @returns A function producing the conjunction.
88
- * @since 0.1.0
89
- */
90
- (that: MediaQuery): (self: MediaQuery) => MediaQuery;
91
- /**
92
- * Conjoins two queries: the result matches where both match. Features
93
- * re-sort into canonical order and exact duplicates collapse, so `and`
94
- * is commutative and idempotent.
95
- *
96
- * @param self - The first query.
97
- * @param that - The second query.
98
- * @returns The conjunction.
99
- * @example
100
- * ```ts
101
- * MediaQuery.minWidth(1280).pipe(
102
- * MediaQuery.and(MediaQuery.prefersColorScheme('dark')),
103
- * MediaQuery.render,
104
- * ) // '(min-width: 1280px) and (prefers-color-scheme: dark)'
105
- * ```
106
- * @since 0.1.0
107
- */
108
- (self: MediaQuery, that: MediaQuery): MediaQuery;
109
- };
110
- /**
111
- * Renders the query as CSS text: features in canonical order —
112
- * `min-width` ascending, then `prefers-color-scheme` — joined with
113
- * ` and `. The `mediaSyntax` option picks the width-feature spelling
114
- * (default `'prefix'`).
115
- *
116
- * @param query - The query to render.
117
- * @param options - Optional syntax selection.
118
- * @returns Deterministic CSS text, without the `@media ` prefix.
119
- * @since 0.1.0
120
- */
121
- declare const render: (query: MediaQuery, options?: RenderOptions) => string;
122
- declare const equals: {
123
- /**
124
- * Returns a function that checks structural equality against `that`.
125
- *
126
- * @param that - The query to compare against.
127
- * @returns A function testing its argument for structural equality with `that`.
128
- * @since 0.1.0
129
- */
130
- (that: MediaQuery): (self: MediaQuery) => boolean;
131
- /**
132
- * Structural equality over canonically ordered features: two queries
133
- * built from the same conditions compare equal regardless of
134
- * construction order.
135
- *
136
- * @param self - The first query.
137
- * @param that - The second query.
138
- * @returns `true` if the queries are structurally equal.
139
- * @since 0.1.0
140
- */
141
- (self: MediaQuery, that: MediaQuery): boolean;
142
- };
143
- //#endregion
144
- export { RenderOptions as n, mediaQuery_d_exports as r, MediaQuery as t };
145
- //# sourceMappingURL=mediaQuery-BYR1z-iD.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mediaQuery.internal-B6iuMd75.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 { MediaQuery, RenderOptions } from './mediaQuery.ts'\n\nexport const MediaQueryTypeId = Symbol.for('fashionable/query/mediaQuery')\nexport type MediaQueryTypeId = typeof MediaQueryTypeId\n\n// ---------------------------------------------------------------------------\n// feature ADT\n// ---------------------------------------------------------------------------\n\n/** @internal */\nexport type MediaFeature =\n | { readonly _tag: 'MinWidth'; readonly px: number }\n | { readonly _tag: 'PrefersColorScheme'; readonly scheme: 'dark' | 'light' }\n\n// Feature kinds order by definition rank, then within kind: min-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.\nconst featureRank = (feature: MediaFeature): number => {\n switch (feature._tag) {\n case 'MinWidth':\n return 0\n case 'PrefersColorScheme':\n return 1\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') {\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') {\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') {\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 '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 => {\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 prefersColorScheme = (scheme: 'dark' | 'light'): MediaQuery =>\n new MediaQueryImpl([{ _tag: 'PrefersColorScheme', scheme }])\n\n/** @internal */\nexport const and = dual<\n (that: MediaQuery) => (self: MediaQuery) => MediaQuery,\n (self: MediaQuery, that: MediaQuery) => MediaQuery\n>(\n 2,\n (self: MediaQuery, that: MediaQuery): MediaQuery =>\n new MediaQueryImpl(canonicalize([...featuresOf(self), ...featuresOf(that)])),\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) => boolean,\n (self: MediaQuery, that: MediaQuery) => boolean\n>(2, (self: MediaQuery, that: MediaQuery): boolean => Equal.equals(self, that))\n"],"mappings":";;;;AAKA,MAAa,mBAAmB,OAAO,IAAI,8BAA8B;AAgBzE,MAAM,eAAe,YAAkC;CACrD,QAAQ,QAAQ,MAAhB;EACE,KAAK,YACH,OAAO;EACT,KAAK,sBACH,OAAO;CACX;AACF;AAEA,MAAM,mBAAmB,GAAiB,MAA4B;CACpE,MAAM,OAAO,YAAY,CAAC,IAAI,YAAY,CAAC;CAC3C,IAAI,S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