@sanity/themer 0.0.0 → 0.1.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/README.md +9 -89
- package/dist/{legacy.cjs → defaults-DJtuhI2W.js} +94 -56
- package/dist/defaults-DJtuhI2W.js.map +1 -0
- package/dist/legacy.d.ts +8 -90
- package/dist/legacy.d.ts.map +1 -1
- package/dist/legacy.js +2 -1199
- package/dist/tool.d.ts +20 -13
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +682 -250
- package/dist/tool.js.map +1 -1
- package/dist/types-DfPLuLv0.d.ts +74 -0
- package/dist/types-DfPLuLv0.d.ts.map +1 -0
- package/package.json +22 -39
- package/dist/_chunks/mix.cjs +0 -52
- package/dist/_chunks/mix.cjs.map +0 -1
- package/dist/_chunks/mix.js +0 -42
- package/dist/_chunks/mix.js.map +0 -1
- package/dist/_chunks/presets.cjs +0 -215
- package/dist/_chunks/presets.cjs.map +0 -1
- package/dist/_chunks/presets.js +0 -201
- package/dist/_chunks/presets.js.map +0 -1
- package/dist/_chunks/types.d.cts +0 -26
- package/dist/_chunks/types.d.cts.map +0 -1
- package/dist/_chunks/types.d.ts +0 -26
- package/dist/_chunks/types.d.ts.map +0 -1
- package/dist/index.cjs +0 -3
- package/dist/index.d.cts +0 -63
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts +0 -63
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/legacy.cjs.map +0 -1
- package/dist/legacy.d.cts +0 -166
- package/dist/legacy.d.cts.map +0 -1
- package/dist/legacy.js.map +0 -1
- package/dist/tool.cjs +0 -407
- package/dist/tool.cjs.map +0 -1
- package/dist/tool.d.cts +0 -45
- package/dist/tool.d.cts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults-DJtuhI2W.js","names":["Hue","dropUndefined","hue","Partial","undefined","result","mid","midPoint","lightest","darkest","dropUndefined","black","white","Hues","PartialHues","lightest","hex","toLowerCase","darkest","defaultHues","default","mid","midPoint","primary","transparent","positive","caution","critical","applyHues","_hues","defaults","hues","defaultMid","primaryMid","transparentMid","positiveMid","cautionMid","criticalMid","mix","weight","color","otherColor","r1","g1","b1","hexToRgb","r2","g2","b2","w2","reduceHex","channelToHex","Math","floor","isColor","input","test","TypeError","JSON","stringify","hex","length","slice","parseInt","value","toString","isColor","dropUndefined","Hue","HueMidPoint","PartialHues","HUE_KEYS","const","VALID_MID_POINTS","Set","parseHuesFromSearchParams","searchParams","URLSearchParams","lightest","has","assertValidColor","get","toLowerCase","undefined","darkest","default","parseHue","primary","transparent","positive","caution","critical","key","defaultLightest","defaultDarkest","Partial","input","mid","midPoint","params","split","length","TypeError","JSON","stringify","param","maybeMid","maybeMidPoint","roundMidPoint","Number","isNaN","assertValidMidPoint","startsWith","replace","throwDuplicate","value","Math","round","a","b","String","isMidPoint","applyHues","parseHuesFromSearchParams","ThemePreset","definePreset","slug","title","searchParams","hues","URLSearchParams","defaultPreset","presets","getPreset","needle","toLowerCase","match","find","preset","COLOR_TINTS","ColorTints","mix","Hue","Hues","createTonesFromHues","hues","default","primary","transparent","positive","caution","critical","createTintsFromHue","hue","title","reduce","Partial","tints","tint","hex","getColorHex","tintNum","Number","midPoint","darkSize","lightPosition","darkPosition","mid","toLowerCase","lightest","darkest","ColorTints","buildTheme","createColorTheme","multiply","multiplyRgb","parseColor","rgba","rgbToHex","screen","screenRgb","applyHues","createTonesFromHues","blue","cyan","gray","green","magenta","orange","purple","red","yellow","LegacyTheme","PartialHues","NEUTRAL_TONES","ReadonlySet","Set","SPOT_TINTS","Record","getTint","key","tints","Error","defaultTheme","themeFromHues","partialHues","bg","fg","hues","black","title","hex","default","darkest","white","lightest","tones","focusRingHue","primary","accentHue","critical","linkHue","color","base","dark","name","skeletonFrom","transparent","border","focusRing","shadow","outline","umbra","penumbra","ambient","skeleton","from","to","solid","state","tone","mix","mix2","defaultTints","isNeutral","has","bg2","icon","muted","accent","link","code","button","mode","enabled","hovered","pressed","selected","disabled","card","input","placeholder","selectable","spot","syntax","mainShade","secondaryShade","atrule","attrName","attrValue","attribute","boolean","builtin","cdata","char","class","className","comment","constant","deleted","doctype","entity","function","hexcode","id","important","inserted","keyword","number","operator","prolog","property","pseudoClass","pseudoElement","punctuation","regex","selector","string","symbol","tag","unit","url","variable","v2","undefined","applyHues","parseHuesFromSearchParams","getPreset","themeFromHues","Hues","LegacyTheme","PartialHues","createTheme","hues","parseHuesFromUrl","url","URL","searchParams","preset","get","buildThemeFromUrl","applyHues","createTheme","Hues","LegacyTheme","hues","theme"],"sources":["../src/legacy/dropUndefined.ts","../src/legacy/palette.ts","../src/legacy/applyHues.ts","../src/lib/mix.ts","../src/legacy/parseHuesFromSearchParams.ts","../src/legacy/presets.ts","../src/legacy/createTonesFromHues.ts","../src/legacy/themeFromHues.ts","../src/legacy/createTheme.ts","../src/legacy/defaults.ts"],"sourcesContent":["import {Hue} from './types'\n\n/**\n * Drops properties that are set to `undefined`, so that spreading the hue\n * over defaults doesn't shadow them. The hosted Themer service used a\n * `JSON.parse(JSON.stringify(…))` round trip for this.\n */\nexport function dropUndefined(hue: Partial<Hue> | undefined): Partial<Hue> | undefined {\n if (!hue) return undefined\n\n const result: Partial<Hue> = {}\n\n if (hue.mid !== undefined) result.mid = hue.mid\n if (hue.midPoint !== undefined) result.midPoint = hue.midPoint\n if (hue.lightest !== undefined) result.lightest = hue.lightest\n if (hue.darkest !== undefined) result.darkest = hue.darkest\n\n return result\n}\n","import {ColorTint, ColorTints} from '@sanity/color'\n\n/**\n * The color palette from `@sanity/color@2.2.5`, vendored so that themes\n * generated by this module keep producing the exact same colors as the hosted\n * Themer service (themer.sanity.build), which bundles that version. The\n * current `@sanity/color` palette has different values, so it cannot be used\n * here without changing generated themes.\n */\n\n/** @internal */\nexport const black: ColorTint = {title: 'Black', hex: '#101112'}\n\n/** @internal */\nexport const white: ColorTint = {title: 'White', hex: '#fff'}\n\n/** @internal */\nexport const gray: ColorTints = {\n '50': {title: 'Gray 50', hex: '#f2f3f5'},\n '100': {title: 'Gray 100', hex: '#e6e8ec'},\n '200': {title: 'Gray 200', hex: '#ced2d9'},\n '300': {title: 'Gray 300', hex: '#b6bcc6'},\n '400': {title: 'Gray 400', hex: '#9ea6b3'},\n '500': {title: 'Gray 500', hex: '#8690a0'},\n '600': {title: 'Gray 600', hex: '#6e7683'},\n '700': {title: 'Gray 700', hex: '#565d67'},\n '800': {title: 'Gray 800', hex: '#3f434a'},\n '900': {title: 'Gray 900', hex: '#272a2e'},\n '950': {title: 'Gray 950', hex: '#1b1d20'},\n}\n\n/** @internal */\nexport const blue: ColorTints = {\n '50': {title: 'Blue 50', hex: '#e8f1fe'},\n '100': {title: 'Blue 100', hex: '#d2e3fe'},\n '200': {title: 'Blue 200', hex: '#a6c8fd'},\n '300': {title: 'Blue 300', hex: '#7aacfd'},\n '400': {title: 'Blue 400', hex: '#4e91fc'},\n '500': {title: 'Blue 500', hex: '#2276fc'},\n '600': {title: 'Blue 600', hex: '#1e61cd'},\n '700': {title: 'Blue 700', hex: '#1a4d9e'},\n '800': {title: 'Blue 800', hex: '#17396f'},\n '900': {title: 'Blue 900', hex: '#132540'},\n '950': {title: 'Blue 950', hex: '#111b29'},\n}\n\n/** @internal */\nexport const purple: ColorTints = {\n '50': {title: 'Purple 50', hex: '#f8e9fe'},\n '100': {title: 'Purple 100', hex: '#f2d3fe'},\n '200': {title: 'Purple 200', hex: '#e6a7fd'},\n '300': {title: 'Purple 300', hex: '#d97bfd'},\n '400': {title: 'Purple 400', hex: '#cd4efc'},\n '500': {title: 'Purple 500', hex: '#c123fc'},\n '600': {title: 'Purple 600', hex: '#9d1fcd'},\n '700': {title: 'Purple 700', hex: '#7a1b9e'},\n '800': {title: 'Purple 800', hex: '#56186f'},\n '900': {title: 'Purple 900', hex: '#331440'},\n '950': {title: 'Purple 950', hex: '#211229'},\n}\n\n/** @internal */\nexport const magenta: ColorTints = {\n '50': {title: 'Magenta 50', hex: '#fcebf5'},\n '100': {title: 'Magenta 100', hex: '#f9d7eb'},\n '200': {title: 'Magenta 200', hex: '#f4afd8'},\n '300': {title: 'Magenta 300', hex: '#ef87c4'},\n '400': {title: 'Magenta 400', hex: '#ea5fb1'},\n '500': {title: 'Magenta 500', hex: '#e5389e'},\n '600': {title: 'Magenta 600', hex: '#ba3082'},\n '700': {title: 'Magenta 700', hex: '#8f2866'},\n '800': {title: 'Magenta 800', hex: '#65204a'},\n '900': {title: 'Magenta 900', hex: '#3a182d'},\n '950': {title: 'Magenta 950', hex: '#25141f'},\n}\n\n/** @internal */\nexport const red: ColorTints = {\n '50': {title: 'Red 50', hex: '#fdebea'},\n '100': {title: 'Red 100', hex: '#fcd8d5'},\n '200': {title: 'Red 200', hex: '#f9b1ab'},\n '300': {title: 'Red 300', hex: '#f68b82'},\n '400': {title: 'Red 400', hex: '#f36458'},\n '500': {title: 'Red 500', hex: '#f03e2f'},\n '600': {title: 'Red 600', hex: '#c33529'},\n '700': {title: 'Red 700', hex: '#962c23'},\n '800': {title: 'Red 800', hex: '#69231d'},\n '900': {title: 'Red 900', hex: '#3c1a17'},\n '950': {title: 'Red 950', hex: '#261514'},\n}\n\n/** @internal */\nexport const orange: ColorTints = {\n '50': {title: 'Orange 50', hex: '#fef0e6'},\n '100': {title: 'Orange 100', hex: '#fee2ce'},\n '200': {title: 'Orange 200', hex: '#fdc59d'},\n '300': {title: 'Orange 300', hex: '#fca86d'},\n '400': {title: 'Orange 400', hex: '#fb8b3c'},\n '500': {title: 'Orange 500', hex: '#e57322'},\n '600': {title: 'Orange 600', hex: '#ba5f1f'},\n '700': {title: 'Orange 700', hex: '#904b1b'},\n '800': {title: 'Orange 800', hex: '#653818'},\n '900': {title: 'Orange 900', hex: '#3a2415'},\n '950': {title: 'Orange 950', hex: '#251a13'},\n}\n\n/** @internal */\nexport const yellow: ColorTints = {\n '50': {title: 'Yellow 50', hex: '#fef7da'},\n '100': {title: 'Yellow 100', hex: '#fdefb6'},\n '200': {title: 'Yellow 200', hex: '#fcdf6d'},\n '300': {title: 'Yellow 300', hex: '#fbd024'},\n '400': {title: 'Yellow 400', hex: '#d9b421'},\n '500': {title: 'Yellow 500', hex: '#b7991e'},\n '600': {title: 'Yellow 600', hex: '#967e1c'},\n '700': {title: 'Yellow 700', hex: '#746219'},\n '800': {title: 'Yellow 800', hex: '#534717'},\n '900': {title: 'Yellow 900', hex: '#312c14'},\n '950': {title: 'Yellow 950', hex: '#201e13'},\n}\n\n/** @internal */\nexport const green: ColorTints = {\n '50': {title: 'Green 50', hex: '#e7f9ed'},\n '100': {title: 'Green 100', hex: '#d0f4dc'},\n '200': {title: 'Green 200', hex: '#a1eaba'},\n '300': {title: 'Green 300', hex: '#72e097'},\n '400': {title: 'Green 400', hex: '#43d675'},\n '500': {title: 'Green 500', hex: '#3ab564'},\n '600': {title: 'Green 600', hex: '#329454'},\n '700': {title: 'Green 700', hex: '#297343'},\n '800': {title: 'Green 800', hex: '#215233'},\n '900': {title: 'Green 900', hex: '#183122'},\n '950': {title: 'Green 950', hex: '#14211a'},\n}\n\n/** @internal */\nexport const cyan: ColorTints = {\n '50': {title: 'Cyan 50', hex: '#e3fafd'},\n '100': {title: 'Cyan 100', hex: '#c7f5fc'},\n '200': {title: 'Cyan 200', hex: '#90ecf9'},\n '300': {title: 'Cyan 300', hex: '#59e3f6'},\n '400': {title: 'Cyan 400', hex: '#22daf4'},\n '500': {title: 'Cyan 500', hex: '#1fb8ce'},\n '600': {title: 'Cyan 600', hex: '#1c97a8'},\n '700': {title: 'Cyan 700', hex: '#197583'},\n '800': {title: 'Cyan 800', hex: '#16545d'},\n '900': {title: 'Cyan 900', hex: '#133237'},\n '950': {title: 'Cyan 950', hex: '#112124'},\n}\n","import {dropUndefined} from './dropUndefined'\nimport {black, white} from './palette'\nimport {Hues, PartialHues} from './types'\n\nconst lightest = white.hex.toLowerCase()\nconst darkest = black.hex.toLowerCase()\n\n/**\n * The hues of the default Studio theme, matching the `default` preset of the\n * hosted Themer service.\n */\nconst defaultHues: Hues = {\n default: {\n lightest,\n darkest,\n mid: '#8690a0',\n midPoint: 500,\n },\n primary: {\n lightest,\n darkest,\n mid: '#2276fc',\n midPoint: 500,\n },\n transparent: {\n lightest,\n darkest,\n mid: '#8690a0',\n midPoint: 500,\n },\n positive: {\n lightest,\n darkest,\n mid: '#43d675',\n midPoint: 400,\n },\n caution: {\n lightest,\n darkest,\n mid: '#fbd024',\n midPoint: 300,\n },\n critical: {\n lightest,\n darkest,\n mid: '#f03e2f',\n midPoint: 500,\n },\n}\n\n/**\n * Merges partial hues over the defaults, exactly like the hosted Themer\n * service did. When a hue's `mid` color is customized without an explicit\n * `midPoint`, the mid point resets to `500`.\n */\nexport function applyHues(_hues: PartialHues, defaults: Hues = defaultHues): Hues {\n // Filter out undefined values so they don't shadow the defaults when spread\n const hues: PartialHues = {\n default: dropUndefined(_hues.default),\n primary: dropUndefined(_hues.primary),\n transparent: dropUndefined(_hues.transparent),\n positive: dropUndefined(_hues.positive),\n caution: dropUndefined(_hues.caution),\n critical: dropUndefined(_hues.critical),\n }\n\n const defaultMid = hues.default?.mid?.toLowerCase() || defaults.default.mid\n const primaryMid = hues.primary?.mid?.toLowerCase() || defaults.primary.mid\n const transparentMid = hues.transparent?.mid?.toLowerCase() || defaults.transparent.mid\n const positiveMid = hues.positive?.mid?.toLowerCase() || defaults.positive.mid\n const cautionMid = hues.caution?.mid?.toLowerCase() || defaults.caution.mid\n const criticalMid = hues.critical?.mid?.toLowerCase() || defaults.critical.mid\n\n return {\n default: {\n ...defaults.default,\n midPoint: defaultMid === defaults.default.mid ? defaults.default.midPoint : 500,\n ...hues.default,\n mid: defaultMid,\n },\n primary: {\n ...defaults.primary,\n midPoint: primaryMid === defaults.primary.mid ? defaults.primary.midPoint : 500,\n ...hues.primary,\n mid: primaryMid,\n },\n transparent: {\n ...defaults.transparent,\n midPoint: transparentMid === defaults.transparent.mid ? defaults.transparent.midPoint : 500,\n ...hues.transparent,\n mid: transparentMid,\n },\n positive: {\n ...defaults.positive,\n midPoint: positiveMid === defaults.positive.mid ? defaults.positive.midPoint : 500,\n ...hues.positive,\n mid: positiveMid,\n },\n caution: {\n ...defaults.caution,\n midPoint: cautionMid === defaults.caution.mid ? defaults.caution.midPoint : 500,\n ...hues.caution,\n mid: cautionMid,\n },\n critical: {\n ...defaults.critical,\n midPoint: criticalMid === defaults.critical.mid ? defaults.critical.midPoint : 500,\n ...hues.critical,\n mid: criticalMid,\n },\n }\n}\n","/**\n * Color mixing that is byte-for-byte compatible with the `mix` function from\n * `polished`, which the hosted Themer service (themer.sanity.build) used to\n * interpolate hue tints. Only opaque hex colors are supported, which is all\n * the theme generators ever pass.\n *\n * @internal\n */\nexport function mix(weight: number, color: string, otherColor: string): string {\n // `polished` returns the other color as-is when the weight is 0\n if (weight === 0) return otherColor\n\n const [r1, g1, b1] = hexToRgb(color)\n const [r2, g2, b2] = hexToRgb(otherColor)\n\n const w2 = 1 - weight\n\n return reduceHex(\n `#${channelToHex(Math.floor(r1 * weight + r2 * w2))}${channelToHex(\n Math.floor(g1 * weight + g2 * w2),\n )}${channelToHex(Math.floor(b1 * weight + b2 * w2))}`,\n )\n}\n\n/**\n * Matches `#abc` and `#aabbcc` hex colors (the only formats the theme\n * generators accept), same as the hosted Themer service did.\n *\n * @internal\n */\nexport function isColor(input: string): boolean {\n return /^#(?:[0-9a-f]{3}){1,2}$/i.test(input)\n}\n\nfunction hexToRgb(color: string): [number, number, number] {\n if (!isColor(color)) {\n throw new TypeError(`Invalid color: ${JSON.stringify(color)} — expected a hex color`)\n }\n\n const hex =\n color.length === 4\n ? `${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}`\n : color.slice(1)\n\n return [\n parseInt(hex.slice(0, 2), 16),\n parseInt(hex.slice(2, 4), 16),\n parseInt(hex.slice(4, 6), 16),\n ]\n}\n\nfunction channelToHex(value: number): string {\n const hex = value.toString(16)\n\n return hex.length === 1 ? `0${hex}` : hex\n}\n\n/** Shortens `#aabbcc` to `#abc` when possible, same as `polished` does */\nfunction reduceHex(hex: string): string {\n if (hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]) {\n return `#${hex[1]}${hex[3]}${hex[5]}`\n }\n\n return hex\n}\n","import {isColor} from '../lib/mix'\nimport {dropUndefined} from './dropUndefined'\nimport {Hue, HueMidPoint, PartialHues} from './types'\n\nconst HUE_KEYS = ['default', 'primary', 'transparent', 'positive', 'caution', 'critical'] as const\n\nconst VALID_MID_POINTS = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])\n\n/**\n * Parses hues from the query of a hosted Themer service URL, exactly like\n * `https://themer.sanity.build/api/hues` did — including its validation\n * errors.\n */\nexport function parseHuesFromSearchParams(searchParams: URLSearchParams): PartialHues {\n const lightest = searchParams.has('lightest')\n ? assertValidColor(`#${(searchParams.get('lightest') ?? '').toLowerCase()}`)\n : undefined\n const darkest = searchParams.get('darkest')\n ? assertValidColor(`#${(searchParams.get('darkest') ?? '').toLowerCase()}`)\n : undefined\n\n // Filter out undefined values so they don't shadow defaults downstream\n return {\n default: dropUndefined(parseHue('default', searchParams, lightest, darkest)),\n primary: dropUndefined(parseHue('primary', searchParams, lightest, darkest)),\n transparent: dropUndefined(parseHue('transparent', searchParams, lightest, darkest)),\n positive: dropUndefined(parseHue('positive', searchParams, lightest, darkest)),\n caution: dropUndefined(parseHue('caution', searchParams, lightest, darkest)),\n critical: dropUndefined(parseHue('critical', searchParams, lightest, darkest)),\n }\n}\n\nfunction parseHue(\n key: (typeof HUE_KEYS)[number],\n searchParams: URLSearchParams,\n defaultLightest: string | undefined,\n defaultDarkest: string | undefined,\n): Partial<Hue> {\n if (!searchParams.has(key)) {\n return {lightest: defaultLightest, darkest: defaultDarkest}\n }\n const input = (searchParams.get(key) ?? '').toLowerCase()\n\n let mid: string | undefined\n let midPoint: HueMidPoint | undefined\n let lightest: string | undefined\n let darkest: string | undefined\n // format: color;midPoint;lightest:color;darkest:color\n const params = input.split(';')\n if (params.length > 4) {\n throw new TypeError(\n `Invalid number of params for the ${key} hue, it should be 4 or less instead it's ${\n params.length\n }: ${JSON.stringify(params)}`,\n )\n }\n for (const param of params) {\n const maybeMid = `#${param}`\n const maybeMidPoint = roundMidPoint(Number(param))\n\n switch (true) {\n case param === '':\n break\n case isColor(maybeMid) && !mid:\n mid = maybeMid\n break\n case !Number.isNaN(maybeMidPoint) && !midPoint:\n midPoint = assertValidMidPoint(maybeMidPoint)\n break\n case param.startsWith('lightest:') && !lightest:\n lightest = assertValidColor(`#${param.replace(/^lightest:/, '')}`)\n break\n case param.startsWith('darkest:') && !darkest:\n darkest = assertValidColor(`#${param.replace(/^darkest:/, '')}`)\n break\n // Surface duplicates\n case isColor(maybeMid):\n throwDuplicate(key, mid?.replace(/^#/, ''), param, input)\n break\n case !Number.isNaN(maybeMidPoint):\n throwDuplicate(key, midPoint, maybeMidPoint, input)\n break\n case param.startsWith('lightest:'):\n throwDuplicate(key, lightest?.replace(/^#/, 'lightest:'), param, input)\n break\n case param.startsWith('darkest:'):\n throwDuplicate(key, darkest?.replace(/^#/, 'darkest:'), param, input)\n break\n default:\n // If the parser can't make sense of it we throw to surface that something is wrong with the input\n throw new TypeError(`Invalid param for the ${key} hue: ${param}`)\n }\n }\n\n return {\n mid,\n midPoint,\n lightest: lightest ?? defaultLightest,\n darkest: darkest ?? defaultDarkest,\n }\n}\n\nfunction roundMidPoint(value: number): number {\n if (value < 75) {\n return 50\n }\n if (value > 925) {\n return 950\n }\n\n return Math.round(value / 100) * 100\n}\n\nfunction throwDuplicate(key: string, a: unknown, b: unknown, input: string): never {\n throw new TypeError(\n `Duplicate params detected. Remove at least ${\n a === b\n ? `one of the ${JSON.stringify(String(a))}`\n : `${JSON.stringify(String(a))} or ${JSON.stringify(String(b))}`\n } from the ${key} hue: ${JSON.stringify(input)}`,\n )\n}\n\nfunction assertValidColor(input: string): string {\n if (isColor(input)) {\n return input\n }\n throw new TypeError(`Invalid color: ${input}`)\n}\n\nfunction assertValidMidPoint(input: number): HueMidPoint {\n if (isMidPoint(input)) {\n return input\n }\n throw new TypeError(`Invalid midPoint: ${input}`)\n}\n\nfunction isMidPoint(input: number): input is HueMidPoint {\n return VALID_MID_POINTS.has(input)\n}\n","import {applyHues} from './applyHues'\nimport {parseHuesFromSearchParams} from './parseHuesFromSearchParams'\nimport {ThemePreset} from './types'\n\nfunction definePreset(slug: string, title: string, searchParams: string): ThemePreset {\n return {\n slug,\n title,\n searchParams,\n hues: applyHues(parseHuesFromSearchParams(new URLSearchParams(searchParams))),\n }\n}\n\nconst defaultPreset = definePreset(\n 'default',\n 'Studio v3',\n 'lightest=fff&darkest=101112&default=8690a0;500&primary=2276fc;500&transparent=8690a0;500&positive=43d675;400&caution=fbd024;300&critical=f03e2f;500',\n)\n\n/**\n * The preset themes of the hosted Themer service (themer.sanity.build), with\n * the same slugs and hues:\n *\n * ```ts\n * import {createTheme, presets} from '@sanity/themer/legacy'\n *\n * const verdant = presets.find((preset) => preset.slug === 'verdant')\n * const theme = createTheme(verdant.hues)\n * ```\n *\n * @public\n */\nexport const presets: ThemePreset[] = [\n defaultPreset,\n definePreset(\n 'dew',\n 'Dew',\n 'default=5e63b4;600;lightest:fcfcfd;darkest:0d0d15&primary=d1a308;400;lightest:fcfcfd;darkest:0d0d15&transparent=6c6fa7;500;lightest:fcfcfd;darkest:0d0d15&positive=43D675;300;lightest:fcfcfd;darkest:0d0d15&caution=fb9f24;400;lightest:fcfcfd;darkest:0d0d15&critical=F03E2F;500;lightest:fcfcfd;darkest:0d0d15',\n ),\n definePreset(\n 'pink-synth',\n 'Pink Synth',\n 'lightest=f7f2f5&darkest=171721&default=8b6584&primary=ec4899&transparent=503a4c&positive=10b981&caution=fde047;300&critical=fe3459',\n ),\n definePreset(\n 'pixel-art',\n 'Pixel Art',\n 'default=57619c;600&primary=f10784&transparent=5b6498;600&positive=43d675;300&caution=fbd024;200&lightest=fcfcfd&darkest=0d0e15',\n ),\n definePreset(\n 'retro-colonial',\n 'Retro Colonial',\n 'default=8bb9b5;400&primary=fa7a78;400&transparent=8bb9b5;400&positive=43d675;300&caution=fbd024;200&critical=f02f53&lightest=fcfdfd&darkest=0d1515',\n ),\n definePreset(\n 'rosabel',\n 'Rosabel',\n 'default=9d8966&primary=ed2555;700&transparent=9d8966&positive=43d675;300&caution=fbd024;200&lightest=fdfdfc&darkest=15120d',\n ),\n definePreset(\n 'stereofidelic',\n 'Stereofidelic',\n 'default=678e9a&primary=f13009&transparent=678e9a&positive=43d675;300&caution=fbd024;200&critical=f02f35&lightest=fcfdfd&darkest=0e1315',\n ),\n definePreset(\n 'tw-cyan',\n 'Tailwind Cyan',\n 'default=677389;500;lightest:f9fafb;darkest:101728&primary=51b4d0;500;lightest:effefe;darkest:264d61&transparent=6b727f;500;lightest:f8fafb;darkest:131826&positive=55b785;500;lightest:eefdf5;darkest:214d3b&caution=e2b53e;500;lightest:fefbea;darkest:69411b&critical=e14f62;500;lightest:fdf2f2;darkest:7d2037',\n ),\n definePreset(\n 'verdant',\n 'Verdant',\n 'default=5c9199;500;lightest:fcfdfd;darkest:0d1415&primary=1cb485;400;lightest:fcfdfd;darkest:0d1415&transparent=5c9199;500;lightest:fcfdfd;darkest:0d1415&positive=43D675;300;lightest:fcfdfd;darkest:0d1415&caution=FBD024;200;lightest:fcfdfd;darkest:0d1415&critical=F03E2F;500;lightest:fcfdfd;darkest:0d1415',\n ),\n]\n\n/**\n * Finds a preset by its slug, falling back to the default Studio preset for\n * unknown slugs — the behavior of the hosted Themer service's `?preset`\n * param, which `parseHuesFromUrl` exposes.\n *\n * @internal\n */\nexport function getPreset(slug: string | null | undefined): ThemePreset {\n const needle = slug?.toLowerCase()\n const match = presets.find((preset) => preset.slug === needle)\n if (match) return match\n return defaultPreset\n}\n","import {COLOR_TINTS, ColorTints} from '@sanity/color'\n\nimport {mix} from '../lib/mix'\nimport {Hue, Hues} from './types'\n\n/**\n * Generates the tint ramp for each of the six hues, exactly like the hosted\n * Themer service did.\n */\nexport function createTonesFromHues(hues: Hues): {\n default: ColorTints\n primary: ColorTints\n transparent: ColorTints\n positive: ColorTints\n caution: ColorTints\n critical: ColorTints\n} {\n return {\n default: createTintsFromHue(hues.default, 'Default'),\n primary: createTintsFromHue(hues.primary, 'Primary'),\n transparent: createTintsFromHue(hues.transparent, 'Transparent'),\n positive: createTintsFromHue(hues.positive, 'Positive'),\n caution: createTintsFromHue(hues.caution, 'Caution'),\n critical: createTintsFromHue(hues.critical, 'Critical'),\n }\n}\n\nfunction createTintsFromHue(hue: Hue, title: string): ColorTints {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the reduce assigns every COLOR_TINTS key, so the Partial is complete\n return COLOR_TINTS.reduce<Partial<ColorTints>>((tints, tint) => {\n tints[tint] = {\n title: `${title} ${tint}`,\n hex: getColorHex(hue, tint),\n }\n\n return tints\n }, {}) as ColorTints\n}\n\nfunction getColorHex(hue: Hue, tint: string): string {\n const tintNum = Number(tint)\n const midPoint = hue.midPoint\n const darkSize = 1000 - midPoint\n const lightPosition = tintNum / midPoint\n const darkPosition = (tintNum - midPoint) / darkSize\n\n if (tintNum === midPoint) {\n return hue.mid.toLowerCase()\n }\n\n // light side of scale: x < midPoint\n if (tintNum < midPoint) {\n return mix(lightPosition, hue.mid, hue.lightest)\n }\n\n // dark side of scale: x > midPoint\n return mix(darkPosition, hue.darkest, hue.mid)\n}\n","import {ColorTints} from '@sanity/color'\nimport {\n buildTheme,\n createColorTheme,\n multiply as multiplyRgb,\n parseColor,\n rgba,\n rgbToHex,\n screen as screenRgb,\n} from '@sanity/ui/theme'\n\nimport {applyHues} from './applyHues'\nimport {createTonesFromHues} from './createTonesFromHues'\nimport {blue, cyan, gray, green, magenta, orange, purple, red, yellow} from './palette'\nimport {LegacyTheme, PartialHues} from './types'\n\nconst NEUTRAL_TONES: ReadonlySet<string> = new Set(['default', 'transparent'])\n\n/** The static tints used for spot colors, syntax highlighting and input states */\nconst SPOT_TINTS: Record<string, ColorTints> = {\n blue,\n cyan,\n gray,\n green,\n magenta,\n orange,\n purple,\n red,\n yellow,\n}\n\nfunction getTint(key: string): ColorTints {\n const tints = SPOT_TINTS[key]\n\n if (!tints) {\n throw new Error(`Unknown tint: ${key}`)\n }\n\n return tints\n}\n\nconst defaultTheme = buildTheme()\n\n/**\n * Generates a Studio theme from hues, producing the exact same colors as the\n * hosted Themer service (themer.sanity.build). This is a port of its\n * `themeFromHues` implementation:\n * https://github.com/sanity-io/themer/blob/main/apps/v1/utils/themeFromHues.ts\n */\nexport function themeFromHues(partialHues: PartialHues): LegacyTheme {\n function multiply(bg: string, fg: string): string {\n return rgbToHex(multiplyRgb(parseColor(bg), parseColor(fg)))\n }\n function screen(bg: string, fg: string): string {\n return rgbToHex(screenRgb(parseColor(bg), parseColor(fg)))\n }\n\n const hues = applyHues(partialHues)\n // These variables are made top-level to keep the body of createColorTheme largely the same.\n // This makes it much easier to sync it with new releases of @sanity/ui should its implementation details change.\n const black = {title: 'Black', hex: hues.default.darkest}\n const white = {title: 'white', hex: hues.default.lightest}\n\n const tones = createTonesFromHues(hues)\n const focusRingHue = tones.primary\n const accentHue = tones.critical\n const linkHue = tones.primary\n\n // Generate colors :OOO\n // Based on the studio color theme of @sanity/ui at the time the hosted\n // Themer service was built\n // oxlint-disable-next-line no-deprecated\n const color = createColorTheme({\n base: ({dark, name}) => {\n if (name === 'default') {\n const skeletonFrom = dark ? tones.transparent[900].hex : tones.transparent[100].hex\n\n return {\n fg: dark ? white.hex : black.hex,\n bg: dark ? black.hex : white.hex,\n border: tones.transparent[dark ? 800 : 200].hex,\n focusRing: focusRingHue[500].hex,\n shadow: {\n outline: rgba(tones.transparent[500].hex, 0.4),\n umbra: rgba(dark ? black.hex : tones.transparent[500].hex, 0.2),\n penumbra: rgba(dark ? black.hex : tones.transparent[500].hex, 0.14),\n ambient: rgba(dark ? black.hex : tones.transparent[500].hex, 0.12),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (name === 'transparent') {\n const tints = tones.default\n const skeletonFrom = tints[dark ? 800 : 200].hex\n\n return {\n fg: tints[dark ? 100 : 900].hex,\n bg: tints[dark ? 950 : 50].hex,\n border: tints[dark ? 800 : 300].hex,\n focusRing: focusRingHue[500].hex,\n shadow: {\n outline: rgba(tints[500].hex, dark ? 0.2 : 0.4),\n umbra: rgba(dark ? black.hex : tints[500].hex, 0.2),\n penumbra: rgba(dark ? black.hex : tints[500].hex, 0.14),\n ambient: rgba(dark ? black.hex : tints[500].hex, 0.12),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n const tints = tones[name] || tones.default\n const skeletonFrom = tints[dark ? 800 : 200].hex\n\n return {\n fg: tints[dark ? 100 : 900].hex,\n bg: tints[dark ? 950 : 50].hex,\n border: tints[dark ? 800 : 200].hex,\n focusRing: tints[500].hex,\n shadow: {\n outline: rgba(tints[500].hex, dark ? 0.2 : 0.4),\n umbra: rgba(dark ? black.hex : tints[500].hex, 0.2),\n penumbra: rgba(dark ? black.hex : tints[500].hex, 0.14),\n ambient: rgba(dark ? black.hex : tints[500].hex, 0.12),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n },\n\n solid: ({base, dark, name, state, tone}) => {\n const mix = dark ? screen : multiply\n const mix2 = dark ? multiply : screen\n const defaultTints = tones[name] || tones.default\n const isNeutral = NEUTRAL_TONES.has(name) && NEUTRAL_TONES.has(tone)\n\n let tints = tones[tone === 'default' ? name : tone] || defaultTints\n\n if (state === 'disabled') {\n tints = defaultTints\n const bg = mix(base.bg, tints[dark ? 800 : 200].hex)\n const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex)\n\n return {\n bg,\n bg2: mix2(bg, tints[dark ? 50 : 950].hex),\n border: mix(base.bg, tints[dark ? 800 : 200].hex),\n fg: mix(base.bg, dark ? black.hex : white.hex),\n icon: mix(base.bg, dark ? black.hex : white.hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 950 : 50].hex),\n },\n accent: {\n fg: mix(base.bg, tints[dark ? 950 : 50].hex),\n },\n link: {\n fg: mix(base.bg, tints[dark ? 950 : 50].hex),\n },\n code: {\n bg,\n fg: mix(base.bg, tints[dark ? 950 : 50].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (state === 'hovered') {\n const bg = mix(base.bg, tints[dark ? 300 : 600].hex)\n const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex)\n\n return {\n bg,\n bg2: mix2(bg, tints[dark ? 50 : 950].hex),\n border: mix(base.bg, tints[dark ? 300 : 600].hex),\n fg: mix(base.bg, dark ? black.hex : white.hex),\n icon: mix(base.bg, dark ? black.hex : white.hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n accent: {\n fg: mix2(bg, accentHue[dark ? 800 : 200].hex),\n },\n link: {\n fg: mix2(bg, linkHue[dark ? 800 : 200].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (state === 'pressed') {\n const bg = mix(base.bg, tints[dark ? 200 : 800].hex)\n const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex)\n\n return {\n bg: mix(base.bg, tints[dark ? 200 : 800].hex),\n bg2: mix2(bg, tints[dark ? 50 : 950].hex),\n border: mix(base.bg, tints[dark ? 200 : 800].hex),\n fg: mix(base.bg, dark ? black.hex : white.hex),\n icon: mix(base.bg, dark ? black.hex : white.hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n accent: {\n fg: mix2(bg, accentHue[dark ? 800 : 200].hex),\n },\n link: {\n fg: mix2(bg, linkHue[dark ? 800 : 200].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (state === 'selected') {\n if (isNeutral) {\n tints = tones.primary\n }\n\n const bg = mix(base.bg, tints[dark ? 200 : 800].hex)\n const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex)\n\n return {\n bg,\n bg2: mix2(bg, tints[dark ? 50 : 950].hex),\n border: mix(base.bg, tints[dark ? 200 : 800].hex),\n fg: mix(base.bg, dark ? black.hex : white.hex),\n icon: mix(base.bg, dark ? black.hex : white.hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n accent: {\n fg: mix2(bg, accentHue[dark ? 800 : 200].hex),\n },\n link: {\n fg: mix2(bg, linkHue[dark ? 800 : 200].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 800 : 200].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n // state: \"enabled\" | unknown\n const bg = mix(base.bg, tints[dark ? 400 : 500].hex)\n const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex)\n\n return {\n bg,\n bg2: mix2(bg, tints[dark ? 50 : 950].hex),\n border: mix(base.bg, tints[dark ? 400 : 500].hex),\n fg: mix(base.bg, dark ? black.hex : white.hex),\n icon: mix(base.bg, dark ? black.hex : white.hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 900 : 100].hex),\n },\n accent: {\n fg: mix2(bg, accentHue[dark ? 900 : 100].hex),\n },\n link: {\n fg: mix2(bg, linkHue[dark ? 900 : 100].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 900 : 100].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n },\n\n muted: ({base, dark, name, state, tone}) => {\n const mix = dark ? screen : multiply\n const defaultTints = tones[name] || tones.default\n const isNeutral = NEUTRAL_TONES.has(name) && NEUTRAL_TONES.has(tone)\n\n let tints = tones[tone === 'default' ? name : tone] || defaultTints\n\n if (state === 'disabled') {\n tints = defaultTints\n\n const bg = base.bg\n const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n border: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(bg, tints[dark ? 800 : 200].hex),\n icon: mix(bg, tints[dark ? 800 : 200].hex),\n muted: {\n fg: mix(bg, tints[dark ? 900 : 100].hex),\n },\n accent: {\n fg: mix(bg, tints[dark ? 900 : 100].hex),\n },\n link: {\n fg: mix(bg, tints[dark ? 900 : 100].hex),\n },\n code: {\n bg,\n fg: mix(bg, tints[dark ? 900 : 100].hex),\n },\n skeleton: {\n from: rgba(skeletonFrom, 0.5),\n to: rgba(skeletonFrom, 0.25),\n },\n }\n }\n\n if (state === 'hovered') {\n if (isNeutral) {\n tints = tones.primary\n }\n\n const bg = mix(base.bg, tints[dark ? 950 : 50].hex)\n const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n border: mix(bg, tints[dark ? 900 : 100].hex),\n fg: mix(base.bg, tints[dark ? 200 : 800].hex),\n icon: mix(base.bg, tints[dark ? 200 : 800].hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n accent: {\n fg: mix(base.bg, linkHue[dark ? 400 : 500].hex),\n },\n link: {\n fg: mix(base.bg, linkHue[dark ? 400 : 600].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (state === 'pressed') {\n if (isNeutral) {\n tints = tones.primary\n }\n\n const bg = mix(base.bg, tints[dark ? 900 : 100].hex)\n const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n border: mix(bg, tints[dark ? 900 : 100].hex),\n fg: mix(base.bg, tints[dark ? 200 : 800].hex),\n icon: mix(base.bg, tints[dark ? 200 : 800].hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n accent: {\n fg: mix(bg, accentHue[dark ? 400 : 500].hex),\n },\n link: {\n fg: mix(bg, linkHue[dark ? 400 : 600].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n if (state === 'selected') {\n if (isNeutral) {\n tints = tones.primary\n }\n\n const bg = mix(base.bg, tints[dark ? 900 : 100].hex)\n const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n border: mix(bg, tints[dark ? 900 : 100].hex),\n fg: mix(base.bg, tints[dark ? 200 : 800].hex),\n icon: mix(base.bg, tints[dark ? 200 : 800].hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n accent: {\n fg: mix(bg, accentHue[dark ? 400 : 500].hex),\n },\n link: {\n fg: mix(bg, linkHue[dark ? 400 : 600].hex),\n },\n code: {\n bg: mix(bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n }\n\n const bg = base.bg\n const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n border: mix(bg, tints[dark ? 900 : 100].hex),\n fg: mix(base.bg, tints[dark ? 300 : 700].hex),\n icon: mix(base.bg, tints[dark ? 300 : 700].hex),\n muted: {\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n accent: {\n fg: mix(base.bg, accentHue[dark ? 400 : 500].hex),\n },\n link: {\n fg: mix(base.bg, linkHue[dark ? 400 : 600].hex),\n },\n code: {\n bg: mix(base.bg, tints[dark ? 950 : 50].hex),\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n },\n\n button: ({base, mode, muted, solid}) => {\n if (mode === 'bleed') {\n return {\n enabled: {\n ...muted.enabled,\n border: muted.enabled.bg,\n },\n hovered: {\n ...muted.hovered,\n border: muted.hovered.bg,\n },\n pressed: {\n ...muted.pressed,\n border: muted.pressed.bg,\n },\n selected: {\n ...muted.selected,\n border: muted.selected.bg,\n },\n disabled: {\n ...muted.disabled,\n border: muted.disabled.bg,\n },\n }\n }\n\n if (mode === 'ghost') {\n return {\n ...solid,\n enabled: {\n ...muted.enabled,\n border: base.border,\n },\n disabled: muted.disabled,\n }\n }\n\n return solid\n },\n\n card: ({base, dark, muted, name, solid, state}) => {\n if (state === 'hovered') {\n return muted[name].hovered\n }\n\n if (state === 'disabled') {\n return muted[name].disabled\n }\n\n const isNeutral = NEUTRAL_TONES.has(name)\n const tints = tones[name] || tones.default\n const mix = dark ? screen : multiply\n\n if (state === 'pressed') {\n if (isNeutral) {\n return muted.primary.pressed\n }\n\n return muted[name].pressed\n }\n\n if (state === 'selected') {\n if (isNeutral) {\n return solid.primary.enabled\n }\n\n return solid[name].enabled\n }\n\n const bg = base.bg\n const skeletonFrom = mix(base.bg, tints[dark ? 900 : 100].hex)\n\n return {\n bg,\n bg2: mix(bg, tints[dark ? 950 : 50].hex),\n fg: base.fg,\n icon: base.fg,\n border: base.border,\n muted: {\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n },\n accent: {\n fg: mix(base.bg, red[dark ? 400 : 500].hex),\n },\n link: {\n fg: mix(base.bg, blue[dark ? 400 : 600].hex),\n },\n code: {\n bg: mix(base.bg, tints[dark ? 950 : 50].hex),\n fg: tints[dark ? 400 : 600].hex,\n },\n skeleton: {\n from: skeletonFrom,\n to: rgba(skeletonFrom, 0.5),\n },\n }\n },\n\n input: ({base, dark, mode, state}) => {\n const mix = dark ? screen : multiply\n\n if (mode === 'invalid') {\n const tints = tones.critical\n\n return {\n bg: mix(base.bg, tints[dark ? 950 : 50].hex),\n bg2: mix(base.bg, tints[dark ? 800 : 200].hex),\n fg: mix(base.bg, tints[dark ? 400 : 600].hex),\n border: mix(base.bg, tints[dark ? 800 : 200].hex),\n placeholder: mix(base.bg, tints[dark ? 600 : 400].hex),\n }\n }\n\n if (state === 'hovered') {\n return {\n bg: base.bg,\n bg2: mix(base.bg, gray[dark ? 700 : 300].hex),\n fg: base.fg,\n border: mix(base.bg, gray[dark ? 700 : 300].hex),\n placeholder: mix(base.bg, gray[dark ? 600 : 400].hex),\n }\n }\n\n if (state === 'disabled') {\n return {\n bg: mix(base.bg, gray[dark ? 950 : 50].hex),\n bg2: mix(base.bg, gray[dark ? 900 : 100].hex),\n fg: mix(base.bg, gray[dark ? 700 : 300].hex),\n border: mix(base.bg, gray[dark ? 900 : 100].hex),\n placeholder: mix(base.bg, gray[dark ? 800 : 200].hex),\n }\n }\n\n if (state === 'readOnly') {\n return {\n bg: mix(base.bg, gray[dark ? 950 : 50].hex),\n bg2: mix(base.bg, gray[dark ? 800 : 200].hex),\n fg: mix(base.bg, gray[dark ? 200 : 800].hex),\n border: mix(base.bg, gray[dark ? 800 : 200].hex),\n placeholder: mix(base.bg, gray[dark ? 600 : 400].hex),\n }\n }\n\n return {\n bg: base.bg,\n bg2: base.border,\n fg: base.fg,\n border: base.border,\n placeholder: mix(base.bg, gray[dark ? 600 : 400].hex),\n }\n },\n\n selectable: ({base, muted, tone, solid, state}) => {\n if (state === 'enabled') {\n return {\n ...muted[tone].enabled,\n bg: base.bg,\n }\n }\n\n if (state === 'pressed') {\n if (tone === 'default') {\n return muted.primary.pressed\n }\n\n return muted[tone].pressed\n }\n\n if (state === 'selected') {\n if (tone === 'default') {\n return solid.primary.enabled\n }\n\n return solid[tone].enabled\n }\n\n if (state === 'disabled') {\n return {\n ...muted[tone].disabled,\n bg: base.bg,\n }\n }\n\n return muted[tone][state]\n },\n\n spot: ({base, dark, key}) => {\n const mix = dark ? screen : multiply\n\n return mix(base.bg, getTint(key)[dark ? 400 : 500].hex)\n },\n\n syntax: ({base, dark}) => {\n const mix = dark ? screen : multiply\n const mainShade = dark ? 400 : 600\n const secondaryShade = dark ? 600 : 400\n\n return {\n atrule: mix(base.bg, purple[mainShade].hex),\n attrName: mix(base.bg, green[mainShade].hex),\n attrValue: mix(base.bg, yellow[mainShade].hex),\n attribute: mix(base.bg, yellow[mainShade].hex),\n boolean: mix(base.bg, purple[mainShade].hex),\n builtin: mix(base.bg, purple[mainShade].hex),\n cdata: mix(base.bg, yellow[mainShade].hex),\n char: mix(base.bg, yellow[mainShade].hex),\n class: mix(base.bg, orange[mainShade].hex),\n className: mix(base.bg, cyan[mainShade].hex),\n comment: mix(base.bg, gray[secondaryShade].hex),\n constant: mix(base.bg, purple[mainShade].hex),\n deleted: mix(base.bg, red[mainShade].hex),\n doctype: mix(base.bg, gray[secondaryShade].hex),\n entity: mix(base.bg, red[mainShade].hex),\n function: mix(base.bg, green[mainShade].hex),\n hexcode: mix(base.bg, blue[mainShade].hex),\n id: mix(base.bg, purple[mainShade].hex),\n important: mix(base.bg, purple[mainShade].hex),\n inserted: mix(base.bg, yellow[mainShade].hex),\n keyword: mix(base.bg, magenta[mainShade].hex),\n number: mix(base.bg, purple[mainShade].hex),\n operator: mix(base.bg, magenta[mainShade].hex),\n prolog: mix(base.bg, gray[secondaryShade].hex),\n property: mix(base.bg, blue[mainShade].hex),\n pseudoClass: mix(base.bg, yellow[mainShade].hex),\n pseudoElement: mix(base.bg, yellow[mainShade].hex),\n punctuation: mix(base.bg, gray[mainShade].hex),\n regex: mix(base.bg, blue[mainShade].hex),\n selector: mix(base.bg, red[mainShade].hex),\n string: mix(base.bg, yellow[mainShade].hex),\n symbol: mix(base.bg, purple[mainShade].hex),\n tag: mix(base.bg, red[mainShade].hex),\n unit: mix(base.bg, orange[mainShade].hex),\n url: mix(base.bg, red[mainShade].hex),\n variable: mix(base.bg, red[mainShade].hex),\n }\n },\n })\n\n // Sanity Studio only reads `color`, `fonts` and `v2` off a custom theme, and\n // throws away the `fonts` of themes flagged `__themer: true` — a workaround\n // for the hosted service serving the fonts of the `@sanity/ui` version it was\n // bundled with, which drifted from the Studio's own. These fonts come from the\n // `@sanity/ui` installed next to the Studio instead, so they already are the\n // ones the workaround substitutes and the theme needs no flag:\n // https://github.com/sanity-io/sanity/blob/bae53feb46ab7f5630259a264968b50bdbc728bb/packages/sanity/src/core/studio/StudioThemeProvider.tsx#L13-L17\n // oxlint-disable-next-line no-deprecated -- the legacy API intentionally targets the deprecated v0 color property, like the hosted service did\n return {...defaultTheme, color, v2: undefined}\n}\n","import {applyHues} from './applyHues'\nimport {parseHuesFromSearchParams} from './parseHuesFromSearchParams'\nimport {getPreset} from './presets'\nimport {themeFromHues} from './themeFromHues'\nimport {Hues, LegacyTheme, PartialHues} from './types'\n\n/**\n * Generates a Studio theme from hues, producing the same colors as importing\n * the theme from the hosted Themer service (themer.sanity.build):\n *\n * ```ts\n * import {createTheme, hues} from '@sanity/themer/legacy'\n * import {defineConfig} from 'sanity'\n *\n * export default defineConfig({\n * theme: createTheme({...hues, primary: {...hues.primary, mid: '#22fca8'}}),\n * // ...rest of the config\n * })\n * ```\n *\n * @public\n */\nexport function createTheme(hues: PartialHues = {}): LegacyTheme {\n return themeFromHues(hues)\n}\n\n/**\n * Parses the hues encoded in a hosted Themer service URL, returning the exact\n * hues that `https://themer.sanity.build/api/hues` served for that query —\n * presets and overrides included.\n *\n * ```ts\n * import {createTheme, parseHuesFromUrl} from '@sanity/themer/legacy'\n *\n * const hues = parseHuesFromUrl(\n * 'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8',\n * )\n * const theme = createTheme(hues)\n * ```\n *\n * @public\n */\nexport function parseHuesFromUrl(url: string | URL): Hues {\n const {searchParams} = new URL(url, 'https://themer.sanity.build/api/hues')\n const preset = getPreset(searchParams.get('preset'))\n\n return applyHues(parseHuesFromSearchParams(searchParams), preset.hues)\n}\n\n/**\n * The one-line replacement for a theme imported from the hosted Themer\n * service — pass the URL that used to be imported:\n *\n * ```ts\n * // Before:\n * // import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant'\n *\n * // After:\n * import {buildThemeFromUrl} from '@sanity/themer/legacy'\n *\n * const theme = buildThemeFromUrl(\n * 'https://themer.sanity.build/api/hues?preset=verdant',\n * )\n * ```\n *\n * @public\n */\nexport function buildThemeFromUrl(url: string | URL): LegacyTheme {\n return createTheme(parseHuesFromUrl(url))\n}\n","import {applyHues} from './applyHues'\nimport {createTheme} from './createTheme'\nimport {Hues, LegacyTheme} from './types'\n\n/**\n * The hues of the default Studio theme — the same `hues` export that\n * `https://themer.sanity.build/api/hues` served without any parameters.\n *\n * @public\n */\nexport const hues: Hues = applyHues({})\n\n/**\n * The default Studio theme — the same `theme` export that\n * `https://themer.sanity.build/api/hues` served without any parameters.\n *\n * @public\n */\nexport const theme: LegacyTheme = createTheme(hues)\n"],"mappings":";;;;;;;AAOA,SAAgBC,cAAcC,KAAyD;CACrF,IAAI,CAACA,KAAK;CAEV,IAAMG,SAAuB,CAAC;CAO9B,OALIH,IAAII,QAAQF,KAAAA,MAAWC,OAAOC,MAAMJ,IAAII,MACxCJ,IAAIK,aAAaH,KAAAA,MAAWC,OAAOE,WAAWL,IAAIK,WAClDL,IAAIM,aAAaJ,KAAAA,MAAWC,OAAOG,WAAWN,IAAIM,WAClDN,IAAIO,YAAYL,KAAAA,MAAWC,OAAOI,UAAUP,IAAIO,UAE7CJ;AACT;;;;;;;;;ACPA,MAAa,QAAmB;CAAC,OAAO;CAAS,KAAK;AAAS,G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DA,MAAaU,OAAaJ,UAAU,CAAC,CAAC,GAQzBK,QAAqBJ,YAAYG,IAAI"}
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,80 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* The tint (between 50 and 950) that a `Hue`'s `mid` color is placed at.
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
type HueMidPoint = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
8
|
-
/**
|
|
9
|
-
* A single hue configuration, matching the hosted Themer service
|
|
10
|
-
* (themer.sanity.build) hue format.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
interface Hue {
|
|
15
|
-
/** The mid color of the hue's tint ramp, as a hex color */
|
|
16
|
-
mid: string;
|
|
17
|
-
/** The tint that `mid` is placed at — the rest of the ramp is interpolated */
|
|
18
|
-
midPoint: HueMidPoint;
|
|
19
|
-
/** The hex color that the ramp's lightest end interpolates towards */
|
|
20
|
-
lightest: string;
|
|
21
|
-
/** The hex color that the ramp's darkest end interpolates towards */
|
|
22
|
-
darkest: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The six hues a legacy Themer theme is generated from.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
interface Hues {
|
|
30
|
-
default: Hue;
|
|
31
|
-
transparent: Hue;
|
|
32
|
-
primary: Hue;
|
|
33
|
-
positive: Hue;
|
|
34
|
-
caution: Hue;
|
|
35
|
-
critical: Hue;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* `Hues` where every hue, and every property of each hue, is optional.
|
|
39
|
-
* Omitted properties fall back to the default Studio theme hues.
|
|
40
|
-
*
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
type PartialHues = { [TKey in keyof Hues]?: Partial<Hues[TKey]>; };
|
|
44
|
-
/**
|
|
45
|
-
* A theme generated by `createTheme`, compatible with the `theme` property in
|
|
46
|
-
* a Sanity Studio `defineConfig`.
|
|
47
|
-
*
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
type LegacyTheme = RootTheme & {
|
|
51
|
-
/**
|
|
52
|
-
* Marks the theme as generated by Themer, which Sanity Studio detects to
|
|
53
|
-
* reconcile fonts and other non-color attributes.
|
|
54
|
-
*/
|
|
55
|
-
__themer: true;
|
|
56
|
-
/**
|
|
57
|
-
* Set to `undefined` so that `@sanity/ui` derives the v2 theme internally
|
|
58
|
-
* from the generated colors.
|
|
59
|
-
*/
|
|
60
|
-
v2: undefined;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* A preset theme, carried over from the hosted Themer service.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
interface ThemePreset {
|
|
68
|
-
slug: string;
|
|
69
|
-
title: string;
|
|
70
|
-
/**
|
|
71
|
-
* The canonical search params for this preset — the same query that
|
|
72
|
-
* `https://themer.sanity.build/api/hues` served the preset for.
|
|
73
|
-
*/
|
|
74
|
-
searchParams: string;
|
|
75
|
-
/** The preset's resolved hues, ready to pass to `createTheme` */
|
|
76
|
-
hues: Hues;
|
|
77
|
-
}
|
|
1
|
+
import { a as PartialHues, i as LegacyTheme, n as HueMidPoint, o as ThemePreset, r as Hues, t as Hue } from "./types-DfPLuLv0.js";
|
|
78
2
|
/**
|
|
79
3
|
* Generates a Studio theme from hues, producing the same colors as importing
|
|
80
4
|
* the theme from the hosted Themer service (themer.sanity.build):
|
|
@@ -118,16 +42,16 @@ declare function parseHuesFromUrl(url: string | URL): Hues;
|
|
|
118
42
|
* // import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant'
|
|
119
43
|
*
|
|
120
44
|
* // After:
|
|
121
|
-
* import {
|
|
45
|
+
* import {buildThemeFromUrl} from '@sanity/themer/legacy'
|
|
122
46
|
*
|
|
123
|
-
* const theme =
|
|
47
|
+
* const theme = buildThemeFromUrl(
|
|
124
48
|
* 'https://themer.sanity.build/api/hues?preset=verdant',
|
|
125
49
|
* )
|
|
126
50
|
* ```
|
|
127
51
|
*
|
|
128
52
|
* @public
|
|
129
53
|
*/
|
|
130
|
-
declare function
|
|
54
|
+
declare function buildThemeFromUrl(url: string | URL): LegacyTheme;
|
|
131
55
|
/**
|
|
132
56
|
* The hues of the default Studio theme — the same `hues` export that
|
|
133
57
|
* `https://themer.sanity.build/api/hues` served without any parameters.
|
|
@@ -147,20 +71,14 @@ declare const theme: LegacyTheme;
|
|
|
147
71
|
* the same slugs and hues:
|
|
148
72
|
*
|
|
149
73
|
* ```ts
|
|
150
|
-
* import {createTheme,
|
|
74
|
+
* import {createTheme, presets} from '@sanity/themer/legacy'
|
|
151
75
|
*
|
|
152
|
-
* const
|
|
76
|
+
* const verdant = presets.find((preset) => preset.slug === 'verdant')
|
|
77
|
+
* const theme = createTheme(verdant.hues)
|
|
153
78
|
* ```
|
|
154
79
|
*
|
|
155
80
|
* @public
|
|
156
81
|
*/
|
|
157
82
|
declare const presets: ThemePreset[];
|
|
158
|
-
|
|
159
|
-
* Finds a preset by its slug, falling back to the default Studio preset for
|
|
160
|
-
* unknown slugs — the same behavior as the hosted Themer service.
|
|
161
|
-
*
|
|
162
|
-
* @public
|
|
163
|
-
*/
|
|
164
|
-
declare function getPreset(slug: string | null | undefined): ThemePreset;
|
|
165
|
-
export { type Hue, type HueMidPoint, type Hues, type LegacyTheme, type PartialHues, type ThemePreset, createTheme, createThemeFromUrl, getPreset, hues, parseHuesFromUrl, presets, theme };
|
|
83
|
+
export { type Hue, type HueMidPoint, type Hues, type LegacyTheme, type PartialHues, type ThemePreset, buildThemeFromUrl, createTheme, hues, parseHuesFromUrl, presets, theme };
|
|
166
84
|
//# sourceMappingURL=legacy.d.ts.map
|
package/dist/legacy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.d.ts","names":[],"sources":["../src/legacy/
|
|
1
|
+
{"version":3,"file":"legacy.d.ts","names":[],"sources":["../src/legacy/createTheme.ts","../src/legacy/defaults.ts","../src/legacy/presets.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAsBgB,YAAY,OAAM,cAAmB;;;;;;;;;;;;;;;;;iBAoBrC,iBAAiB,cAAc,MAAM;;;;;;;;;;;;;;;;;;;iBAyBrC,kBAAkB,cAAc,MAAM;;;;;;;cCzDzC,MAAM;;;;;;;cAQN,OAAO;;;;;;;;;;;;;;cCcP,SAAS"}
|