{
  "version": 3,
  "sources": ["../../src/lib/styles.tsx"],
  "sourcesContent": ["import {\n\tDefaultColorStyle,\n\tDefaultFontStyle,\n\tisFontEntry,\n\ttype TLTheme,\n\ttype TLThemeColors,\n\ttype TLThemeFont,\n} from '@tldraw/editor'\nimport { TLUiIconJsx } from './ui/components/primitives/TldrawUiIcon'\n\n/** @public */\nexport type StyleValuesForUi<T> = readonly {\n\treadonly value: T\n\treadonly icon: string | TLUiIconJsx\n}[]\n\nfunction isPaletteColor(value: unknown): boolean {\n\treturn typeof value === 'object' && value !== null && 'solid' in value\n}\n\n/**\n * Returns the current list of color style items for the style panel,\n * derived from the theme's color palette. Only palette colors are included;\n * utility colors like `text`, `background`, etc. are excluded.\n *\n * Colors are ordered by their position in {@link @tldraw/tlschema#DefaultColorStyle},\n * followed by any additional theme colors in their object key order.\n *\n * @public\n */\nexport function getColorStyleItems(colors: TLThemeColors): StyleValuesForUi<string> {\n\tconst result: StyleValuesForUi<string>[number][] = []\n\tconst seen = new Set<string>()\n\n\t// First, add colors in the preferred order from DefaultColorStyle\n\tfor (const name of DefaultColorStyle.values) {\n\t\tif (name in colors && isPaletteColor(colors[name as keyof typeof colors])) {\n\t\t\t// we remove white here temporarily, it's an easter egg color that the panel does not yet account for\n\t\t\tif (name === 'white') continue\n\t\t\tresult.push({ value: name, icon: 'color' as const })\n\t\t\tseen.add(name)\n\t\t}\n\t}\n\n\t// Then, append any remaining palette colors from the theme\n\tfor (const [key, value] of Object.entries(colors)) {\n\t\tif (!seen.has(key) && key !== 'white' && isPaletteColor(value)) {\n\t\t\tresult.push({ value: key, icon: 'color' as const })\n\t\t}\n\t}\n\n\treturn result\n}\n\nconst defaultFontIcons: Record<string, string> = {\n\tdraw: 'font-draw',\n\tsans: 'font-sans',\n\tserif: 'font-serif',\n\tmono: 'font-mono',\n}\n\n/**\n * Returns the current list of font style items for the style panel,\n * derived from the theme's font palette.\n *\n * Fonts are ordered by their position in {@link @tldraw/tlschema#DefaultFontStyle},\n * followed by any additional theme fonts in their object key order.\n *\n * @public\n */\nexport function getFontStyleItems(theme: TLTheme): StyleValuesForUi<string> {\n\tconst result: StyleValuesForUi<string>[number][] = []\n\tconst seen = new Set<string>()\n\n\tfor (const name of DefaultFontStyle.values) {\n\t\tconst entry = theme.fonts[name as keyof typeof theme.fonts]\n\t\tif (name in theme.fonts && isFontEntry(entry)) {\n\t\t\tresult.push({ value: name, icon: fontIcon(entry, name) })\n\t\t\tseen.add(name)\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(theme.fonts)) {\n\t\tif (!seen.has(key) && isFontEntry(value)) {\n\t\t\tresult.push({ value: key, icon: fontIcon(value, key) })\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunction fontIcon(font: TLThemeFont, name: string): string | TLUiIconJsx {\n\tif (font.icon != null) return font.icon as string | TLUiIconJsx\n\treturn defaultFontIcons[name] ?? 'font-draw'\n}\n\n// todo: default styles prop?\nexport const STYLES = {\n\tfill: [\n\t\t{ value: 'none', icon: 'fill-none' },\n\t\t{ value: 'semi', icon: 'fill-semi' },\n\t\t{ value: 'solid', icon: 'fill-solid' },\n\t],\n\tfillExtra: [\n\t\t{ value: 'pattern', icon: 'fill-pattern' },\n\t\t{ value: 'lined-fill', icon: 'fill-lined-fill' },\n\t\t{ value: 'fill', icon: 'fill-fill' },\n\t],\n\tdash: [\n\t\t{ value: 'draw', icon: 'dash-draw' },\n\t\t{ value: 'dashed', icon: 'dash-dashed' },\n\t\t{ value: 'dotted', icon: 'dash-dotted' },\n\t\t{ value: 'solid', icon: 'dash-solid' },\n\t],\n\tsize: [\n\t\t{ value: 's', icon: 'size-small' },\n\t\t{ value: 'm', icon: 'size-medium' },\n\t\t{ value: 'l', icon: 'size-large' },\n\t\t{ value: 'xl', icon: 'size-extra-large' },\n\t],\n\tfont: [\n\t\t{ value: 'draw', icon: 'font-draw' },\n\t\t{ value: 'sans', icon: 'font-sans' },\n\t\t{ value: 'serif', icon: 'font-serif' },\n\t\t{ value: 'mono', icon: 'font-mono' },\n\t],\n\ttextAlign: [\n\t\t{ value: 'start', icon: 'text-align-left' },\n\t\t{ value: 'middle', icon: 'text-align-center' },\n\t\t{ value: 'end', icon: 'text-align-right' },\n\t],\n\thorizontalAlign: [\n\t\t{ value: 'start', icon: 'horizontal-align-start' },\n\t\t{ value: 'middle', icon: 'horizontal-align-middle' },\n\t\t{ value: 'end', icon: 'horizontal-align-end' },\n\t],\n\tverticalAlign: [\n\t\t{ value: 'start', icon: 'vertical-align-start' },\n\t\t{ value: 'middle', icon: 'vertical-align-middle' },\n\t\t{ value: 'end', icon: 'vertical-align-end' },\n\t],\n\tarrowKind: [\n\t\t{ value: 'arc', icon: 'arrow-arc' },\n\t\t{ value: 'elbow', icon: 'arrow-elbow' },\n\t],\n\tarrowheadStart: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tarrowheadEnd: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tspline: [\n\t\t{ value: 'line', icon: 'spline-line' },\n\t\t{ value: 'cubic', icon: 'spline-cubic' },\n\t],\n} as const satisfies Record<string, StyleValuesForUi<string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