@sanity/themer 0.10.3 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimatedColorWheelIcon-CwWOVAsw.js.map +1 -1
- package/dist/{ResizableSidebar-B5Px5VCf.js → ResizableSidebar-Qo2gLzlm.js} +29 -29
- package/dist/{ResizableSidebar-B5Px5VCf.js.map → ResizableSidebar-Qo2gLzlm.js.map} +1 -1
- package/dist/bundle.css +109 -109
- package/dist/{themes-sELelb-j.js → themes-C_-85qf1.js} +29 -29
- package/dist/{themes-sELelb-j.js.map → themes-C_-85qf1.js.map} +1 -1
- package/dist/tool.js +2 -2
- package/dist/tool.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedColorWheelIcon-CwWOVAsw.js","names":["(value) => (isSliceFilled(value, index) ? 1 : 0)","{opacity}","<motion.path d={SLICE_PATHS[index]} fill={SLICE_COLORS[index]} style={{opacity}} />","SLICE_PATHS[index]","SLICE_COLORS[index]","motion.path","{\n busy,\n ref,\n}: {\n busy: boolean\n ref: React.Ref<{spin: () => void}>\n}","(value) => wheelRotation(value)","() => ({\n spin: () => {\n // A run in progress plays out — hovering again does not cut it short\n if (progress.isAnimating()) return\n\n animate(progress, [0, 1], {duration: ANIMATION_DURATION, ease: 'linear'})\n },\n })","[progress]","() => {\n if (!busy) return undefined\n\n let looping = false\n const raf = setTimeout(() => {\n looping = true\n const lap = (from: number) => {\n animate(progress, [from, 1], {\n duration: (1 - from) * ANIMATION_DURATION,\n ease: 'linear',\n onComplete: () => {\n if (looping) lap(0)\n },\n })\n }\n\n lap(progress.get())\n }, 160)\n\n return () => {\n clearTimeout(raf)\n looping = false\n }\n }","[busy, progress]","() => () => progress.stop()","{rotate}","SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))","<path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />","<motion.svg\n data-sanity-icon=\"color-wheel\"\n fill=\"none\"\n height=\"1em\"\n style={{rotate}}\n viewBox=\"0 0 25 25\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))}\n <path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />\n </motion.svg>","motion.svg","_c"],"sources":["../src/tool/colorWheel.ts","../src/tool/AnimatedColorWheelIcon.tsx"],"sourcesContent":["import {blue, cyan, green, magenta, orange, purple, red, yellow} from '@sanity/color'\n\n/**\n * The spokes of the color wheel icon (`ColorWheelIcon` from `@sanity/icons`)\n * cut its ring into this many slices, one of them centered on 12 o'clock\n */\nexport const SLICE_COUNT = 8\n\n/**\n * The colors the slices fill with, clockwise from 12 o'clock: the palette's\n * hues in rainbow order, like a real color swatch\n */\nexport const SLICE_COLORS: readonly string[] = [\n red[500].hex,\n orange[500].hex,\n yellow[400].hex,\n green[500].hex,\n cyan[500].hex,\n blue[500].hex,\n purple[500].hex,\n magenta[500].hex,\n]\n\n/**\n * The animation plays in acts of this length, in seconds. In the first act\n * the top half of the slices pop in, one at a time like the segments of a\n * classic spinner; in the second the wheel spins up while the bottom half pop\n * in; in the third the colors pop out again as the spin's speed carries over\n * into the clearing.\n */\nconst ACT_DURATION = 0.55\n\n/**\n * The clearing would take a whole act to come to rest, but its last slice\n * pops out as the clearing reaches that slice's leading edge — with nothing\n * left to show, the animation ends there\n */\nconst CLEARING_ACTS = 1 - Math.cbrt(1 / SLICE_COUNT)\n\nconst TOTAL_ACTS = 2 + CLEARING_ACTS\n\n/** How long the whole animation takes, in seconds */\nexport const ANIMATION_DURATION = ACT_DURATION * TOTAL_ACTS\n\nfunction actAt(progress: number): number {\n return progress * TOTAL_ACTS\n}\n\n/**\n * How far the wheel has turned at `progress` (0–1), in degrees.\n *\n * It stands still while the top half of the slices pop in. As the 6 o'clock\n * slice pops in it starts spinning — one full turn with a cubic ease-in, from\n * rest to top speed as the bottom half pop in — and it stands still again the\n * moment it is back upright: the clearing of {@link isSliceFilled} takes off\n * at the speed the spin reached, as if the wheel kept turning and eased out\n * over a second turn, so the two read as one movement.\n */\nexport function wheelRotation(progress: number): number {\n const spin = actAt(progress) - 1\n\n if (spin <= 0 || spin >= 1) return 0\n\n return 360 * spin ** 3\n}\n\n/**\n * Whether slice `index` (clockwise from 12 o'clock) shows its color at\n * `progress` (0–1). A slice pops in whole as the fill reaches its leading\n * edge, and pops out whole as the clearing does — stepped, never partial.\n *\n * The fill goes clockwise at a steady pace over the first two acts, half of\n * the slices in each. The clearing follows in the third act, the same way\n * round, on a cubic ease-out that starts at the speed the spin of\n * {@link wheelRotation} ends with: the slices at first pop out as quickly as\n * they were passing by, then ever more slowly.\n */\nexport function isSliceFilled(progress: number, index: number): boolean {\n const act = actAt(progress)\n const filling = (act * SLICE_COUNT) / 2\n\n if (filling <= index) return false\n\n const clearing = act - 2\n\n if (clearing <= 0) return true\n\n return (1 - (1 - clearing) ** 3) * SLICE_COUNT < index\n}\n","import {animate, motion, type MotionValue, useMotionValue, useTransform} from 'motion/react'\nimport {useEffect, useImperativeHandle} from 'react'\n\nimport {\n isSliceFilled,\n SLICE_COLORS,\n SLICE_COUNT,\n wheelRotation,\n ANIMATION_DURATION,\n} from './colorWheel'\n\n/**\n * The geometry of `ColorWheelIcon` from `@sanity/icons`: a ring between two\n * circles around the center of a 25×25 viewBox, cut into eight slices by the\n * spokes of its outline path\n */\nconst CENTER = 12.5\nconst OUTER_RADIUS = 8\nconst INNER_RADIUS = 3.5\nconst OUTLINE =\n 'M9.43853 5.10896L11.1606 9.26642M13.8394 15.7336L15.5615 19.891M15.7336 11.1606L19.891 9.43853M9.26642 13.8394L5.10896 15.5615M5.3139 9.52342L9.23359 11.147M15.7664 13.853L19.6861 15.4766M13.853 9.23359L15.4766 5.3139M9.52342 19.6861L11.147 15.7664M20.5 12.5C20.5 16.9183 16.9183 20.5 12.5 20.5C8.08172 20.5 4.5 16.9183 4.5 12.5C4.5 8.08172 8.08172 4.5 12.5 4.5C16.9183 4.5 20.5 8.08172 20.5 12.5ZM16 12.5C16 14.433 14.433 16 12.5 16C10.567 16 9 14.433 9 12.5C9 10.567 10.567 9 12.5 9C14.433 9 16 10.567 16 12.5Z'\n\nconst SLICE_ANGLE = 360 / SLICE_COUNT\n\n/** A point on a circle around the center, at `degrees` clockwise from 3 o'clock */\nfunction point(radius: number, degrees: number): string {\n const radians = (degrees * Math.PI) / 180\n\n return `${CENTER + radius * Math.cos(radians)} ${CENTER + radius * Math.sin(radians)}`\n}\n\n/**\n * The part of the ring a slice colors in: between its two spokes, from the\n * inner circle out to the outer. The 12 o'clock slice is centered on 12, so\n * it starts half a slice before it.\n */\nfunction slicePath(index: number): string {\n const start = index * SLICE_ANGLE - SLICE_ANGLE / 2 - 90\n const end = start + SLICE_ANGLE\n\n return [\n `M${point(OUTER_RADIUS, start)}`,\n `A${OUTER_RADIUS} ${OUTER_RADIUS} 0 0 1 ${point(OUTER_RADIUS, end)}`,\n `L${point(INNER_RADIUS, end)}`,\n `A${INNER_RADIUS} ${INNER_RADIUS} 0 0 0 ${point(INNER_RADIUS, start)}`,\n 'Z',\n ].join('')\n}\n\nconst SLICE_PATHS = SLICE_COLORS.map((_, index) => slicePath(index))\n\n/**\n * A filled shape, not a stroked one: the icon styles of `@sanity/ui` force\n * `vector-effect: non-scaling-stroke` on every path in an icon, which fills\n * are none the wiser about\n */\nfunction Slice(props: {index: number; progress: MotionValue<number>}) {\n const {index, progress} = props\n const opacity = useTransform(progress, (value) => (isSliceFilled(value, index) ? 1 : 0))\n\n return <motion.path d={SLICE_PATHS[index]} fill={SLICE_COLORS[index]} style={{opacity}} />\n}\n\n/**\n * The `ColorWheelIcon` of `@sanity/icons`, with an animation driven by\n * `progress` (0–1): the slices pop in with color one at a time, clockwise\n * from 12 o'clock like the segments of a classic spinner, the wheel spins once\n * as the 6 o'clock slice pops in, and the colors pop out the same way round,\n * carrying the spin's speed to a rest (see `colorWheel.ts`). At rest — at\n * either end — it looks exactly like the icon it stands in for. With\n * `prefers-reduced-motion: reduce` the navbar renders that icon instead of\n * this one, so nothing here moves.\n *\n * @internal\n */\nexport default function AnimatedColorWheelIcon({\n busy,\n ref,\n}: {\n busy: boolean\n ref: React.Ref<{spin: () => void}>\n}) {\n const progress = useMotionValue(0)\n const rotate = useTransform(progress, (value) => wheelRotation(value))\n\n useImperativeHandle(\n ref,\n () => ({\n spin: () => {\n // A run in progress plays out — hovering again does not cut it short\n if (progress.isAnimating()) return\n\n animate(progress, [0, 1], {duration: ANIMATION_DURATION, ease: 'linear'})\n },\n }),\n [progress],\n )\n\n // Laps from wherever a hover's run has got to, so the wheel never jumps,\n // and the lap in progress as the code arrives plays out: at rest, the wheel\n // looks like the icon again\n useEffect(() => {\n if (!busy) return undefined\n\n let looping = false\n const raf = setTimeout(() => {\n looping = true\n const lap = (from: number) => {\n animate(progress, [from, 1], {\n duration: (1 - from) * ANIMATION_DURATION,\n ease: 'linear',\n onComplete: () => {\n if (looping) lap(0)\n },\n })\n }\n\n lap(progress.get())\n }, 160)\n\n return () => {\n clearTimeout(raf)\n looping = false\n }\n }, [busy, progress])\n\n useEffect(() => () => progress.stop(), [progress])\n\n return (\n <motion.svg\n data-sanity-icon=\"color-wheel\"\n fill=\"none\"\n height=\"1em\"\n style={{rotate}}\n viewBox=\"0 0 25 25\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))}\n <path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />\n </motion.svg>\n )\n}\n"],"mappings":";;;;;;;;;AAYA,MAAa,eAAkC;CAC7C,IAAI,IAAI,CAAC;CACT,OAAO,IAAI,CAAC;CACZ,OAAO,IAAI,CAAC;CACZ,MAAM,IAAI,CAAC;CACX,KAAK,IAAI,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,GAChB,UAAU;EACZ;CACF,GAAG,KAAA,CAAC,MAAM,QAAQ,GAtBX,EAAA,KAAA,MAMO,EAAA,KAAA,0DAPd,UAAUD,IAuBPC,EAAgB;CAETC,IAAAA,IAA6BH;CAAvC,AAAsB,EAAA,OAAA,qCAAZ,iBAAY,SAAS,KAAK,GAAG,KAAA,CAAC,QAAQ,GAA1B,EAAA,KAAA,iCAAtB,UAAUG,IAA6BH,EAAU;CAOtCI,IAAAA;CAAC,AAAA,EAAA,QAAA,uBAAD,KAAA,EAAC,OAAM,GAAN,EAAA,MAAA;CAKPC,IAAAA;CAC4C,AAAA,EAAA,QAAA,yBAD5C,KAAA,aAAa,KAAK,OAAO,UACxB,oBAAC,OAAD;EAA0B;EAAiB;CAAW,GAA1C,KAA0C,CACvD,GAD4C,EAAA,MAAA;CAE7CC,IAAAA;sDAAC,KAAA,oBAAA,QAAD;EAAM,GAAG;EAAS,QAAO;EAAe,gBAAe;EAAQ,aAAa;CAAM,CAAA;CAZpFC,IAAAA;CADF,OAKWH,EAAAA,QAAAA,MAAAA,EAAAA,QAKNC,MATH,MAAA,qBAACG,OAAAA,KAAD;EACE,oBAAiB;EACjB,MAAK;EACL,QAAO;EACP,OAAOJ;EACP,SAAQ;EACR,OAAM;EACN,OAAM;EAPR,UAAA,CASGC,IAGDC,EACU;KATHF,EAAAA,MAAAA,IAKNC,EAAAA,MAAAA,gCATHE;AAeJ;AA7DwC,SAAA,MAAC,OAAA;CAAU,OAAA,cAAc,KAAK"}
|
|
1
|
+
{"version":3,"file":"AnimatedColorWheelIcon-CwWOVAsw.js","names":["(value) => (isSliceFilled(value, index) ? 1 : 0)","{opacity}","<motion.path d={SLICE_PATHS[index]} fill={SLICE_COLORS[index]} style={{opacity}} />","SLICE_PATHS[index]","SLICE_COLORS[index]","motion.path","{\n busy,\n ref,\n}: {\n busy: boolean\n ref: React.Ref<{spin: () => void}>\n}","(value) => wheelRotation(value)","() => ({\n spin: () => {\n // A run in progress plays out — hovering again does not cut it short\n if (progress.isAnimating()) return\n\n animate(progress, [0, 1], {duration: ANIMATION_DURATION, ease: 'linear'})\n },\n })","[progress]","() => {\n if (!busy) return undefined\n\n let looping = false\n const raf = setTimeout(() => {\n looping = true\n const lap = (from: number) => {\n animate(progress, [from, 1], {\n duration: (1 - from) * ANIMATION_DURATION,\n ease: 'linear',\n onComplete: () => {\n if (looping) lap(0)\n },\n })\n }\n\n lap(progress.get())\n }, 160)\n\n return () => {\n clearTimeout(raf)\n looping = false\n }\n }","[busy, progress]","() => () => progress.stop()","{rotate}","SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))","<path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />","<motion.svg\n data-sanity-icon=\"color-wheel\"\n fill=\"none\"\n height=\"1em\"\n style={{rotate}}\n viewBox=\"0 0 25 25\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))}\n <path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />\n </motion.svg>","motion.svg","_c"],"sources":["../src/tool/colorWheel.ts","../src/tool/AnimatedColorWheelIcon.tsx"],"sourcesContent":["import {blue, cyan, green, magenta, orange, purple, red, yellow} from '@sanity/color'\n\n/**\n * The spokes of the color wheel icon (`ColorWheelIcon` from `@sanity/icons`)\n * cut its ring into this many slices, one of them centered on 12 o'clock\n */\nexport const SLICE_COUNT = 8\n\n/**\n * The colors the slices fill with, clockwise from 12 o'clock: the palette's\n * hues in rainbow order, like a real color swatch\n */\nexport const SLICE_COLORS: readonly string[] = [\n red[500].hex,\n orange[500].hex,\n yellow[400].hex,\n green[500].hex,\n cyan[500].hex,\n blue[500].hex,\n purple[500].hex,\n magenta[500].hex,\n]\n\n/**\n * The animation plays in acts of this length, in seconds. In the first act\n * the top half of the slices pop in, one at a time like the segments of a\n * classic spinner; in the second the wheel spins up while the bottom half pop\n * in; in the third the colors pop out again as the spin's speed carries over\n * into the clearing.\n */\nconst ACT_DURATION = 0.55\n\n/**\n * The clearing would take a whole act to come to rest, but its last slice\n * pops out as the clearing reaches that slice's leading edge — with nothing\n * left to show, the animation ends there\n */\nconst CLEARING_ACTS = 1 - Math.cbrt(1 / SLICE_COUNT)\n\nconst TOTAL_ACTS = 2 + CLEARING_ACTS\n\n/** How long the whole animation takes, in seconds */\nexport const ANIMATION_DURATION = ACT_DURATION * TOTAL_ACTS\n\nfunction actAt(progress: number): number {\n return progress * TOTAL_ACTS\n}\n\n/**\n * How far the wheel has turned at `progress` (0–1), in degrees.\n *\n * It stands still while the top half of the slices pop in. As the 6 o'clock\n * slice pops in it starts spinning — one full turn with a cubic ease-in, from\n * rest to top speed as the bottom half pop in — and it stands still again the\n * moment it is back upright: the clearing of {@link isSliceFilled} takes off\n * at the speed the spin reached, as if the wheel kept turning and eased out\n * over a second turn, so the two read as one movement.\n */\nexport function wheelRotation(progress: number): number {\n const spin = actAt(progress) - 1\n\n if (spin <= 0 || spin >= 1) return 0\n\n return 360 * spin ** 3\n}\n\n/**\n * Whether slice `index` (clockwise from 12 o'clock) shows its color at\n * `progress` (0–1). A slice pops in whole as the fill reaches its leading\n * edge, and pops out whole as the clearing does — stepped, never partial.\n *\n * The fill goes clockwise at a steady pace over the first two acts, half of\n * the slices in each. The clearing follows in the third act, the same way\n * round, on a cubic ease-out that starts at the speed the spin of\n * {@link wheelRotation} ends with: the slices at first pop out as quickly as\n * they were passing by, then ever more slowly.\n */\nexport function isSliceFilled(progress: number, index: number): boolean {\n const act = actAt(progress)\n const filling = (act * SLICE_COUNT) / 2\n\n if (filling <= index) return false\n\n const clearing = act - 2\n\n if (clearing <= 0) return true\n\n return (1 - (1 - clearing) ** 3) * SLICE_COUNT < index\n}\n","import {animate, motion, type MotionValue, useMotionValue, useTransform} from 'motion/react'\nimport {useEffect, useImperativeHandle} from 'react'\n\nimport {\n isSliceFilled,\n SLICE_COLORS,\n SLICE_COUNT,\n wheelRotation,\n ANIMATION_DURATION,\n} from './colorWheel'\n\n/**\n * The geometry of `ColorWheelIcon` from `@sanity/icons`: a ring between two\n * circles around the center of a 25×25 viewBox, cut into eight slices by the\n * spokes of its outline path\n */\nconst CENTER = 12.5\nconst OUTER_RADIUS = 8\nconst INNER_RADIUS = 3.5\nconst OUTLINE =\n 'M9.43853 5.10896L11.1606 9.26642M13.8394 15.7336L15.5615 19.891M15.7336 11.1606L19.891 9.43853M9.26642 13.8394L5.10896 15.5615M5.3139 9.52342L9.23359 11.147M15.7664 13.853L19.6861 15.4766M13.853 9.23359L15.4766 5.3139M9.52342 19.6861L11.147 15.7664M20.5 12.5C20.5 16.9183 16.9183 20.5 12.5 20.5C8.08172 20.5 4.5 16.9183 4.5 12.5C4.5 8.08172 8.08172 4.5 12.5 4.5C16.9183 4.5 20.5 8.08172 20.5 12.5ZM16 12.5C16 14.433 14.433 16 12.5 16C10.567 16 9 14.433 9 12.5C9 10.567 10.567 9 12.5 9C14.433 9 16 10.567 16 12.5Z'\n\nconst SLICE_ANGLE = 360 / SLICE_COUNT\n\n/** A point on a circle around the center, at `degrees` clockwise from 3 o'clock */\nfunction point(radius: number, degrees: number): string {\n const radians = (degrees * Math.PI) / 180\n\n return `${CENTER + radius * Math.cos(radians)} ${CENTER + radius * Math.sin(radians)}`\n}\n\n/**\n * The part of the ring a slice colors in: between its two spokes, from the\n * inner circle out to the outer. The 12 o'clock slice is centered on 12, so\n * it starts half a slice before it.\n */\nfunction slicePath(index: number): string {\n const start = index * SLICE_ANGLE - SLICE_ANGLE / 2 - 90\n const end = start + SLICE_ANGLE\n\n return [\n `M${point(OUTER_RADIUS, start)}`,\n `A${OUTER_RADIUS} ${OUTER_RADIUS} 0 0 1 ${point(OUTER_RADIUS, end)}`,\n `L${point(INNER_RADIUS, end)}`,\n `A${INNER_RADIUS} ${INNER_RADIUS} 0 0 0 ${point(INNER_RADIUS, start)}`,\n 'Z',\n ].join('')\n}\n\nconst SLICE_PATHS = SLICE_COLORS.map((_, index) => slicePath(index))\n\n/**\n * A filled shape, not a stroked one: the icon styles of `@sanity/ui` force\n * `vector-effect: non-scaling-stroke` on every path in an icon, which fills\n * are none the wiser about\n */\nfunction Slice(props: {index: number; progress: MotionValue<number>}) {\n const {index, progress} = props\n const opacity = useTransform(progress, (value) => (isSliceFilled(value, index) ? 1 : 0))\n\n return <motion.path d={SLICE_PATHS[index]} fill={SLICE_COLORS[index]} style={{opacity}} />\n}\n\n/**\n * The `ColorWheelIcon` of `@sanity/icons`, with an animation driven by\n * `progress` (0–1): the slices pop in with color one at a time, clockwise\n * from 12 o'clock like the segments of a classic spinner, the wheel spins once\n * as the 6 o'clock slice pops in, and the colors pop out the same way round,\n * carrying the spin's speed to a rest (see `colorWheel.ts`). At rest — at\n * either end — it looks exactly like the icon it stands in for. With\n * `prefers-reduced-motion: reduce` the navbar renders that icon instead of\n * this one, so nothing here moves.\n *\n * @internal\n */\nexport default function AnimatedColorWheelIcon({\n busy,\n ref,\n}: {\n busy: boolean\n ref: React.Ref<{spin: () => void}>\n}) {\n const progress = useMotionValue(0)\n const rotate = useTransform(progress, (value) => wheelRotation(value))\n\n useImperativeHandle(\n ref,\n () => ({\n spin: () => {\n // A run in progress plays out — hovering again does not cut it short\n if (progress.isAnimating()) return\n\n animate(progress, [0, 1], {duration: ANIMATION_DURATION, ease: 'linear'})\n },\n }),\n [progress],\n )\n\n // Laps from wherever a hover's run has got to, so the wheel never jumps,\n // and the lap in progress as the code arrives plays out: at rest, the wheel\n // looks like the icon again\n useEffect(() => {\n if (!busy) return undefined\n\n let looping = false\n const raf = setTimeout(() => {\n looping = true\n const lap = (from: number) => {\n animate(progress, [from, 1], {\n duration: (1 - from) * ANIMATION_DURATION,\n ease: 'linear',\n onComplete: () => {\n if (looping) lap(0)\n },\n })\n }\n\n lap(progress.get())\n }, 160)\n\n return () => {\n clearTimeout(raf)\n looping = false\n }\n }, [busy, progress])\n\n useEffect(() => () => progress.stop(), [progress])\n\n return (\n <motion.svg\n data-sanity-icon=\"color-wheel\"\n fill=\"none\"\n height=\"1em\"\n style={{rotate}}\n viewBox=\"0 0 25 25\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {SLICE_COLORS.map((color, index) => (\n <Slice key={color} index={index} progress={progress} />\n ))}\n <path d={OUTLINE} stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth={1.2} />\n </motion.svg>\n )\n}\n"],"mappings":";;;;;;;;;AAYA,MAAa,eAAkC;CAC7C,IAAI,IAAI,CAAC;CACT,OAAO,IAAI,CAAC;CACZ,OAAO,IAAI,CAAC;CACZ,MAAM,IAAI,CAAC;CACX,KAAK,IAAI,CAAC;CACV,KAAK,IAAI,CAAC;CACV,OAAO,IAAI,CAAC;CACZ,QAAQ,IAAI,CAAC;AACf,GAkBM,aAAa,KAFG,IAAI,KAAK,KAAK,IAAA,CAAe,IAKtC,qBAAqB,MAAe;AAEjD,SAAS,MAAM,UAA0B;CACvC,OAAO,WAAW;AACpB;;;;;;;;;;;AAYA,SAAgB,cAAc,UAA0B;CACtD,IAAM,OAAO,MAAM,QAAQ,IAAI;CAI/B,OAFI,QAAQ,KAAK,QAAQ,IAAU,IAE5B,MAAM,QAAQ;AACvB;;;;;;;;;;;;AAaA,SAAgB,cAAc,UAAkB,OAAwB;CACtE,IAAM,MAAM,MAAM,QAAQ;CAG1B,IAFiB,MAAA,IAAqB,KAEvB,OAAO,OAAO;CAE7B,IAAM,WAAW,MAAM;CAIvB,OAFI,YAAY,MAER,KAAK,IAAI,aAAa,KAAA,IAAmB;AACnD;;;;;;ACxEA,MAAM,SAAS,MAET,eAAe;;AAOrB,SAAS,MAAM,QAAgB,SAAyB;CACtD,IAAM,UAAW,UAAU,KAAK,KAAM;CAEtC,OAAO,GAAG,SAAS,SAAS,KAAK,IAAI,OAAO,EAAE,GAAG,SAAS,SAAS,KAAK,IAAI,OAAO;AACrF;;;;;;AAOA,SAAS,UAA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O;EACP,OAAOJ;EACP,SAAQ;EACR,OAAM;EACN,OAAM;EAPR,UAAA,CASGC,IAGDC,EACU;C,IATHF,EAAAA,MAAAA,IAKNC,EAAAA,MAAAA,I,4BATHE;AAeJ;AA7DwC,SAAA,MAAC,OAAA;CAAU,OAAA,cAAc,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as DEFAULT_BACKGROUND, c as resolveThemeOptions, d as hslToHex, f as relativeLuminance, i as DEFAULT_ACCENT, l as isColor, n as buildTheme, o as SCHEMES, r as buildPalette, s as deriveTextColor, u as hexToHsl } from "./presets-CqBgS3A-.js";
|
|
2
|
-
import { a as displayTitle, c as resolveThemes, l as addThemerTransitionType, n as CONFIG_TITLE, t as CONFIG_SLUG } from "./themes-
|
|
2
|
+
import { a as displayTitle, c as resolveThemes, l as addThemerTransitionType, n as CONFIG_TITLE, t as CONFIG_SLUG } from "./themes-C_-85qf1.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { useColorSchemeValue } from "sanity";
|
|
5
5
|
import { Badge, BoundaryElementProvider, Box, Button, Card, Dialog, Flex, Layer, Stack, Text, TextInput, ThemeProvider, useMediaIndex, useRootTheme, useTheme_v2 } from "@sanity/ui";
|
|
@@ -33,7 +33,7 @@ import scrollIntoView from "scroll-into-view-if-needed";
|
|
|
33
33
|
import { Code } from "@sanity/ui/code";
|
|
34
34
|
import { registerLanguage } from "react-refractor";
|
|
35
35
|
import typescript from "refractor/typescript";
|
|
36
|
-
var root$2 = "
|
|
36
|
+
var root$2 = "_12pbjan0";
|
|
37
37
|
const ScrollAreaInsetContext = createContext({
|
|
38
38
|
left: 0,
|
|
39
39
|
right: 0,
|
|
@@ -115,24 +115,24 @@ function ScrollAreaBleed(props) {
|
|
|
115
115
|
children: props.children
|
|
116
116
|
}), $[4] = props.children, $[5] = t3, $[6] = t4) : t4 = $[6], t4;
|
|
117
117
|
}
|
|
118
|
-
var avatar = "
|
|
119
|
-
bg: "var(--
|
|
120
|
-
fg: "var(--
|
|
121
|
-
mutedFg: "var(--
|
|
122
|
-
border: "var(--
|
|
123
|
-
accent: "var(--
|
|
124
|
-
avatar: "var(--
|
|
125
|
-
selectedBg: "var(--
|
|
126
|
-
selectedFg: "var(--
|
|
127
|
-
inputBg: "var(--
|
|
128
|
-
inputBorder: "var(--
|
|
129
|
-
}, field = "
|
|
130
|
-
fg: "
|
|
131
|
-
muted: "
|
|
132
|
-
selected: "
|
|
133
|
-
}, list = "
|
|
134
|
-
light: "
|
|
135
|
-
dark: "
|
|
118
|
+
var avatar = "_125jg1hh", body = "_125jg1hi", button = "_125jg1hq", colors = {
|
|
119
|
+
bg: "var(--_125jg1h0)",
|
|
120
|
+
fg: "var(--_125jg1h1)",
|
|
121
|
+
mutedFg: "var(--_125jg1h2)",
|
|
122
|
+
border: "var(--_125jg1h3)",
|
|
123
|
+
accent: "var(--_125jg1h4)",
|
|
124
|
+
avatar: "var(--_125jg1h5)",
|
|
125
|
+
selectedBg: "var(--_125jg1h6)",
|
|
126
|
+
selectedFg: "var(--_125jg1h7)",
|
|
127
|
+
inputBg: "var(--_125jg1h8)",
|
|
128
|
+
inputBorder: "var(--_125jg1h9)"
|
|
129
|
+
}, field = "_125jg1hn", footer = "_125jg1hp", form = "_125jg1hm", input = "_125jg1ho", line = {
|
|
130
|
+
fg: "_125jg1hs _125jg1hr",
|
|
131
|
+
muted: "_125jg1ht _125jg1hr",
|
|
132
|
+
selected: "_125jg1hu _125jg1hr"
|
|
133
|
+
}, list = "_125jg1hj", listRow = "_125jg1hk", logo = "_125jg1hf", navbar = "_125jg1he", pane = "_125jg1hl", root$1 = "_125jg1ha", spacer = "_125jg1hg", studio = {
|
|
134
|
+
light: "_125jg1hb",
|
|
135
|
+
dark: "_125jg1hd _125jg1hb"
|
|
136
136
|
};
|
|
137
137
|
/** The document rows in the list pane — the widths of their title lines */
|
|
138
138
|
const LIST_ROWS = [
|
|
@@ -275,7 +275,7 @@ function ThemeThumbnail(props) {
|
|
|
275
275
|
children: /* @__PURE__ */ jsx(ThemePreview, { options: props.options })
|
|
276
276
|
}), $[0] = props.options, $[1] = t0), t0;
|
|
277
277
|
}
|
|
278
|
-
var removedThumbnail = "
|
|
278
|
+
var removedThumbnail = "_14ebtty0";
|
|
279
279
|
/**
|
|
280
280
|
* The flow for restoring removed themes: the presets and custom themes the
|
|
281
281
|
* user took out of the list, each with a button to put it back — and, for
|
|
@@ -805,7 +805,7 @@ function useImagePalette(onPalette) {
|
|
|
805
805
|
function _temp$6(swatch) {
|
|
806
806
|
return swatch === null;
|
|
807
807
|
}
|
|
808
|
-
var paletteGrid = "
|
|
808
|
+
var paletteGrid = "_2cqxof2", tile = "_2cqxof4", variantButton = "_2cqxof6", variantFrame = "_2cqxof7", variantRow = "_2cqxof5", variantScale = "var(--_2cqxof1)", variantScaleBox = "_2cqxof8", variantWidth = "var(--_2cqxof0)";
|
|
809
809
|
/** The swatches on display: the vibrant family over the muted one */
|
|
810
810
|
const TILES = [
|
|
811
811
|
"vibrant",
|
|
@@ -897,7 +897,7 @@ function ImagePaletteSection(props) {
|
|
|
897
897
|
"data-with-image": imageUrl !== void 0,
|
|
898
898
|
children: [imageUrl && /* @__PURE__ */ jsx("img", {
|
|
899
899
|
alt: "",
|
|
900
|
-
className: "
|
|
900
|
+
className: "_2cqxof3",
|
|
901
901
|
src: imageUrl
|
|
902
902
|
}), TILES.map((key) => {
|
|
903
903
|
let hex = palette[key], title = IMAGE_PALETTE_TITLES[key];
|
|
@@ -1004,7 +1004,7 @@ function ImagePaletteSection(props) {
|
|
|
1004
1004
|
function _temp$5(event_0) {
|
|
1005
1005
|
event_0.preventDefault();
|
|
1006
1006
|
}
|
|
1007
|
-
var colorRowText = "
|
|
1007
|
+
var colorRowText = "_1dxffns2", range = "_1dxffns1", swatch = "_1dxffns0";
|
|
1008
1008
|
const SCHEME_TITLES = {
|
|
1009
1009
|
dark: "Dark mode",
|
|
1010
1010
|
light: "Light mode"
|
|
@@ -1719,7 +1719,7 @@ function PasteThemeDialog(props) {
|
|
|
1719
1719
|
children: t15
|
|
1720
1720
|
}), $[34] = id, $[35] = onClose, $[36] = t15, $[37] = t6, $[38] = t16) : t16 = $[38], t16;
|
|
1721
1721
|
}
|
|
1722
|
-
var frame$1 = "
|
|
1722
|
+
var frame$1 = "_1fljyi72", menuCard = "_1fljyi74", menuSlot = "_1fljyi73", pickButton = "_1fljyi71", root = "_1fljyi70";
|
|
1723
1723
|
/**
|
|
1724
1724
|
* Scrolls the applied theme's card into view when it is not already, as a
|
|
1725
1725
|
* ref: the list scrolls to it as it mounts — coming back from the editor or
|
|
@@ -2072,7 +2072,7 @@ function ThemeSnippetDialog(props) {
|
|
|
2072
2072
|
children: t9
|
|
2073
2073
|
}), $[19] = id, $[20] = onClose, $[21] = t2, $[22] = t9, $[23] = t10) : t10 = $[23], t10;
|
|
2074
2074
|
}
|
|
2075
|
-
var cardGrid = "
|
|
2075
|
+
var cardGrid = "gm65l50";
|
|
2076
2076
|
/**
|
|
2077
2077
|
* The flow for picking a theme: a grid of theme cards — the configured theme,
|
|
2078
2078
|
* the presets and the user's own themes — that drag into the order the user
|
|
@@ -2275,7 +2275,7 @@ function selectDialog(snapshot) {
|
|
|
2275
2275
|
function useIsTooSmallForSplitScreen() {
|
|
2276
2276
|
return useMediaIndex() <= 3;
|
|
2277
2277
|
}
|
|
2278
|
-
var title = "
|
|
2278
|
+
var title = "e2uyq60";
|
|
2279
2279
|
const VIEW_TITLES = {
|
|
2280
2280
|
list: "Themer",
|
|
2281
2281
|
edit: "Edit theme",
|
|
@@ -2407,7 +2407,7 @@ function selectView(snapshot) {
|
|
|
2407
2407
|
function sameView(a, b) {
|
|
2408
2408
|
return a.name === b.name ? a.name !== "edit" || b.name !== "edit" || a.slug === b.slug && a.focusTitle === b.focusTitle : !1;
|
|
2409
2409
|
}
|
|
2410
|
-
var content = "
|
|
2410
|
+
var content = "_1uwpnld3", frame = "_1uwpnld2", resizeHandle = "_1uwpnld4", sidebar = "_1uwpnld1";
|
|
2411
2411
|
/** How far one arrow key press resizes the sidebar */
|
|
2412
2412
|
const WIDTH_STORAGE_KEY = "sanityStudio:themer:width";
|
|
2413
2413
|
function clampWidth(width) {
|
|
@@ -2523,4 +2523,4 @@ function ResizableSidebar(t0) {
|
|
|
2523
2523
|
function _temp() {}
|
|
2524
2524
|
export { ResizableSidebar as default };
|
|
2525
2525
|
|
|
2526
|
-
//# sourceMappingURL=ResizableSidebar-
|
|
2526
|
+
//# sourceMappingURL=ResizableSidebar-Qo2gLzlm.js.map
|