{"version":3,"file":"tailwindTheme.mjs","names":[],"sources":["../../src/tailwindTheme.mjs"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from './tokens/js/tokens-esm.js';\n\n/**\n * This function is adding agnostic\n * classes to the tailwind config.\n * the classes are without any prefix\n * while the CSS variables are still scoped\n *\n * Example class:\n * `.n-primary-text-default`\n * will point to the scoped CSS variable:\n * `--theme-color-primary-text-default`\n */\nconst themedPaletteWithoutPrefix = () => {\n  const flatkey = '';\n  const result = {};\n  const extractValue = (input, flatkey = '') => {\n    if (typeof input === 'object') {\n      Object.keys(input).forEach((key) => {\n        if (flatkey === '') {\n          extractValue(input[key], `${key}`);\n        } else {\n          extractValue(input[key], `${flatkey}-${key}`);\n        }\n      });\n    }\n    if (typeof input === 'string') {\n      flatkey = flatkey.replace('light-', '');\n      result[flatkey] = `var(--theme-color-${flatkey})`;\n    }\n  };\n  extractValue(tokens.theme.light.color, flatkey);\n  return result;\n};\n\n/**\n * This function is adding agnostic\n * shadow classes to the tailwind config.\n *\n * Example class:\n * `.n-shadow-overlay`\n * will point to the scoped CSS variable:\n * `--theme-shadow-overlay`\n */\nconst themedShadows = () => {\n  const result = {};\n  const extractValue = (input, flatkey = '') => {\n    if (typeof input === 'object') {\n      Object.keys(input).forEach((key) => {\n        extractValue(input[key], `${flatkey}-${key}`);\n      });\n    }\n    if (typeof input === 'string') {\n      flatkey = flatkey.replace('light-', '');\n      // Remove \"shadow-\" prefix as tailwind appends it automatically\n      const key = flatkey.replace('shadow-', '');\n      result[key] = `var(--theme-${flatkey})`;\n    }\n  };\n  extractValue(tokens.theme.light.boxShadow, 'shadow');\n  return result;\n};\n\n/** Prefixes all keys of an object with a given string, used for flat objects only */\nconst prefixProperties = (obj, prefix) =>\n  Object.keys(obj).reduce((acc, curr) => {\n    acc[`${prefix}-${curr}`] = obj[curr];\n    return acc;\n  }, {});\n\n/** @type {import('tailwindcss').Config['theme']} */\nexport const tailwindTheme = {\n  colors: {\n    ...tokens.palette,\n    graph: tokens.graph,\n    categorical: tokens.categorical,\n    dark: { ...tokens.theme.dark.color },\n    light: { ...tokens.theme.light.color },\n    // Add agnostic themed color classes to the tailwind config without the color prefix\n    ...themedPaletteWithoutPrefix(),\n  },\n  borderRadius: tokens.borderRadius,\n  boxShadow: {\n    /**\n     * Only `colors` property supports nesting in Tailwind config.\n     * Source: https://github.com/tailwindlabs/tailwindcss/discussions/2343\n     * To mitigate, the `dark` and `light` keys are prefixed in property name of the objects\n     */\n    ...prefixProperties(tokens.theme.dark.boxShadow, 'dark'),\n    ...prefixProperties(tokens.theme.light.boxShadow, 'light'),\n    ...themedShadows(),\n  },\n  /**\n   * Avoid colors being generated as shadow color classes\n   * Source: https://github.com/tailwindlabs/tailwindcss/discussions/11933\n   */\n  boxShadowColor: {},\n  fontFamily: {\n    sans: ['\"Public Sans\"', 'sans-serif'],\n    mono: ['\"Fira Code\"', 'monospace'],\n    syne: ['\"Syne Neo\"', 'sans-serif'],\n  },\n  screens: {\n    ...tokens.breakpoint,\n  },\n  /** Use our custom animation tokens */\n  transitionTimingFunction: {\n    DEFAULT: tokens.motion.easing.standard,\n  },\n  transitionDuration: {\n    DEFAULT: tokens.motion.duration.quick,\n    quick: tokens.motion.duration.quick,\n    slow: tokens.motion.duration.slow,\n  },\n  transitionDelay: {\n    DEFAULT: '0ms',\n    none: '0ms',\n    delayed: '100ms',\n  },\n  transit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