Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

theme.js.map 7.3KB

1
  1. {"version":3,"sources":["../../src/util/theme.ts"],"names":[],"mappings":";;;;AAAA,SAAS,UAAT,EAAqB,QAArB,EAA+B,UAA/B,QAAsD,cAAtD;AACA,OAAO,KAAK,IAAZ,MAAsB,uBAAtB;AACA,OAAO,KAAK,GAAZ,MAAqB,yBAArB;AAsBA,OAAM,SAAU,KAAV,CAAiB,KAAjB,EAAsF;AAAA,QAAd,MAAc,uEAAL,KAAK;;AAC1F,QAAM,SAAS,OAAO,IAAP,CAAY,KAAZ,CAAf;AACA,QAAM,cAAmB,EAAzB;AAEA,SAAK,IAAI,IAAI,CAAb,EAAgB,IAAI,OAAO,MAA3B,EAAmC,EAAE,CAArC,EAAwC;AACtC,YAAM,OAAO,OAAO,CAAP,CAAb;AACA,YAAM,QAAQ,MAAM,IAAN,CAAd;AAEA,YAAI,MAAJ,EAAY;AACV,gBAAI,SAAS,MAAT,IAAmB,KAAK,UAAL,CAAgB,SAAhB,CAAnB,IAAiD,KAAK,UAAL,CAAgB,QAAhB,CAArD,EAAgF;AAC9E,4BAAY,IAAZ,IAAoB,WAAW,KAAX,CAApB;AACD;AACF,SAJD,MAIO,IAAI,QAAO,KAAP,yCAAO,KAAP,OAAiB,QAArB,EAA+B;AACpC,wBAAY,IAAZ,IAAoB,MAAM,KAAN,EAAa,IAAb,CAApB;AACD,SAFM,MAEA;AACL,wBAAY,IAAZ,IAAoB,cAAc,IAAd,EAAoB,WAAW,KAAX,CAApB,CAApB;AACD;AACF;AAED,WAAO,WAAP;AACD;AAED;;;AAGA,IAAM,eAAe,SAAf,YAAe,CAAC,IAAD,EAAe,KAAf,EAAwC;AAC3D,mBACC,IADD,gCAEoB,KAFpB,sCAGgB,KAHhB,0BAKC,IALD,2BAMS,KANT,qCAOe,KAPf;AASD,CAVD;AAYA;;;AAGA,IAAM,kBAAkB,SAAlB,eA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,CAAU,GAAV,CAAb,CAAP;AACD;AAED,SAAS,MAAT,CAAiB,KAAjB,EAA6B,MAA7B,EAA2C;AACzC,QAAM,MAAM,IAAI,OAAJ,CAAY,KAAK,KAAL,CAAW,KAAX,CAAZ,CAAZ;AACA,QAAI,CAAJ,IAAS,IAAI,CAAJ,IAAS,SAAS,EAA3B;AACA,WAAO,KAAK,OAAL,CAAa,IAAI,KAAJ,CAAU,GAAV,CAAb,CAAP;AACD","sourcesContent":["import { colorToInt, intToHex, colorToHex, RGB } from './colorUtils'\nimport * as sRGB from './color/transformSRGB'\nimport * as LAB from './color/transformCIELAB'\nimport { VuetifyTheme } from 'vuetify/types'\n\ninterface ParsedThemeItem {\n base: string\n lighten5: string\n lighten4: string\n lighten3: string\n lighten2: string\n lighten1: string\n darken1: string\n darken2: string\n darken3: string\n darken4: string\n\n [name: string]: string\n}\n\ninterface ParsedTheme {\n [name: string]: ParsedThemeItem\n}\n\nexport function parse (theme: VuetifyTheme | Record<string, number | string>, isItem = false): ParsedTheme {\n const colors = Object.keys(theme)\n const parsedTheme: any = {}\n\n for (let i = 0; i < colors.length; ++i) {\n const name = colors[i]\n const value = theme[name]\n\n if (isItem) {\n if (name === 'base' || name.startsWith('lighten') || name.startsWith('darken')) {\n parsedTheme[name] = colorToHex(value)\n }\n } else if (typeof value === 'object') {\n parsedTheme[name] = parse(value, true)\n } else {\n parsedTheme[name] = genVariations(name, colorToInt(value))\n }\n }\n\n return parsedTheme\n}\n\n/**\n * Generate the CSS for a base color (.primary)\n */\nconst genBaseColor = (name: string, value: string): string => {\n return `\n.${name} {\n background-color: ${value} !important;\n border-color: ${value} !important;\n}\n.${name}--text {\n color: ${value} !important;\n caret-color: ${value} !important;\n}`\n}\n\n/**\n * Generate the CSS for a variant color (.primary.darken-2)\n */\nconst genVariantColor = (name: string, variant: string, value: string): string => {\n const [type, n] = variant.split(/(\\d)/, 2)\n return `\n.${name}.${type}-${n} {\n background-color: ${value} !important;\n border-color: ${value} !important;\n}\n.${name}--text.text--${type}-${n} {\n color: ${value} !important;\n caret-color: ${value} !important;\n}`\n}\n\nconst genColorVariableName = (name: string, variant = 'base'): string => `--v-${name}-${variant}`\n\nconst genColorVariable = (name: string, variant = 'base'): string => `var(${genColorVariableName(name, variant)})`\n\nexport function genStyles (theme: ParsedTheme, cssVar = false): string {\n const colors = Object.keys(theme)\n\n if (!colors.length) return ''\n\n let variablesCss = ''\n let css = ''\n\n const aColor = cssVar ? genColorVariable('primary') : theme.primary.base\n css += `a { color: ${aColor}; }`\n\n for (let i = 0; i < colors.length; ++i) {\n const name = colors[i]\n const value = theme[name]\n\n if (typeof value !== 'object') continue\n\n css += genBaseColor(name, cssVar ? genColorVariable(name) : value.base)\n cssVar && (variablesCss += ` ${genColorVariableName(name)}: ${value.base};\\n`)\n\n const variants = Object.keys(value)\n for (let i = 0; i < variants.length; ++i) {\n const variant = variants[i]\n const variantValue = value[variant]\n if (variant === 'base') continue\n\n css += genVariantColor(name, variant, cssVar ? genColorVariable(name, variant) : variantValue)\n cssVar && (variablesCss += ` ${genColorVariableName(name, variant)}: ${variantValue};\\n`)\n }\n }\n\n if (cssVar) {\n variablesCss = `:root {\\n${variablesCss}}\\n\\n`\n }\n\n return variablesCss + css\n}\n\nexport function genVariations (name: string, value: RGB): Record<string, string> {\n const values: Record<string, string> = {\n base: intToHex(value)\n }\n\n for (let i = 5; i > 0; --i) {\n values[`lighten${i}`] = intToHex(lighten(value, i))\n }\n\n for (let i = 1; i <= 4; ++i) {\n values[`darken${i}`] = intToHex(darken(value, i))\n }\n\n return values\n}\n\nfunction lighten (value: RGB, amount: number): RGB {\n const lab = LAB.fromXYZ(sRGB.toXYZ(value))\n lab[0] = lab[0] + amount * 10\n return sRGB.fromXYZ(LAB.toXYZ(lab))\n}\n\nfunction darken (value: RGB, amount: number): RGB {\n const lab = LAB.fromXYZ(sRGB.toXYZ(value))\n lab[0] = lab[0] - amount * 10\n return sRGB.fromXYZ(LAB.toXYZ(lab))\n}\n"],"sourceRoot":""}