@sanity/themer 0.3.6 → 0.3.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.js","names":["Hue","dropUndefined","hue","Partial","undefined","result","mid","midPoint","lightest","darkest","ColorTint","ColorTints","black","title","hex","white","gray","blue","purple","magenta","red","orange","yellow","green","cyan","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","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/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","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,QAA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;;;;;;;;ACxrBA,SAAgBQ,YAAYC,OAAoB,CAAC,GAAgB;CAC/D,OAAOL,cAAcK,IAAI;AAC3B;;;;;;;;;;;;;;;;;AAkBA,SAAgBC,iBAAiBC,KAAyB;CACxD,IAAM,EAACE,iBAAgB,IAAID,IAAID,KAAK,sCAAsC,GACpEG,SAASX,UAAUU,aAAaE,IAAI,QAAQ,CAAC;CAEnD,OAAOd,UAAUC,0BAA0BW,YAAY,GAAGC,OAAOL,IAAI;AACvE;;;;;;;;;;;;;;;;;;;AAoBA,SAAgBO,kBAAkBL,KAAgC;CAChE,OAAOH,YAAYE,iBAAiBC,GAAG,CAAC;AAC1C;;;;;;;AC3DA,MAAaU,OAAaJ,UAAU,CAAC,CAAC,GAQzBK,QAAqBJ,YAAYG,IAAI"}
1
+ {"version":3,"file":"legacy.js","names":[],"sources":["../src/legacy/dropUndefined.ts","../src/legacy/palette.ts","../src/legacy/applyHues.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","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,SAAgB,cAAc,KAAyD;CACrF,IAAI,CAAC,KAAK;CAEV,IAAM,SAAuB,CAAC;CAO9B,OALI,IAAI,QAAQ,KAAA,MAAW,OAAO,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;;;;;;;;;;AAoBA,SAAgB,kBAAkB,KAAgC;CAChE,OAAO,YAAY,iBAAiB,GAAG,CAAC;AAC1C;;;;;;;AC3DA,MAAa,OAAa,UAAU,CAAC,CAAC,GAQzB,QAAqB,YAAY,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"mix-BfV6_Ke4.js","names":["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"],"sources":["../src/lib/mix.ts"],"sourcesContent":["/**\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"],"mappings":";;;;;;;;AAQA,SAAgBA,IAAIC,QAAgBC,OAAeC,YAA4B;CAE7E,IAAIF,WAAW,GAAG,OAAOE;CAEzB,IAAM,CAACC,IAAIC,IAAIC,MAAMC,SAASL,KAAK,GAC7B,CAACM,IAAIC,IAAIC,MAAMH,SAASJ,UAAU,GAElCQ,KAAK,IAAIV;CAEf,OAAOW,UACL,IAAIC,aAAaC,KAAKC,MAAMX,KAAKH,SAASO,KAAKG,EAAE,CAAC,IAAIE,aACpDC,KAAKC,MAAMV,KAAKJ,SAASQ,KAAKE,EAAE,CAClC,IAAIE,aAAaC,KAAKC,MAAMT,KAAKL,SAASS,KAAKC,EAAE,CAAC,GACpD;AACF;;;;;;;AAQA,SAAgBK,QAAQC,OAAwB;CAC9C,OAAO,2BAA2BC,KAAKD,KAAK;AAC9C;AAEA,SAASV,SAASL,OAAyC;CACzD,IAAI,CAACc,QAAQd,KAAK,GAChB,MAAUiB,UAAU,kBAAkBC,KAAKC,UAAUnB,KAAK,EAAC,wBAAyB;CAGtF,IAAMoB,MACJpB,MAAMqB,WAAW,IACb,GAAGrB,MAAM,KAAKA,MAAM,KAAKA,MAAM,KAAKA,MAAM,KAAKA,MAAM,KAAKA,MAAM,OAChEA,MAAMsB,MAAM,CAAC;CAEnB,OAAO;EACLC,SAASH,IAAIE,MAAM,GAAG,CAAC,GAAG,EAAE;EAC5BC,SAASH,IAAIE,MAAM,GAAG,CAAC,GAAG,EAAE;EAC5BC,SAASH,IAAIE,MAAM,GAAG,CAAC,GAAG,EAAE;CAAC;AAEjC;AAEA,SAASX,aAAaa,OAAuB;CAC3C,IAAMJ,MAAMI,MAAMC,SAAS,EAAE;CAE7B,OAAOL,IAAIC,WAAW,IAAI,IAAID,QAAQA;AACxC;;AAGA,SAASV,UAAUU,KAAqB;CAKtC,OAJIA,IAAI,OAAOA,IAAI,MAAMA,IAAI,OAAOA,IAAI,MAAMA,IAAI,OAAOA,IAAI,KACpD,IAAIA,IAAI,KAAKA,IAAI,KAAKA,IAAI,OAG5BA;AACT"}
1
+ {"version":3,"file":"mix-BfV6_Ke4.js","names":[],"sources":["../src/lib/mix.ts"],"sourcesContent":["/**\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"],"mappings":";;;;;;;;AAQA,SAAgB,IAAI,QAAgB,OAAe,YAA4B;CAE7E,IAAI,WAAW,GAAG,OAAO;CAEzB,IAAM,CAAC,IAAI,IAAI,MAAM,SAAS,KAAK,GAC7B,CAAC,IAAI,IAAI,MAAM,SAAS,UAAU,GAElC,KAAK,IAAI;CAEf,OAAO,UACL,IAAI,aAAa,KAAK,MAAM,KAAK,SAAS,KAAK,EAAE,CAAC,IAAI,aACpD,KAAK,MAAM,KAAK,SAAS,KAAK,EAAE,CAClC,IAAI,aAAa,KAAK,MAAM,KAAK,SAAS,KAAK,EAAE,CAAC,GACpD;AACF;;;;;;;AAQA,SAAgB,QAAQ,OAAwB;CAC9C,OAAO,2BAA2B,KAAK,KAAK;AAC9C;AAEA,SAAS,SAAS,OAAyC;CACzD,IAAI,CAAC,QAAQ,KAAK,GAChB,MAAU,UAAU,kBAAkB,KAAK,UAAU,KAAK,EAAE,wBAAwB;CAGtF,IAAM,MACJ,MAAM,WAAW,IACb,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,OAChE,MAAM,MAAM,CAAC;CAEnB,OAAO;EACL,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;EAC5B,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;EAC5B,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;CAC9B;AACF;AAEA,SAAS,aAAa,OAAuB;CAC3C,IAAM,MAAM,MAAM,SAAS,EAAE;CAE7B,OAAO,IAAI,WAAW,IAAI,IAAI,QAAQ;AACxC;;AAGA,SAAS,UAAU,KAAqB;CAKtC,OAJI,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,IAAI,KACpD,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,OAG5B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"presets-DWzYcsLg.js","names":["Hsl","h","s","l","hexToHsl","hex","r","g","b","parseHex","max","Math","min","delta","abs","normalizeHue","hslToHex","hsl","clamp01","c","x","m","channelToHex","mixHue","from","to","amount","relativeLuminance","linearChannel","value","expanded","length","slice","parseInt","round","toString","padStart","hue","black","blue","gray","white","isColor","hexToHsl","hslToHex","BuildThemeOptions","accent","background","dark","light","contrast","text","ResolvedThemeOptions","DEFAULT_ACCENT","hex","DEFAULT_TEXT","DEFAULT_BACKGROUND_DARK","DEFAULT_BACKGROUND_LIGHT","DEFAULT_CONTRAST","MINIMUM_CONTRAST","MAXIMUM_CONTRAST","resolveThemeOptions","options","normalizeColor","undefined","normalizeContrast","deriveTextColor","accentHsl","defaultAccent","defaultText","h","s","Math","min","l","value","name","TypeError","JSON","stringify","lower","toLowerCase","length","Number","isFinite","max","color","COLOR_TINTS","ColorHueKey","ColorTintKey","ColorTints","hexToHsl","Hsl","hslToHex","mixHue","relativeLuminance","BuildThemeOptions","DEFAULT_ACCENT","DEFAULT_CONTRAST","DEFAULT_TEXT","MAXIMUM_CONTRAST","MINIMUM_CONTRAST","resolveThemeOptions","MINIMUM_ANCHOR_LIGHTNESS","MAXIMUM_ANCHOR_LIGHTNESS","MINIMUM_DARK_BACKGROUND_CONTRAST","BACKGROUND_LIGHTNESS_STEP","GeneratedColorPalette","black","white","Record","buildPalette","options","resolved","accentAnchor","clampAnchorLightness","accent","textAnchor","text","grayAnchor","applyContrast","contrast","blueTints","remapTints","blue","grayTints","gray","anchorLuminances","darkenBackground","background","dark","tints","lightenBackground","light","purple","tintHexes","magenta","red","orange","yellow","green","cyan","amount","h","s","l","from","to","rotation","result","Partial","tint","value","hex","remapSaturation","remapLightness","Math","min","anchor","max","rules","maximumLuminance","tintLuminances","map","isDarkEnough","luminance","every","tintLuminance","lightness","current","minimumLuminance","buildTheme","buildUITheme","RootTheme","buildPalette","BuildThemeOptions","options","palette","BuildThemeOptions","DEFAULT_ACCENT","ThemePreset","slug","title","options","presets","accent","text","background","dark","light"],"sources":["../src/theme/hsl.ts","../src/theme/options.ts","../src/theme/buildPalette.ts","../src/theme/buildTheme.ts","../src/theme/presets.ts"],"sourcesContent":["/**\n * Color math for the palette generator, kept at full float precision: unlike\n * the HSL helpers in `@sanity/ui/theme`, nothing is rounded between the two\n * conversions, so `hslToHex(hexToHsl(hex))` returns `hex` unchanged for every\n * color. `buildTheme` relies on that to reproduce the stock `@sanity/color`\n * palette byte-for-byte when it is called with the stock anchor colors.\n */\n\n/**\n * A color in HSL space: `h` in degrees within `[0, 360)`, `s` and `l` as\n * fractions within `[0, 1]`.\n *\n * @internal\n */\nexport interface Hsl {\n h: number\n s: number\n l: number\n}\n\n/** @internal */\nexport function hexToHsl(hex: string): Hsl {\n const [r, g, b] = parseHex(hex)\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const delta = max - min\n\n const l = (max + min) / 2\n\n if (delta === 0) {\n return {h: 0, s: 0, l}\n }\n\n const s = delta / (1 - Math.abs(2 * l - 1))\n\n let h: number\n\n if (max === r) {\n h = ((g - b) / delta) % 6\n } else if (max === g) {\n h = (b - r) / delta + 2\n } else {\n h = (r - g) / delta + 4\n }\n\n return {h: normalizeHue(h * 60), s, l}\n}\n\n/** @internal */\nexport function hslToHex(hsl: Hsl): string {\n const h = normalizeHue(hsl.h)\n const s = clamp01(hsl.s)\n const l = clamp01(hsl.l)\n\n const c = (1 - Math.abs(2 * l - 1)) * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = l - c / 2\n\n let r = 0\n let g = 0\n let b = 0\n\n if (h < 60) {\n r = c\n g = x\n } else if (h < 120) {\n r = x\n g = c\n } else if (h < 180) {\n g = c\n b = x\n } else if (h < 240) {\n g = x\n b = c\n } else if (h < 300) {\n r = x\n b = c\n } else {\n r = c\n b = x\n }\n\n return `#${channelToHex(r + m)}${channelToHex(g + m)}${channelToHex(b + m)}`\n}\n\n/**\n * Rotates `from` towards `to` along the shortest arc of the hue circle.\n *\n * @internal\n */\nexport function mixHue(from: number, to: number, amount: number): number {\n const delta = ((((to - from) % 360) + 540) % 360) - 180\n\n return normalizeHue(from + delta * amount)\n}\n\n/**\n * The WCAG relative luminance of a hex color, between 0 (black) and 1 (white).\n *\n * @internal\n */\nexport function relativeLuminance(hex: string): number {\n const [r, g, b] = parseHex(hex)\n\n return 0.2126 * linearChannel(r) + 0.7152 * linearChannel(g) + 0.0722 * linearChannel(b)\n}\n\nfunction linearChannel(value: number): number {\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4\n}\n\n/** Parses `#abc` and `#aabbcc` hex colors into channel fractions of 1 */\nfunction parseHex(hex: string): [number, number, number] {\n const expanded =\n hex.length === 4 ? `${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex.slice(1)\n\n return [\n parseInt(expanded.slice(0, 2), 16) / 255,\n parseInt(expanded.slice(2, 4), 16) / 255,\n parseInt(expanded.slice(4, 6), 16) / 255,\n ]\n}\n\nfunction channelToHex(value: number): string {\n return Math.round(clamp01(value) * 255)\n .toString(16)\n .padStart(2, '0')\n}\n\nfunction normalizeHue(hue: number): number {\n return ((hue % 360) + 360) % 360\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value))\n}\n","import {black, blue, gray, white} from '@sanity/color'\n\nimport {isColor} from '../lib/mix'\nimport {hexToHsl, hslToHex} from './hsl'\n\n/**\n * Options for {@link buildTheme} and {@link buildPalette}.\n *\n * Every color is a hex color (`#rgb` or `#rrggbb`). Passing the stock values\n * for every option — or just `accent: '#556bfc'` on its own — reproduces the\n * `@sanity/color` palette exactly, so the generated theme matches\n * `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport interface BuildThemeOptions {\n /**\n * The accent color — the brand color of the theme. Replaces the `blue`\n * scale of the palette, which Sanity UI uses for primary buttons, focus\n * rings and links.\n *\n * The stock accent is `#556bfc` (`blue/500` of `@sanity/color`).\n */\n accent: string\n\n /**\n * The backgrounds of the two color schemes. `dark` replaces `black` in the\n * palette and `light` replaces `white` — every other color of a scheme is\n * blended onto them.\n *\n * Both are kept far enough from the text and accent colors to stay usable:\n * `dark` is made darker until it has enough contrast with them (it can\n * never be lighter than either), and `light` can never be darker than\n * either.\n *\n * The stock backgrounds are `#0d0e12` (dark) and `#ffffff` (light).\n */\n background?: {\n /** The dark scheme background — defaults to `#0d0e12` */\n dark?: string\n /** The light scheme background — defaults to `#ffffff` */\n light?: string\n }\n\n /**\n * How strongly text and borders separate from the accent color, between 15\n * and 100. The default is 85, which uses the text color as-is. Above 85 the\n * text scale loses its tint until it is fully neutral at 100 — a high\n * contrast scheme with no mixing of the text and accent colors. Below 85\n * more and more of the accent color mixes into the text scale, giving text\n * and borders more color, until the scale fully adopts the accent hue and\n * saturation at 15.\n */\n contrast?: number\n\n /**\n * The text color. Replaces the `gray` scale of the palette, which Sanity UI\n * uses for text, icons, borders and neutral surfaces. When omitted, it is\n * derived from the accent color: a mostly desaturated version of it, the\n * way the stock `gray` scale carries a hint of the stock blue.\n *\n * The stock text color is `#727892` (`gray/500` of `@sanity/color`).\n */\n text?: string\n}\n\n/**\n * {@link BuildThemeOptions} with every option filled in: colors normalized to\n * lowercase `#rrggbb`, the text color derived from the accent when it was\n * omitted, and the contrast clamped into its valid range.\n *\n * @internal\n */\nexport interface ResolvedThemeOptions {\n accent: string\n background: {dark: string; light: string}\n contrast: number\n text: string\n}\n\n/** The stock accent color — `blue/500` of `@sanity/color` @internal */\nexport const DEFAULT_ACCENT: string = blue[500].hex\n\n/** The stock text color — `gray/500` of `@sanity/color` @internal */\nexport const DEFAULT_TEXT: string = gray[500].hex\n\n/** The stock dark scheme background — `black` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_DARK: string = black.hex\n\n/** The stock light scheme background — `white` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_LIGHT: string = white.hex\n\n/** The contrast that applies the text color as-is @internal */\nexport const DEFAULT_CONTRAST = 85\n\n/** @internal */\nexport const MINIMUM_CONTRAST = 15\n\n/** @internal */\nexport const MAXIMUM_CONTRAST = 100\n\n/** @internal */\nexport function resolveThemeOptions(options: BuildThemeOptions): ResolvedThemeOptions {\n const accent = normalizeColor(options.accent, 'accent')\n\n return {\n accent,\n background: {\n dark:\n options.background?.dark === undefined\n ? DEFAULT_BACKGROUND_DARK\n : normalizeColor(options.background.dark, 'background.dark'),\n light:\n options.background?.light === undefined\n ? DEFAULT_BACKGROUND_LIGHT\n : normalizeColor(options.background.light, 'background.light'),\n },\n contrast: normalizeContrast(options.contrast),\n text:\n options.text === undefined ? deriveTextColor(accent) : normalizeColor(options.text, 'text'),\n }\n}\n\n/**\n * Derives the text color from an accent color, keeping the relationship the\n * stock palette has between `gray/500` and `blue/500`: the text color takes\n * the accent's hue (offset the way the stock gray is offset from the stock\n * blue), carries about an eighth of its saturation, and keeps the stock text\n * lightness. Deriving from the stock accent returns the stock text color.\n *\n * @internal\n */\nexport function deriveTextColor(accent: string): string {\n const accentHsl = hexToHsl(normalizeColor(accent, 'accent'))\n const defaultAccent = hexToHsl(DEFAULT_ACCENT)\n const defaultText = hexToHsl(DEFAULT_TEXT)\n\n return hslToHex({\n h: defaultText.h + (accentHsl.h - defaultAccent.h),\n s: Math.min(1, defaultText.s * (accentHsl.s / defaultAccent.s)),\n l: defaultText.l,\n })\n}\n\nfunction normalizeColor(value: string, name: string): string {\n if (typeof value !== 'string' || !isColor(value)) {\n throw new TypeError(\n `Invalid \\`${name}\\` color: ${JSON.stringify(value)} — expected a hex color like #556bfc`,\n )\n }\n\n const lower = value.toLowerCase()\n\n return lower.length === 4\n ? `#${lower[1]}${lower[1]}${lower[2]}${lower[2]}${lower[3]}${lower[3]}`\n : lower\n}\n\nfunction normalizeContrast(value: number | undefined): number {\n if (value === undefined) {\n return DEFAULT_CONTRAST\n }\n\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new TypeError(\n `Invalid \\`contrast\\`: ${JSON.stringify(value)} — expected a number between ${MINIMUM_CONTRAST} and ${MAXIMUM_CONTRAST}`,\n )\n }\n\n return Math.min(MAXIMUM_CONTRAST, Math.max(MINIMUM_CONTRAST, value))\n}\n","import {color, COLOR_TINTS, ColorHueKey, ColorTintKey, ColorTints} from '@sanity/color'\n\nimport {hexToHsl, Hsl, hslToHex, mixHue, relativeLuminance} from './hsl'\nimport {\n BuildThemeOptions,\n DEFAULT_ACCENT,\n DEFAULT_CONTRAST,\n DEFAULT_TEXT,\n MAXIMUM_CONTRAST,\n MINIMUM_CONTRAST,\n resolveThemeOptions,\n} from './options'\n\n/**\n * The lightness band the accent and text colors are clamped into — anchors\n * outside it would squeeze most of their scale's tints into an\n * indistinguishable sliver, messing with the rest of the scale.\n */\nconst MINIMUM_ANCHOR_LIGHTNESS = 0.25\nconst MAXIMUM_ANCHOR_LIGHTNESS = 0.75\n\n/**\n * The contrast ratio the dark background must reach against the 400 tints of\n * the text and accent scales — the tints Sanity UI paints muted text and\n * solid buttons with on dark backgrounds. The stock palette sits at ~6.8.\n */\nconst MINIMUM_DARK_BACKGROUND_CONTRAST = 4.5\n\n/** How much lightness each step of a background adjustment removes or adds */\nconst BACKGROUND_LIGHTNESS_STEP = 0.005\n\n/**\n * The color palette generated by {@link buildPalette}: the `palette` config\n * of `buildTheme` from `@sanity/ui/theme`, with every color as a hex string.\n *\n * @public\n */\nexport type GeneratedColorPalette = {black: string; white: string} & Record<\n ColorHueKey,\n Record<ColorTintKey, string>\n>\n\n/**\n * Generates a Sanity UI color palette from the theme options: the accent\n * color replaces the `blue` scale, the text color the `gray` scale, and the\n * backgrounds replace `black` and `white`. All other hues keep their stock\n * `@sanity/color` values. Called with the stock colors, it returns the stock\n * palette byte-for-byte.\n *\n * ```ts\n * import {buildPalette} from '@sanity/themer'\n *\n * const palette = buildPalette({accent: '#556bfc'})\n * ```\n *\n * @public\n */\nexport function buildPalette(options: BuildThemeOptions): GeneratedColorPalette {\n const resolved = resolveThemeOptions(options)\n\n const accentAnchor = clampAnchorLightness(hexToHsl(resolved.accent))\n const textAnchor = clampAnchorLightness(hexToHsl(resolved.text))\n const grayAnchor = applyContrast(textAnchor, accentAnchor, resolved.contrast)\n\n const blueTints = remapTints(color.blue, hexToHsl(DEFAULT_ACCENT), accentAnchor)\n const grayTints = remapTints(color.gray, hexToHsl(DEFAULT_TEXT), grayAnchor)\n\n const anchorLuminances = [\n relativeLuminance(hslToHex(grayAnchor)),\n relativeLuminance(hslToHex(accentAnchor)),\n ]\n\n return {\n black: darkenBackground(resolved.background.dark, {\n anchorLuminances,\n tints: [grayTints['400'], blueTints['400']],\n }),\n white: lightenBackground(resolved.background.light, anchorLuminances),\n gray: grayTints,\n blue: blueTints,\n purple: tintHexes(color.purple),\n magenta: tintHexes(color.magenta),\n red: tintHexes(color.red),\n orange: tintHexes(color.orange),\n yellow: tintHexes(color.yellow),\n green: tintHexes(color.green),\n cyan: tintHexes(color.cyan),\n }\n}\n\n/**\n * Mixes the accent color into the text color according to the contrast: 85\n * applies the text color as-is, 100 removes its tint entirely, and lower\n * values rotate and saturate it towards the accent.\n */\nfunction applyContrast(text: Hsl, accent: Hsl, contrast: number): Hsl {\n if (contrast === DEFAULT_CONTRAST) {\n return text\n }\n\n if (contrast > DEFAULT_CONTRAST) {\n const amount = (contrast - DEFAULT_CONTRAST) / (MAXIMUM_CONTRAST - DEFAULT_CONTRAST)\n\n return {h: text.h, s: text.s * (1 - amount), l: text.l}\n }\n\n const amount = (DEFAULT_CONTRAST - contrast) / (DEFAULT_CONTRAST - MINIMUM_CONTRAST)\n\n return {\n h: mixHue(text.h, accent.h, amount),\n s: text.s + (accent.s - text.s) * amount,\n l: text.l,\n }\n}\n\n/**\n * Rebuilds a stock tint scale around a new anchor color, where `from` is the\n * scale's stock 500 tint: hues rotate along, saturation scales\n * proportionally, and lightness is remapped piecewise so the anchor takes the\n * new lightness while the scale keeps spanning light to dark. When the anchor\n * matches the stock one, every tint comes back unchanged.\n */\nfunction remapTints(tints: ColorTints, from: Hsl, to: Hsl): Record<ColorTintKey, string> {\n const rotation = to.h - from.h\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n const value = hexToHsl(tints[tint].hex)\n\n result[tint] = hslToHex({\n h: value.h + rotation,\n s: remapSaturation(value.s, from.s, to.s),\n l: remapLightness(value.l, from.l, to.l),\n })\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n\nfunction remapSaturation(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n return Math.min(1, value * (to / from))\n}\n\nfunction remapLightness(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n if (value <= from) {\n return value * (to / from)\n }\n\n return to + ((value - from) * (1 - to)) / (1 - from)\n}\n\nfunction clampAnchorLightness(anchor: Hsl): Hsl {\n const l = Math.min(MAXIMUM_ANCHOR_LIGHTNESS, Math.max(MINIMUM_ANCHOR_LIGHTNESS, anchor.l))\n\n return l === anchor.l ? anchor : {...anchor, l}\n}\n\n/**\n * Enforces the dark background rules: it can never be lighter than the text\n * or accent colors, and it must reach enough contrast with the 400 tints of\n * their scales — it is made darker until it does (or bottoms out at black).\n */\nfunction darkenBackground(\n hex: string,\n rules: {anchorLuminances: number[]; tints: string[]},\n): string {\n const maximumLuminance = Math.min(...rules.anchorLuminances)\n const tintLuminances = rules.tints.map((tint) => relativeLuminance(tint))\n\n const isDarkEnough = (background: string): boolean => {\n const luminance = relativeLuminance(background)\n\n return (\n luminance < maximumLuminance &&\n tintLuminances.every(\n (tintLuminance) =>\n (tintLuminance + 0.05) / (luminance + 0.05) >= MINIMUM_DARK_BACKGROUND_CONTRAST,\n )\n )\n }\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (!isDarkEnough(current) && lightness > 0) {\n lightness = Math.max(0, lightness - BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\n/**\n * Enforces the light background rule: it can never be darker than the text\n * or accent colors — it is made lighter until it is (or tops out at white).\n */\nfunction lightenBackground(hex: string, anchorLuminances: number[]): string {\n const minimumLuminance = Math.max(...anchorLuminances)\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (relativeLuminance(current) <= minimumLuminance && lightness < 1) {\n lightness = Math.min(1, lightness + BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\nfunction tintHexes(tints: ColorTints): Record<ColorTintKey, string> {\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n result[tint] = tints[tint].hex\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n","import {buildTheme as buildUITheme, RootTheme} from '@sanity/ui/theme'\n\nimport {buildPalette} from './buildPalette'\nimport {BuildThemeOptions} from './options'\n\n/**\n * Generates a Studio theme from a handful of colors, by replacing the color\n * palette that the `buildTheme` from `@sanity/ui/theme` otherwise fills with\n * `@sanity/color`: the accent color replaces the `blue` scale (primary\n * buttons, focus rings, links), the optional text color the `gray` scale\n * (text, icons, borders), and the optional backgrounds replace `black` and\n * `white`. The result is the same type of theme that `@sanity/ui/theme`\n * builds, ready for the `theme` property of a Studio config.\n *\n * ```ts\n * import {buildTheme} from '@sanity/themer'\n * import {defineConfig} from 'sanity'\n *\n * export const theme = buildTheme({\n * accent: '#556bfc',\n * text: '#727892', // optional — derived from `accent` when omitted\n * background: {dark: '#0d0e12', light: '#ffffff'}, // optional\n * contrast: 85, // optional, 15–100\n * })\n *\n * export default defineConfig({\n * theme,\n * // ...rest of the config\n * })\n * ```\n *\n * Called with the stock colors — like the example — it returns the exact\n * same colors as `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport function buildTheme(options: BuildThemeOptions): RootTheme {\n return buildUITheme({palette: buildPalette(options)})\n}\n","import {BuildThemeOptions, DEFAULT_ACCENT} from './options'\n\n/**\n * A preset theme: a named set of {@link BuildThemeOptions} ready to pass to\n * `buildTheme`.\n *\n * @public\n */\nexport interface ThemePreset {\n slug: string\n title: string\n /** The preset's theme options, ready to pass to `buildTheme` */\n options: BuildThemeOptions\n}\n\n/**\n * Preset themes for `buildTheme`, carried over from the hosted Themer service\n * (themer.sanity.build) presets: each one maps the legacy preset's primary\n * hue to `accent`, its default hue to `text` and its lightest/darkest colors\n * to the backgrounds.\n *\n * ```ts\n * import {buildTheme, presets} from '@sanity/themer'\n *\n * const verdant = presets.find((preset) => preset.slug === 'verdant')\n * const theme = buildTheme(verdant.options)\n * ```\n *\n * @public\n */\nexport const presets: ThemePreset[] = [\n {\n slug: 'studio',\n title: 'Studio',\n options: {accent: DEFAULT_ACCENT},\n },\n {\n slug: 'dew',\n title: 'Dew',\n options: {\n accent: '#d1a308',\n text: '#5e63b4',\n background: {dark: '#0d0d15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'pink-synth',\n title: 'Pink Synth',\n options: {\n accent: '#ec4899',\n text: '#8b6584',\n background: {dark: '#171721', light: '#f7f2f5'},\n },\n },\n {\n slug: 'pixel-art',\n title: 'Pixel Art',\n options: {\n accent: '#f10784',\n text: '#57619c',\n background: {dark: '#0d0e15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'retro-colonial',\n title: 'Retro Colonial',\n options: {\n accent: '#fa7a78',\n text: '#8bb9b5',\n background: {dark: '#0d1515', light: '#fcfdfd'},\n },\n },\n {\n slug: 'rosabel',\n title: 'Rosabel',\n options: {\n accent: '#ed2555',\n text: '#9d8966',\n background: {dark: '#15120d', light: '#fdfdfc'},\n },\n },\n {\n slug: 'stereofidelic',\n title: 'Stereofidelic',\n options: {\n accent: '#f13009',\n text: '#678e9a',\n background: {dark: '#0e1315', light: '#fcfdfd'},\n },\n },\n {\n slug: 'verdant',\n title: 'Verdant',\n options: {\n accent: '#1cb485',\n text: '#5c9199',\n background: {dark: '#0d1415', light: '#fcfdfd'},\n },\n },\n]\n"],"mappings":";;;;AAqBA,SAAgBI,SAASC,KAAkB;CACzC,IAAM,CAACC,GAAGC,GAAGC,KAAKC,SAASJ,GAAG,GAExBK,MAAMC,KAAKD,IAAIJ,GAAGC,GAAGC,CAAC,GACtBI,MAAMD,KAAKC,IAAIN,GAAGC,GAAGC,CAAC,GACtBK,QAAQH,MAAME,KAEdT,KAAKO,MAAME,OAAO;CAExB,IAAIC,UAAU,GACZ,OAAO;EAACZ,GAAG;EAAGC,GAAG;EAAGC;CAAC;CAGvB,IAAMD,IAAIW,SAAS,IAAIF,KAAKG,IAAI,IAAIX,IAAI,CAAC,IAErCF;CAUJ,OARA,AAKEA,IALES,QAAQJ,KACJC,IAAIC,KAAKK,QAAS,IACfH,QAAQH,KACZC,IAAIF,KAAKO,QAAQ,KAEjBP,IAAIC,KAAKM,QAAQ,GAGjB;EAACZ,GAAGc,aAAad,IAAI,EAAE;EAAGC;EAAGC;CAAC;AACvC;;AAGA,SAAgBa,SAASC,KAAkB;CACzC,IAAMhB,IAAIc,aAAaE,IAAIhB,CAAC,GACtBC,IAAIgB,QAAQD,IAAIf,CAAC,GACjBC,IAAIe,QAAQD,IAAId,CAAC,GAEjBgB,KAAK,IAAIR,KAAKG,IAAI,IAAIX,IAAI,CAAC,KAAKD,GAChCkB,IAAID,KAAK,IAAIR,KAAKG,IAAMb,IAAI,KAAM,IAAK,CAAC,IACxCoB,IAAIlB,IAAIgB,IAAI,GAEdb,IAAI,GACJC,IAAI,GACJC,IAAI;CAsBR,OApBIP,IAAI,MACNK,IAAIa,GACJZ,IAAIa,KACKnB,IAAI,OACbK,IAAIc,GACJb,IAAIY,KACKlB,IAAI,OACbM,IAAIY,GACJX,IAAIY,KACKnB,IAAI,OACbM,IAAIa,GACJZ,IAAIW,KAC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gD,CAAC;CAEvD,KAAK,IAAME,QAAQhE,aACjB8D,OAAOE,QAAQpB,MAAMoB,KAAK,CAACE;CAI7B,OAAOJ;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClMA,SAAgBsB,aAAWK,SAAuC;CAChE,OAAOJ,WAAa,EAACK,SAASH,aAAaE,OAAO,EAAC,CAAC;AACtD;;;;;;;;;;;;;;;;ACRA,MAAaQ,UAAyB;CACpC;EACEH,MAAM;EACNC,OAAO;EACPC,SAAS,EAACE,QAAQN,eAAc;CAClC;CACA;EACEE,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;CACA;EACER,MAAM;EACNC,OAAO;EACPC,SAAS;GACPE,QAAQ;GACRC,MAAM;GACNC,YAAY;IAACC,MAAM;IAAWC,OAAO;GAAS;EAChD;CACF;AAAC"}
1
+ {"version":3,"file":"presets-DWzYcsLg.js","names":[],"sources":["../src/theme/hsl.ts","../src/theme/options.ts","../src/theme/buildPalette.ts","../src/theme/buildTheme.ts","../src/theme/presets.ts"],"sourcesContent":["/**\n * Color math for the palette generator, kept at full float precision: unlike\n * the HSL helpers in `@sanity/ui/theme`, nothing is rounded between the two\n * conversions, so `hslToHex(hexToHsl(hex))` returns `hex` unchanged for every\n * color. `buildTheme` relies on that to reproduce the stock `@sanity/color`\n * palette byte-for-byte when it is called with the stock anchor colors.\n */\n\n/**\n * A color in HSL space: `h` in degrees within `[0, 360)`, `s` and `l` as\n * fractions within `[0, 1]`.\n *\n * @internal\n */\nexport interface Hsl {\n h: number\n s: number\n l: number\n}\n\n/** @internal */\nexport function hexToHsl(hex: string): Hsl {\n const [r, g, b] = parseHex(hex)\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const delta = max - min\n\n const l = (max + min) / 2\n\n if (delta === 0) {\n return {h: 0, s: 0, l}\n }\n\n const s = delta / (1 - Math.abs(2 * l - 1))\n\n let h: number\n\n if (max === r) {\n h = ((g - b) / delta) % 6\n } else if (max === g) {\n h = (b - r) / delta + 2\n } else {\n h = (r - g) / delta + 4\n }\n\n return {h: normalizeHue(h * 60), s, l}\n}\n\n/** @internal */\nexport function hslToHex(hsl: Hsl): string {\n const h = normalizeHue(hsl.h)\n const s = clamp01(hsl.s)\n const l = clamp01(hsl.l)\n\n const c = (1 - Math.abs(2 * l - 1)) * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = l - c / 2\n\n let r = 0\n let g = 0\n let b = 0\n\n if (h < 60) {\n r = c\n g = x\n } else if (h < 120) {\n r = x\n g = c\n } else if (h < 180) {\n g = c\n b = x\n } else if (h < 240) {\n g = x\n b = c\n } else if (h < 300) {\n r = x\n b = c\n } else {\n r = c\n b = x\n }\n\n return `#${channelToHex(r + m)}${channelToHex(g + m)}${channelToHex(b + m)}`\n}\n\n/**\n * Rotates `from` towards `to` along the shortest arc of the hue circle.\n *\n * @internal\n */\nexport function mixHue(from: number, to: number, amount: number): number {\n const delta = ((((to - from) % 360) + 540) % 360) - 180\n\n return normalizeHue(from + delta * amount)\n}\n\n/**\n * The WCAG relative luminance of a hex color, between 0 (black) and 1 (white).\n *\n * @internal\n */\nexport function relativeLuminance(hex: string): number {\n const [r, g, b] = parseHex(hex)\n\n return 0.2126 * linearChannel(r) + 0.7152 * linearChannel(g) + 0.0722 * linearChannel(b)\n}\n\nfunction linearChannel(value: number): number {\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4\n}\n\n/** Parses `#abc` and `#aabbcc` hex colors into channel fractions of 1 */\nfunction parseHex(hex: string): [number, number, number] {\n const expanded =\n hex.length === 4 ? `${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex.slice(1)\n\n return [\n parseInt(expanded.slice(0, 2), 16) / 255,\n parseInt(expanded.slice(2, 4), 16) / 255,\n parseInt(expanded.slice(4, 6), 16) / 255,\n ]\n}\n\nfunction channelToHex(value: number): string {\n return Math.round(clamp01(value) * 255)\n .toString(16)\n .padStart(2, '0')\n}\n\nfunction normalizeHue(hue: number): number {\n return ((hue % 360) + 360) % 360\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value))\n}\n","import {black, blue, gray, white} from '@sanity/color'\n\nimport {isColor} from '../lib/mix'\nimport {hexToHsl, hslToHex} from './hsl'\n\n/**\n * Options for {@link buildTheme} and {@link buildPalette}.\n *\n * Every color is a hex color (`#rgb` or `#rrggbb`). Passing the stock values\n * for every option — or just `accent: '#556bfc'` on its own — reproduces the\n * `@sanity/color` palette exactly, so the generated theme matches\n * `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport interface BuildThemeOptions {\n /**\n * The accent color — the brand color of the theme. Replaces the `blue`\n * scale of the palette, which Sanity UI uses for primary buttons, focus\n * rings and links.\n *\n * The stock accent is `#556bfc` (`blue/500` of `@sanity/color`).\n */\n accent: string\n\n /**\n * The backgrounds of the two color schemes. `dark` replaces `black` in the\n * palette and `light` replaces `white` — every other color of a scheme is\n * blended onto them.\n *\n * Both are kept far enough from the text and accent colors to stay usable:\n * `dark` is made darker until it has enough contrast with them (it can\n * never be lighter than either), and `light` can never be darker than\n * either.\n *\n * The stock backgrounds are `#0d0e12` (dark) and `#ffffff` (light).\n */\n background?: {\n /** The dark scheme background — defaults to `#0d0e12` */\n dark?: string\n /** The light scheme background — defaults to `#ffffff` */\n light?: string\n }\n\n /**\n * How strongly text and borders separate from the accent color, between 15\n * and 100. The default is 85, which uses the text color as-is. Above 85 the\n * text scale loses its tint until it is fully neutral at 100 — a high\n * contrast scheme with no mixing of the text and accent colors. Below 85\n * more and more of the accent color mixes into the text scale, giving text\n * and borders more color, until the scale fully adopts the accent hue and\n * saturation at 15.\n */\n contrast?: number\n\n /**\n * The text color. Replaces the `gray` scale of the palette, which Sanity UI\n * uses for text, icons, borders and neutral surfaces. When omitted, it is\n * derived from the accent color: a mostly desaturated version of it, the\n * way the stock `gray` scale carries a hint of the stock blue.\n *\n * The stock text color is `#727892` (`gray/500` of `@sanity/color`).\n */\n text?: string\n}\n\n/**\n * {@link BuildThemeOptions} with every option filled in: colors normalized to\n * lowercase `#rrggbb`, the text color derived from the accent when it was\n * omitted, and the contrast clamped into its valid range.\n *\n * @internal\n */\nexport interface ResolvedThemeOptions {\n accent: string\n background: {dark: string; light: string}\n contrast: number\n text: string\n}\n\n/** The stock accent color — `blue/500` of `@sanity/color` @internal */\nexport const DEFAULT_ACCENT: string = blue[500].hex\n\n/** The stock text color — `gray/500` of `@sanity/color` @internal */\nexport const DEFAULT_TEXT: string = gray[500].hex\n\n/** The stock dark scheme background — `black` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_DARK: string = black.hex\n\n/** The stock light scheme background — `white` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_LIGHT: string = white.hex\n\n/** The contrast that applies the text color as-is @internal */\nexport const DEFAULT_CONTRAST = 85\n\n/** @internal */\nexport const MINIMUM_CONTRAST = 15\n\n/** @internal */\nexport const MAXIMUM_CONTRAST = 100\n\n/** @internal */\nexport function resolveThemeOptions(options: BuildThemeOptions): ResolvedThemeOptions {\n const accent = normalizeColor(options.accent, 'accent')\n\n return {\n accent,\n background: {\n dark:\n options.background?.dark === undefined\n ? DEFAULT_BACKGROUND_DARK\n : normalizeColor(options.background.dark, 'background.dark'),\n light:\n options.background?.light === undefined\n ? DEFAULT_BACKGROUND_LIGHT\n : normalizeColor(options.background.light, 'background.light'),\n },\n contrast: normalizeContrast(options.contrast),\n text:\n options.text === undefined ? deriveTextColor(accent) : normalizeColor(options.text, 'text'),\n }\n}\n\n/**\n * Derives the text color from an accent color, keeping the relationship the\n * stock palette has between `gray/500` and `blue/500`: the text color takes\n * the accent's hue (offset the way the stock gray is offset from the stock\n * blue), carries about an eighth of its saturation, and keeps the stock text\n * lightness. Deriving from the stock accent returns the stock text color.\n *\n * @internal\n */\nexport function deriveTextColor(accent: string): string {\n const accentHsl = hexToHsl(normalizeColor(accent, 'accent'))\n const defaultAccent = hexToHsl(DEFAULT_ACCENT)\n const defaultText = hexToHsl(DEFAULT_TEXT)\n\n return hslToHex({\n h: defaultText.h + (accentHsl.h - defaultAccent.h),\n s: Math.min(1, defaultText.s * (accentHsl.s / defaultAccent.s)),\n l: defaultText.l,\n })\n}\n\nfunction normalizeColor(value: string, name: string): string {\n if (typeof value !== 'string' || !isColor(value)) {\n throw new TypeError(\n `Invalid \\`${name}\\` color: ${JSON.stringify(value)} — expected a hex color like #556bfc`,\n )\n }\n\n const lower = value.toLowerCase()\n\n return lower.length === 4\n ? `#${lower[1]}${lower[1]}${lower[2]}${lower[2]}${lower[3]}${lower[3]}`\n : lower\n}\n\nfunction normalizeContrast(value: number | undefined): number {\n if (value === undefined) {\n return DEFAULT_CONTRAST\n }\n\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new TypeError(\n `Invalid \\`contrast\\`: ${JSON.stringify(value)} — expected a number between ${MINIMUM_CONTRAST} and ${MAXIMUM_CONTRAST}`,\n )\n }\n\n return Math.min(MAXIMUM_CONTRAST, Math.max(MINIMUM_CONTRAST, value))\n}\n","import {color, COLOR_TINTS, ColorHueKey, ColorTintKey, ColorTints} from '@sanity/color'\n\nimport {hexToHsl, Hsl, hslToHex, mixHue, relativeLuminance} from './hsl'\nimport {\n BuildThemeOptions,\n DEFAULT_ACCENT,\n DEFAULT_CONTRAST,\n DEFAULT_TEXT,\n MAXIMUM_CONTRAST,\n MINIMUM_CONTRAST,\n resolveThemeOptions,\n} from './options'\n\n/**\n * The lightness band the accent and text colors are clamped into — anchors\n * outside it would squeeze most of their scale's tints into an\n * indistinguishable sliver, messing with the rest of the scale.\n */\nconst MINIMUM_ANCHOR_LIGHTNESS = 0.25\nconst MAXIMUM_ANCHOR_LIGHTNESS = 0.75\n\n/**\n * The contrast ratio the dark background must reach against the 400 tints of\n * the text and accent scales — the tints Sanity UI paints muted text and\n * solid buttons with on dark backgrounds. The stock palette sits at ~6.8.\n */\nconst MINIMUM_DARK_BACKGROUND_CONTRAST = 4.5\n\n/** How much lightness each step of a background adjustment removes or adds */\nconst BACKGROUND_LIGHTNESS_STEP = 0.005\n\n/**\n * The color palette generated by {@link buildPalette}: the `palette` config\n * of `buildTheme` from `@sanity/ui/theme`, with every color as a hex string.\n *\n * @public\n */\nexport type GeneratedColorPalette = {black: string; white: string} & Record<\n ColorHueKey,\n Record<ColorTintKey, string>\n>\n\n/**\n * Generates a Sanity UI color palette from the theme options: the accent\n * color replaces the `blue` scale, the text color the `gray` scale, and the\n * backgrounds replace `black` and `white`. All other hues keep their stock\n * `@sanity/color` values. Called with the stock colors, it returns the stock\n * palette byte-for-byte.\n *\n * ```ts\n * import {buildPalette} from '@sanity/themer'\n *\n * const palette = buildPalette({accent: '#556bfc'})\n * ```\n *\n * @public\n */\nexport function buildPalette(options: BuildThemeOptions): GeneratedColorPalette {\n const resolved = resolveThemeOptions(options)\n\n const accentAnchor = clampAnchorLightness(hexToHsl(resolved.accent))\n const textAnchor = clampAnchorLightness(hexToHsl(resolved.text))\n const grayAnchor = applyContrast(textAnchor, accentAnchor, resolved.contrast)\n\n const blueTints = remapTints(color.blue, hexToHsl(DEFAULT_ACCENT), accentAnchor)\n const grayTints = remapTints(color.gray, hexToHsl(DEFAULT_TEXT), grayAnchor)\n\n const anchorLuminances = [\n relativeLuminance(hslToHex(grayAnchor)),\n relativeLuminance(hslToHex(accentAnchor)),\n ]\n\n return {\n black: darkenBackground(resolved.background.dark, {\n anchorLuminances,\n tints: [grayTints['400'], blueTints['400']],\n }),\n white: lightenBackground(resolved.background.light, anchorLuminances),\n gray: grayTints,\n blue: blueTints,\n purple: tintHexes(color.purple),\n magenta: tintHexes(color.magenta),\n red: tintHexes(color.red),\n orange: tintHexes(color.orange),\n yellow: tintHexes(color.yellow),\n green: tintHexes(color.green),\n cyan: tintHexes(color.cyan),\n }\n}\n\n/**\n * Mixes the accent color into the text color according to the contrast: 85\n * applies the text color as-is, 100 removes its tint entirely, and lower\n * values rotate and saturate it towards the accent.\n */\nfunction applyContrast(text: Hsl, accent: Hsl, contrast: number): Hsl {\n if (contrast === DEFAULT_CONTRAST) {\n return text\n }\n\n if (contrast > DEFAULT_CONTRAST) {\n const amount = (contrast - DEFAULT_CONTRAST) / (MAXIMUM_CONTRAST - DEFAULT_CONTRAST)\n\n return {h: text.h, s: text.s * (1 - amount), l: text.l}\n }\n\n const amount = (DEFAULT_CONTRAST - contrast) / (DEFAULT_CONTRAST - MINIMUM_CONTRAST)\n\n return {\n h: mixHue(text.h, accent.h, amount),\n s: text.s + (accent.s - text.s) * amount,\n l: text.l,\n }\n}\n\n/**\n * Rebuilds a stock tint scale around a new anchor color, where `from` is the\n * scale's stock 500 tint: hues rotate along, saturation scales\n * proportionally, and lightness is remapped piecewise so the anchor takes the\n * new lightness while the scale keeps spanning light to dark. When the anchor\n * matches the stock one, every tint comes back unchanged.\n */\nfunction remapTints(tints: ColorTints, from: Hsl, to: Hsl): Record<ColorTintKey, string> {\n const rotation = to.h - from.h\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n const value = hexToHsl(tints[tint].hex)\n\n result[tint] = hslToHex({\n h: value.h + rotation,\n s: remapSaturation(value.s, from.s, to.s),\n l: remapLightness(value.l, from.l, to.l),\n })\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n\nfunction remapSaturation(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n return Math.min(1, value * (to / from))\n}\n\nfunction remapLightness(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n if (value <= from) {\n return value * (to / from)\n }\n\n return to + ((value - from) * (1 - to)) / (1 - from)\n}\n\nfunction clampAnchorLightness(anchor: Hsl): Hsl {\n const l = Math.min(MAXIMUM_ANCHOR_LIGHTNESS, Math.max(MINIMUM_ANCHOR_LIGHTNESS, anchor.l))\n\n return l === anchor.l ? anchor : {...anchor, l}\n}\n\n/**\n * Enforces the dark background rules: it can never be lighter than the text\n * or accent colors, and it must reach enough contrast with the 400 tints of\n * their scales — it is made darker until it does (or bottoms out at black).\n */\nfunction darkenBackground(\n hex: string,\n rules: {anchorLuminances: number[]; tints: string[]},\n): string {\n const maximumLuminance = Math.min(...rules.anchorLuminances)\n const tintLuminances = rules.tints.map((tint) => relativeLuminance(tint))\n\n const isDarkEnough = (background: string): boolean => {\n const luminance = relativeLuminance(background)\n\n return (\n luminance < maximumLuminance &&\n tintLuminances.every(\n (tintLuminance) =>\n (tintLuminance + 0.05) / (luminance + 0.05) >= MINIMUM_DARK_BACKGROUND_CONTRAST,\n )\n )\n }\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (!isDarkEnough(current) && lightness > 0) {\n lightness = Math.max(0, lightness - BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\n/**\n * Enforces the light background rule: it can never be darker than the text\n * or accent colors — it is made lighter until it is (or tops out at white).\n */\nfunction lightenBackground(hex: string, anchorLuminances: number[]): string {\n const minimumLuminance = Math.max(...anchorLuminances)\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (relativeLuminance(current) <= minimumLuminance && lightness < 1) {\n lightness = Math.min(1, lightness + BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\nfunction tintHexes(tints: ColorTints): Record<ColorTintKey, string> {\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n result[tint] = tints[tint].hex\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n","import {buildTheme as buildUITheme, RootTheme} from '@sanity/ui/theme'\n\nimport {buildPalette} from './buildPalette'\nimport {BuildThemeOptions} from './options'\n\n/**\n * Generates a Studio theme from a handful of colors, by replacing the color\n * palette that the `buildTheme` from `@sanity/ui/theme` otherwise fills with\n * `@sanity/color`: the accent color replaces the `blue` scale (primary\n * buttons, focus rings, links), the optional text color the `gray` scale\n * (text, icons, borders), and the optional backgrounds replace `black` and\n * `white`. The result is the same type of theme that `@sanity/ui/theme`\n * builds, ready for the `theme` property of a Studio config.\n *\n * ```ts\n * import {buildTheme} from '@sanity/themer'\n * import {defineConfig} from 'sanity'\n *\n * export const theme = buildTheme({\n * accent: '#556bfc',\n * text: '#727892', // optional — derived from `accent` when omitted\n * background: {dark: '#0d0e12', light: '#ffffff'}, // optional\n * contrast: 85, // optional, 15–100\n * })\n *\n * export default defineConfig({\n * theme,\n * // ...rest of the config\n * })\n * ```\n *\n * Called with the stock colors — like the example — it returns the exact\n * same colors as `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport function buildTheme(options: BuildThemeOptions): RootTheme {\n return buildUITheme({palette: buildPalette(options)})\n}\n","import {BuildThemeOptions, DEFAULT_ACCENT} from './options'\n\n/**\n * A preset theme: a named set of {@link BuildThemeOptions} ready to pass to\n * `buildTheme`.\n *\n * @public\n */\nexport interface ThemePreset {\n slug: string\n title: string\n /** The preset's theme options, ready to pass to `buildTheme` */\n options: BuildThemeOptions\n}\n\n/**\n * Preset themes for `buildTheme`, carried over from the hosted Themer service\n * (themer.sanity.build) presets: each one maps the legacy preset's primary\n * hue to `accent`, its default hue to `text` and its lightest/darkest colors\n * to the backgrounds.\n *\n * ```ts\n * import {buildTheme, presets} from '@sanity/themer'\n *\n * const verdant = presets.find((preset) => preset.slug === 'verdant')\n * const theme = buildTheme(verdant.options)\n * ```\n *\n * @public\n */\nexport const presets: ThemePreset[] = [\n {\n slug: 'studio',\n title: 'Studio',\n options: {accent: DEFAULT_ACCENT},\n },\n {\n slug: 'dew',\n title: 'Dew',\n options: {\n accent: '#d1a308',\n text: '#5e63b4',\n background: {dark: '#0d0d15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'pink-synth',\n title: 'Pink Synth',\n options: {\n accent: '#ec4899',\n text: '#8b6584',\n background: {dark: '#171721', light: '#f7f2f5'},\n },\n },\n {\n slug: 'pixel-art',\n title: 'Pixel Art',\n options: {\n accent: '#f10784',\n text: '#57619c',\n background: {dark: '#0d0e15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'retro-colonial',\n title: 'Retro Colonial',\n options: {\n accent: '#fa7a78',\n text: '#8bb9b5',\n background: {dark: '#0d1515', light: '#fcfdfd'},\n },\n },\n {\n slug: 'rosabel',\n title: 'Rosabel',\n options: {\n accent: '#ed2555',\n text: '#9d8966',\n background: {dark: '#15120d', light: '#fdfdfc'},\n },\n },\n {\n slug: 'stereofidelic',\n title: 'Stereofidelic',\n options: {\n accent: '#f13009',\n text: '#678e9a',\n background: {dark: '#0e1315', light: '#fcfdfd'},\n },\n },\n {\n slug: 'verdant',\n title: 'Verdant',\n options: {\n accent: '#1cb485',\n text: '#5c9199',\n background: {dark: '#0d1415', light: '#fcfdfd'},\n },\n },\n]\n"],"mappings":";;;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E,MAAM;EACN,OAAO;EACP,SAAS;GACP,QAAQ;GACR,MAAM;GACN,YAAY;IAAC,MAAM;IAAW,OAAO;GAAS;EAChD;CACF;AACF"}
package/dist/tool.js CHANGED
@@ -78,10 +78,10 @@ registerLanguage(typescript);
78
78
  */
79
79
  const Swatch = styled.input.withConfig({
80
80
  displayName: "Swatch",
81
- componentId: "sc-c158py-0"
81
+ componentId: "sc-7kf8xr-0"
82
82
  })`box-sizing:border-box;flex:none;width:33px;height:33px;padding:0;border:1px solid var(--card-border-color);border-radius:4px;background:none;cursor:pointer;&::-webkit-color-swatch-wrapper{padding:0;}&::-webkit-color-swatch{border:none;border-radius:3px;}&::-moz-color-swatch{border:none;border-radius:3px;}`, Range = styled.input.withConfig({
83
83
  displayName: "Range",
84
- componentId: "sc-c158py-1"
84
+ componentId: "sc-7kf8xr-1"
85
85
  })`display:block;width:100%;margin:0;accent-color:var(--card-focus-ring-color);`;
86
86
  /**
87
87
  * The themer sidebar: presets, the accent/text/background pickers and the
@@ -670,13 +670,15 @@ function ThemerNavbarButton() {
670
670
  * @internal
671
671
  */
672
672
  function ThemerNavbar(props) {
673
- let $ = c(7), { open, setOpen } = useThemer(), t0;
674
- if ($[0] !== open || $[1] !== props || $[2] !== setOpen) {
675
- let t1;
676
- $[4] !== open || $[5] !== setOpen ? (t1 = () => setOpen(!open), $[4] = open, $[5] = setOpen, $[6] = t1) : t1 = $[6], t0 = props.renderDefault({
673
+ let $ = c(10), { open, setOpen } = useThemer(), t0;
674
+ $[0] === props.__internal_actions ? t0 = $[1] : (t0 = props.__internal_actions ?? [], $[0] = props.__internal_actions, $[1] = t0);
675
+ let t1;
676
+ if ($[2] !== open || $[3] !== props || $[4] !== setOpen || $[5] !== t0) {
677
+ let t2;
678
+ $[7] !== open || $[8] !== setOpen ? (t2 = () => setOpen(!open), $[7] = open, $[8] = setOpen, $[9] = t2) : t2 = $[9], t1 = props.renderDefault({
677
679
  ...props,
678
680
  __internal_actions: [
679
- ...props.__internal_actions ?? [],
681
+ ...t0,
680
682
  {
681
683
  location: "topbar",
682
684
  name: "themer-topbar",
@@ -686,14 +688,14 @@ function ThemerNavbar(props) {
686
688
  icon: ColorWheelIcon,
687
689
  location: "sidebar",
688
690
  name: "themer-sidebar",
689
- onAction: t1,
691
+ onAction: t2,
690
692
  selected: open,
691
693
  title: "Themer"
692
694
  }
693
695
  ]
694
- }), $[0] = open, $[1] = props, $[2] = setOpen, $[3] = t0;
695
- } else t0 = $[3];
696
- return t0;
696
+ }), $[2] = open, $[3] = props, $[4] = setOpen, $[5] = t0, $[6] = t1;
697
+ } else t1 = $[6];
698
+ return t1;
697
699
  }
698
700
  function _temp() {
699
701
  return /* @__PURE__ */ jsx(ThemerNavbarButton, {});
package/dist/tool.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","names":["createContext","useContext","BuildThemeOptions","ThemerContextValue","baseOptions","options","setOptions","open","setOpen","ThemerContext","useThemer","context","Error","BuildThemeOptions","DEFAULT_ACCENT","DEFAULT_BACKGROUND_DARK","DEFAULT_BACKGROUND_LIGHT","DEFAULT_CONTRAST","deriveTextColor","resolveThemeOptions","minimizeOptions","options","resolved","minimized","accent","text","dark","background","light","contrast","Object","keys","length","sameOptions","a","b","left","right","BuildThemeOptions","minimizeOptions","createThemeSnippet","options","minimized","entries","accent","text","undefined","push","background","parts","dark","light","join","contrast","COLOR_TINTS","ColorTintKey","ClipboardIcon","CloseIcon","ResetIcon","Box","Button","Card","Flex","Grid","Stack","Text","Code","useToast","useMemo","registerLanguage","typescript","styled","buildPalette","BuildThemeOptions","resolveThemeOptions","presets","ThemePreset","useThemer","sameOptions","createThemeSnippet","Swatch","input","Range","ThemerSidebar","$","_c","baseOptions","options","setOptions","setOpen","toast","active","t0","resolved","t1","palette","t2","find","preset","slug","activePresetSlug","t3","snippet","t4","changes","patch","t5","changes_0","background","patchBackground","t6","field","next","clearField","t7","key","next_0","dark","undefined","light","clearBackground","t8","navigator","clipboard","writeText","push","status","title","handleCopy","t9","Symbol","for","t10","t11","t12","map","preset_0","t13","t14","t15","accent","t16","blue","t17","text","t18","t19","t20","gray","t21","t22","t23","t24","black","t25","t26","t27","t28","white","t29","t30","t31","contrast","t32","t33","t34","t35","event","Number","currentTarget","value","t36","t37","t38","t39","t40","t41","t42","t43","t44","t45","t46","t47","t48","paletteStyle","React","CSSProperties","display","gap","height","borderRadius","overflow","boxShadow","PresetButton","props","onClick","swatches","const","_temp","flex","rampStyle","ColorRow","adjusted","auto","onChange","onClear","tints","tint","Box","Flex","Layer","ActiveToolLayoutProps","useThemer","ThemerSidebar","sidebarStyle","React","CSSProperties","width","flex","borderLeft","boxSizing","overflow","ThemerActiveToolLayout","props","$","_c","open","t0","renderDefault","t1","t2","t3","isColor","BuildThemeOptions","MAXIMUM_CONTRAST","MINIMUM_CONTRAST","STORAGE_KEY","sanitizeColor","value","toLowerCase","sanitizeOptions","accent","Reflect","get","options","text","background","dark","light","contrast","Number","isFinite","Math","min","max","readStoredOptions","localStorage","raw","getItem","JSON","parse","writeStoredOptions","removeItem","setItem","stringify","ThemeProvider","useEffect","useMemo","useState","LayoutProps","buildTheme","BuildThemeOptions","ThemerContext","ThemerContextValue","readStoredOptions","writeStoredOptions","ThemerLayout","props","$","_c","baseOptions","layoutProps","open","setOpen","options","setOptions","t0","t1","t2","theme","t3","context","t4","t5","renderDefault","t6","Provider","ColorWheelIcon","Button","Text","Tooltip","NavbarProps","useThemer","ThemerNavbarButton","$","_c","open","setOpen","t0","Symbol","for","t1","t2","ThemerNavbar","props","renderDefault","__internal_actions","location","name","render","_temp","icon","onAction","selected","title","definePlugin","LayoutProps","BuildThemeOptions","DEFAULT_ACCENT","ThemerActiveToolLayout","ThemerLayout","ThemerNavbar","ThemerToolOptions","config","themerTool","options","baseOptions","accent","ThemerLayoutWithOptions","props","$","_c","t0","name","studio","components","layout","navbar","activeToolLayout"],"sources":["../src/tool/context.ts","../src/tool/options.ts","../src/tool/snippet.ts","../src/tool/ThemerSidebar.tsx","../src/tool/ThemerActiveToolLayout.tsx","../src/tool/storage.ts","../src/tool/ThemerLayout.tsx","../src/tool/ThemerNavbar.tsx","../src/tool/plugin.tsx"],"sourcesContent":["import {createContext, useContext} from 'react'\n\nimport {BuildThemeOptions} from '../theme/options'\n\n/** @internal */\nexport interface ThemerContextValue {\n /** The theme options the Studio's configured theme was generated from */\n baseOptions: BuildThemeOptions\n /** The draft options, or `null` when the configured theme is untouched */\n options: BuildThemeOptions | null\n setOptions: (options: BuildThemeOptions | null) => void\n /** Whether the themer sidebar is open */\n open: boolean\n setOpen: (open: boolean) => void\n}\n\n/** @internal */\nexport const ThemerContext = createContext<ThemerContextValue | null>(null)\n\n/** @internal */\nexport function useThemer(): ThemerContextValue {\n const context = useContext(ThemerContext)\n\n if (!context) {\n throw new Error('useThemer must be used within the `themerTool` plugin')\n }\n\n return context\n}\n","import {\n BuildThemeOptions,\n DEFAULT_ACCENT,\n DEFAULT_BACKGROUND_DARK,\n DEFAULT_BACKGROUND_LIGHT,\n DEFAULT_CONTRAST,\n deriveTextColor,\n resolveThemeOptions,\n} from '../theme/options'\n\n/**\n * Reduces theme options to the minimal object that recreates them through\n * `buildTheme`: the text color is dropped when it matches the one derived\n * from the accent, and backgrounds and contrast are dropped when they match\n * the defaults. Options that boil down to the stock Studio theme reduce to\n * `null` — they need nothing from this package.\n *\n * @internal\n */\nexport function minimizeOptions(options: BuildThemeOptions): BuildThemeOptions | null {\n const resolved = resolveThemeOptions(options)\n const minimized: BuildThemeOptions = {accent: resolved.accent}\n\n if (resolved.text !== deriveTextColor(resolved.accent)) {\n minimized.text = resolved.text\n }\n\n const dark =\n resolved.background.dark === DEFAULT_BACKGROUND_DARK ? null : resolved.background.dark\n const light =\n resolved.background.light === DEFAULT_BACKGROUND_LIGHT ? null : resolved.background.light\n\n if (dark !== null || light !== null) {\n minimized.background = {}\n if (dark !== null) minimized.background.dark = dark\n if (light !== null) minimized.background.light = light\n }\n\n if (resolved.contrast !== DEFAULT_CONTRAST) {\n minimized.contrast = resolved.contrast\n }\n\n if (minimized.accent === DEFAULT_ACCENT && Object.keys(minimized).length === 1) {\n return null\n }\n\n return minimized\n}\n\n/**\n * Whether two sets of theme options generate the same theme, comparing their\n * resolved forms so that derived and explicit values (and hex casing) don't\n * matter.\n *\n * @internal\n */\nexport function sameOptions(a: BuildThemeOptions, b: BuildThemeOptions): boolean {\n const left = resolveThemeOptions(a)\n const right = resolveThemeOptions(b)\n\n return (\n left.accent === right.accent &&\n left.text === right.text &&\n left.background.dark === right.background.dark &&\n left.background.light === right.background.light &&\n left.contrast === right.contrast\n )\n}\n","import {BuildThemeOptions} from '../theme/options'\nimport {minimizeOptions} from './options'\n\n/**\n * Serializes theme options into the `buildTheme` call to paste into\n * `sanity.config.ts`, keeping only what differs from the derived defaults.\n *\n * Options that boil down to the stock Studio theme need nothing from this\n * package — so they serialize to a bare `buildTheme()` from `@sanity/ui/theme`\n * instead.\n *\n * @internal\n */\nexport function createThemeSnippet(options: BuildThemeOptions): string {\n const minimized = minimizeOptions(options)\n\n if (minimized === null) {\n return \"import {buildTheme} from '@sanity/ui/theme'\\n\\nexport const theme = buildTheme()\\n\"\n }\n\n const entries: string[] = [` accent: '${minimized.accent}',`]\n\n if (minimized.text !== undefined) {\n entries.push(` text: '${minimized.text}',`)\n }\n\n if (minimized.background) {\n const parts: string[] = []\n\n if (minimized.background.dark !== undefined) parts.push(`dark: '${minimized.background.dark}'`)\n if (minimized.background.light !== undefined) {\n parts.push(`light: '${minimized.background.light}'`)\n }\n\n entries.push(` background: {${parts.join(', ')}},`)\n }\n\n if (minimized.contrast !== undefined) {\n entries.push(` contrast: ${minimized.contrast},`)\n }\n\n return `import {buildTheme} from '@sanity/themer'\\n\\nexport const theme = buildTheme({\\n${entries.join('\\n')}\\n})\\n`\n}\n","import {COLOR_TINTS, ColorTintKey} from '@sanity/color'\nimport {ClipboardIcon} from '@sanity/icons/Clipboard'\nimport {CloseIcon} from '@sanity/icons/Close'\nimport {ResetIcon} from '@sanity/icons/Reset'\nimport {Box, Button, Card, Flex, Grid, Stack, Text} from '@sanity/ui'\nimport {Code} from '@sanity/ui/code'\nimport {useToast} from '@sanity/ui/toast'\nimport {useMemo} from 'react'\nimport {registerLanguage} from 'react-refractor'\nimport typescript from 'refractor/typescript'\nimport {styled} from 'styled-components'\n\nimport {buildPalette} from '../theme/buildPalette'\nimport {BuildThemeOptions, resolveThemeOptions} from '../theme/options'\nimport {presets, ThemePreset} from '../theme/presets'\nimport {useThemer} from './context'\nimport {sameOptions} from './options'\nimport {createThemeSnippet} from './snippet'\n\n// `Code` only highlights languages the surrounding app has registered with\n// react-refractor, and the Studio registers its own set from an async import\n// during startup — a race this sidebar keeps losing. Registering the one\n// language the snippet needs keeps it highlighted from the first render.\nregisterLanguage(typescript)\n\n/**\n * `<input type=\"color\">` paints the color into a shadow-DOM swatch that brings\n * its own border and padding, which then sits inside ours as a second border.\n * Stripping that chrome leaves the themed border as the only one.\n */\nconst Swatch = styled.input`\n box-sizing: border-box;\n flex: none;\n width: 33px;\n height: 33px;\n padding: 0;\n border: 1px solid var(--card-border-color);\n border-radius: 4px;\n background: none;\n cursor: pointer;\n\n &::-webkit-color-swatch-wrapper {\n padding: 0;\n }\n\n &::-webkit-color-swatch {\n border: none;\n border-radius: 3px;\n }\n\n &::-moz-color-swatch {\n border: none;\n border-radius: 3px;\n }\n`\n\n/** A native range input, themed through `accent-color` */\nconst Range = styled.input`\n display: block;\n width: 100%;\n margin: 0;\n accent-color: var(--card-focus-ring-color);\n`\n\n/**\n * The themer sidebar: presets, the accent/text/background pickers and the\n * contrast slider that generate the previewed `buildTheme` theme, plus the\n * `buildTheme` snippet to make it permanent.\n *\n * @internal\n */\nexport function ThemerSidebar() {\n const {baseOptions, options, setOptions, setOpen} = useThemer()\n const toast = useToast()\n\n const active = options ?? baseOptions\n const resolved = useMemo(() => resolveThemeOptions(active), [active])\n const palette = useMemo(() => buildPalette(active), [active])\n const activePresetSlug = presets.find((preset) => sameOptions(preset.options, active))?.slug ?? ''\n const snippet = createThemeSnippet(active)\n\n const patch = (changes: Partial<BuildThemeOptions>) => {\n setOptions({...active, ...changes})\n }\n\n const patchBackground = (changes: {dark?: string; light?: string}) => {\n setOptions({...active, background: {...active.background, ...changes}})\n }\n\n const clearField = (field: 'text' | 'contrast') => {\n const next = {...active}\n\n delete next[field]\n setOptions(next)\n }\n\n const clearBackground = (key: 'dark' | 'light') => {\n const background = {...active.background}\n\n delete background[key]\n\n const next = {...active}\n\n if (background.dark === undefined && background.light === undefined) {\n delete next.background\n } else {\n next.background = background\n }\n\n setOptions(next)\n }\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(snippet)\n toast.push({status: 'success', title: 'Copied theme to the clipboard'})\n } catch {\n toast.push({status: 'error', title: 'Could not copy the theme'})\n }\n }\n\n return (\n <Card height=\"fill\">\n <Flex direction=\"column\" height=\"fill\">\n <Card borderBottom padding={3}>\n <Flex align=\"center\" gap={2}>\n <Box flex={1} paddingLeft={1}>\n <Text size={1} weight=\"semibold\">\n Themer\n </Text>\n </Box>\n <Button\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={() => setOpen(false)}\n padding={2}\n title=\"Close themer\"\n />\n </Flex>\n </Card>\n\n <Box flex={1} overflow=\"auto\" padding={3}>\n <Stack gap={4}>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Presets\n </Text>\n <Grid gap={2} gridTemplateColumns={2}>\n {presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))}\n </Grid>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Colors\n </Text>\n <Stack gap={4}>\n <ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />\n <ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />\n <ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />\n <ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />\n </Stack>\n </Stack>\n\n <Stack gap={3}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>\n <Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />\n <Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Add to your config\n </Text>\n <Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>\n <Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>\n </Stack>\n </Stack>\n </Box>\n </Flex>\n </Card>\n )\n}\n\nconst paletteStyle: React.CSSProperties = {\n display: 'flex',\n // The gaps let the border color through, so a near-white light background\n // still reads as a swatch rather than a hole in the palette\n gap: 1,\n background: 'var(--card-border-color)',\n height: 21,\n borderRadius: 3,\n overflow: 'hidden',\n boxShadow: 'inset 0 0 0 1px var(--card-border-color)',\n}\n\n/** A little palette of the colors a preset would apply */\nfunction PresetButton(props: {active: boolean; onClick: () => void; preset: ThemePreset}) {\n const {active, onClick, preset} = props\n\n const swatches = useMemo(() => {\n const resolved = resolveThemeOptions(preset.options)\n\n return [\n ['accent', resolved.accent],\n ['text', resolved.text],\n ['dark', resolved.background.dark],\n ['light', resolved.background.light],\n ] as const\n }, [preset])\n\n return (\n <Button mode=\"ghost\" onClick={onClick} padding={2} selected={active} title={preset.title}>\n <Stack as=\"span\" gap={2}>\n <span style={paletteStyle}>\n {swatches.map(([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n ))}\n </span>\n <Text align=\"left\" size={1} textOverflow=\"ellipsis\">\n {preset.title}\n </Text>\n </Stack>\n </Button>\n )\n}\n\nconst rampStyle: React.CSSProperties = {\n ...paletteStyle,\n height: 13,\n borderRadius: 2,\n}\n\n/**\n * One color of the theme: a swatch with its value, an optional reset-to-auto\n * button, and the generated 50–950 tint ramp for the scales it anchors.\n */\nfunction ColorRow(props: {\n /** The color the generator actually applied, when it may differ from the input */\n adjusted?: string\n /** Whether the value is derived rather than explicitly set */\n auto?: boolean\n onChange: (value: string) => void\n onClear?: () => void\n /** The generated tint ramp this color anchors */\n tints?: Record<ColorTintKey, string>\n title: string\n value: string\n}) {\n const {adjusted, auto, onChange, onClear, tints, title, value} = props\n\n return (\n <Stack gap={2}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1}>{title}</Text>\n <Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>\n </Stack>\n {onClear && !auto && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={onClear}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n <Swatch\n aria-label={`${title} color`}\n onChange={(event) => onChange(event.currentTarget.value)}\n type=\"color\"\n value={value}\n />\n </Flex>\n {tints && (\n <span style={rampStyle}>\n {COLOR_TINTS.map((tint) => (\n <span key={tint} style={{flex: 1, background: tints[tint]}} />\n ))}\n </span>\n )}\n </Stack>\n )\n}\n","import {Box, Flex, Layer} from '@sanity/ui'\nimport {type ActiveToolLayoutProps} from 'sanity'\n\nimport {useThemer} from './context'\nimport {ThemerSidebar} from './ThemerSidebar'\n\n/**\n * Narrow enough to leave the studio preview as much room as possible: it fits\n * the widest picker label next to its swatch, and the code snippet scrolls\n * horizontally rather than widening the sidebar.\n */\nconst sidebarStyle: React.CSSProperties = {\n width: 240,\n flex: 'none',\n borderLeft: '1px solid var(--card-border-color)',\n boxSizing: 'border-box',\n overflow: 'hidden',\n}\n\n/**\n * Renders the themer sidebar next to the active tool, so the user can browse\n * around their own studio while tweaking the theme.\n *\n * @internal\n */\nexport function ThemerActiveToolLayout(props: ActiveToolLayoutProps) {\n const {open} = useThemer()\n\n return (\n <Flex height=\"fill\" sizing=\"border\">\n <Box flex={1} height=\"fill\" overflow=\"auto\">\n {props.renderDefault(props)}\n </Box>\n\n {open && (\n <Layer height=\"fill\" style={sidebarStyle} zOffset={100}>\n <ThemerSidebar />\n </Layer>\n )}\n </Flex>\n )\n}\n","import {isColor} from '../lib/mix'\nimport {BuildThemeOptions, MAXIMUM_CONTRAST, MINIMUM_CONTRAST} from '../theme/options'\n\nconst STORAGE_KEY = 'sanityStudio:themer:options'\n\nfunction sanitizeColor(value: unknown): string | null {\n return typeof value === 'string' && isColor(value) ? value.toLowerCase() : null\n}\n\nfunction sanitizeOptions(value: unknown): BuildThemeOptions | null {\n if (!value || typeof value !== 'object') return null\n\n const accent = sanitizeColor(Reflect.get(value, 'accent'))\n\n if (!accent) return null\n\n const options: BuildThemeOptions = {accent}\n const text = sanitizeColor(Reflect.get(value, 'text'))\n\n if (text) options.text = text\n\n const background: unknown = Reflect.get(value, 'background')\n\n if (background && typeof background === 'object') {\n const dark = sanitizeColor(Reflect.get(background, 'dark'))\n const light = sanitizeColor(Reflect.get(background, 'light'))\n\n if (dark || light) {\n options.background = {}\n if (dark) options.background.dark = dark\n if (light) options.background.light = light\n }\n }\n\n const contrast: unknown = Reflect.get(value, 'contrast')\n\n if (typeof contrast === 'number' && Number.isFinite(contrast)) {\n options.contrast = Math.min(MAXIMUM_CONTRAST, Math.max(MINIMUM_CONTRAST, contrast))\n }\n\n return options\n}\n\n/**\n * Restores draft theme options from localStorage, so theme drafts survive\n * studio reloads.\n *\n * @internal\n */\nexport function readStoredOptions(): BuildThemeOptions | null {\n try {\n if (typeof localStorage === 'undefined') return null\n\n const raw = localStorage.getItem(STORAGE_KEY)\n\n if (!raw) return null\n\n return sanitizeOptions(JSON.parse(raw))\n } catch {\n return null\n }\n}\n\n/** @internal */\nexport function writeStoredOptions(options: BuildThemeOptions | null): void {\n try {\n if (typeof localStorage === 'undefined') return\n\n if (options === null) {\n localStorage.removeItem(STORAGE_KEY)\n } else {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(options))\n }\n } catch {\n // Storage can be unavailable (e.g. private browsing) — drafts just won't persist\n }\n}\n","import {ThemeProvider} from '@sanity/ui'\nimport {useEffect, useMemo, useState} from 'react'\nimport {type LayoutProps} from 'sanity'\n\nimport {buildTheme} from '../theme/buildTheme'\nimport {BuildThemeOptions} from '../theme/options'\nimport {ThemerContext, ThemerContextValue} from './context'\nimport {readStoredOptions, writeStoredOptions} from './storage'\n\n/**\n * Wraps the whole Studio so that draft themes generated by the themer sidebar\n * apply everywhere while the user browses around, and hosts the state that the\n * navbar toggle and the sidebar share.\n *\n * The draft theme provider inherits the color scheme from the Studio, so the\n * preview follows the appearance setting (light/dark/system) like any other\n * theme.\n *\n * @internal\n */\nexport function ThemerLayout(props: LayoutProps & {baseOptions: BuildThemeOptions}) {\n const {baseOptions, ...layoutProps} = props\n const [open, setOpen] = useState(false)\n const [options, setOptions] = useState<BuildThemeOptions | null>(readStoredOptions)\n\n useEffect(() => writeStoredOptions(options), [options])\n\n // The theme identity must be stable between renders: it feeds the\n // styled-components theme context for the whole Studio, and rebuilding it\n // would re-render everything\n const theme = useMemo(() => (options === null ? null : buildTheme(options)), [options])\n\n const context = useMemo<ThemerContextValue>(\n () => ({baseOptions, options, setOptions, open, setOpen}),\n [baseOptions, options, open],\n )\n\n return (\n <ThemerContext.Provider value={context}>\n {theme === null ? (\n layoutProps.renderDefault(layoutProps)\n ) : (\n <ThemeProvider theme={theme}>{layoutProps.renderDefault(layoutProps)}</ThemeProvider>\n )}\n </ThemerContext.Provider>\n )\n}\n","import {ColorWheelIcon} from '@sanity/icons/ColorWheel'\nimport {Button, Text} from '@sanity/ui'\nimport {Tooltip} from '@sanity/ui/tooltip'\nimport {type NavbarProps} from 'sanity'\n\nimport {useThemer} from './context'\n\nfunction ThemerNavbarButton() {\n const {open, setOpen} = useThemer()\n\n return (\n <Tooltip content={<Text size={1}>Themer</Text>} portal>\n <Button\n aria-label=\"Themer\"\n icon={ColorWheelIcon}\n mode=\"bleed\"\n onClick={() => setOpen(!open)}\n // The Studio's own navbar buttons go through a wrapper that pins them\n // to this padding, where `@sanity/ui` defaults to a roomier 3\n padding={2}\n selected={open}\n />\n </Tooltip>\n )\n}\n\n/**\n * Adds the toggle that opens and closes the themer sidebar to the Studio\n * navbar — an icon button with a tooltip in the top bar (like the Tasks\n * toggle), and a regular titled action in the narrow-screen sidebar menu.\n *\n * @internal\n */\nexport function ThemerNavbar(props: NavbarProps) {\n const {open, setOpen} = useThemer()\n\n return props.renderDefault({\n ...props,\n __internal_actions: [\n ...(props.__internal_actions ?? []),\n {\n location: 'topbar',\n name: 'themer-topbar',\n render: () => <ThemerNavbarButton />,\n },\n {\n icon: ColorWheelIcon,\n location: 'sidebar',\n name: 'themer-sidebar',\n onAction: () => setOpen(!open),\n selected: open,\n title: 'Themer',\n },\n ],\n })\n}\n","import {definePlugin, type LayoutProps} from 'sanity'\n\nimport {BuildThemeOptions, DEFAULT_ACCENT} from '../theme/options'\nimport {ThemerActiveToolLayout} from './ThemerActiveToolLayout'\nimport {ThemerLayout} from './ThemerLayout'\nimport {ThemerNavbar} from './ThemerNavbar'\n\n/**\n * Options for the {@link themerTool} plugin.\n *\n * This is experimental and may change or be removed in any release without\n * notice — use at your own risk.\n *\n * @alpha\n */\nexport interface ThemerToolOptions {\n /**\n * The `buildTheme` options that the Studio's configured theme was generated\n * from — the themer starts editing from these, so pass the same object that\n * the `theme` in the Studio config uses:\n *\n * ```ts\n * const config: BuildThemeOptions = {accent: '#1cb485'}\n *\n * export default defineConfig({\n * theme: buildTheme(config),\n * plugins: [themerTool({config})],\n * })\n * ```\n */\n config?: BuildThemeOptions\n}\n\n/**\n * A Studio plugin that adds a themer sidebar for `buildTheme` themes: a\n * navbar toggle opens the sidebar next to the active tool, where presets, the\n * accent/text/background pickers and the contrast slider preview a\n * `buildTheme` theme live on the whole Studio while you browse around.\n * Toggle between light and dark mode with the regular appearance menu — the\n * preview follows it.\n *\n * ```ts\n * import {themerTool} from '@sanity/themer/tool'\n * import {defineConfig} from 'sanity'\n *\n * export default defineConfig({\n * plugins: [themerTool()],\n * // ...rest of the config\n * })\n * ```\n *\n * This is experimental and may change or be removed in any release without\n * notice — use at your own risk.\n *\n * @alpha\n */\nexport const themerTool = definePlugin<ThemerToolOptions | void>((options) => {\n const baseOptions = options?.config ?? {accent: DEFAULT_ACCENT}\n\n function ThemerLayoutWithOptions(props: LayoutProps) {\n return <ThemerLayout {...props} baseOptions={baseOptions} />\n }\n\n return {\n name: '@sanity/themer/tool',\n studio: {\n components: {\n layout: ThemerLayoutWithOptions,\n navbar: ThemerNavbar,\n activeToolLayout: ThemerActiveToolLayout,\n },\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAaS,gBAAgBT,cAAyC,IAAI;;AAG1E,SAAOU,YAAA;CACL,IAAAC,UAAgBV,WAAWQ,aAAa;CAExC,IAAI,CAACE,SACH,MAAUC,MAAM,uDAAuD;CAC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ACD,IAAI,GAACF,EAAA,KAAAE,MAAAF,EAAA,KAAAG,SAAAH,EAAA,KAAAO,MAAAA,KAAAP,EAAA,IAb7BI,KAAAM,MAAKC,cAAe;GAAA,GACtBD;GAAKE,oBACY;IAAA,GACdF,MAAKE,sBAAL,CAAA;IACJ;KAAAC,UACY;KAAQC,MACZ;KAAeC,QACbC;IACV;IACA;KAAAC,MACQxB;KAAcoB,UACV;KAASC,MACb;KAAgBI,UACZX;KAAoBY,UACpBjB;KAAIkB,OACP;IACT;GAAC;EAEL,CAAC,GAACpB,EAAA,KAAAE,MAAAF,EAAA,KAAAU,OAAAV,EAAA,KAAAG,SAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAlBKI;AAkBL;AArBG,SAAAY,QAAA;CAAA,OAUe,oBAAC,oBAAD,CAAmB,CAAA;AAAG;;;;;;;;;;;;;;;;;;;;;;;;ACa5C,MAAac,aAAaT,cAAwCU,YAAY;CAC5E,IAAMC,cAAcD,SAASF,UAAU,EAACI,QAAQT,eAAc;CAE9D,SAAAU,wBAAAC,OAAA;EAAA,IAAAC,IAAAC,EAAA,CAAA,GAAAC;EAC8D,OAD9DF,EAAA,OAAAD,QAC8DG,KAAAF,EAAA,MAArDE,KAAA,oBAAC,cAAD;GAAa,GAAKH;GAAoBH;EAAW,CAAA,GAAII,EAAA,KAAAD,OAAAC,EAAA,KAAAE,KAArDA;CAAqD;CAG9D,OAAO;EACLC,MAAM;EACNC,QAAQ,EACNC,YAAY;GACVC,QAAQR;GACRS,QAAQhB;GACRiB,kBAAkBnB;EACpB,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"tool.js","names":["resolveThemeOptions(active)","useMemo(() => resolveThemeOptions(active), [active])","buildPalette(active)","useMemo(() => buildPalette(active), [active])","presets.find((preset) => sameOptions(preset.options, active))?.slug ?? ''","createThemeSnippet(active)","(changes: Partial<BuildThemeOptions>) => {\n setOptions({...active, ...changes})\n }","(changes: {dark?: string; light?: string}) => {\n setOptions({...active, background: {...active.background, ...changes}})\n }","active.background","changes","(field: 'text' | 'contrast') => {\n const next = {...active}\n\n delete next[field]\n setOptions(next)\n }","(key: 'dark' | 'light') => {\n const background = {...active.background}\n\n delete background[key]\n\n const next = {...active}\n\n if (background.dark === undefined && background.light === undefined) {\n delete next.background\n } else {\n next.background = background\n }\n\n setOptions(next)\n }","next","async () => {\n try {\n await navigator.clipboard.writeText(snippet)\n toast.push({status: 'success', title: 'Copied theme to the clipboard'})\n } catch {\n toast.push({status: 'error', title: 'Could not copy the theme'})\n }\n }","<Box flex={1} paddingLeft={1}>\n <Text size={1} weight=\"semibold\">\n Themer\n </Text>\n </Box>","<Card borderBottom padding={3}>\n <Flex align=\"center\" gap={2}>\n <Box flex={1} paddingLeft={1}>\n <Text size={1} weight=\"semibold\">\n Themer\n </Text>\n </Box>\n <Button\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={() => setOpen(false)}\n padding={2}\n title=\"Close themer\"\n />\n </Flex>\n </Card>","<Text size={1} weight=\"medium\">\n Presets\n </Text>","presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))","preset","<Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Presets\n </Text>\n <Grid gap={2} gridTemplateColumns={2}>\n {presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))}\n </Grid>\n </Stack>","<Text size={1} weight=\"medium\">\n Colors\n </Text>","(accent) => patch({accent})","<ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />","blue","accent","(text) => patch({text})","() => clearField('text')","<ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />","gray","text","active.text === undefined","(dark) => patchBackground({dark})","() => clearBackground('dark')","<ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />","black","dark","active.background?.dark === undefined","(light) => patchBackground({light})","() => clearBackground('light')","<ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />","white","light","active.background?.light === undefined","<Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Colors\n </Text>\n <Stack gap={4}>\n <ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />\n <ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />\n <ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />\n <ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />\n </Stack>\n </Stack>","<Text size={1} weight=\"medium\">\n Contrast\n </Text>","<Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>","contrast","active.contrast === undefined ? ' · auto' : ''","active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )","<Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>","(event) => patch({contrast: Number(event.currentTarget.value)})","<Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />","<Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>","<Stack gap={3}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>\n <Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />\n <Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>\n </Stack>","<Text size={1} weight=\"medium\">\n Add to your config\n </Text>","<Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>","<Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />","() => setOptions(null)","<Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />","options === null","<Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>","<Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Add to your config\n </Text>\n <Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>\n <Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>\n </Stack>","<Box flex={1} overflow=\"auto\" padding={3}>\n <Stack gap={4}>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Presets\n </Text>\n <Grid gap={2} gridTemplateColumns={2}>\n {presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))}\n </Grid>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Colors\n </Text>\n <Stack gap={4}>\n <ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />\n <ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />\n <ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />\n <ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />\n </Stack>\n </Stack>\n\n <Stack gap={3}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>\n <Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />\n <Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Add to your config\n </Text>\n <Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>\n <Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>\n </Stack>\n </Stack>\n </Box>","<Card height=\"fill\">\n <Flex direction=\"column\" height=\"fill\">\n <Card borderBottom padding={3}>\n <Flex align=\"center\" gap={2}>\n <Box flex={1} paddingLeft={1}>\n <Text size={1} weight=\"semibold\">\n Themer\n </Text>\n </Box>\n <Button\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={() => setOpen(false)}\n padding={2}\n title=\"Close themer\"\n />\n </Flex>\n </Card>\n\n <Box flex={1} overflow=\"auto\" padding={3}>\n <Stack gap={4}>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Presets\n </Text>\n <Grid gap={2} gridTemplateColumns={2}>\n {presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))}\n </Grid>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Colors\n </Text>\n <Stack gap={4}>\n <ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />\n <ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />\n <ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />\n <ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />\n </Stack>\n </Stack>\n\n <Stack gap={3}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>\n <Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />\n <Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Add to your config\n </Text>\n <Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>\n <Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>\n </Stack>\n </Stack>\n </Box>\n </Flex>\n </Card>","resolveThemeOptions(preset.options)","options","['accent', resolved.accent]","['text', resolved.text]","['dark', resolved.background.dark]","['light', resolved.background.light]","[\n ['accent', resolved.accent],\n ['text', resolved.text],\n ['dark', resolved.background.dark],\n ['light', resolved.background.light],\n ]","<span style={paletteStyle}>\n {swatches.map(([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n ))}\n </span>","([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n )","<Text align=\"left\" size={1} textOverflow=\"ellipsis\">\n {preset.title}\n </Text>","title","<Stack as=\"span\" gap={2}>\n <span style={paletteStyle}>\n {swatches.map(([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n ))}\n </span>\n <Text align=\"left\" size={1} textOverflow=\"ellipsis\">\n {preset.title}\n </Text>\n </Stack>","<Button mode=\"ghost\" onClick={onClick} padding={2} selected={active} title={preset.title}>\n <Stack as=\"span\" gap={2}>\n <span style={paletteStyle}>\n {swatches.map(([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n ))}\n </span>\n <Text align=\"left\" size={1} textOverflow=\"ellipsis\">\n {preset.title}\n </Text>\n </Stack>\n </Button>","[key, background]","<Text size={1}>{title}</Text>","<Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>","adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''","auto ? ' · auto' : ''","<Stack flex={1} gap={2}>\n <Text size={1}>{title}</Text>\n <Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>\n </Stack>","onClear && !auto && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={onClear}\n padding={2}\n title=\"Reset to auto\"\n />\n )","(event) => onChange(event.currentTarget.value)","<Swatch\n aria-label={`${title} color`}\n onChange={(event) => onChange(event.currentTarget.value)}\n type=\"color\"\n value={value}\n />","`${title} color`","<Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1}>{title}</Text>\n <Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>\n </Stack>\n {onClear && !auto && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={onClear}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n <Swatch\n aria-label={`${title} color`}\n onChange={(event) => onChange(event.currentTarget.value)}\n type=\"color\"\n value={value}\n />\n </Flex>","tints && (\n <span style={rampStyle}>\n {COLOR_TINTS.map((tint) => (\n <span key={tint} style={{flex: 1, background: tints[tint]}} />\n ))}\n </span>\n )","<Stack gap={2}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1}>{title}</Text>\n <Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>\n </Stack>\n {onClear && !auto && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={onClear}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n <Swatch\n aria-label={`${title} color`}\n onChange={(event) => onChange(event.currentTarget.value)}\n type=\"color\"\n value={value}\n />\n </Flex>\n {tints && (\n <span style={rampStyle}>\n {COLOR_TINTS.map((tint) => (\n <span key={tint} style={{flex: 1, background: tints[tint]}} />\n ))}\n </span>\n )}\n </Stack>","props.renderDefault(props)","props.renderDefault","<Box flex={1} height=\"fill\" overflow=\"auto\">\n {props.renderDefault(props)}\n </Box>","open && (\n <Layer height=\"fill\" style={sidebarStyle} zOffset={100}>\n <ThemerSidebar />\n </Layer>\n )","<Flex height=\"fill\" sizing=\"border\">\n <Box flex={1} height=\"fill\" overflow=\"auto\">\n {props.renderDefault(props)}\n </Box>\n\n {open && (\n <Layer height=\"fill\" style={sidebarStyle} zOffset={100}>\n <ThemerSidebar />\n </Layer>\n )}\n </Flex>","() => writeStoredOptions(options)","[options]","options === null ? null : buildTheme(options)","useMemo(() => (options === null ? null : buildTheme(options)), [options])","{baseOptions, options, setOptions, open, setOpen}","useMemo<ThemerContextValue>(\n () => ({baseOptions, options, setOptions, open, setOpen}),\n [baseOptions, options, open],\n )","<ThemerContext.Provider value={context}>\n {theme === null ? (\n layoutProps.renderDefault(layoutProps)\n ) : (\n <ThemeProvider theme={theme}>{layoutProps.renderDefault(layoutProps)}</ThemeProvider>\n )}\n </ThemerContext.Provider>","Provider","theme === null ? (\n layoutProps.renderDefault(layoutProps)\n ) : (\n <ThemeProvider theme={theme}>{layoutProps.renderDefault(layoutProps)}</ThemeProvider>\n )","ThemerContext.Provider","<Text size={1}>Themer</Text>","() => setOpen(!open)","<Tooltip content={<Text size={1}>Themer</Text>} portal>\n <Button\n aria-label=\"Themer\"\n icon={ColorWheelIcon}\n mode=\"bleed\"\n onClick={() => setOpen(!open)}\n // The Studio's own navbar buttons go through a wrapper that pins them\n // to this padding, where `@sanity/ui` defaults to a roomier 3\n padding={2}\n selected={open}\n />\n </Tooltip>","props.__internal_actions ?? []","__internal_actions","props.renderDefault({\n ...props,\n __internal_actions: [\n ...(props.__internal_actions ?? []),\n {\n location: 'topbar',\n name: 'themer-topbar',\n render: () => <ThemerNavbarButton />,\n },\n {\n icon: ColorWheelIcon,\n location: 'sidebar',\n name: 'themer-sidebar',\n onAction: () => setOpen(!open),\n selected: open,\n title: 'Themer',\n },\n ],\n })","() => <ThemerNavbarButton />","<ThemerLayout {...props} baseOptions={baseOptions} />"],"sources":["../src/tool/context.ts","../src/tool/options.ts","../src/tool/snippet.ts","../src/tool/ThemerSidebar.tsx","../src/tool/ThemerActiveToolLayout.tsx","../src/tool/storage.ts","../src/tool/ThemerLayout.tsx","../src/tool/ThemerNavbar.tsx","../src/tool/plugin.tsx"],"sourcesContent":["import {createContext, useContext} from 'react'\n\nimport {BuildThemeOptions} from '../theme/options'\n\n/** @internal */\nexport interface ThemerContextValue {\n /** The theme options the Studio's configured theme was generated from */\n baseOptions: BuildThemeOptions\n /** The draft options, or `null` when the configured theme is untouched */\n options: BuildThemeOptions | null\n setOptions: (options: BuildThemeOptions | null) => void\n /** Whether the themer sidebar is open */\n open: boolean\n setOpen: (open: boolean) => void\n}\n\n/** @internal */\nexport const ThemerContext = createContext<ThemerContextValue | null>(null)\n\n/** @internal */\nexport function useThemer(): ThemerContextValue {\n const context = useContext(ThemerContext)\n\n if (!context) {\n throw new Error('useThemer must be used within the `themerTool` plugin')\n }\n\n return context\n}\n","import {\n BuildThemeOptions,\n DEFAULT_ACCENT,\n DEFAULT_BACKGROUND_DARK,\n DEFAULT_BACKGROUND_LIGHT,\n DEFAULT_CONTRAST,\n deriveTextColor,\n resolveThemeOptions,\n} from '../theme/options'\n\n/**\n * Reduces theme options to the minimal object that recreates them through\n * `buildTheme`: the text color is dropped when it matches the one derived\n * from the accent, and backgrounds and contrast are dropped when they match\n * the defaults. Options that boil down to the stock Studio theme reduce to\n * `null` — they need nothing from this package.\n *\n * @internal\n */\nexport function minimizeOptions(options: BuildThemeOptions): BuildThemeOptions | null {\n const resolved = resolveThemeOptions(options)\n const minimized: BuildThemeOptions = {accent: resolved.accent}\n\n if (resolved.text !== deriveTextColor(resolved.accent)) {\n minimized.text = resolved.text\n }\n\n const dark =\n resolved.background.dark === DEFAULT_BACKGROUND_DARK ? null : resolved.background.dark\n const light =\n resolved.background.light === DEFAULT_BACKGROUND_LIGHT ? null : resolved.background.light\n\n if (dark !== null || light !== null) {\n minimized.background = {}\n if (dark !== null) minimized.background.dark = dark\n if (light !== null) minimized.background.light = light\n }\n\n if (resolved.contrast !== DEFAULT_CONTRAST) {\n minimized.contrast = resolved.contrast\n }\n\n if (minimized.accent === DEFAULT_ACCENT && Object.keys(minimized).length === 1) {\n return null\n }\n\n return minimized\n}\n\n/**\n * Whether two sets of theme options generate the same theme, comparing their\n * resolved forms so that derived and explicit values (and hex casing) don't\n * matter.\n *\n * @internal\n */\nexport function sameOptions(a: BuildThemeOptions, b: BuildThemeOptions): boolean {\n const left = resolveThemeOptions(a)\n const right = resolveThemeOptions(b)\n\n return (\n left.accent === right.accent &&\n left.text === right.text &&\n left.background.dark === right.background.dark &&\n left.background.light === right.background.light &&\n left.contrast === right.contrast\n )\n}\n","import {BuildThemeOptions} from '../theme/options'\nimport {minimizeOptions} from './options'\n\n/**\n * Serializes theme options into the `buildTheme` call to paste into\n * `sanity.config.ts`, keeping only what differs from the derived defaults.\n *\n * Options that boil down to the stock Studio theme need nothing from this\n * package — so they serialize to a bare `buildTheme()` from `@sanity/ui/theme`\n * instead.\n *\n * @internal\n */\nexport function createThemeSnippet(options: BuildThemeOptions): string {\n const minimized = minimizeOptions(options)\n\n if (minimized === null) {\n return \"import {buildTheme} from '@sanity/ui/theme'\\n\\nexport const theme = buildTheme()\\n\"\n }\n\n const entries: string[] = [` accent: '${minimized.accent}',`]\n\n if (minimized.text !== undefined) {\n entries.push(` text: '${minimized.text}',`)\n }\n\n if (minimized.background) {\n const parts: string[] = []\n\n if (minimized.background.dark !== undefined) parts.push(`dark: '${minimized.background.dark}'`)\n if (minimized.background.light !== undefined) {\n parts.push(`light: '${minimized.background.light}'`)\n }\n\n entries.push(` background: {${parts.join(', ')}},`)\n }\n\n if (minimized.contrast !== undefined) {\n entries.push(` contrast: ${minimized.contrast},`)\n }\n\n return `import {buildTheme} from '@sanity/themer'\\n\\nexport const theme = buildTheme({\\n${entries.join('\\n')}\\n})\\n`\n}\n","import {COLOR_TINTS, ColorTintKey} from '@sanity/color'\nimport {ClipboardIcon} from '@sanity/icons/Clipboard'\nimport {CloseIcon} from '@sanity/icons/Close'\nimport {ResetIcon} from '@sanity/icons/Reset'\nimport {Box, Button, Card, Flex, Grid, Stack, Text} from '@sanity/ui'\nimport {Code} from '@sanity/ui/code'\nimport {useToast} from '@sanity/ui/toast'\nimport {useMemo} from 'react'\nimport {registerLanguage} from 'react-refractor'\nimport typescript from 'refractor/typescript'\nimport {styled} from 'styled-components'\n\nimport {buildPalette} from '../theme/buildPalette'\nimport {BuildThemeOptions, resolveThemeOptions} from '../theme/options'\nimport {presets, ThemePreset} from '../theme/presets'\nimport {useThemer} from './context'\nimport {sameOptions} from './options'\nimport {createThemeSnippet} from './snippet'\n\n// `Code` only highlights languages the surrounding app has registered with\n// react-refractor, and the Studio registers its own set from an async import\n// during startup — a race this sidebar keeps losing. Registering the one\n// language the snippet needs keeps it highlighted from the first render.\nregisterLanguage(typescript)\n\n/**\n * `<input type=\"color\">` paints the color into a shadow-DOM swatch that brings\n * its own border and padding, which then sits inside ours as a second border.\n * Stripping that chrome leaves the themed border as the only one.\n */\nconst Swatch = styled.input`\n box-sizing: border-box;\n flex: none;\n width: 33px;\n height: 33px;\n padding: 0;\n border: 1px solid var(--card-border-color);\n border-radius: 4px;\n background: none;\n cursor: pointer;\n\n &::-webkit-color-swatch-wrapper {\n padding: 0;\n }\n\n &::-webkit-color-swatch {\n border: none;\n border-radius: 3px;\n }\n\n &::-moz-color-swatch {\n border: none;\n border-radius: 3px;\n }\n`\n\n/** A native range input, themed through `accent-color` */\nconst Range = styled.input`\n display: block;\n width: 100%;\n margin: 0;\n accent-color: var(--card-focus-ring-color);\n`\n\n/**\n * The themer sidebar: presets, the accent/text/background pickers and the\n * contrast slider that generate the previewed `buildTheme` theme, plus the\n * `buildTheme` snippet to make it permanent.\n *\n * @internal\n */\nexport function ThemerSidebar() {\n const {baseOptions, options, setOptions, setOpen} = useThemer()\n const toast = useToast()\n\n const active = options ?? baseOptions\n const resolved = useMemo(() => resolveThemeOptions(active), [active])\n const palette = useMemo(() => buildPalette(active), [active])\n const activePresetSlug = presets.find((preset) => sameOptions(preset.options, active))?.slug ?? ''\n const snippet = createThemeSnippet(active)\n\n const patch = (changes: Partial<BuildThemeOptions>) => {\n setOptions({...active, ...changes})\n }\n\n const patchBackground = (changes: {dark?: string; light?: string}) => {\n setOptions({...active, background: {...active.background, ...changes}})\n }\n\n const clearField = (field: 'text' | 'contrast') => {\n const next = {...active}\n\n delete next[field]\n setOptions(next)\n }\n\n const clearBackground = (key: 'dark' | 'light') => {\n const background = {...active.background}\n\n delete background[key]\n\n const next = {...active}\n\n if (background.dark === undefined && background.light === undefined) {\n delete next.background\n } else {\n next.background = background\n }\n\n setOptions(next)\n }\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(snippet)\n toast.push({status: 'success', title: 'Copied theme to the clipboard'})\n } catch {\n toast.push({status: 'error', title: 'Could not copy the theme'})\n }\n }\n\n return (\n <Card height=\"fill\">\n <Flex direction=\"column\" height=\"fill\">\n <Card borderBottom padding={3}>\n <Flex align=\"center\" gap={2}>\n <Box flex={1} paddingLeft={1}>\n <Text size={1} weight=\"semibold\">\n Themer\n </Text>\n </Box>\n <Button\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={() => setOpen(false)}\n padding={2}\n title=\"Close themer\"\n />\n </Flex>\n </Card>\n\n <Box flex={1} overflow=\"auto\" padding={3}>\n <Stack gap={4}>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Presets\n </Text>\n <Grid gap={2} gridTemplateColumns={2}>\n {presets.map((preset) => (\n <PresetButton\n active={preset.slug === activePresetSlug}\n key={preset.slug}\n onClick={() => setOptions(preset.options)}\n preset={preset}\n />\n ))}\n </Grid>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Colors\n </Text>\n <Stack gap={4}>\n <ColorRow\n onChange={(accent) => patch({accent})}\n tints={palette.blue}\n title=\"Accent\"\n value={resolved.accent}\n />\n <ColorRow\n auto={active.text === undefined}\n onChange={(text) => patch({text})}\n onClear={() => clearField('text')}\n tints={palette.gray}\n title=\"Text\"\n value={resolved.text}\n />\n <ColorRow\n adjusted={palette.black}\n auto={active.background?.dark === undefined}\n onChange={(dark) => patchBackground({dark})}\n onClear={() => clearBackground('dark')}\n title=\"Background · dark\"\n value={resolved.background.dark}\n />\n <ColorRow\n adjusted={palette.white}\n auto={active.background?.light === undefined}\n onChange={(light) => patchBackground({light})}\n onClear={() => clearBackground('light')}\n title=\"Background · light\"\n value={resolved.background.light}\n />\n </Stack>\n </Stack>\n\n <Stack gap={3}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1} weight=\"medium\">\n Contrast\n </Text>\n <Text muted size={0}>\n {resolved.contrast}\n {active.contrast === undefined ? ' · auto' : ''}\n </Text>\n </Stack>\n {active.contrast !== undefined && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={() => clearField('contrast')}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n </Flex>\n <Range\n aria-label=\"Contrast\"\n max={100}\n min={15}\n onChange={(event) => patch({contrast: Number(event.currentTarget.value)})}\n step={1}\n type=\"range\"\n value={resolved.contrast}\n />\n <Text muted size={0}>\n 100 keeps text and borders neutral — lower values blend in the accent\n </Text>\n </Stack>\n\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n Add to your config\n </Text>\n <Card border overflow=\"auto\" padding={2} radius={2} tone=\"transparent\">\n <Code language=\"ts\" size={0}>\n {snippet}\n </Code>\n </Card>\n <Flex gap={2}>\n <Button\n icon={ClipboardIcon}\n mode=\"ghost\"\n onClick={() => void handleCopy()}\n text=\"Copy\"\n />\n <Button\n disabled={options === null}\n icon={ResetIcon}\n mode=\"ghost\"\n onClick={() => setOptions(null)}\n text=\"Reset\"\n tone=\"critical\"\n />\n </Flex>\n </Stack>\n </Stack>\n </Box>\n </Flex>\n </Card>\n )\n}\n\nconst paletteStyle: React.CSSProperties = {\n display: 'flex',\n // The gaps let the border color through, so a near-white light background\n // still reads as a swatch rather than a hole in the palette\n gap: 1,\n background: 'var(--card-border-color)',\n height: 21,\n borderRadius: 3,\n overflow: 'hidden',\n boxShadow: 'inset 0 0 0 1px var(--card-border-color)',\n}\n\n/** A little palette of the colors a preset would apply */\nfunction PresetButton(props: {active: boolean; onClick: () => void; preset: ThemePreset}) {\n const {active, onClick, preset} = props\n\n const swatches = useMemo(() => {\n const resolved = resolveThemeOptions(preset.options)\n\n return [\n ['accent', resolved.accent],\n ['text', resolved.text],\n ['dark', resolved.background.dark],\n ['light', resolved.background.light],\n ] as const\n }, [preset])\n\n return (\n <Button mode=\"ghost\" onClick={onClick} padding={2} selected={active} title={preset.title}>\n <Stack as=\"span\" gap={2}>\n <span style={paletteStyle}>\n {swatches.map(([key, background]) => (\n <span key={key} style={{flex: 1, background}} />\n ))}\n </span>\n <Text align=\"left\" size={1} textOverflow=\"ellipsis\">\n {preset.title}\n </Text>\n </Stack>\n </Button>\n )\n}\n\nconst rampStyle: React.CSSProperties = {\n ...paletteStyle,\n height: 13,\n borderRadius: 2,\n}\n\n/**\n * One color of the theme: a swatch with its value, an optional reset-to-auto\n * button, and the generated 50–950 tint ramp for the scales it anchors.\n */\nfunction ColorRow(props: {\n /** The color the generator actually applied, when it may differ from the input */\n adjusted?: string\n /** Whether the value is derived rather than explicitly set */\n auto?: boolean\n onChange: (value: string) => void\n onClear?: () => void\n /** The generated tint ramp this color anchors */\n tints?: Record<ColorTintKey, string>\n title: string\n value: string\n}) {\n const {adjusted, auto, onChange, onClear, tints, title, value} = props\n\n return (\n <Stack gap={2}>\n <Flex align=\"center\" gap={2}>\n <Stack flex={1} gap={2}>\n <Text size={1}>{title}</Text>\n <Text muted size={0} textOverflow=\"ellipsis\">\n {value}\n {adjusted !== undefined && adjusted !== value ? ` → ${adjusted}` : ''}\n {auto ? ' · auto' : ''}\n </Text>\n </Stack>\n {onClear && !auto && (\n <Button\n icon={ResetIcon}\n mode=\"bleed\"\n onClick={onClear}\n padding={2}\n title=\"Reset to auto\"\n />\n )}\n <Swatch\n aria-label={`${title} color`}\n onChange={(event) => onChange(event.currentTarget.value)}\n type=\"color\"\n value={value}\n />\n </Flex>\n {tints && (\n <span style={rampStyle}>\n {COLOR_TINTS.map((tint) => (\n <span key={tint} style={{flex: 1, background: tints[tint]}} />\n ))}\n </span>\n )}\n </Stack>\n )\n}\n","import {Box, Flex, Layer} from '@sanity/ui'\nimport {type ActiveToolLayoutProps} from 'sanity'\n\nimport {useThemer} from './context'\nimport {ThemerSidebar} from './ThemerSidebar'\n\n/**\n * Narrow enough to leave the studio preview as much room as possible: it fits\n * the widest picker label next to its swatch, and the code snippet scrolls\n * horizontally rather than widening the sidebar.\n */\nconst sidebarStyle: React.CSSProperties = {\n width: 240,\n flex: 'none',\n borderLeft: '1px solid var(--card-border-color)',\n boxSizing: 'border-box',\n overflow: 'hidden',\n}\n\n/**\n * Renders the themer sidebar next to the active tool, so the user can browse\n * around their own studio while tweaking the theme.\n *\n * @internal\n */\nexport function ThemerActiveToolLayout(props: ActiveToolLayoutProps) {\n const {open} = useThemer()\n\n return (\n <Flex height=\"fill\" sizing=\"border\">\n <Box flex={1} height=\"fill\" overflow=\"auto\">\n {props.renderDefault(props)}\n </Box>\n\n {open && (\n <Layer height=\"fill\" style={sidebarStyle} zOffset={100}>\n <ThemerSidebar />\n </Layer>\n )}\n </Flex>\n )\n}\n","import {isColor} from '../lib/mix'\nimport {BuildThemeOptions, MAXIMUM_CONTRAST, MINIMUM_CONTRAST} from '../theme/options'\n\nconst STORAGE_KEY = 'sanityStudio:themer:options'\n\nfunction sanitizeColor(value: unknown): string | null {\n return typeof value === 'string' && isColor(value) ? value.toLowerCase() : null\n}\n\nfunction sanitizeOptions(value: unknown): BuildThemeOptions | null {\n if (!value || typeof value !== 'object') return null\n\n const accent = sanitizeColor(Reflect.get(value, 'accent'))\n\n if (!accent) return null\n\n const options: BuildThemeOptions = {accent}\n const text = sanitizeColor(Reflect.get(value, 'text'))\n\n if (text) options.text = text\n\n const background: unknown = Reflect.get(value, 'background')\n\n if (background && typeof background === 'object') {\n const dark = sanitizeColor(Reflect.get(background, 'dark'))\n const light = sanitizeColor(Reflect.get(background, 'light'))\n\n if (dark || light) {\n options.background = {}\n if (dark) options.background.dark = dark\n if (light) options.background.light = light\n }\n }\n\n const contrast: unknown = Reflect.get(value, 'contrast')\n\n if (typeof contrast === 'number' && Number.isFinite(contrast)) {\n options.contrast = Math.min(MAXIMUM_CONTRAST, Math.max(MINIMUM_CONTRAST, contrast))\n }\n\n return options\n}\n\n/**\n * Restores draft theme options from localStorage, so theme drafts survive\n * studio reloads.\n *\n * @internal\n */\nexport function readStoredOptions(): BuildThemeOptions | null {\n try {\n if (typeof localStorage === 'undefined') return null\n\n const raw = localStorage.getItem(STORAGE_KEY)\n\n if (!raw) return null\n\n return sanitizeOptions(JSON.parse(raw))\n } catch {\n return null\n }\n}\n\n/** @internal */\nexport function writeStoredOptions(options: BuildThemeOptions | null): void {\n try {\n if (typeof localStorage === 'undefined') return\n\n if (options === null) {\n localStorage.removeItem(STORAGE_KEY)\n } else {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(options))\n }\n } catch {\n // Storage can be unavailable (e.g. private browsing) — drafts just won't persist\n }\n}\n","import {ThemeProvider} from '@sanity/ui'\nimport {useEffect, useMemo, useState} from 'react'\nimport {type LayoutProps} from 'sanity'\n\nimport {buildTheme} from '../theme/buildTheme'\nimport {BuildThemeOptions} from '../theme/options'\nimport {ThemerContext, ThemerContextValue} from './context'\nimport {readStoredOptions, writeStoredOptions} from './storage'\n\n/**\n * Wraps the whole Studio so that draft themes generated by the themer sidebar\n * apply everywhere while the user browses around, and hosts the state that the\n * navbar toggle and the sidebar share.\n *\n * The draft theme provider inherits the color scheme from the Studio, so the\n * preview follows the appearance setting (light/dark/system) like any other\n * theme.\n *\n * @internal\n */\nexport function ThemerLayout(props: LayoutProps & {baseOptions: BuildThemeOptions}) {\n const {baseOptions, ...layoutProps} = props\n const [open, setOpen] = useState(false)\n const [options, setOptions] = useState<BuildThemeOptions | null>(readStoredOptions)\n\n useEffect(() => writeStoredOptions(options), [options])\n\n // The theme identity must be stable between renders: it feeds the\n // styled-components theme context for the whole Studio, and rebuilding it\n // would re-render everything\n const theme = useMemo(() => (options === null ? null : buildTheme(options)), [options])\n\n const context = useMemo<ThemerContextValue>(\n () => ({baseOptions, options, setOptions, open, setOpen}),\n [baseOptions, options, open],\n )\n\n return (\n <ThemerContext.Provider value={context}>\n {theme === null ? (\n layoutProps.renderDefault(layoutProps)\n ) : (\n <ThemeProvider theme={theme}>{layoutProps.renderDefault(layoutProps)}</ThemeProvider>\n )}\n </ThemerContext.Provider>\n )\n}\n","import {ColorWheelIcon} from '@sanity/icons/ColorWheel'\nimport {Button, Text} from '@sanity/ui'\nimport {Tooltip} from '@sanity/ui/tooltip'\nimport {type NavbarProps} from 'sanity'\n\nimport {useThemer} from './context'\n\nfunction ThemerNavbarButton() {\n const {open, setOpen} = useThemer()\n\n return (\n <Tooltip content={<Text size={1}>Themer</Text>} portal>\n <Button\n aria-label=\"Themer\"\n icon={ColorWheelIcon}\n mode=\"bleed\"\n onClick={() => setOpen(!open)}\n // The Studio's own navbar buttons go through a wrapper that pins them\n // to this padding, where `@sanity/ui` defaults to a roomier 3\n padding={2}\n selected={open}\n />\n </Tooltip>\n )\n}\n\n/**\n * Adds the toggle that opens and closes the themer sidebar to the Studio\n * navbar — an icon button with a tooltip in the top bar (like the Tasks\n * toggle), and a regular titled action in the narrow-screen sidebar menu.\n *\n * @internal\n */\nexport function ThemerNavbar(props: NavbarProps) {\n const {open, setOpen} = useThemer()\n\n return props.renderDefault({\n ...props,\n __internal_actions: [\n ...(props.__internal_actions ?? []),\n {\n location: 'topbar',\n name: 'themer-topbar',\n render: () => <ThemerNavbarButton />,\n },\n {\n icon: ColorWheelIcon,\n location: 'sidebar',\n name: 'themer-sidebar',\n onAction: () => setOpen(!open),\n selected: open,\n title: 'Themer',\n },\n ],\n })\n}\n","import {definePlugin, type LayoutProps} from 'sanity'\n\nimport {BuildThemeOptions, DEFAULT_ACCENT} from '../theme/options'\nimport {ThemerActiveToolLayout} from './ThemerActiveToolLayout'\nimport {ThemerLayout} from './ThemerLayout'\nimport {ThemerNavbar} from './ThemerNavbar'\n\n/**\n * Options for the {@link themerTool} plugin.\n *\n * This is experimental and may change or be removed in any release without\n * notice — use at your own risk.\n *\n * @alpha\n */\nexport interface ThemerToolOptions {\n /**\n * The `buildTheme` options that the Studio's configured theme was generated\n * from — the themer starts editing from these, so pass the same object that\n * the `theme` in the Studio config uses:\n *\n * ```ts\n * const config: BuildThemeOptions = {accent: '#1cb485'}\n *\n * export default defineConfig({\n * theme: buildTheme(config),\n * plugins: [themerTool({config})],\n * })\n * ```\n */\n config?: BuildThemeOptions\n}\n\n/**\n * A Studio plugin that adds a themer sidebar for `buildTheme` themes: a\n * navbar toggle opens the sidebar next to the active tool, where presets, the\n * accent/text/background pickers and the contrast slider preview a\n * `buildTheme` theme live on the whole Studio while you browse around.\n * Toggle between light and dark mode with the regular appearance menu — the\n * preview follows it.\n *\n * ```ts\n * import {themerTool} from '@sanity/themer/tool'\n * import {defineConfig} from 'sanity'\n *\n * export default defineConfig({\n * plugins: [themerTool()],\n * // ...rest of the config\n * })\n * ```\n *\n * This is experimental and may change or be removed in any release without\n * notice — use at your own risk.\n *\n * @alpha\n */\nexport const themerTool = definePlugin<ThemerToolOptions | void>((options) => {\n const baseOptions = options?.config ?? {accent: DEFAULT_ACCENT}\n\n function ThemerLayoutWithOptions(props: LayoutProps) {\n return <ThemerLayout {...props} baseOptions={baseOptions} />\n }\n\n return {\n name: '@sanity/themer/tool',\n studio: {\n components: {\n layout: ThemerLayoutWithOptions,\n navbar: ThemerNavbar,\n activeToolLayout: ThemerActiveToolLayout,\n },\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAAgB,cAAyC,IAAI;;AAG1E,SAAgB,YAAgC;CAC9C,IAAM,UAAU,WAAW,aAAa;CAExC,IAAI,CAAC,SACH,MAAU,MAAM,uDAAuD;CAGzE,OAAO;AACT;;;;;;;;;;ACTA,SAAgB,gBAAgB,SAAsD;CACp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;;;;;;;;ACa3C,MAAa,aAAa,cAAwC,YAAY;CAC5E,IAAM,cAAc,SAAS,UAAU,EAAC,QAAQ,eAAc;CAE9D,SAAS,wBAAwB,OAAoB;gBAC5CE;EAAP,OAAyB,EAAA,OAAA,qBAAlB,KAAA,oBAAC,cAAD;GAAc,GAAI;GAAoB;EAAc,CAAA,GAAlC,EAAA,KAAA,mBAAlBA;CACT;CAEA,OAAO;EACL,MAAM;EACN,QAAQ,EACN,YAAY;GACV,QAAQ;GACR,QAAQ;GACR,kBAAkB;EACpB,EACF;CACF;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/themer",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Generate Sanity Studio themes, and preview them with a Studio tool.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -37,15 +37,15 @@
37
37
  "react-refractor": "^4.0.0",
38
38
  "refractor": "^5.0.0",
39
39
  "@sanity/color": "^3.0.8",
40
- "@sanity/ui": "^4.0.4",
41
- "@sanity/icons": "^5.2.1"
40
+ "@sanity/icons": "^5.2.1",
41
+ "@sanity/ui": "^4.0.5"
42
42
  },
43
43
  "devDependencies": {
44
- "@sanity/tsdown-config": "^0.25.0",
44
+ "@sanity/tsdown-config": "^0.26.0",
45
45
  "@sanity/vanilla-extract-vite-plugin": "^0.2.13",
46
46
  "@types/node": "^24.13.3",
47
47
  "@types/react": "^19.2.18",
48
- "babel-plugin-react-compiler": "^1.0.0",
48
+ "oxc-transform-react": "^0.145.0",
49
49
  "react": "^19.2.8",
50
50
  "rimraf": "^5.0.5",
51
51
  "sanity": "^6.10.1",