@yahoo/uds 3.142.0 → 3.143.0

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.
Files changed (106) hide show
  1. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
  2. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
  3. package/dist/styles/styler.d.cts +3 -3
  4. package/dist/styles/styler.d.ts +3 -3
  5. package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.js.map +1 -1
  6. package/dist/tailwind/dist/automated-config/dist/properties.js.map +1 -1
  7. package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.js.map +1 -1
  8. package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.js.map +1 -1
  9. package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.js.map +1 -1
  10. package/dist/tailwind/dist/automated-config/dist/utils/index.js.map +1 -1
  11. package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.js.map +1 -1
  12. package/dist/tailwind/dist/cli/dist/lib/logger.js.map +1 -1
  13. package/dist/tailwind/dist/cli/dist/lib/print.js.map +1 -1
  14. package/dist/tailwind/dist/cli/dist/lib/spinner.js.map +1 -1
  15. package/dist/tailwind/dist/commands/css.helpers.js.map +1 -1
  16. package/dist/tailwind/dist/commands/css.js.map +1 -1
  17. package/dist/tailwind/dist/commands/generateComponentData.js.map +1 -1
  18. package/dist/tailwind/dist/commands/generatePurgeCSSData.js.map +1 -1
  19. package/dist/tailwind/dist/commands/purge.js.map +1 -1
  20. package/dist/tailwind/dist/css/generate.helpers.js.map +1 -1
  21. package/dist/tailwind/dist/css/generate.js.map +1 -1
  22. package/dist/tailwind/dist/css/nodeUtils.js.map +1 -1
  23. package/dist/tailwind/dist/css/perf.js.map +1 -1
  24. package/dist/tailwind/dist/css/postcss.helpers.js.map +1 -1
  25. package/dist/tailwind/dist/css/postcss.js.map +1 -1
  26. package/dist/tailwind/dist/css/purgeWorker.js.map +1 -1
  27. package/dist/tailwind/dist/css/runner.helpers.js.map +1 -1
  28. package/dist/tailwind/dist/css/runner.js.map +1 -1
  29. package/dist/tailwind/dist/css/utils.js.map +1 -1
  30. package/dist/tailwind/dist/css/workerPool.js.map +1 -1
  31. package/dist/tailwind/dist/css-tokens/dist/index.js.map +1 -1
  32. package/dist/tailwind/dist/fixtures/dist/index.cjs +0 -10
  33. package/dist/tailwind/dist/fixtures/dist/index.js +0 -10
  34. package/dist/tailwind/dist/fixtures/dist/index.js.map +1 -1
  35. package/dist/tailwind/dist/modes/dist/index.cjs +1 -0
  36. package/dist/tailwind/dist/modes/dist/index.js +1 -0
  37. package/dist/tailwind/dist/modes/dist/index.js.map +1 -1
  38. package/dist/tailwind/dist/plugin.js.map +1 -1
  39. package/dist/tailwind/dist/purger/legacy/purgeCSS.js.map +1 -1
  40. package/dist/tailwind/dist/purger/legacy/purgeFromCode.js.map +1 -1
  41. package/dist/tailwind/dist/purger/optimized/ast/expressions.js.map +1 -1
  42. package/dist/tailwind/dist/purger/optimized/purge.js.map +1 -1
  43. package/dist/tailwind/dist/purger/optimized/purgeFromCode.js.map +1 -1
  44. package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js.map +1 -1
  45. package/dist/tailwind/dist/purger/optimized/utils/files.js.map +1 -1
  46. package/dist/tailwind/dist/purger/optimized/utils/safelist.js.map +1 -1
  47. package/dist/tailwind/dist/runtimeConfig/hookMetadata.js.map +1 -1
  48. package/dist/tailwind/dist/tailwind/base/addColorModeVars.js.map +1 -1
  49. package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.js.map +1 -1
  50. package/dist/tailwind/dist/tailwind/base/addFontFaceDeclarations.js.map +1 -1
  51. package/dist/tailwind/dist/tailwind/base/addFontVars.js.map +1 -1
  52. package/dist/tailwind/dist/tailwind/base/addMotionVars.js.map +1 -1
  53. package/dist/tailwind/dist/tailwind/base/addScaleModeVars.js.map +1 -1
  54. package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.js.map +1 -1
  55. package/dist/tailwind/dist/tailwind/components/getHitTargetStyles.js.map +1 -1
  56. package/dist/tailwind/dist/tailwind/components/getIconStyles.js.map +1 -1
  57. package/dist/tailwind/dist/tailwind/components/getInputStyles.js.map +1 -1
  58. package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.js.map +1 -1
  59. package/dist/tailwind/dist/tailwind/plugins/a11y.js.map +1 -1
  60. package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js.map +1 -1
  61. package/dist/tailwind/dist/tailwind/plugins/borderRadius.js.map +1 -1
  62. package/dist/tailwind/dist/tailwind/plugins/borderWidth.js.map +1 -1
  63. package/dist/tailwind/dist/tailwind/plugins/breakpoints.js.map +1 -1
  64. package/dist/tailwind/dist/tailwind/plugins/colors.js.map +1 -1
  65. package/dist/tailwind/dist/tailwind/plugins/components.js.map +1 -1
  66. package/dist/tailwind/dist/tailwind/plugins/elevation.js.map +1 -1
  67. package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js.map +1 -1
  68. package/dist/tailwind/dist/tailwind/plugins/icons.js.map +1 -1
  69. package/dist/tailwind/dist/tailwind/plugins/input.js.map +1 -1
  70. package/dist/tailwind/dist/tailwind/plugins/motion.js.map +1 -1
  71. package/dist/tailwind/dist/tailwind/plugins/nestedBorderRadius.js.map +1 -1
  72. package/dist/tailwind/dist/tailwind/plugins/scaleMode.js.map +1 -1
  73. package/dist/tailwind/dist/tailwind/plugins/shadows.js.map +1 -1
  74. package/dist/tailwind/dist/tailwind/plugins/sizing.js.map +1 -1
  75. package/dist/tailwind/dist/tailwind/plugins/typography.js.map +1 -1
  76. package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.js.map +1 -1
  77. package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.js.map +1 -1
  78. package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js.map +1 -1
  79. package/dist/tailwind/dist/tailwind/utils/getColorModeStyles.js.map +1 -1
  80. package/dist/tailwind/dist/tailwind/utils/getElevationStyles.js.map +1 -1
  81. package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.js.map +1 -1
  82. package/dist/tailwind/dist/tailwind/utils/getFontStyles.js.map +1 -1
  83. package/dist/tailwind/dist/tailwind/utils/getMotionStyles.js.map +1 -1
  84. package/dist/tailwind/dist/tailwind/utils/getNestedBorderRadiusUtilities.js.map +1 -1
  85. package/dist/tailwind/dist/tailwind/utils/getScaleModeStyles.js.map +1 -1
  86. package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.js.map +1 -1
  87. package/dist/tailwind/dist/tailwind/utils/getShadowStyles.js.map +1 -1
  88. package/dist/tailwind/dist/utils/assertUnreachable.js.map +1 -1
  89. package/dist/tailwind/dist/utils/entries.js.map +1 -1
  90. package/dist/tailwind/dist/utils/entryPoints.js.map +1 -1
  91. package/dist/tailwind/dist/utils/fromEntries.js.map +1 -1
  92. package/dist/tailwind/dist/utils/generatePurgeCSSData.js.map +1 -1
  93. package/dist/tailwind/dist/utils/mapValues.js.map +1 -1
  94. package/dist/tailwind/dist/utils/opacity.js.map +1 -1
  95. package/dist/tailwind/dist/utils/optimizeCSS.js.map +1 -1
  96. package/dist/tailwind/dist/utils/parseTokens.js.map +1 -1
  97. package/dist/tailwind/dist/utils/postcssPreserveVars.js.map +1 -1
  98. package/dist/tailwind/dist/utils/tsMorph.js.map +1 -1
  99. package/dist/uds/generated/componentData.cjs +1311 -1311
  100. package/dist/uds/generated/componentData.js +1311 -1311
  101. package/dist/uds/generated/tailwindPurge.cjs +3 -0
  102. package/dist/uds/generated/tailwindPurge.js +3 -0
  103. package/dist/uds/package.cjs +2 -2
  104. package/dist/uds/package.js +2 -2
  105. package/generated/componentData.json +1692 -1692
  106. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"getResponsiveTextStyles.js","names":[],"sources":["../../../src/tailwind/components/getResponsiveTextStyles.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport {\n FONT_FAMILY_PREFIX,\n FONT_SIZE_PREFIX,\n FONT_SLANT_PREFIX,\n FONT_WEIGHT_PREFIX,\n FONT_WIDTH_PREFIX,\n LETTER_SPACING_PREFIX,\n LINE_HEIGHT_PREFIX,\n TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,\n TEXT_RESPONSIVE_CLASSNAME,\n TEXT_TRANSFORM_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport { textVariants } from '@yahoo/uds-fixtures';\nimport type { BreakpointWithBase, TypographyStyle } from '@yahoo/uds-types';\nimport { isString } from 'lodash';\n\nimport { assertUnreachable } from '../../utils/assertUnreachable';\nimport { entries } from '../../utils/entries';\nimport type { CssStyleObject } from './types';\n\nconst textVariantsSafe = (variant: string) => variant.replace('/', '-');\nconst BASE_SIZE = 16; // Base size in pixels for rem calculations\n\nconst toRem = (size: number) => `${size / BASE_SIZE}rem`;\n\nconst mapClassNames = (name: keyof typeof TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES) =>\n '.' + TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[name];\n\nconst getValue = (\n config: UniversalTokensConfig,\n variant: keyof UniversalTokensConfig['typography'],\n key: keyof TypographyStyle,\n breakpoint: BreakpointWithBase,\n): string => {\n const data = config.typography[variant]?.[key];\n\n if (!data) {\n throw new Error(`Missing typography data for variant \"${variant}\" and key \"${key}\"`);\n }\n\n const value = breakpoint === 'base' ? data.base : data.breakpoints?.[breakpoint];\n\n if (!value) {\n throw new Error(\n `Missing value for variant \"${variant}\", key \"${key}\", and breakpoint \"${breakpoint}\"`,\n );\n }\n\n if (isString(value)) {\n return value;\n }\n\n switch (value.type) {\n case 'px':\n return toRem(value.value);\n case 'unitless':\n return String(value.value);\n }\n\n return assertUnreachable(value);\n};\n\nconst convertFontAlias = (config: UniversalTokensConfig, value: string) => {\n if (value in config.font) {\n return `var(--${FONT_FAMILY_PREFIX}-${value})`;\n }\n\n return value;\n};\n\nconst cssVariablesForBreakpoint = (config: UniversalTokensConfig, breakpoint: BreakpointWithBase) =>\n Object.fromEntries(\n textVariants.flatMap((variant) => {\n const safeVariant = textVariantsSafe(variant);\n\n return [\n [\n `--${FONT_FAMILY_PREFIX}-${safeVariant}`,\n convertFontAlias(config, getValue(config, variant, 'fontFamily', breakpoint)),\n ],\n [`--${FONT_SIZE_PREFIX}-${safeVariant}`, getValue(config, variant, 'fontSize', breakpoint)],\n [\n `--${FONT_WEIGHT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontWeight', breakpoint),\n ],\n [\n `--${FONT_SLANT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontSlant', breakpoint),\n ],\n [\n `--${FONT_WIDTH_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontWidth', breakpoint),\n ],\n [\n `--${LINE_HEIGHT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'lineHeight', breakpoint),\n ],\n [\n `--${TEXT_TRANSFORM_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'textTransform', breakpoint),\n ],\n [\n `--${LETTER_SPACING_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'letterSpacing', breakpoint),\n ],\n ];\n }),\n ) as unknown as CssStyleObject;\n\nconst tailwindConfigPerVariant = (prefix: string) =>\n Object.fromEntries(\n textVariants.map(textVariantsSafe).map((variant) => [variant, `var(--${prefix}-${variant})`]),\n );\n\nconst RESPONSIVE_TAILWIND_CONFIG_MAP = {\n fontFamily: tailwindConfigPerVariant(FONT_FAMILY_PREFIX),\n fontWeight: tailwindConfigPerVariant(FONT_WEIGHT_PREFIX),\n fontSlant: tailwindConfigPerVariant(FONT_SLANT_PREFIX),\n fontWidth: tailwindConfigPerVariant(FONT_WIDTH_PREFIX),\n fontSize: tailwindConfigPerVariant(FONT_SIZE_PREFIX),\n lineHeight: tailwindConfigPerVariant(LINE_HEIGHT_PREFIX),\n textTransform: tailwindConfigPerVariant(TEXT_TRANSFORM_PREFIX),\n letterSpacing: tailwindConfigPerVariant(LETTER_SPACING_PREFIX),\n};\n\nconst getBaseTextVars = (config: UniversalTokensConfig) => {\n return cssVariablesForBreakpoint(config, 'base');\n};\n\nconst getResponsiveTextStyles = (config: UniversalTokensConfig) => {\n // Mobile first approach: find the smallest breakpoint\n const breakpoints = entries(config.breakpoints).sort(\n ([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB,\n );\n\n return {\n // Order necessary for CSS specificity.\n // 1. Class to opt-in an element and its children to responsive text styles.\n [`.${TEXT_RESPONSIVE_CLASSNAME}`]: Object.fromEntries(\n breakpoints.map(([name, { value: minWidth }]) => [\n // If its the smallest breakpoint, we set the base styles\n `@media (min-width: ${minWidth}px)`,\n cssVariablesForBreakpoint(config, name),\n ]),\n ),\n\n // 2. Classes for locking to a specific breakpoint.\n [mapClassNames('base')]: cssVariablesForBreakpoint(config, 'base'),\n\n [mapClassNames('defaultBreakpoint')]: cssVariablesForBreakpoint(\n config,\n config.globalDefaults.breakpoint,\n ),\n\n ...Object.fromEntries(\n breakpoints.map(([name]) => [mapClassNames(name), cssVariablesForBreakpoint(config, name)]),\n ),\n } as CssStyleObject;\n};\n\nexport {\n cssVariablesForBreakpoint,\n getBaseTextVars,\n getResponsiveTextStyles,\n RESPONSIVE_TAILWIND_CONFIG_MAP,\n textVariantsSafe,\n};\n"],"mappings":";;;;;;;AAqBA,MAAM,oBAAoB,YAAoB,QAAQ,QAAQ,KAAK,IAAI;AACvE,MAAM,YAAY;AAElB,MAAM,SAAS,SAAiB,GAAG,OAAO,UAAU;AAEpD,MAAM,iBAAiB,SACrB,MAAM,sCAAsC;AAE9C,MAAM,YACJ,QACA,SACA,KACA,eACW;CACX,MAAM,OAAO,OAAO,WAAW,WAAW;AAE1C,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,wCAAwC,QAAQ,aAAa,IAAI,GAAG;CAGtF,MAAM,QAAQ,eAAe,SAAS,KAAK,OAAO,KAAK,cAAc;AAErE,KAAI,CAAC,MACH,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F;AAEH,MAAM,iCAAiC;CACrC,YAAY,yBAAyB,mBAAmB;CACxD,YAAY,yBAAyB,mBAAmB;CACxD,WAAW,yBAAyB,kBAAkB;CACtD,WAAW,yBAAyB,kBAAkB;CACtD,UAAU,yBAAyB,iBAAiB;CACpD,YAAY,yBAAyB,mBAAmB;CACxD,eAAe,yBAAyB,sBAAsB;CAC9D,eAAe,yBAAyB,sBAAsB;CAC/D;AAED,MAAM,mBAAmB,WAAkC;AACzD,QAAO,0BAA0B,QAAQ,OAAO;;AAGlD,MAAM,2BAA2B,WAAkC;CAEjE,MAAM,cAAc,QAAQ,OAAO,YAAY,CAAC,MAC7C,GAAG,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,iBAAiB,YAAY,UACrE;AAED,QAAO;GAGJ,IAAI,8BAA8B,OAAO,YACxC,YAAY,KAAK,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAE/C,sBAAsB,SAAS,MAC/B,0BAA0B,QAAQ,KAAK,CACxC,CAAC,CACH;GAGA,cAAc,OAAO,GAAG,0BAA0B,QAAQ,OAAO;GAEjE,cAAc,oBAAoB,GAAG,0BACpC,QACA,OAAO,eAAe,WACvB;EAED,GAAG,OAAO,YACR,YAAY,KAAK,CAAC,UAAU,CAAC,cAAc,KAAK,EAAE,0BAA0B,QAAQ,KAAK,CAAC,CAAC,CAC5F;EACF"}
1
+ {"version":3,"file":"getResponsiveTextStyles.js","names":[],"sources":["../../../src/tailwind/components/getResponsiveTextStyles.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport {\n FONT_FAMILY_PREFIX,\n FONT_SIZE_PREFIX,\n FONT_SLANT_PREFIX,\n FONT_WEIGHT_PREFIX,\n FONT_WIDTH_PREFIX,\n LETTER_SPACING_PREFIX,\n LINE_HEIGHT_PREFIX,\n TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,\n TEXT_RESPONSIVE_CLASSNAME,\n TEXT_TRANSFORM_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport { textVariants } from '@yahoo/uds-fixtures';\nimport type { BreakpointWithBase, TypographyStyle } from '@yahoo/uds-types';\nimport { isString } from 'lodash';\n\nimport { assertUnreachable } from '../../utils/assertUnreachable';\nimport { entries } from '../../utils/entries';\nimport type { CssStyleObject } from './types';\n\nconst textVariantsSafe = (variant: string) => variant.replace('/', '-');\nconst BASE_SIZE = 16; // Base size in pixels for rem calculations\n\nconst toRem = (size: number) => `${size / BASE_SIZE}rem`;\n\nconst mapClassNames = (name: keyof typeof TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES) =>\n '.' + TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[name];\n\nconst getValue = (\n config: UniversalTokensConfig,\n variant: keyof UniversalTokensConfig['typography'],\n key: keyof TypographyStyle,\n breakpoint: BreakpointWithBase,\n): string => {\n const data = config.typography[variant]?.[key];\n\n if (!data) {\n throw new Error(`Missing typography data for variant \"${variant}\" and key \"${key}\"`);\n }\n\n const value = breakpoint === 'base' ? data.base : data.breakpoints?.[breakpoint];\n\n if (!value) {\n throw new Error(\n `Missing value for variant \"${variant}\", key \"${key}\", and breakpoint \"${breakpoint}\"`,\n );\n }\n\n if (isString(value)) {\n return value;\n }\n\n switch (value.type) {\n case 'px':\n return toRem(value.value);\n case 'unitless':\n return String(value.value);\n }\n\n return assertUnreachable(value);\n};\n\nconst convertFontAlias = (config: UniversalTokensConfig, value: string) => {\n if (value in config.font) {\n return `var(--${FONT_FAMILY_PREFIX}-${value})`;\n }\n\n return value;\n};\n\nconst cssVariablesForBreakpoint = (config: UniversalTokensConfig, breakpoint: BreakpointWithBase) =>\n Object.fromEntries(\n textVariants.flatMap((variant) => {\n const safeVariant = textVariantsSafe(variant);\n\n return [\n [\n `--${FONT_FAMILY_PREFIX}-${safeVariant}`,\n convertFontAlias(config, getValue(config, variant, 'fontFamily', breakpoint)),\n ],\n [`--${FONT_SIZE_PREFIX}-${safeVariant}`, getValue(config, variant, 'fontSize', breakpoint)],\n [\n `--${FONT_WEIGHT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontWeight', breakpoint),\n ],\n [\n `--${FONT_SLANT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontSlant', breakpoint),\n ],\n [\n `--${FONT_WIDTH_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'fontWidth', breakpoint),\n ],\n [\n `--${LINE_HEIGHT_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'lineHeight', breakpoint),\n ],\n [\n `--${TEXT_TRANSFORM_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'textTransform', breakpoint),\n ],\n [\n `--${LETTER_SPACING_PREFIX}-${safeVariant}`,\n getValue(config, variant, 'letterSpacing', breakpoint),\n ],\n ];\n }),\n ) as unknown as CssStyleObject;\n\nconst tailwindConfigPerVariant = (prefix: string) =>\n Object.fromEntries(\n textVariants.map(textVariantsSafe).map((variant) => [variant, `var(--${prefix}-${variant})`]),\n );\n\nconst RESPONSIVE_TAILWIND_CONFIG_MAP = {\n fontFamily: tailwindConfigPerVariant(FONT_FAMILY_PREFIX),\n fontWeight: tailwindConfigPerVariant(FONT_WEIGHT_PREFIX),\n fontSlant: tailwindConfigPerVariant(FONT_SLANT_PREFIX),\n fontWidth: tailwindConfigPerVariant(FONT_WIDTH_PREFIX),\n fontSize: tailwindConfigPerVariant(FONT_SIZE_PREFIX),\n lineHeight: tailwindConfigPerVariant(LINE_HEIGHT_PREFIX),\n textTransform: tailwindConfigPerVariant(TEXT_TRANSFORM_PREFIX),\n letterSpacing: tailwindConfigPerVariant(LETTER_SPACING_PREFIX),\n};\n\nconst getBaseTextVars = (config: UniversalTokensConfig) => {\n return cssVariablesForBreakpoint(config, 'base');\n};\n\nconst getResponsiveTextStyles = (config: UniversalTokensConfig) => {\n // Mobile first approach: find the smallest breakpoint\n const breakpoints = entries(config.breakpoints).sort(\n ([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB,\n );\n\n return {\n // Order necessary for CSS specificity.\n // 1. Class to opt-in an element and its children to responsive text styles.\n [`.${TEXT_RESPONSIVE_CLASSNAME}`]: Object.fromEntries(\n breakpoints.map(([name, { value: minWidth }]) => [\n // If its the smallest breakpoint, we set the base styles\n `@media (min-width: ${minWidth}px)`,\n cssVariablesForBreakpoint(config, name),\n ]),\n ),\n\n // 2. Classes for locking to a specific breakpoint.\n [mapClassNames('base')]: cssVariablesForBreakpoint(config, 'base'),\n\n [mapClassNames('defaultBreakpoint')]: cssVariablesForBreakpoint(\n config,\n config.globalDefaults.breakpoint,\n ),\n\n ...Object.fromEntries(\n breakpoints.map(([name]) => [mapClassNames(name), cssVariablesForBreakpoint(config, name)]),\n ),\n } as CssStyleObject;\n};\n\nexport {\n cssVariablesForBreakpoint,\n getBaseTextVars,\n getResponsiveTextStyles,\n RESPONSIVE_TAILWIND_CONFIG_MAP,\n textVariantsSafe,\n};\n"],"mappings":";;;;;;;AAqBA,MAAM,oBAAoB,YAAoB,QAAQ,QAAQ,KAAK,IAAI;AACvE,MAAM,YAAY;AAElB,MAAM,SAAS,SAAiB,GAAG,OAAO,UAAU;AAEpD,MAAM,iBAAiB,SACrB,MAAM,sCAAsC;AAE9C,MAAM,YACJ,QACA,SACA,KACA,eACW;CACX,MAAM,OAAO,OAAO,WAAW,WAAW;CAE1C,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,wCAAwC,QAAQ,aAAa,IAAI,GAAG;CAGtF,MAAM,QAAQ,eAAe,SAAS,KAAK,OAAO,KAAK,cAAc;CAErE,IAAI,CAAC,OACH,MAAM,IAAI,MACR,8BAA8B,QAAQ,UAAU,IAAI,qBAAqB,WAAW,GACrF;CAGH,IAAI,SAAS,MAAM,EACjB,OAAO;CAGT,QAAQ,MAAM,MAAd;EACE,KAAK,MACH,OAAO,MAAM,MAAM,MAAM;EAC3B,KAAK,YACH,OAAO,OAAO,MAAM,MAAM;;CAG9B,OAAO,kBAAkB,MAAM;;AAGjC,MAAM,oBAAoB,QAA+B,UAAkB;CAC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AmB,WAAkC;CACzD,OAAO,0BAA0B,QAAQ,OAAO;;AAGlD,MAAM,2BAA2B,WAAkC;CAEjE,MAAM,cAAc,QAAQ,OAAO,YAAY,CAAC,MAC7C,GAAG,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,iBAAiB,YAAY,UACrE;CAED,OAAO;GAGJ,IAAI,8BAA8B,OAAO,YACxC,YAAY,KAAK,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAE/C,sBAAsB,SAAS,MAC/B,0BAA0B,QAAQ,KAAK,CACxC,CAAC,CACH;GAGA,cAAc,OAAO,GAAG,0BAA0B,QAAQ,OAAO;GAEjE,cAAc,oBAAoB,GAAG,0BACpC,QACA,OAAO,eAAe,WACvB;EAED,GAAG,OAAO,YACR,YAAY,KAAK,CAAC,UAAU,CAAC,cAAc,KAAK,EAAE,0BAA0B,QAAQ,KAAK,CAAC,CAAC,CAC5F;EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"a11y.js","names":[],"sources":["../../../src/tailwind/plugins/a11y.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getFocusRingStyles } from '../components/getFocusRingStyles';\nimport { getHitTargetStyles } from '../components/getHitTargetStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst a11yPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addComponents }) => {\n // TODO: Skip when `useImportNamespace`?\n const hitTargetStyles = getHitTargetStyles();\n addComponents(hitTargetStyles);\n\n // TODO: Skip when `useImportNamespace`?\n const focusRingStyles = getFocusRingStyles();\n addComponents(focusRingStyles);\n },\n\n () => ({\n // Guarantee that the dark mode class is not purged\n safelist: ['uds-hit-target', 'uds-ring'],\n theme: {\n extend: {\n /**\n * Used in @ariakit/react https://ariakit.org/guide/styling#aria\n * By default, Tailwind offers all of these. Including in this config\n * to provide links to ariakit docs for ones that are shared between the two.\n * This is not exhaustive, and only includes the shared ones at the moment.\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L17\n */\n aria: {\n /** https://ariakit.org/guide/styling#aria-checked */\n checked: 'checked=\"true\"',\n /** https://ariakit.org/guide/styling#aria-disabled */\n disabled: 'disabled=\"true\"',\n /** https://ariakit.org/guide/styling#aria-expanded */\n expanded: 'expanded=\"true\"',\n /** https://ariakit.org/guide/styling#aria-invalid */\n invalid: 'aria-invalid=\"true\"',\n },\n /**\n * Used in @ariakit/react https://ariakit.org/guide/styling#css-selectors\n * By default, Tailwind does not include any values for this option\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L888\n */\n data: {\n active: 'active=\"true\"',\n 'active-item': 'active-item=\"true\"',\n autofill: 'autofill=\"true\"',\n backdrop: 'backdrop=\"true\"',\n enter: 'enter=\"true\"',\n leave: 'leave=\"true\"',\n 'focus-visible': 'focus-visible=\"true\"',\n },\n },\n },\n }),\n);\n\nexport { a11yPlugin };\n"],"mappings":";;;;;AAMA,MAAM,aAAa,OAAO,mBAErB,EAAE,oBAAoB;AAGrB,eADwB,oBACK,CAAC;AAI9B,eADwB,oBACK,CAAC;UAG3B;CAEL,UAAU,CAAC,kBAAkB,WAAW;CACxC,OAAO,EACL,QAAQ;;;;;;;;EAQN,MAAM;;GAEJ,SAAS;;GAET,UAAU;;GAEV,UAAU;;GAEV,SAAS;GACV;;;;;;EAMD,MAAM;GACJ,QAAQ;GACR,eAAe;GACf,UAAU;GACV,UAAU;GACV,OAAO;GACP,OAAO;GACP,iBAAiB;GAClB;EACF,EACF;CACF,EACF"}
1
+ {"version":3,"file":"a11y.js","names":[],"sources":["../../../src/tailwind/plugins/a11y.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getFocusRingStyles } from '../components/getFocusRingStyles';\nimport { getHitTargetStyles } from '../components/getHitTargetStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst a11yPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addComponents }) => {\n // TODO: Skip when `useImportNamespace`?\n const hitTargetStyles = getHitTargetStyles();\n addComponents(hitTargetStyles);\n\n // TODO: Skip when `useImportNamespace`?\n const focusRingStyles = getFocusRingStyles();\n addComponents(focusRingStyles);\n },\n\n () => ({\n // Guarantee that the dark mode class is not purged\n safelist: ['uds-hit-target', 'uds-ring'],\n theme: {\n extend: {\n /**\n * Used in @ariakit/react https://ariakit.org/guide/styling#aria\n * By default, Tailwind offers all of these. Including in this config\n * to provide links to ariakit docs for ones that are shared between the two.\n * This is not exhaustive, and only includes the shared ones at the moment.\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L17\n */\n aria: {\n /** https://ariakit.org/guide/styling#aria-checked */\n checked: 'checked=\"true\"',\n /** https://ariakit.org/guide/styling#aria-disabled */\n disabled: 'disabled=\"true\"',\n /** https://ariakit.org/guide/styling#aria-expanded */\n expanded: 'expanded=\"true\"',\n /** https://ariakit.org/guide/styling#aria-invalid */\n invalid: 'aria-invalid=\"true\"',\n },\n /**\n * Used in @ariakit/react https://ariakit.org/guide/styling#css-selectors\n * By default, Tailwind does not include any values for this option\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L888\n */\n data: {\n active: 'active=\"true\"',\n 'active-item': 'active-item=\"true\"',\n autofill: 'autofill=\"true\"',\n backdrop: 'backdrop=\"true\"',\n enter: 'enter=\"true\"',\n leave: 'leave=\"true\"',\n 'focus-visible': 'focus-visible=\"true\"',\n },\n },\n },\n }),\n);\n\nexport { a11yPlugin };\n"],"mappings":";;;;;AAMA,MAAM,aAAa,OAAO,mBAErB,EAAE,oBAAoB;CAGrB,cADwB,oBACK,CAAC;CAI9B,cADwB,oBACK,CAAC;UAG3B;CAEL,UAAU,CAAC,kBAAkB,WAAW;CACxC,OAAO,EACL,QAAQ;;;;;;;;EAQN,MAAM;;GAEJ,SAAS;;GAET,UAAU;;GAEV,UAAU;;GAEV,SAAS;GACV;;;;;;EAMD,MAAM;GACJ,QAAQ;GACR,eAAe;GACf,UAAU;GACV,UAAU;GACV,OAAO;GACP,OAAO;GACP,iBAAiB;GAClB;EACF,EACF;CACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"blurBgFallback.js","names":[],"sources":["../../../src/tailwind/plugins/blurBgFallback.ts"],"sourcesContent":["import {\n BACKGROUND_BLUR_COLOR_PREFIX,\n BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n// .uds-bgBlurFillFallback — for the element that has the fill property\n// .uds-bgBlurFallback — for the element that has the backdrop-filter property\n\nconst blurBgFallbackPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addUtilities }) => {\n addUtilities({\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n\n '@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))': {\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_COLOR_PREFIX})`,\n },\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_COLOR_PREFIX})`,\n WebkitBackdropFilter: 'var(--uds-backdrop-blur)',\n backdropFilter: 'var(--uds-backdrop-blur)',\n },\n },\n\n '@media (prefers-reduced-transparency)': {\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n WebkitBackdropFilter: 'none',\n backdropFilter: 'none',\n },\n },\n });\n },\n\n () => ({\n safelist: ['uds-bgBlurFillFallback', 'uds-bgBlurFallback'],\n }),\n);\n\nexport { blurBgFallbackPlugin };\n"],"mappings":";;;;AAWA,MAAM,uBAAuB,OAAO,mBAE/B,EAAE,mBAAmB;AACpB,cAAa;EACX,2BAA2B,EACzB,MAAM,SAAS,sCAAsC,IACtD;EAED,uBAAuB,EACrB,iBAAiB,SAAS,sCAAsC,IACjE;EAED,kFAAkF;GAChF,2BAA2B,EACzB,MAAM,SAAS,6BAA6B,IAC7C;GACD,uBAAuB;IACrB,iBAAiB,SAAS,6BAA6B;IACvD,sBAAsB;IACtB,gBAAgB;IACjB;GACF;EAED,yCAAyC;GACvC,2BAA2B,EACzB,MAAM,SAAS,sCAAsC,IACtD;GACD,uBAAuB;IACrB,iBAAiB,SAAS,sCAAsC;IAChE,sBAAsB;IACtB,gBAAgB;IACjB;GACF;EACF,CAAC;UAGC,EACL,UAAU,CAAC,0BAA0B,qBAAqB,EAC3D,EACF"}
1
+ {"version":3,"file":"blurBgFallback.js","names":[],"sources":["../../../src/tailwind/plugins/blurBgFallback.ts"],"sourcesContent":["import {\n BACKGROUND_BLUR_COLOR_PREFIX,\n BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n// .uds-bgBlurFillFallback — for the element that has the fill property\n// .uds-bgBlurFallback — for the element that has the backdrop-filter property\n\nconst blurBgFallbackPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addUtilities }) => {\n addUtilities({\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n\n '@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))': {\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_COLOR_PREFIX})`,\n },\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_COLOR_PREFIX})`,\n WebkitBackdropFilter: 'var(--uds-backdrop-blur)',\n backdropFilter: 'var(--uds-backdrop-blur)',\n },\n },\n\n '@media (prefers-reduced-transparency)': {\n '.uds-bgBlurFillFallback': {\n fill: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n },\n '.uds-bgBlurFallback': {\n backgroundColor: `var(--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX})`,\n WebkitBackdropFilter: 'none',\n backdropFilter: 'none',\n },\n },\n });\n },\n\n () => ({\n safelist: ['uds-bgBlurFillFallback', 'uds-bgBlurFallback'],\n }),\n);\n\nexport { blurBgFallbackPlugin };\n"],"mappings":";;;;AAWA,MAAM,uBAAuB,OAAO,mBAE/B,EAAE,mBAAmB;CACpB,aAAa;EACX,2BAA2B,EACzB,MAAM,SAAS,sCAAsC,IACtD;EAED,uBAAuB,EACrB,iBAAiB,SAAS,sCAAsC,IACjE;EAED,kFAAkF;GAChF,2BAA2B,EACzB,MAAM,SAAS,6BAA6B,IAC7C;GACD,uBAAuB;IACrB,iBAAiB,SAAS,6BAA6B;IACvD,sBAAsB;IACtB,gBAAgB;IACjB;GACF;EAED,yCAAyC;GACvC,2BAA2B,EACzB,MAAM,SAAS,sCAAsC,IACtD;GACD,uBAAuB;IACrB,iBAAiB,SAAS,sCAAsC;IAChE,sBAAsB;IACtB,gBAAgB;IACjB;GACF;EACF,CAAC;UAGC,EACL,UAAU,CAAC,0BAA0B,qBAAqB,EAC3D,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"borderRadius.js","names":[],"sources":["../../../src/tailwind/plugins/borderRadius.ts"],"sourcesContent":["import { BORDER_RADIUS_PREFIX } from '@yahoo/uds-css-tokens';\nimport { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport type { BorderRadiusConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BORDER_RADIUS_THEME_KEY = 'udsBorderRadius';\n\nconst udsBorderRadiusToCSSVariable = (token: string) => `var(--${BORDER_RADIUS_PREFIX}-${token})`;\n\nconst getBorderRadiusTheme = (\n config: BorderRadiusConfig,\n mergeTokensIntoTailwindTheme: boolean,\n) => {\n /**\n * Given the UDS border radius tokens in config (none, xs, sm, md, lg, xl, full), create a tailwind\n * border radius theme value that points to the corresponding UDS CSS variables.\n *\n * For example:\n *\n * {\n * sm: 'var(--uds-border-radius-sm)',\n * md: 'var(--uds-border-radius-md)',\n * }\n *\n * Note: The values of the CSS variables are defined elsewhere. This code only ensures the Tailwind-generated\n * classes are mapped to the correct CSS variable.\n */\n const udsBorderRadii = fromEntries(\n Object.keys(config).map((udsAlias) => [udsAlias, udsBorderRadiusToCSSVariable(udsAlias)]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border radius values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii,\n };\n }\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border radius values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii,\n\n // Also overwrite the default Tailwind border radius theme values with UDS values for consistency.\n borderRadius: {\n ...udsBorderRadii,\n\n // Set the Tailwind 'DEFAULT' tailwind border radius to map to UDS 'sm' border radius\n DEFAULT: udsBorderRadiusToCSSVariable('sm'),\n\n // Set the Tailwind 'sm' tailwind border radius to map to UDS 'xs' border radius\n // See: https://ouryahoo.slack.com/archives/C04TLTQN6EM/p1724352657515249\n sm: udsBorderRadiusToCSSVariable('xs'),\n },\n };\n};\n\nconst borderRadiusPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n 'uds-border-radius': (value) => ({\n 'border-radius': value,\n }),\n\n 'uds-border-top-start-radius': (value) => ({\n 'border-start-start-radius': value,\n }),\n\n 'uds-border-top-end-radius': (value) => ({\n 'border-start-end-radius': value,\n }),\n\n 'uds-border-bottom-start-radius': (value) => ({\n 'border-end-start-radius': value,\n }),\n\n 'uds-border-bottom-end-radius': (value) => ({\n 'border-end-end-radius': value,\n }),\n },\n { values: theme(UDS_BORDER_RADIUS_THEME_KEY) },\n );\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderRadiusTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderRadius',\n );\n\n return {\n theme: {\n extend: {\n ...getBorderRadiusTheme(\n // The border radius values are currently stored in the config from the default scale mode.\n config.scaleMode[DEFAULT_SCALE_MODE].borderRadius,\n !shouldNotMergeBorderRadiusTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport {\n borderRadiusPlugin,\n getBorderRadiusTheme,\n UDS_BORDER_RADIUS_THEME_KEY,\n udsBorderRadiusToCSSVariable,\n};\n"],"mappings":";;;;;;;AASA,MAAM,8BAA8B;AAEpC,MAAM,gCAAgC,UAAkB,SAAS,qBAAqB,GAAG,MAAM;AAE/F,MAAM,wBACJ,QACA,iCACG;;;;;;;;;;;;;;;CAeH,MAAM,iBAAiB,YACrB,OAAO,KAAK,OAAO,CAAC,KAAK,aAAa,CAAC,UAAU,6BAA6B,SAAS,CAAC,CAAC,CAC1F;AAED,KAAI,CAAC,6BAGH,QAAO,GACJ,8BAA8B,gBAChC;AAGH,QAAO;GAGJ,8BAA8B;EAG/B,cAAc;GACZ,GAAG;GAGH,SAAS,6BAA6B,KAAK;GAI3C,IAAI,6BAA6B,KAAK;GACvC;EACF;;AAGH,MAAM,qBAAqB,OAAO,mBAE7B,EAAE,gBAAgB,YAAY;AAC7B,gBACE;EACE,sBAAsB,WAAW,EAC/B,iBAAiB,OAClB;EAED,gCAAgC,WAAW,EACzC,6BAA6B,OAC9B;EAED,8BAA8B,WAAW,EACvC,2BAA2B,OAC5B;EAED,mCAAmC,WAAW,EAC5C,2BAA2B,OAC5B;EAED,iCAAiC,WAAW,EAC1C,yBAAyB,OAC1B;EACF,EACD,EAAE,QAAQ,MAAM,4BAA4B,EAAE,CAC/C;IAGJ,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,oDAAoD,sCACxD,8BACA,eACD;AAED,QAAO,EACL,OAAO,EACL,QAAQ,EACN,GAAG,qBAED,OAAO,UAAU,oBAAoB,cACrC,CAAC,kDACF,EACF,EACF,EACF;EAEJ"}
1
+ {"version":3,"file":"borderRadius.js","names":[],"sources":["../../../src/tailwind/plugins/borderRadius.ts"],"sourcesContent":["import { BORDER_RADIUS_PREFIX } from '@yahoo/uds-css-tokens';\nimport { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport type { BorderRadiusConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BORDER_RADIUS_THEME_KEY = 'udsBorderRadius';\n\nconst udsBorderRadiusToCSSVariable = (token: string) => `var(--${BORDER_RADIUS_PREFIX}-${token})`;\n\nconst getBorderRadiusTheme = (\n config: BorderRadiusConfig,\n mergeTokensIntoTailwindTheme: boolean,\n) => {\n /**\n * Given the UDS border radius tokens in config (none, xs, sm, md, lg, xl, full), create a tailwind\n * border radius theme value that points to the corresponding UDS CSS variables.\n *\n * For example:\n *\n * {\n * sm: 'var(--uds-border-radius-sm)',\n * md: 'var(--uds-border-radius-md)',\n * }\n *\n * Note: The values of the CSS variables are defined elsewhere. This code only ensures the Tailwind-generated\n * classes are mapped to the correct CSS variable.\n */\n const udsBorderRadii = fromEntries(\n Object.keys(config).map((udsAlias) => [udsAlias, udsBorderRadiusToCSSVariable(udsAlias)]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border radius values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii,\n };\n }\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border radius values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii,\n\n // Also overwrite the default Tailwind border radius theme values with UDS values for consistency.\n borderRadius: {\n ...udsBorderRadii,\n\n // Set the Tailwind 'DEFAULT' tailwind border radius to map to UDS 'sm' border radius\n DEFAULT: udsBorderRadiusToCSSVariable('sm'),\n\n // Set the Tailwind 'sm' tailwind border radius to map to UDS 'xs' border radius\n // See: https://ouryahoo.slack.com/archives/C04TLTQN6EM/p1724352657515249\n sm: udsBorderRadiusToCSSVariable('xs'),\n },\n };\n};\n\nconst borderRadiusPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n 'uds-border-radius': (value) => ({\n 'border-radius': value,\n }),\n\n 'uds-border-top-start-radius': (value) => ({\n 'border-start-start-radius': value,\n }),\n\n 'uds-border-top-end-radius': (value) => ({\n 'border-start-end-radius': value,\n }),\n\n 'uds-border-bottom-start-radius': (value) => ({\n 'border-end-start-radius': value,\n }),\n\n 'uds-border-bottom-end-radius': (value) => ({\n 'border-end-end-radius': value,\n }),\n },\n { values: theme(UDS_BORDER_RADIUS_THEME_KEY) },\n );\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderRadiusTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderRadius',\n );\n\n return {\n theme: {\n extend: {\n ...getBorderRadiusTheme(\n // The border radius values are currently stored in the config from the default scale mode.\n config.scaleMode[DEFAULT_SCALE_MODE].borderRadius,\n !shouldNotMergeBorderRadiusTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport {\n borderRadiusPlugin,\n getBorderRadiusTheme,\n UDS_BORDER_RADIUS_THEME_KEY,\n udsBorderRadiusToCSSVariable,\n};\n"],"mappings":";;;;;;;AASA,MAAM,8BAA8B;AAEpC,MAAM,gCAAgC,UAAkB,SAAS,qBAAqB,GAAG,MAAM;AAE/F,MAAM,wBACJ,QACA,iCACG;;;;;;;;;;;;;;;CAeH,MAAM,iBAAiB,YACrB,OAAO,KAAK,OAAO,CAAC,KAAK,aAAa,CAAC,UAAU,6BAA6B,SAAS,CAAC,CAAC,CAC1F;CAED,IAAI,CAAC,8BAGH,OAAO,GACJ,8BAA8B,gBAChC;CAGH,OAAO;GAGJ,8BAA8B;EAG/B,cAAc;GACZ,GAAG;GAGH,SAAS,6BAA6B,KAAK;GAI3C,IAAI,6BAA6B,KAAK;GACvC;EACF;;AAGH,MAAM,qBAAqB,OAAO,mBAE7B,EAAE,gBAAgB,YAAY;CAC7B,eACE;EACE,sBAAsB,WAAW,EAC/B,iBAAiB,OAClB;EAED,gCAAgC,WAAW,EACzC,6BAA6B,OAC9B;EAED,8BAA8B,WAAW,EACvC,2BAA2B,OAC5B;EAED,mCAAmC,WAAW,EAC5C,2BAA2B,OAC5B;EAED,iCAAiC,WAAW,EAC1C,yBAAyB,OAC1B;EACF,EACD,EAAE,QAAQ,MAAM,4BAA4B,EAAE,CAC/C;IAGJ,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,oDAAoD,sCACxD,8BACA,eACD;CAED,OAAO,EACL,OAAO,EACL,QAAQ,EACN,GAAG,qBAED,OAAO,UAAU,oBAAoB,cACrC,CAAC,kDACF,EACF,EACF,EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"borderWidth.js","names":[],"sources":["../../../src/tailwind/plugins/borderWidth.ts"],"sourcesContent":["import { BORDER_WIDTH_PREFIX } from '@yahoo/uds-css-tokens';\nimport { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport type { BorderWidthConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BORDER_WIDTH_THEME_KEY = 'udsBorderWidth';\n\nconst udsBorderWidthToCSSVariable = (token: string) => `var(--${BORDER_WIDTH_PREFIX}-${token})`;\n\nconst getBorderWidthTheme = (config: BorderWidthConfig, mergeTokensIntoTailwindTheme: boolean) => {\n /**\n * Given the UDS border width tokens in config (none, thin, medium, thick), create a tailwind\n * border width theme value that points to the corresponding UDS CSS variables.\n *\n * For example:\n *\n * {\n * thin: 'var(--uds-border-width-thin)',\n * thick: 'var(--uds-border-width-thick)',\n * }\n *\n * Note: The values of the CSS variables are defined elsewhere. This code only ensures the Tailwind-generated\n * classes are mapped to the correct CSS variable.\n */\n const udsBorderWidths = fromEntries(\n Object.keys(config).map((udsAlias) => [udsAlias, udsBorderWidthToCSSVariable(udsAlias)]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths,\n };\n }\n\n const widths = {\n ...udsBorderWidths,\n\n // Set the Tailwind 'DEFAULT' tailwind border width to map to UDS 'thin' border width\n DEFAULT: udsBorderWidthToCSSVariable('thin'),\n\n // Set the Tailwind '2' tailwind border width to map to UDS 'medium' border width\n '2': udsBorderWidthToCSSVariable('medium'),\n\n // Set the Tailwind '4' tailwind border width to map to UDS 'thick' border width\n '4': udsBorderWidthToCSSVariable('thick'),\n };\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths,\n\n // Also overwrite the default Tailwind border width theme values with UDS values for consistency.\n borderWidth: widths,\n outlineWidth: { ...widths, DEFAULT: '2px' },\n outlineOffset: { ...widths, DEFAULT: '2px' },\n };\n};\n\nconst borderWidthPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n 'uds-border-width': (value) => ({\n 'border-width': value,\n }),\n\n 'uds-border-width-x': (value) => ({\n 'border-left-width': value,\n 'border-right-width': value,\n }),\n\n 'uds-border-width-y': (value) => ({\n 'border-top-width': value,\n 'border-bottom-width': value,\n }),\n\n 'uds-border-width-top': (value) => ({\n 'border-top-width': value,\n }),\n\n 'uds-border-width-right': (value) => ({\n 'border-right-width': value,\n }),\n\n 'uds-border-width-bottom': (value) => ({\n 'border-bottom-width': value,\n }),\n\n 'uds-border-width-left': (value) => ({\n 'border-left-width': value,\n }),\n\n 'uds-border-width-start': (value) => ({\n 'border-inline-start-width': value,\n }),\n\n 'uds-border-width-end': (value) => ({\n 'border-inline-end-width': value,\n }),\n },\n { values: theme(UDS_BORDER_WIDTH_THEME_KEY) },\n );\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderWidth',\n );\n\n return {\n theme: {\n extend: {\n ...getBorderWidthTheme(\n // The border width values are currently stored in the config from the default scale mode.\n config.scaleMode[DEFAULT_SCALE_MODE].borderWidth,\n !shouldNotMergeBorderWidthTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport { borderWidthPlugin, UDS_BORDER_WIDTH_THEME_KEY, udsBorderWidthToCSSVariable };\n"],"mappings":";;;;;;;A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1
+ {"version":3,"file":"borderWidth.js","names":[],"sources":["../../../src/tailwind/plugins/borderWidth.ts"],"sourcesContent":["import { BORDER_WIDTH_PREFIX } from '@yahoo/uds-css-tokens';\nimport { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport type { BorderWidthConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BORDER_WIDTH_THEME_KEY = 'udsBorderWidth';\n\nconst udsBorderWidthToCSSVariable = (token: string) => `var(--${BORDER_WIDTH_PREFIX}-${token})`;\n\nconst getBorderWidthTheme = (config: BorderWidthConfig, mergeTokensIntoTailwindTheme: boolean) => {\n /**\n * Given the UDS border width tokens in config (none, thin, medium, thick), create a tailwind\n * border width theme value that points to the corresponding UDS CSS variables.\n *\n * For example:\n *\n * {\n * thin: 'var(--uds-border-width-thin)',\n * thick: 'var(--uds-border-width-thick)',\n * }\n *\n * Note: The values of the CSS variables are defined elsewhere. This code only ensures the Tailwind-generated\n * classes are mapped to the correct CSS variable.\n */\n const udsBorderWidths = fromEntries(\n Object.keys(config).map((udsAlias) => [udsAlias, udsBorderWidthToCSSVariable(udsAlias)]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths,\n };\n }\n\n const widths = {\n ...udsBorderWidths,\n\n // Set the Tailwind 'DEFAULT' tailwind border width to map to UDS 'thin' border width\n DEFAULT: udsBorderWidthToCSSVariable('thin'),\n\n // Set the Tailwind '2' tailwind border width to map to UDS 'medium' border width\n '2': udsBorderWidthToCSSVariable('medium'),\n\n // Set the Tailwind '4' tailwind border width to map to UDS 'thick' border width\n '4': udsBorderWidthToCSSVariable('thick'),\n };\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths,\n\n // Also overwrite the default Tailwind border width theme values with UDS values for consistency.\n borderWidth: widths,\n outlineWidth: { ...widths, DEFAULT: '2px' },\n outlineOffset: { ...widths, DEFAULT: '2px' },\n };\n};\n\nconst borderWidthPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n 'uds-border-width': (value) => ({\n 'border-width': value,\n }),\n\n 'uds-border-width-x': (value) => ({\n 'border-left-width': value,\n 'border-right-width': value,\n }),\n\n 'uds-border-width-y': (value) => ({\n 'border-top-width': value,\n 'border-bottom-width': value,\n }),\n\n 'uds-border-width-top': (value) => ({\n 'border-top-width': value,\n }),\n\n 'uds-border-width-right': (value) => ({\n 'border-right-width': value,\n }),\n\n 'uds-border-width-bottom': (value) => ({\n 'border-bottom-width': value,\n }),\n\n 'uds-border-width-left': (value) => ({\n 'border-left-width': value,\n }),\n\n 'uds-border-width-start': (value) => ({\n 'border-inline-start-width': value,\n }),\n\n 'uds-border-width-end': (value) => ({\n 'border-inline-end-width': value,\n }),\n },\n { values: theme(UDS_BORDER_WIDTH_THEME_KEY) },\n );\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderWidth',\n );\n\n return {\n theme: {\n extend: {\n ...getBorderWidthTheme(\n // The border width values are currently stored in the config from the default scale mode.\n config.scaleMode[DEFAULT_SCALE_MODE].borderWidth,\n !shouldNotMergeBorderWidthTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport { borderWidthPlugin, UDS_BORDER_WIDTH_THEME_KEY, udsBorderWidthToCSSVariable };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EACF,EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.js","names":[],"sources":["../../../src/tailwind/plugins/breakpoints.ts"],"sourcesContent":["import type { BreakpointsConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { entries } from '../..//utils/entries';\nimport { mapValues } from '../..//utils/mapValues';\nimport { assertUnreachable } from '../../utils/assertUnreachable';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BREAKPOINTS_THEME_KEY = 'udsBreakpoints';\n\nconst getScreensTheme = (config: BreakpointsConfig, mergeTokensIntoTailwindTheme: boolean) => {\n const breakpoints = mapValues(config, (breakpoint) => {\n switch (breakpoint.type) {\n case 'px':\n return `${breakpoint.value}px`;\n }\n\n return assertUnreachable(breakpoint.type);\n });\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind screens values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BREAKPOINTS_THEME_KEY]: breakpoints,\n };\n }\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind screens values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BREAKPOINTS_THEME_KEY]: breakpoints,\n\n // Also overwrite the default Tailwind screens theme values with UDS values for consistency.\n screens: breakpoints,\n };\n};\n\nconst breakpointsPlugin = plugin.withOptions<TailwindPluginOptions>(\n // No code-generation needed.\n ({ config }) =>\n ({ addVariant }) => {\n const breakpoints = entries(config.breakpoints).sort(\n ([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB,\n );\n\n for (const [name, { value: minWidth }] of breakpoints) {\n addVariant(`uds-${name}`, `@media (min-width: ${minWidth}px)`);\n }\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeScreensTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'screens',\n );\n\n return {\n theme: {\n extend: {\n ...getScreensTheme(config.breakpoints, !shouldNotMergeScreensTokensIntoTailwindTheme),\n },\n },\n };\n },\n);\n\nexport { breakpointsPlugin, getScreensTheme, UDS_BREAKPOINTS_THEME_KEY };\n"],"mappings":";;;;;;;AASA,MAAM,4BAA4B;AAElC,MAAM,mBAAmB,QAA2B,iCAA0C;CAC5F,MAAM,cAAc,UAAU,SAAS,eAAe;AACpD,UAAQ,WAAW,MAAnB;GACE,KAAK,KACH,QAAO,GAAG,WAAW,MAAM;;AAG/B,SAAO,kBAAkB,WAAW,KAAK;GACzC;AAEF,KAAI,CAAC,6BAGH,QAAO,GACJ,4BAA4B,aAC9B;AAGH,QAAO;GAGJ,4BAA4B;EAG7B,SAAS;EACV;;AAGH,MAAM,oBAAoB,OAAO,aAE9B,EAAE,cACA,EAAE,iBAAiB;CAClB,MAAM,cAAc,QAAQ,OAAO,YAAY,CAAC,MAC7C,GAAG,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,iBAAiB,YAAY,UACrE;AAED,MAAK,MAAM,CAAC,MAAM,EAAE,OAAO,eAAe,YACxC,YAAW,OAAO,QAAQ,sBAAsB,SAAS,KAAK;IAInE,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,+CAA+C,sCACnD,8BACA,UACD;AAED,QAAO,EACL,OAAO,EACL,QAAQ,EACN,GAAG,gBAAgB,OAAO,aAAa,CAAC,6CAA6C,EACtF,EACF,EACF;EAEJ"}
1
+ {"version":3,"file":"breakpoints.js","names":[],"sources":["../../../src/tailwind/plugins/breakpoints.ts"],"sourcesContent":["import type { BreakpointsConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { entries } from '../..//utils/entries';\nimport { mapValues } from '../..//utils/mapValues';\nimport { assertUnreachable } from '../../utils/assertUnreachable';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_BREAKPOINTS_THEME_KEY = 'udsBreakpoints';\n\nconst getScreensTheme = (config: BreakpointsConfig, mergeTokensIntoTailwindTheme: boolean) => {\n const breakpoints = mapValues(config, (breakpoint) => {\n switch (breakpoint.type) {\n case 'px':\n return `${breakpoint.value}px`;\n }\n\n return assertUnreachable(breakpoint.type);\n });\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind screens values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BREAKPOINTS_THEME_KEY]: breakpoints,\n };\n }\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind screens values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BREAKPOINTS_THEME_KEY]: breakpoints,\n\n // Also overwrite the default Tailwind screens theme values with UDS values for consistency.\n screens: breakpoints,\n };\n};\n\nconst breakpointsPlugin = plugin.withOptions<TailwindPluginOptions>(\n // No code-generation needed.\n ({ config }) =>\n ({ addVariant }) => {\n const breakpoints = entries(config.breakpoints).sort(\n ([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB,\n );\n\n for (const [name, { value: minWidth }] of breakpoints) {\n addVariant(`uds-${name}`, `@media (min-width: ${minWidth}px)`);\n }\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeScreensTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'screens',\n );\n\n return {\n theme: {\n extend: {\n ...getScreensTheme(config.breakpoints, !shouldNotMergeScreensTokensIntoTailwindTheme),\n },\n },\n };\n },\n);\n\nexport { breakpointsPlugin, getScreensTheme, UDS_BREAKPOINTS_THEME_KEY };\n"],"mappings":";;;;;;;AASA,MAAM,4BAA4B;AAElC,MAAM,mBAAmB,QAA2B,iCAA0C;CAC5F,MAAM,cAAc,UAAU,SAAS,eAAe;EACpD,QAAQ,WAAW,MAAnB;GACE,KAAK,MACH,OAAO,GAAG,WAAW,MAAM;;EAG/B,OAAO,kBAAkB,WAAW,KAAK;GACzC;CAEF,IAAI,CAAC,8BAGH,OAAO,GACJ,4BAA4B,aAC9B;CAGH,OAAO;GAGJ,4BAA4B;EAG7B,SAAS;EACV;;AAGH,MAAM,oBAAoB,OAAO,aAE9B,EAAE,cACA,EAAE,iBAAiB;CAClB,MAAM,cAAc,QAAQ,OAAO,YAAY,CAAC,MAC7C,GAAG,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,iBAAiB,YAAY,UACrE;CAED,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,eAAe,aACxC,WAAW,OAAO,QAAQ,sBAAsB,SAAS,KAAK;IAInE,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,+CAA+C,sCACnD,8BACA,UACD;CAED,OAAO,EACL,OAAO,EACL,QAAQ,EACN,GAAG,gBAAgB,OAAO,aAAa,CAAC,6CAA6C,EACtF,EACF,EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":[],"sources":["../../../src/tailwind/plugins/colors.ts"],"sourcesContent":["import {\n BACKGROUND_COLOR_PREFIX,\n DARK_COLOR_MODE_CLASSNAME,\n INVERT_COLOR_MODE_CLASSNAME,\n LIGHT_COLOR_MODE_CLASSNAME,\n SYSTEM_COLOR_MODE_CLASSNAME,\n} from '@yahoo/uds-css-tokens';\nimport { DEFAULT_COLOR_MODE } from '@yahoo/uds-modes';\nimport { ALWAYS_PREFIX, deprecatedAlwaysPalette, newAlwaysPalette } from '@yahoo/uds-palette';\nimport { mapKeys } from 'lodash';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { mapValues } from '../../utils/mapValues';\nimport { parseTokens } from '../../utils/parseTokens';\nimport { addColorModeVars } from '../base/addColorModeVars';\nimport { addColorModeVarsV2 } from '../base/addColorModeVarsV2';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getTailwindAsUdsColors } from './getTailwindAsUdsColors';\n\nconst tailwindColorsAsUds = getTailwindAsUdsColors();\n\nconst colorsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config, enableSystemColorMode = false }) =>\n (api) => {\n const tokens = parseTokens(config);\n\n if (enableSystemColorMode) {\n addColorModeVarsV2(tokens, api);\n } else {\n addColorModeVars(tokens, api);\n }\n },\n\n ({ config }) => {\n const tokens = parseTokens(config);\n const colorModeToken = tokens.colorMode[DEFAULT_COLOR_MODE].tailwindConfig;\n const spectrumWithTailwind = mapValues(colorModeToken.spectrum, (hueConfig, hue) => {\n return {\n ...hueConfig,\n ...tailwindColorsAsUds[hue as keyof typeof tailwindColorsAsUds]!,\n };\n });\n\n /* --------------------------------- COLORS --------------------------------- */\n\n const nestedNewAlwaysPalette = mapKeys(newAlwaysPalette, (_, key) =>\n key.replace(ALWAYS_PREFIX, ''),\n );\n\n // Shared across all color groups (i.e. text color, border, background, etc)\n const colors = {\n ...tailwindColorsAsUds,\n ...spectrumWithTailwind,\n ...deprecatedAlwaysPalette,\n\n // Allows accessing new always palette keys via nested path such as `theme('colors.always.white')`\n always: nestedNewAlwaysPalette,\n };\n const textColors = colorModeToken.palette.foreground;\n const backgroundColors = colorModeToken.palette.background;\n const borderColors = colorModeToken.palette.line;\n\n const elevationBackgroundColors = config.elevation\n ? Object.fromEntries(\n Object.keys(config.elevation).map((level) => [\n `elevation-${level}`,\n `var(--${BACKGROUND_COLOR_PREFIX}-elevation-${level})`,\n ]),\n )\n : {};\n\n return {\n darkMode: ['class', DARK_COLOR_MODE_CLASSNAME],\n // Guarantee that the dark mode class is not purged\n safelist: [\n // Guarantee that the light and dark mode class is not purged\n LIGHT_COLOR_MODE_CLASSNAME,\n DARK_COLOR_MODE_CLASSNAME,\n INVERT_COLOR_MODE_CLASSNAME,\n SYSTEM_COLOR_MODE_CLASSNAME,\n ],\n theme: {\n /**\n * Preserve the default values from Tailwind, but also add new values\n * https://tailwindcss.com/docs/theme#extending-the-default-theme\n */\n extend: {\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L743\n */\n outlineColor: {\n ...borderColors,\n DEFAULT: colors.gray['15'],\n },\n /**\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L133\n */\n colors,\n /**\n * Colors object is included by default, but that does not include UDS semantic background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42\n */\n backgroundColor: backgroundColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L889\n */\n textColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L82\n */\n borderColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L253\n */\n fill: backgroundColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L132\n */\n caretColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L759\n */\n placeholderColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L890\n */\n textDecorationColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L241\n */\n divideColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L761\n */\n ringColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L765\n */\n ringOffsetColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L878\n */\n stroke: borderColors,\n /**\n * Gradient color stops object is included by default, but that does not include UDS palette background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42\n */\n gradientColorStops: {\n ...backgroundColors,\n ...elevationBackgroundColors,\n ...colors,\n },\n },\n },\n };\n },\n);\n\nexport { colorsPlugin };\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,sBAAsB,wBAAwB;AAEpD,MAAM,eAAe,OAAO,aACzB,EAAE,QAAQ,wBAAwB,aAChC,QAAQ;CACP,MAAM,SAAS,YAAY,OAAO;AAElC,KAAI,sBACF,oBAAmB,QAAQ,IAAI;KAE/B,kBAAiB,QAAQ,IAAI;IAIlC,EAAE,aAAa;CAEd,MAAM,iBADS,YAAY,OACE,CAAC,UAAU,oBAAoB;CAC5D,MAAM,uBAAuB,UAAU,eAAe,WAAW,WAAW,QAAQ;AAClF,SAAO;GACL,GAAG;GACH,GAAG,oBAAoB;GACxB;GACD;CAIF,MAAM,yBAAyB,QAAQ,mBAAmB,GAAG,QAC3D,IAAI,QAAQ,eAAe,GAAG,CAC/B;CAGD,MAAM,SAAS;EACb,GAAG;EACH,GAAG;EACH,GAAG;EAGH,QAAQ;EACT;CACD,MAAM,aAAa,eAAe,QAAQ;CAC1C,MAAM,mBAAmB,eAAe,QAAQ;CAChD,MAAM,eAAe,eAAe,QAAQ;CAE5C,MAAM,4BAA4B,OAAO,YACrC,OAAO,YACL,OAAO,KAAK,OAAO,UAAU,CAAC,KAAK,UAAU,CAC3C,aAAa,SACb,SAAS,wBAAwB,aAAa,MAAM,GACrD,CAAC,CACJ,GACA,EAAE;AAEN,QAAO;EACL,UAAU,CAAC,SAAS,0BAA0B;EAE9C,UAAU;GAER;GACA;GACA;GACA;GACD;EACD,OAAO;;;;;AAKL,QAAQ;;;;;GAKN,cAAc;IACZ,GAAG;IACH,SAAS,OAAO,KAAK;IACtB;;;;GAID;;;;;GAKA,iBAAiB;;;;;GAKjB,WAAW;;;;;GAKX,aAAa;;;;;GAKb,MAAM;;;;;GAKN,YAAY;;;;;GAKZ,kBAAkB;;;;;GAKlB,qBAAqB;;;;;GAKrB,aAAa;;;;;GAKb,WAAW;;;;;GAKX,iBAAiB;;;;;GAKjB,QAAQ;;;;;GAKR,oBAAoB;IAClB,GAAG;IACH,GAAG;IACH,GAAG;IACJ;GACF,EACF;EACF;EAEJ"}
1
+ {"version":3,"file":"colors.js","names":[],"sources":["../../../src/tailwind/plugins/colors.ts"],"sourcesContent":["import {\n BACKGROUND_COLOR_PREFIX,\n DARK_COLOR_MODE_CLASSNAME,\n INVERT_COLOR_MODE_CLASSNAME,\n LIGHT_COLOR_MODE_CLASSNAME,\n SYSTEM_COLOR_MODE_CLASSNAME,\n} from '@yahoo/uds-css-tokens';\nimport { DEFAULT_COLOR_MODE } from '@yahoo/uds-modes';\nimport { ALWAYS_PREFIX, deprecatedAlwaysPalette, newAlwaysPalette } from '@yahoo/uds-palette';\nimport { mapKeys } from 'lodash';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { mapValues } from '../../utils/mapValues';\nimport { parseTokens } from '../../utils/parseTokens';\nimport { addColorModeVars } from '../base/addColorModeVars';\nimport { addColorModeVarsV2 } from '../base/addColorModeVarsV2';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getTailwindAsUdsColors } from './getTailwindAsUdsColors';\n\nconst tailwindColorsAsUds = getTailwindAsUdsColors();\n\nconst colorsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config, enableSystemColorMode = false }) =>\n (api) => {\n const tokens = parseTokens(config);\n\n if (enableSystemColorMode) {\n addColorModeVarsV2(tokens, api);\n } else {\n addColorModeVars(tokens, api);\n }\n },\n\n ({ config }) => {\n const tokens = parseTokens(config);\n const colorModeToken = tokens.colorMode[DEFAULT_COLOR_MODE].tailwindConfig;\n const spectrumWithTailwind = mapValues(colorModeToken.spectrum, (hueConfig, hue) => {\n return {\n ...hueConfig,\n ...tailwindColorsAsUds[hue as keyof typeof tailwindColorsAsUds]!,\n };\n });\n\n /* --------------------------------- COLORS --------------------------------- */\n\n const nestedNewAlwaysPalette = mapKeys(newAlwaysPalette, (_, key) =>\n key.replace(ALWAYS_PREFIX, ''),\n );\n\n // Shared across all color groups (i.e. text color, border, background, etc)\n const colors = {\n ...tailwindColorsAsUds,\n ...spectrumWithTailwind,\n ...deprecatedAlwaysPalette,\n\n // Allows accessing new always palette keys via nested path such as `theme('colors.always.white')`\n always: nestedNewAlwaysPalette,\n };\n const textColors = colorModeToken.palette.foreground;\n const backgroundColors = colorModeToken.palette.background;\n const borderColors = colorModeToken.palette.line;\n\n const elevationBackgroundColors = config.elevation\n ? Object.fromEntries(\n Object.keys(config.elevation).map((level) => [\n `elevation-${level}`,\n `var(--${BACKGROUND_COLOR_PREFIX}-elevation-${level})`,\n ]),\n )\n : {};\n\n return {\n darkMode: ['class', DARK_COLOR_MODE_CLASSNAME],\n // Guarantee that the dark mode class is not purged\n safelist: [\n // Guarantee that the light and dark mode class is not purged\n LIGHT_COLOR_MODE_CLASSNAME,\n DARK_COLOR_MODE_CLASSNAME,\n INVERT_COLOR_MODE_CLASSNAME,\n SYSTEM_COLOR_MODE_CLASSNAME,\n ],\n theme: {\n /**\n * Preserve the default values from Tailwind, but also add new values\n * https://tailwindcss.com/docs/theme#extending-the-default-theme\n */\n extend: {\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L743\n */\n outlineColor: {\n ...borderColors,\n DEFAULT: colors.gray['15'],\n },\n /**\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L133\n */\n colors,\n /**\n * Colors object is included by default, but that does not include UDS semantic background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42\n */\n backgroundColor: backgroundColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L889\n */\n textColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L82\n */\n borderColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L253\n */\n fill: backgroundColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L132\n */\n caretColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L759\n */\n placeholderColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic text colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L890\n */\n textDecorationColor: textColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L241\n */\n divideColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L761\n */\n ringColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L765\n */\n ringOffsetColor: borderColors,\n /**\n * Colors object is included by default, but that does not include UDS semantic border colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L878\n */\n stroke: borderColors,\n /**\n * Gradient color stops object is included by default, but that does not include UDS palette background colors\n * https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42\n */\n gradientColorStops: {\n ...backgroundColors,\n ...elevationBackgroundColors,\n ...colors,\n },\n },\n },\n };\n },\n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,GAAG;IACH,GAAG;IACJ;GACF,EACF;EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","names":[],"sources":["../../../src/tailwind/plugins/components.ts"],"sourcesContent":["import {\n AvatarConfig,\n BadgeConfig,\n BannerConfig,\n BottomSheetConfig,\n ButtonConfig,\n CheckboxConfig,\n ChipConfig,\n DividerConfig,\n IconButtonConfig,\n InputConfig,\n LinkConfig,\n MenuContentConfig,\n MenuItemConfig,\n ModalConfig,\n PopoverConfig,\n RadioConfig,\n ScrimConfig,\n SwitchConfig,\n TabConfig,\n TabsConfig,\n ToastConfig,\n TooltipConfig,\n} from '@yahoo/uds-automated-config/generatedConfigs';\nimport { generateStyles } from '@yahoo/uds-automated-config/utils';\nimport { opacityMap } from '@yahoo/uds-fixtures';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst componentsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({\n config,\n previewOptions = {\n generatePseudoStateClassModifier: false,\n },\n }) =>\n ({ addComponents, theme }) => {\n // IconButton inherits Button variant styles\n if (config.button || config.iconButton) {\n const buttonStyles = generateStyles(ButtonConfig, config.button, theme, previewOptions);\n addComponents(buttonStyles);\n\n if (config.iconButton) {\n const iconButtonStyles = generateStyles(\n IconButtonConfig,\n config.iconButton,\n theme,\n previewOptions,\n );\n addComponents(iconButtonStyles);\n }\n }\n\n if (config.divider) {\n const dividerStyles = generateStyles(DividerConfig, config.divider, theme, previewOptions);\n addComponents(dividerStyles);\n }\n\n if (config.link) {\n const linkStyles = generateStyles(LinkConfig, config.link, theme, previewOptions);\n addComponents(linkStyles);\n }\n\n if (config.badge) {\n const badgeStyles = generateStyles(BadgeConfig, config.badge, theme, previewOptions);\n addComponents(badgeStyles);\n }\n\n if (config.radio) {\n const radioStyles = generateStyles(RadioConfig, config.radio, theme, previewOptions);\n addComponents(radioStyles);\n }\n\n if (config.avatar) {\n const avatarStyles = generateStyles(AvatarConfig, config.avatar, theme, previewOptions);\n addComponents(avatarStyles);\n }\n\n if (config.chip) {\n const chipStyles = generateStyles(ChipConfig, config.chip, theme, previewOptions);\n addComponents(chipStyles);\n }\n\n if (config.switch) {\n const switchStyles = generateStyles(SwitchConfig, config.switch, theme, previewOptions);\n addComponents(switchStyles);\n }\n\n if (config.checkbox) {\n const checkboxStyles = generateStyles(\n CheckboxConfig,\n config.checkbox,\n theme,\n previewOptions,\n );\n addComponents(checkboxStyles);\n }\n\n // TODO: May need to ensure portal is inside a importNamespace class\n if (config.menuItem) {\n const menuStyles = generateStyles(MenuItemConfig, config.menuItem, theme, previewOptions);\n addComponents(menuStyles);\n }\n\n if (config.menuContent) {\n const menuContentStyles = generateStyles(\n MenuContentConfig,\n config.menuContent,\n theme,\n previewOptions,\n );\n addComponents(menuContentStyles);\n }\n\n if (config.input) {\n const inputStyles = generateStyles(InputConfig, config.input, theme, previewOptions);\n addComponents(inputStyles);\n }\n\n if (config?.toast) {\n const toastStyles = generateStyles(ToastConfig, config.toast, theme, previewOptions);\n addComponents(toastStyles);\n }\n\n if (config.tooltip) {\n const tooltipStyles = generateStyles(TooltipConfig, config.tooltip, theme, previewOptions);\n addComponents(tooltipStyles);\n }\n\n if (config?.bottomSheet) {\n const bottomSheetStyles = generateStyles(\n BottomSheetConfig,\n config.bottomSheet,\n theme,\n previewOptions,\n );\n addComponents(bottomSheetStyles);\n }\n\n if (config?.scrim) {\n const scrimStyles = generateStyles(ScrimConfig, config.scrim, theme, previewOptions);\n addComponents(scrimStyles);\n }\n\n if (config.popover) {\n const popoverStyles = generateStyles(PopoverConfig, config.popover, theme, previewOptions);\n addComponents(popoverStyles);\n }\n\n const bannerStyles = generateStyles(BannerConfig, config.banner, theme, previewOptions);\n addComponents(bannerStyles);\n\n const tabStyles = generateStyles(TabConfig, config.tab, theme, previewOptions);\n addComponents(tabStyles);\n\n const tabsStyles = generateStyles(TabsConfig, config.tabs, theme, previewOptions);\n addComponents(tabsStyles);\n\n const modalStyles = generateStyles(ModalConfig, config.modal, theme, previewOptions);\n addComponents(modalStyles);\n },\n () => ({\n theme: {\n extend: {\n // Added to route configurable opacity steps through to button opacity/disabled property rendering.\n opacity: opacityMap,\n },\n },\n }),\n);\n\nexport { componentsPlugin };\n"],"mappings":";;;;;;AA8BA,MAAM,mBAAmB,OAAO,aAC7B,EACC,QACA,iBAAiB,EACf,kCAAkC,OACnC,QAEA,EAAE,eAAe,YAAY;AAE5B,KAAI,OAAO,UAAU,OAAO,YAAY;AAEtC,gBADqB,eAAe,cAAc,OAAO,QAAQ,OAAO,eAC9C,CAAC;AAE3B,MAAI,OAAO,WAOT,eANyB,eACvB,kBACA,OAAO,YACP,OACA,eAE4B,CAAC;;AAInC,KAAI,OAAO,QAET,eADsB,eAAe,eAAe,OAAO,SAAS,OAAO,eAChD,CAAC;AAG9B,KAAI,OAAO,KAET,eADmB,eAAe,YAAY,OAAO,MAAM,OAAO,eAC1C,CAAC;AAG3B,KAAI,OAAO,MAET,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;AAG5B,KAAI,OAAO,MAET,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;AAG5B,KAAI,OAAO,OAET,eADqB,eAAe,cAAc,OAAO,QAAQ,OAAO,eAC9C,CAAC;AAG7B,KAAI,OAAO,KAET,eADmB,eAAe,YAAY,OAAO,MAAM,OAAO,eAC1C,CAAC;AAG3B,KAAI,OAAO,OAET,eADqB,eAAe,cAAc,OAAO,QAAQ,OAAO,eAC9C,CAAC;AAG7B,KAAI,OAAO,SAOT,eANuB,eACrB,gBACA,OAAO,UACP,OACA,eAE0B,CAAC;AAI/B,KAAI,OAAO,SAET,eADmB,eAAe,gBAAgB,OAAO,UAAU,OAAO,eAClD,CAAC;AAG3B,KAAI,OAAO,YAOT,eAN0B,eACxB,mBACA,OAAO,aACP,OACA,eAE6B,CAAC;AAGlC,KAAI,OAAO,MAET,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;AAG5B,KAAI,QAAQ,MAEV,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;AAG5B,KAAI,OAAO,QAET,eADsB,eAAe,eAAe,OAAO,SAAS,OAAO,eAChD,CAAC;AAG9B,KAAI,QAAQ,YAOV,eAN0B,eACxB,mBACA,OAAO,aACP,OACA,eAE6B,CAAC;AAGlC,KAAI,QAAQ,MAEV,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;AAG5B,KAAI,OAAO,QAET,eADsB,eAAe,eAAe,OAAO,SAAS,OAAO,eAChD,CAAC;AAI9B,eADqB,eAAe,cAAc,OAAO,QAAQ,OAAO,eAC9C,CAAC;AAG3B,eADkB,eAAe,WAAW,OAAO,KAAK,OAAO,eACxC,CAAC;AAGxB,eADmB,eAAe,YAAY,OAAO,MAAM,OAAO,eAC1C,CAAC;AAGzB,eADoB,eAAe,aAAa,OAAO,OAAO,OAAO,eAC5C,CAAC;UAEvB,EACL,OAAO,EACL,QAAQ,EAEN,SAAS,YACV,EACF,EACF,EACF"}
1
+ {"version":3,"file":"components.js","names":[],"sources":["../../../src/tailwind/plugins/components.ts"],"sourcesContent":["import {\n AvatarConfig,\n BadgeConfig,\n BannerConfig,\n BottomSheetConfig,\n ButtonConfig,\n CheckboxConfig,\n ChipConfig,\n DividerConfig,\n IconButtonConfig,\n InputConfig,\n LinkConfig,\n MenuContentConfig,\n MenuItemConfig,\n ModalConfig,\n PopoverConfig,\n RadioConfig,\n ScrimConfig,\n SwitchConfig,\n TabConfig,\n TabsConfig,\n ToastConfig,\n TooltipConfig,\n} from '@yahoo/uds-automated-config/generatedConfigs';\nimport { generateStyles } from '@yahoo/uds-automated-config/utils';\nimport { opacityMap } from '@yahoo/uds-fixtures';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst componentsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({\n config,\n previewOptions = {\n generatePseudoStateClassModifier: false,\n },\n }) =>\n ({ addComponents, theme }) => {\n // IconButton inherits Button variant styles\n if (config.button || config.iconButton) {\n const buttonStyles = generateStyles(ButtonConfig, config.button, theme, previewOptions);\n addComponents(buttonStyles);\n\n if (config.iconButton) {\n const iconButtonStyles = generateStyles(\n IconButtonConfig,\n config.iconButton,\n theme,\n previewOptions,\n );\n addComponents(iconButtonStyles);\n }\n }\n\n if (config.divider) {\n const dividerStyles = generateStyles(DividerConfig, config.divider, theme, previewOptions);\n addComponents(dividerStyles);\n }\n\n if (config.link) {\n const linkStyles = generateStyles(LinkConfig, config.link, theme, previewOptions);\n addComponents(linkStyles);\n }\n\n if (config.badge) {\n const badgeStyles = generateStyles(BadgeConfig, config.badge, theme, previewOptions);\n addComponents(badgeStyles);\n }\n\n if (config.radio) {\n const radioStyles = generateStyles(RadioConfig, config.radio, theme, previewOptions);\n addComponents(radioStyles);\n }\n\n if (config.avatar) {\n const avatarStyles = generateStyles(AvatarConfig, config.avatar, theme, previewOptions);\n addComponents(avatarStyles);\n }\n\n if (config.chip) {\n const chipStyles = generateStyles(ChipConfig, config.chip, theme, previewOptions);\n addComponents(chipStyles);\n }\n\n if (config.switch) {\n const switchStyles = generateStyles(SwitchConfig, config.switch, theme, previewOptions);\n addComponents(switchStyles);\n }\n\n if (config.checkbox) {\n const checkboxStyles = generateStyles(\n CheckboxConfig,\n config.checkbox,\n theme,\n previewOptions,\n );\n addComponents(checkboxStyles);\n }\n\n // TODO: May need to ensure portal is inside a importNamespace class\n if (config.menuItem) {\n const menuStyles = generateStyles(MenuItemConfig, config.menuItem, theme, previewOptions);\n addComponents(menuStyles);\n }\n\n if (config.menuContent) {\n const menuContentStyles = generateStyles(\n MenuContentConfig,\n config.menuContent,\n theme,\n previewOptions,\n );\n addComponents(menuContentStyles);\n }\n\n if (config.input) {\n const inputStyles = generateStyles(InputConfig, config.input, theme, previewOptions);\n addComponents(inputStyles);\n }\n\n if (config?.toast) {\n const toastStyles = generateStyles(ToastConfig, config.toast, theme, previewOptions);\n addComponents(toastStyles);\n }\n\n if (config.tooltip) {\n const tooltipStyles = generateStyles(TooltipConfig, config.tooltip, theme, previewOptions);\n addComponents(tooltipStyles);\n }\n\n if (config?.bottomSheet) {\n const bottomSheetStyles = generateStyles(\n BottomSheetConfig,\n config.bottomSheet,\n theme,\n previewOptions,\n );\n addComponents(bottomSheetStyles);\n }\n\n if (config?.scrim) {\n const scrimStyles = generateStyles(ScrimConfig, config.scrim, theme, previewOptions);\n addComponents(scrimStyles);\n }\n\n if (config.popover) {\n const popoverStyles = generateStyles(PopoverConfig, config.popover, theme, previewOptions);\n addComponents(popoverStyles);\n }\n\n const bannerStyles = generateStyles(BannerConfig, config.banner, theme, previewOptions);\n addComponents(bannerStyles);\n\n const tabStyles = generateStyles(TabConfig, config.tab, theme, previewOptions);\n addComponents(tabStyles);\n\n const tabsStyles = generateStyles(TabsConfig, config.tabs, theme, previewOptions);\n addComponents(tabsStyles);\n\n const modalStyles = generateStyles(ModalConfig, config.modal, theme, previewOptions);\n addComponents(modalStyles);\n },\n () => ({\n theme: {\n extend: {\n // Added to route configurable opacity steps through to button opacity/disabled property rendering.\n opacity: opacityMap,\n },\n },\n }),\n);\n\nexport { componentsPlugin };\n"],"mappings":";;;;;;AA8BA,MAAM,mBAAmB,OAAO,aAC7B,EACC,QACA,iBAAiB,EACf,kCAAkC,OACnC,QAEA,EAAE,eAAe,YAAY;CAE5B,IAAI,OAAO,UAAU,OAAO,YAAY;EAEtC,cADqB,eAAe,cAAc,OAAO,QAAQ,OAAO,eAC9C,CAAC;EAE3B,IAAI,OAAO,YAOT,cANyB,eACvB,kBACA,OAAO,YACP,OACA,eAE4B,CAAC;;CAInC,IAAI,OAAO,SAET,cADsB,eAAe,eAAe,OAAO,SAAS,OAAO,eAChD,CAAC;CAG9B,IAAI,OAAO,MAET,cADmB,eAAe,YAAY,OAAO,MAAM,OAAO,eAC1C,CAAC;CAG3B,IAAI,O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eAC5C,CAAC;UAEvB,EACL,OAAO,EACL,QAAQ,EAEN,SAAS,YACV,EACF,EACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"elevation.js","names":[],"sources":["../../../src/tailwind/plugins/elevation.ts"],"sourcesContent":["import { BORDER_WIDTH_PREFIX, LINE_COLOR_PREFIX } from '@yahoo/uds-css-tokens';\nimport type { ElevationConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { entries } from '../../utils/entries';\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\nimport { getElevationStyles } from '../utils/getElevationStyles';\nimport { UDS_BORDER_WIDTH_THEME_KEY } from './borderWidth';\n\nconst getBorderWidthTheme = (config: ElevationConfig, mergeTokensIntoTailwindTheme: boolean) => {\n const elevationBorderWidths = fromEntries(\n entries(config || {}).map(([level]) => [\n `elevation-${level}`,\n `var(--${BORDER_WIDTH_PREFIX}-elevation-${level})`,\n ]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths,\n };\n }\n\n // Add a \"width-\" prefix to these so they don't collide with border colors\n const namespacedBorderWidths = fromEntries(\n entries(elevationBorderWidths).map(([key, cssVar]) => [`width-${key}`, cssVar]),\n );\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths,\n\n // Also overwrite the default Tailwind border width theme values with UDS values for consistency.\n borderWidth: namespacedBorderWidths,\n outlineWidth: namespacedBorderWidths,\n outlineOffset: namespacedBorderWidths,\n };\n};\n\nconst elevationPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config }) =>\n ({ addUtilities }) => {\n const elevationStyles = getElevationStyles({ config });\n addUtilities(elevationStyles);\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderWidth',\n );\n\n const borderColor = fromEntries(\n entries(config.elevation || {}).map(([level]) => [\n `elevation-${level}`,\n `var(--${LINE_COLOR_PREFIX}-elevation-${level})`,\n ]),\n );\n\n return {\n theme: {\n extend: {\n borderColor,\n outlineColor: borderColor,\n\n ...getBorderWidthTheme(\n config.elevation,\n !shouldNotMergeBorderWidthTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport { elevationPlugin };\n"],"mappings":";;;;;;;;;AAWA,MAAM,uBAAuB,QAAyB,iCAA0C;CAC9F,MAAM,wBAAwB,YAC5B,QAAQ,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CACrC,aAAa,SACb,SAAS,oBAAoB,aAAa,MAAM,GACjD,CAAC,CACH;AAED,KAAI,CAAC,6BAGH,QAAO,GACJ,6BAA6B,uBAC/B;CAIH,MAAM,yBAAyB,YAC7B,QAAQ,sBAAsB,CAAC,KAAK,CAAC,KAAK,YAAY,CAAC,SAAS,OAAO,OAAO,CAAC,CAChF;AAED,QAAO;GAGJ,6BAA6B;EAG9B,aAAa;EACb,cAAc;EACd,eAAe;EAChB;;AAGH,MAAM,kBAAkB,OAAO,aAC5B,EAAE,cACA,EAAE,mBAAmB;AAEpB,cADwB,mBAAmB,EAAE,QAAQ,CACzB,CAAC;IAGhC,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,mDAAmD,sCACvD,8BACA,cACD;CAED,MAAM,cAAc,YAClB,QAAQ,OAAO,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAC/C,aAAa,SACb,SAAS,kBAAkB,aAAa,MAAM,GAC/C,CAAC,CACH;AAED,QAAO,EACL,OAAO,EACL,QAAQ;EACN;EACA,cAAc;EAEd,GAAG,oBACD,OAAO,WACP,CAAC,iDACF;EACF,EACF,EACF;EAEJ"}
1
+ {"version":3,"file":"elevation.js","names":[],"sources":["../../../src/tailwind/plugins/elevation.ts"],"sourcesContent":["import { BORDER_WIDTH_PREFIX, LINE_COLOR_PREFIX } from '@yahoo/uds-css-tokens';\nimport type { ElevationConfig } from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { entries } from '../../utils/entries';\nimport { fromEntries } from '../../utils/fromEntries';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\nimport { getElevationStyles } from '../utils/getElevationStyles';\nimport { UDS_BORDER_WIDTH_THEME_KEY } from './borderWidth';\n\nconst getBorderWidthTheme = (config: ElevationConfig, mergeTokensIntoTailwindTheme: boolean) => {\n const elevationBorderWidths = fromEntries(\n entries(config || {}).map(([level]) => [\n `elevation-${level}`,\n `var(--${BORDER_WIDTH_PREFIX}-elevation-${level})`,\n ]),\n );\n\n if (!mergeTokensIntoTailwindTheme) {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n return {\n [UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths,\n };\n }\n\n // Add a \"width-\" prefix to these so they don't collide with border colors\n const namespacedBorderWidths = fromEntries(\n entries(elevationBorderWidths).map(([key, cssVar]) => [`width-${key}`, cssVar]),\n );\n\n return {\n // Store these values namespaced in the tailwind theme to avoid overwriting default Tailwind border width values.\n // This will be used in the automation CSS generation to map stored values to UDS CSS variables.\n [UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths,\n\n // Also overwrite the default Tailwind border width theme values with UDS values for consistency.\n borderWidth: namespacedBorderWidths,\n outlineWidth: namespacedBorderWidths,\n outlineOffset: namespacedBorderWidths,\n };\n};\n\nconst elevationPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config }) =>\n ({ addUtilities }) => {\n const elevationStyles = getElevationStyles({ config });\n addUtilities(elevationStyles);\n },\n\n ({ config, disableOverrideTailwindTheme }) => {\n const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'borderWidth',\n );\n\n const borderColor = fromEntries(\n entries(config.elevation || {}).map(([level]) => [\n `elevation-${level}`,\n `var(--${LINE_COLOR_PREFIX}-elevation-${level})`,\n ]),\n );\n\n return {\n theme: {\n extend: {\n borderColor,\n outlineColor: borderColor,\n\n ...getBorderWidthTheme(\n config.elevation,\n !shouldNotMergeBorderWidthTokensIntoTailwindTheme,\n ),\n },\n },\n };\n },\n);\n\nexport { elevationPlugin };\n"],"mappings":";;;;;;;;;AAWA,MAAM,uBAAuB,QAAyB,iCAA0C;CAC9F,MAAM,wBAAwB,YAC5B,QAAQ,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CACrC,aAAa,SACb,SAAS,oBAAoB,aAAa,MAAM,GACjD,CAAC,CACH;CAED,IAAI,CAAC,8BAGH,OAAO,GACJ,6BAA6B,uBAC/B;CAIH,MAAM,yBAAyB,YAC7B,QAAQ,sBAAsB,CAAC,KAAK,CAAC,KAAK,YAAY,CAAC,SAAS,OAAO,OAAO,CAAC,CAChF;CAED,OAAO;GAGJ,6BAA6B;EAG9B,aAAa;EACb,cAAc;EACd,eAAe;EAChB;;AAGH,MAAM,kBAAkB,OAAO,aAC5B,EAAE,cACA,EAAE,mBAAmB;CAEpB,aADwB,mBAAmB,EAAE,QAAQ,CACzB,CAAC;IAGhC,EAAE,QAAQ,mCAAmC;CAC5C,MAAM,mDAAmD,sCACvD,8BACA,cACD;CAED,MAAM,cAAc,YAClB,QAAQ,OAAO,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAC/C,aAAa,SACb,SAAS,kBAAkB,aAAa,MAAM,GAC/C,CAAC,CACH;CAED,OAAO,EACL,OAAO,EACL,QAAQ;EACN;EACA,cAAc;EAEd,GAAG,oBACD,OAAO,WACP,CAAC,iDACF;EACF,EACF,EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"getTailwindAsUdsColors.js","names":[],"sources":["../../../src/tailwind/plugins/getTailwindAsUdsColors.ts"],"sourcesContent":["import { defaultTokensConfig } from '@yahoo/uds-config';\nimport type { SpectrumConfig } from '@yahoo/uds-types';\n\nimport { entries } from '../../utils/entries';\n\n// TODO: Pull from @yahoo/uds-cssTokens package when available\nconst SPECTRUM_COLOR_PREFIX = 'uds-spectrum-color';\nconst lightSpectrum = defaultTokensConfig.colorMode.light.spectrum;\n\nconst tailwindColorsConfig = {\n inherit: 'inherit',\n current: 'currentColor',\n transparent: 'transparent',\n black: '#000',\n white: '#fff',\n slate: {\n 50: '#f8fafc',\n 100: '#f1f5f9',\n 200: '#e2e8f0',\n 300: '#cbd5e1',\n 400: '#94a3b8',\n 500: '#64748b',\n 600: '#475569',\n 700: '#334155',\n 800: '#1e293b',\n 900: '#0f172a',\n 950: '#020617',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n zinc: {\n 50: '#fafafa',\n 100: '#f4f4f5',\n 200: '#e4e4e7',\n 300: '#d4d4d8',\n 400: '#a1a1aa',\n 500: '#71717a',\n 600: '#52525b',\n 700: '#3f3f46',\n 800: '#27272a',\n 900: '#18181b',\n 950: '#09090b',\n },\n neutral: {\n 50: '#fafafa',\n 100: '#f5f5f5',\n 200: '#e5e5e5',\n 300: '#d4d4d4',\n 400: '#a3a3a3',\n 500: '#737373',\n 600: '#525252',\n 700: '#404040',\n 800: '#262626',\n 900: '#171717',\n 950: '#0a0a0a',\n },\n stone: {\n 50: '#fafaf9',\n 100: '#f5f5f4',\n 200: '#e7e5e4',\n 300: '#d6d3d1',\n 400: '#a8a29e',\n 500: '#78716c',\n 600: '#57534e',\n 700: '#44403c',\n 800: '#292524',\n 900: '#1c1917',\n 950: '#0c0a09',\n },\n red: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n 950: '#450a0a',\n },\n orange: {\n 50: '#fff7ed',\n 100: '#ffedd5',\n 200: '#fed7aa',\n 300: '#fdba74',\n 400: '#fb923c',\n 500: '#f97316',\n 600: '#ea580c',\n 700: '#c2410c',\n 800: '#9a3412',\n 900: '#7c2d12',\n 950: '#431407',\n },\n amber: {\n 50: '#fffbeb',\n 100: '#fef3c7',\n 200: '#fde68a',\n 300: '#fcd34d',\n 400: '#fbbf24',\n 500: '#f59e0b',\n 600: '#d97706',\n 700: '#b45309',\n 800: '#92400e',\n 900: '#78350f',\n 950: '#451a03',\n },\n yellow: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n 950: '#422006',\n },\n lime: {\n 50: '#f7fee7',\n 100: '#ecfccb',\n 200: '#d9f99d',\n 300: '#bef264',\n 400: '#a3e635',\n 500: '#84cc16',\n 600: '#65a30d',\n 700: '#4d7c0f',\n 800: '#3f6212',\n 900: '#365314',\n 950: '#1a2e05',\n },\n green: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n 950: '#052e16',\n },\n emerald: {\n 50: '#ecfdf5',\n 100: '#d1fae5',\n 200: '#a7f3d0',\n 300: '#6ee7b7',\n 400: '#34d399',\n 500: '#10b981',\n 600: '#059669',\n 700: '#047857',\n 800: '#065f46',\n 900: '#064e3b',\n 950: '#022c22',\n },\n teal: {\n 50: '#f0fdfa',\n 100: '#ccfbf1',\n 200: '#99f6e4',\n 300: '#5eead4',\n 400: '#2dd4bf',\n 500: '#14b8a6',\n 600: '#0d9488',\n 700: '#0f766e',\n 800: '#115e59',\n 900: '#134e4a',\n 950: '#042f2e',\n },\n cyan: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n sky: {\n 50: '#f0f9ff',\n 100: '#e0f2fe',\n 200: '#bae6fd',\n 300: '#7dd3fc',\n 400: '#38bdf8',\n 500: '#0ea5e9',\n 600: '#0284c7',\n 700: '#0369a1',\n 800: '#075985',\n 900: '#0c4a6e',\n 950: '#082f49',\n },\n blue: {\n 50: '#eff6ff',\n 100: '#dbeafe',\n 200: '#bfdbfe',\n 300: '#93c5fd',\n 400: '#60a5fa',\n 500: '#3b82f6',\n 600: '#2563eb',\n 700: '#1d4ed8',\n 800: '#1e40af',\n 900: '#1e3a8a',\n 950: '#172554',\n },\n indigo: {\n 50: '#eef2ff',\n 100: '#e0e7ff',\n 200: '#c7d2fe',\n 300: '#a5b4fc',\n 400: '#818cf8',\n 500: '#6366f1',\n 600: '#4f46e5',\n 700: '#4338ca',\n 800: '#3730a3',\n 900: '#312e81',\n 950: '#1e1b4b',\n },\n violet: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n purple: {\n 50: '#faf5ff',\n 100: '#f3e8ff',\n 200: '#e9d5ff',\n 300: '#d8b4fe',\n 400: '#c084fc',\n 500: '#a855f7',\n 600: '#9333ea',\n 700: '#7e22ce',\n 800: '#6b21a8',\n 900: '#581c87',\n 950: '#3b0764',\n },\n fuchsia: {\n 50: '#fdf4ff',\n 100: '#fae8ff',\n 200: '#f5d0fe',\n 300: '#f0abfc',\n 400: '#e879f9',\n 500: '#d946ef',\n 600: '#c026d3',\n 700: '#a21caf',\n 800: '#86198f',\n 900: '#701a75',\n 950: '#4a044e',\n },\n pink: {\n 50: '#fdf2f8',\n 100: '#fce7f3',\n 200: '#fbcfe8',\n 300: '#f9a8d4',\n 400: '#f472b6',\n 500: '#ec4899',\n 600: '#db2777',\n 700: '#be185d',\n 800: '#9d174d',\n 900: '#831843',\n 950: '#500724',\n },\n rose: {\n 50: '#fff1f2',\n 100: '#ffe4e6',\n 200: '#fecdd3',\n 300: '#fda4af',\n 400: '#fb7185',\n 500: '#f43f5e',\n 600: '#e11d48',\n 700: '#be123c',\n 800: '#9f1239',\n 900: '#881337',\n 950: '#4c0519',\n },\n} as const;\n\ntype Rgb = { r: number; g: number; b: number };\nconst udsLightColors = flattenSpectrumToRgbRecord(lightSpectrum);\n\n/**\n * Iterates the two-level spectrum structure directly instead of using\n * utils/flattenColorPalette, which would flatten SpectrumValueEntry objects\n * into individual primitives (r, g, b, type) and lose the RGB grouping.\n */\nfunction flattenSpectrumToRgbRecord(spectrum: SpectrumConfig): Record<string, Rgb> {\n const result: Record<string, Rgb> = {};\n for (const [hue, steps] of entries(spectrum)) {\n for (const [step, entry] of entries(steps)) {\n const { rgb } = entry;\n result[`${hue}-${step}`] = { r: rgb.r, g: rgb.g, b: rgb.b };\n }\n }\n return result;\n}\n\nfunction hexToRgb(hex: string) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null;\n}\n\nfunction getDiffColor(a: Rgb, b: Rgb) {\n return Math.sqrt(Math.pow(a.r - b.r, 2) + Math.pow(a.g - b.g, 2) + Math.pow(a.b - b.b, 2));\n}\n\nconst getClosestUdsColor = (targetColor: string) => {\n // Convert target color from hex string to RGB values\n const targetRgb = hexToRgb(targetColor);\n\n let closestDistance = null;\n let closestColor: string[] = [];\n\n for (const [name, color] of entries(udsLightColors)) {\n const varName = `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${name}))`;\n const distance = getDiffColor(color, targetRgb!);\n if (closestDistance === null || distance < closestDistance) {\n closestDistance = distance;\n closestColor = [varName];\n } else if (closestDistance === distance) {\n closestColor.push(varName);\n }\n }\n\n return closestColor[0];\n};\n\nexport function getTailwindAsUdsColors() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tailwindColorsAsUds = {} as Record<string, any>;\n\n /** Avoid logging deprecation warnings */\n\n for (const [name, colorOrConfig] of entries(tailwindColorsConfig)) {\n if (typeof colorOrConfig === 'object') {\n for (const [shade, color] of entries(colorOrConfig)) {\n if (!tailwindColorsAsUds[name]) {\n tailwindColorsAsUds[name] = {};\n }\n tailwindColorsAsUds[name][shade] = getClosestUdsColor(color);\n }\n continue;\n }\n }\n\n return tailwindColorsAsUds;\n}\n"],"mappings":";;;;AAMA,MAAM,wBAAwB;AAC9B,MAAM,gBAAgB,oBAAoB,UAAU,MAAM;AAE1D,MAAM,uBAAuB;CAC3B,SAAS;CACT,SAAS;CACT,aAAa;CACb,OAAO;CACP,OAAO;CACP,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,MAAM;EACJ,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,MAAM;EACJ,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,SAAS;EACP,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,KAAK;EACH,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,QAAQ;EACN,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,QAAQ;EACN,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,MAAM;EACJ,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,SAAS;EAC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AAW,aAAa,OAAO,UAAW;AAChD,MAAI,oBAAoB,QAAQ,WAAW,iBAAiB;AAC1D,qBAAkB;AAClB,kBAAe,CAAC,QAAQ;aACf,oBAAoB,SAC7B,cAAa,KAAK,QAAQ;;AAI9B,QAAO,aAAa;;AAGtB,SAAgB,yBAAyB;CAEvC,MAAM,sBAAsB,EAAE;;AAI9B,MAAK,MAAM,CAAC,MAAM,kBAAkB,QAAQ,qBAAqB,CAC/D,KAAI,OAAO,kBAAkB,UAAU;AACrC,OAAK,MAAM,CAAC,OAAO,UAAU,QAAQ,cAAc,EAAE;AACnD,OAAI,CAAC,oBAAoB,MACvB,qBAAoB,QAAQ,EAAE;AAEhC,uBAAoB,MAAM,SAAS,mBAAmB,MAAM;;AAE9D;;AAIJ,QAAO"}
1
+ {"version":3,"file":"getTailwindAsUdsColors.js","names":[],"sources":["../../../src/tailwind/plugins/getTailwindAsUdsColors.ts"],"sourcesContent":["import { defaultTokensConfig } from '@yahoo/uds-config';\nimport type { SpectrumConfig } from '@yahoo/uds-types';\n\nimport { entries } from '../../utils/entries';\n\n// TODO: Pull from @yahoo/uds-cssTokens package when available\nconst SPECTRUM_COLOR_PREFIX = 'uds-spectrum-color';\nconst lightSpectrum = defaultTokensConfig.colorMode.light.spectrum;\n\nconst tailwindColorsConfig = {\n inherit: 'inherit',\n current: 'currentColor',\n transparent: 'transparent',\n black: '#000',\n white: '#fff',\n slate: {\n 50: '#f8fafc',\n 100: '#f1f5f9',\n 200: '#e2e8f0',\n 300: '#cbd5e1',\n 400: '#94a3b8',\n 500: '#64748b',\n 600: '#475569',\n 700: '#334155',\n 800: '#1e293b',\n 900: '#0f172a',\n 950: '#020617',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n zinc: {\n 50: '#fafafa',\n 100: '#f4f4f5',\n 200: '#e4e4e7',\n 300: '#d4d4d8',\n 400: '#a1a1aa',\n 500: '#71717a',\n 600: '#52525b',\n 700: '#3f3f46',\n 800: '#27272a',\n 900: '#18181b',\n 950: '#09090b',\n },\n neutral: {\n 50: '#fafafa',\n 100: '#f5f5f5',\n 200: '#e5e5e5',\n 300: '#d4d4d4',\n 400: '#a3a3a3',\n 500: '#737373',\n 600: '#525252',\n 700: '#404040',\n 800: '#262626',\n 900: '#171717',\n 950: '#0a0a0a',\n },\n stone: {\n 50: '#fafaf9',\n 100: '#f5f5f4',\n 200: '#e7e5e4',\n 300: '#d6d3d1',\n 400: '#a8a29e',\n 500: '#78716c',\n 600: '#57534e',\n 700: '#44403c',\n 800: '#292524',\n 900: '#1c1917',\n 950: '#0c0a09',\n },\n red: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n 950: '#450a0a',\n },\n orange: {\n 50: '#fff7ed',\n 100: '#ffedd5',\n 200: '#fed7aa',\n 300: '#fdba74',\n 400: '#fb923c',\n 500: '#f97316',\n 600: '#ea580c',\n 700: '#c2410c',\n 800: '#9a3412',\n 900: '#7c2d12',\n 950: '#431407',\n },\n amber: {\n 50: '#fffbeb',\n 100: '#fef3c7',\n 200: '#fde68a',\n 300: '#fcd34d',\n 400: '#fbbf24',\n 500: '#f59e0b',\n 600: '#d97706',\n 700: '#b45309',\n 800: '#92400e',\n 900: '#78350f',\n 950: '#451a03',\n },\n yellow: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n 950: '#422006',\n },\n lime: {\n 50: '#f7fee7',\n 100: '#ecfccb',\n 200: '#d9f99d',\n 300: '#bef264',\n 400: '#a3e635',\n 500: '#84cc16',\n 600: '#65a30d',\n 700: '#4d7c0f',\n 800: '#3f6212',\n 900: '#365314',\n 950: '#1a2e05',\n },\n green: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n 950: '#052e16',\n },\n emerald: {\n 50: '#ecfdf5',\n 100: '#d1fae5',\n 200: '#a7f3d0',\n 300: '#6ee7b7',\n 400: '#34d399',\n 500: '#10b981',\n 600: '#059669',\n 700: '#047857',\n 800: '#065f46',\n 900: '#064e3b',\n 950: '#022c22',\n },\n teal: {\n 50: '#f0fdfa',\n 100: '#ccfbf1',\n 200: '#99f6e4',\n 300: '#5eead4',\n 400: '#2dd4bf',\n 500: '#14b8a6',\n 600: '#0d9488',\n 700: '#0f766e',\n 800: '#115e59',\n 900: '#134e4a',\n 950: '#042f2e',\n },\n cyan: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n sky: {\n 50: '#f0f9ff',\n 100: '#e0f2fe',\n 200: '#bae6fd',\n 300: '#7dd3fc',\n 400: '#38bdf8',\n 500: '#0ea5e9',\n 600: '#0284c7',\n 700: '#0369a1',\n 800: '#075985',\n 900: '#0c4a6e',\n 950: '#082f49',\n },\n blue: {\n 50: '#eff6ff',\n 100: '#dbeafe',\n 200: '#bfdbfe',\n 300: '#93c5fd',\n 400: '#60a5fa',\n 500: '#3b82f6',\n 600: '#2563eb',\n 700: '#1d4ed8',\n 800: '#1e40af',\n 900: '#1e3a8a',\n 950: '#172554',\n },\n indigo: {\n 50: '#eef2ff',\n 100: '#e0e7ff',\n 200: '#c7d2fe',\n 300: '#a5b4fc',\n 400: '#818cf8',\n 500: '#6366f1',\n 600: '#4f46e5',\n 700: '#4338ca',\n 800: '#3730a3',\n 900: '#312e81',\n 950: '#1e1b4b',\n },\n violet: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n purple: {\n 50: '#faf5ff',\n 100: '#f3e8ff',\n 200: '#e9d5ff',\n 300: '#d8b4fe',\n 400: '#c084fc',\n 500: '#a855f7',\n 600: '#9333ea',\n 700: '#7e22ce',\n 800: '#6b21a8',\n 900: '#581c87',\n 950: '#3b0764',\n },\n fuchsia: {\n 50: '#fdf4ff',\n 100: '#fae8ff',\n 200: '#f5d0fe',\n 300: '#f0abfc',\n 400: '#e879f9',\n 500: '#d946ef',\n 600: '#c026d3',\n 700: '#a21caf',\n 800: '#86198f',\n 900: '#701a75',\n 950: '#4a044e',\n },\n pink: {\n 50: '#fdf2f8',\n 100: '#fce7f3',\n 200: '#fbcfe8',\n 300: '#f9a8d4',\n 400: '#f472b6',\n 500: '#ec4899',\n 600: '#db2777',\n 700: '#be185d',\n 800: '#9d174d',\n 900: '#831843',\n 950: '#500724',\n },\n rose: {\n 50: '#fff1f2',\n 100: '#ffe4e6',\n 200: '#fecdd3',\n 300: '#fda4af',\n 400: '#fb7185',\n 500: '#f43f5e',\n 600: '#e11d48',\n 700: '#be123c',\n 800: '#9f1239',\n 900: '#881337',\n 950: '#4c0519',\n },\n} as const;\n\ntype Rgb = { r: number; g: number; b: number };\nconst udsLightColors = flattenSpectrumToRgbRecord(lightSpectrum);\n\n/**\n * Iterates the two-level spectrum structure directly instead of using\n * utils/flattenColorPalette, which would flatten SpectrumValueEntry objects\n * into individual primitives (r, g, b, type) and lose the RGB grouping.\n */\nfunction flattenSpectrumToRgbRecord(spectrum: SpectrumConfig): Record<string, Rgb> {\n const result: Record<string, Rgb> = {};\n for (const [hue, steps] of entries(spectrum)) {\n for (const [step, entry] of entries(steps)) {\n const { rgb } = entry;\n result[`${hue}-${step}`] = { r: rgb.r, g: rgb.g, b: rgb.b };\n }\n }\n return result;\n}\n\nfunction hexToRgb(hex: string) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null;\n}\n\nfunction getDiffColor(a: Rgb, b: Rgb) {\n return Math.sqrt(Math.pow(a.r - b.r, 2) + Math.pow(a.g - b.g, 2) + Math.pow(a.b - b.b, 2));\n}\n\nconst getClosestUdsColor = (targetColor: string) => {\n // Convert target color from hex string to RGB values\n const targetRgb = hexToRgb(targetColor);\n\n let closestDistance = null;\n let closestColor: string[] = [];\n\n for (const [name, color] of entries(udsLightColors)) {\n const varName = `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${name}))`;\n const distance = getDiffColor(color, targetRgb!);\n if (closestDistance === null || distance < closestDistance) {\n closestDistance = distance;\n closestColor = [varName];\n } else if (closestDistance === distance) {\n closestColor.push(varName);\n }\n }\n\n return closestColor[0];\n};\n\nexport function getTailwindAsUdsColors() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tailwindColorsAsUds = {} as Record<string, any>;\n\n /** Avoid logging deprecation warnings */\n\n for (const [name, colorOrConfig] of entries(tailwindColorsConfig)) {\n if (typeof colorOrConfig === 'object') {\n for (const [shade, color] of entries(colorOrConfig)) {\n if (!tailwindColorsAsUds[name]) {\n tailwindColorsAsUds[name] = {};\n }\n tailwindColorsAsUds[name][shade] = getClosestUdsColor(color);\n }\n continue;\n }\n }\n\n return tailwindColorsAsUds;\n}\n"],"mappings":";;;;AAMA,MAAM,wBAAwB;AAC9B,MAAM,gBAAgB,oBAAoB,UAAU,MAAM;AAE1D,MAAM,uBAAuB;CAC3B,SAAS;CACT,SAAS;CACT,aAAa;CACb,OAAO;CACP,OAAO;CACP,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,MAAM;EACJ,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,MAAM;EACJ,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,SAAS;EACP,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,KAAK;EACH,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,QAAQ;EACN,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,OAAO;EACL,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACN;CACD,QAAQ;EACN,IAAI;EACJ,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAA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AAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;;AAG5F,MAAM,sBAAsB,gBAAwB;CAElD,MAAM,YAAY,SAAS,YAAY;CAEvC,IAAI,kBAAkB;CACtB,IAAI,eAAyB,EAAE;CAE/B,KAAK,MAAM,CAAC,MAAM,UAAU,QAAQ,eAAe,EAAE;EACnD,MAAM,UAAU,aAAa,sBAAsB,GAAG,KAAK;EAC3D,MAAM,WAAW,aAAa,OAAO,UAAW;EAChD,IAAI,oBAAoB,QAAQ,WAAW,iBAAiB;GAC1D,kBAAkB;GAClB,eAAe,CAAC,QAAQ;SACnB,IAAI,oBAAoB,UAC7B,aAAa,KAAK,QAAQ;;CAI9B,OAAO,aAAa;;AAGtB,SAAgB,yBAAyB;CAEvC,MAAM,sBAAsB,EAAE;;CAI9B,KAAK,MAAM,CAAC,MAAM,kBAAkB,QAAQ,qBAAqB,EAC/D,IAAI,OAAO,kBAAkB,UAAU;EACrC,KAAK,MAAM,CAAC,OAAO,UAAU,QAAQ,cAAc,EAAE;GACnD,IAAI,CAAC,oBAAoB,OACvB,oBAAoB,QAAQ,EAAE;GAEhC,oBAAoB,MAAM,SAAS,mBAAmB,MAAM;;EAE9D;;CAIJ,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","names":[],"sources":["../../../src/tailwind/plugins/icons.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getIconStyles } from '../components/getIconStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst iconsPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addBase }) => {\n const iconStyles = getIconStyles();\n addBase(iconStyles);\n },\n\n () => ({\n safelist: [\n // NOTE: THESE ICON CLASSES ARE USED IN THE ICON CODEGEN - DO NOT CHANGE THEM\n 'uds-light-mode-icon',\n 'uds-dark-mode-icon',\n ],\n }),\n);\n\nexport { iconsPlugin };\n"],"mappings":";;;;AAKA,MAAM,cAAc,OAAO,mBAEtB,EAAE,cAAc;AAEf,SADmB,eACD,CAAC;UAGhB,EACL,UAAU,CAER,uBACA,qBACD,EACF,EACF"}
1
+ {"version":3,"file":"icons.js","names":[],"sources":["../../../src/tailwind/plugins/icons.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getIconStyles } from '../components/getIconStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst iconsPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addBase }) => {\n const iconStyles = getIconStyles();\n addBase(iconStyles);\n },\n\n () => ({\n safelist: [\n // NOTE: THESE ICON CLASSES ARE USED IN THE ICON CODEGEN - DO NOT CHANGE THEM\n 'uds-light-mode-icon',\n 'uds-dark-mode-icon',\n ],\n }),\n);\n\nexport { iconsPlugin };\n"],"mappings":";;;;AAKA,MAAM,cAAc,OAAO,mBAEtB,EAAE,cAAc;CAEf,QADmB,eACD,CAAC;UAGhB,EACL,UAAU,CAER,uBACA,qBACD,EACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../../src/tailwind/plugins/input.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getInputStyles } from '../components/getInputStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated Should be removed or moved into componentsPlugin in the future\n */\nconst inputPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addComponents }) => {\n // TODO: Skip when `useImportNamespace`?\n const inputStyles = getInputStyles();\n addComponents(inputStyles);\n },\n\n () => ({\n // Guarantee that the dark mode class is not purged\n safelist: [\n 'uds-input[list]::-webkit-calendar-picker-indicator',\n 'uds-input::-webkit-datetime-edit',\n 'uds-input::-webkit-calendar-picker-indicator',\n ],\n }),\n);\n\nexport { inputPlugin };\n"],"mappings":";;;;;;;AAQA,MAAM,cAAc,OAAO,mBAEtB,EAAE,oBAAoB;AAGrB,eADoB,gBACK,CAAC;UAGvB,EAEL,UAAU;CACR;CACA;CACA;CACD,EACF,EACF"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../../src/tailwind/plugins/input.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { getInputStyles } from '../components/getInputStyles';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated Should be removed or moved into componentsPlugin in the future\n */\nconst inputPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addComponents }) => {\n // TODO: Skip when `useImportNamespace`?\n const inputStyles = getInputStyles();\n addComponents(inputStyles);\n },\n\n () => ({\n // Guarantee that the dark mode class is not purged\n safelist: [\n 'uds-input[list]::-webkit-calendar-picker-indicator',\n 'uds-input::-webkit-datetime-edit',\n 'uds-input::-webkit-calendar-picker-indicator',\n ],\n }),\n);\n\nexport { inputPlugin };\n"],"mappings":";;;;;;;AAQA,MAAM,cAAc,OAAO,mBAEtB,EAAE,oBAAoB;CAGrB,cADoB,gBACK,CAAC;UAGvB,EAEL,UAAU;CACR;CACA;CACA;CACD,EACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"motion.js","names":[],"sources":["../../../src/tailwind/plugins/motion.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { addMotionVars } from '../base/addMotionVars';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst motionPlugin = plugin.withOptions<TailwindPluginOptions>(({ config }) => (api) => {\n if (!config.motion) {\n return;\n }\n\n addMotionVars(config.motion, api);\n});\n\nexport { motionPlugin };\n"],"mappings":";;;;AAKA,MAAM,eAAe,OAAO,aAAoC,EAAE,cAAc,QAAQ;AACtF,KAAI,CAAC,OAAO,OACV;AAGF,eAAc,OAAO,QAAQ,IAAI;EACjC"}
1
+ {"version":3,"file":"motion.js","names":[],"sources":["../../../src/tailwind/plugins/motion.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { addMotionVars } from '../base/addMotionVars';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\nconst motionPlugin = plugin.withOptions<TailwindPluginOptions>(({ config }) => (api) => {\n if (!config.motion) {\n return;\n }\n\n addMotionVars(config.motion, api);\n});\n\nexport { motionPlugin };\n"],"mappings":";;;;AAKA,MAAM,eAAe,OAAO,aAAoC,EAAE,cAAc,QAAQ;CACtF,IAAI,CAAC,OAAO,QACV;CAGF,cAAc,OAAO,QAAQ,IAAI;EACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"nestedBorderRadius.js","names":[],"sources":["../../../src/tailwind/plugins/nestedBorderRadius.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getNestedBorderRadiusUtilities } from '../utils/getNestedBorderRadiusUtilities';\nimport { UDS_BORDER_RADIUS_THEME_KEY } from './borderRadius';\nimport { UDS_BORDER_WIDTH_THEME_KEY } from './borderWidth';\n\nconst nestedBorderRadiusPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addUtilities, theme, matchUtilities }) => {\n /** Add nested border radius utilities for components like Menu */\n const nestedBorderRadiusUtilities = getNestedBorderRadiusUtilities();\n addUtilities(nestedBorderRadiusUtilities);\n\n /** Add utilities that set --radius variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-size': (value) => ({\n '--uds-nested-border-radius-size': value,\n }),\n },\n {\n values: theme(UDS_BORDER_RADIUS_THEME_KEY),\n },\n );\n\n /** Add utilities that set --padding variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-spacing': (value) => ({\n '--uds-nested-border-radius-spacing': value,\n }),\n },\n {\n values: theme('spacing'),\n },\n );\n\n /** Add utilities that set --border-width variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-width': (value) => ({\n '--uds-nested-border-radius-width': value,\n }),\n },\n {\n values: theme(UDS_BORDER_WIDTH_THEME_KEY),\n },\n );\n },\n);\n\nexport { nestedBorderRadiusPlugin };\n"],"mappings":";;;;;;AAOA,MAAM,2BAA2B,OAAO,mBAEnC,EAAE,cAAc,OAAO,qBAAqB;AAG3C,cADoC,gCACI,CAAC;;AAGzC,gBACE,EACE,kCAAkC,WAAW,EAC3C,mCAAmC,OACpC,GACF,EACD,EACE,QAAQ,MAAM,4BAA4B,EAC3C,CACF;;AAGD,gBACE,EACE,qCAAqC,WAAW,EAC9C,sCAAsC,OACvC,GACF,EACD,EACE,QAAQ,MAAM,UAAU,EACzB,CACF;;AAGD,gBACE,EACE,mCAAmC,WAAW,EAC5C,oCAAoC,OACrC,GACF,EACD,EACE,QAAQ,MAAM,2BAA2B,EAC1C,CACF;EAEN"}
1
+ {"version":3,"file":"nestedBorderRadius.js","names":[],"sources":["../../../src/tailwind/plugins/nestedBorderRadius.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getNestedBorderRadiusUtilities } from '../utils/getNestedBorderRadiusUtilities';\nimport { UDS_BORDER_RADIUS_THEME_KEY } from './borderRadius';\nimport { UDS_BORDER_WIDTH_THEME_KEY } from './borderWidth';\n\nconst nestedBorderRadiusPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ addUtilities, theme, matchUtilities }) => {\n /** Add nested border radius utilities for components like Menu */\n const nestedBorderRadiusUtilities = getNestedBorderRadiusUtilities();\n addUtilities(nestedBorderRadiusUtilities);\n\n /** Add utilities that set --radius variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-size': (value) => ({\n '--uds-nested-border-radius-size': value,\n }),\n },\n {\n values: theme(UDS_BORDER_RADIUS_THEME_KEY),\n },\n );\n\n /** Add utilities that set --padding variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-spacing': (value) => ({\n '--uds-nested-border-radius-spacing': value,\n }),\n },\n {\n values: theme('spacing'),\n },\n );\n\n /** Add utilities that set --border-width variable for nested border radius calculations */\n matchUtilities(\n {\n 'uds-nested-border-radius-width': (value) => ({\n '--uds-nested-border-radius-width': value,\n }),\n },\n {\n values: theme(UDS_BORDER_WIDTH_THEME_KEY),\n },\n );\n },\n);\n\nexport { nestedBorderRadiusPlugin };\n"],"mappings":";;;;;;AAOA,MAAM,2BAA2B,OAAO,mBAEnC,EAAE,cAAc,OAAO,qBAAqB;CAG3C,aADoC,gCACI,CAAC;;CAGzC,eACE,EACE,kCAAkC,WAAW,EAC3C,mCAAmC,OACpC,GACF,EACD,EACE,QAAQ,MAAM,4BAA4B,EAC3C,CACF;;CAGD,eACE,EACE,qCAAqC,WAAW,EAC9C,sCAAsC,OACvC,GACF,EACD,EACE,QAAQ,MAAM,UAAU,EACzB,CACF;;CAGD,eACE,EACE,mCAAmC,WAAW,EAC5C,oCAAoC,OACrC,GACF,EACD,EACE,QAAQ,MAAM,2BAA2B,EAC1C,CACF;EAEN"}
@@ -1 +1 @@
1
- {"version":3,"file":"scaleMode.js","names":[],"sources":["../../../src/tailwind/plugins/scaleMode.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { parseTokens } from '../../utils/parseTokens';\nimport { addScaleModeVars } from '../base/addScaleModeVars';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated Should be removed once the DB no longer uses it.\n */\nconst scaleModePlugin = plugin.withOptions<TailwindPluginOptions>(({ config }) => (api) => {\n const tokens = parseTokens(config);\n addScaleModeVars(tokens, api);\n});\n\nexport { scaleModePlugin };\n"],"mappings":";;;;;;;;AASA,MAAM,kBAAkB,OAAO,aAAoC,EAAE,cAAc,QAAQ;AAEzF,kBADe,YAAY,OACJ,EAAE,IAAI;EAC7B"}
1
+ {"version":3,"file":"scaleMode.js","names":[],"sources":["../../../src/tailwind/plugins/scaleMode.ts"],"sourcesContent":["import plugin from 'tailwindcss/plugin.js';\n\nimport { parseTokens } from '../../utils/parseTokens';\nimport { addScaleModeVars } from '../base/addScaleModeVars';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated Should be removed once the DB no longer uses it.\n */\nconst scaleModePlugin = plugin.withOptions<TailwindPluginOptions>(({ config }) => (api) => {\n const tokens = parseTokens(config);\n addScaleModeVars(tokens, api);\n});\n\nexport { scaleModePlugin };\n"],"mappings":";;;;;;;;AASA,MAAM,kBAAkB,OAAO,aAAoC,EAAE,cAAc,QAAQ;CAEzF,iBADe,YAAY,OACJ,EAAE,IAAI;EAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.js","names":[],"sources":["../../../src/tailwind/plugins/shadows.ts"],"sourcesContent":["import { shadowOffsetMap, shadowOpacityMap, shadowSpreadRadiusMap } from '@yahoo/uds-fixtures';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getShadowPresetValues } from '../utils/getShadowPresetValues';\nimport { getShadowStyles } from '../utils/getShadowStyles';\n\nconst shadowsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config }) =>\n ({ addUtilities, addBase }) => {\n /** Add shadow utilities to make shadow props available in Tailwind */\n if (!config.shadow) {\n return;\n }\n\n // Add _all_ shadow variables (drop & inset) variants to the root\n const dropShadowVariables = getShadowPresetValues({ config, shadowType: 'drop' });\n const insetShadowVariables = getShadowPresetValues({ config, shadowType: 'inset' });\n addBase({ ...dropShadowVariables, ...insetShadowVariables });\n\n // Setup variants for drop & inset shadows\n const dropShadowStyles = getShadowStyles({ config, shadowType: 'drop' });\n const insetShadowStyles = getShadowStyles({ config, shadowType: 'inset' });\n addUtilities({ ...dropShadowStyles, ...insetShadowStyles });\n },\n\n () => ({\n theme: {\n extend: {\n shadowOpacity: shadowOpacityMap,\n shadowSpread: shadowSpreadRadiusMap,\n shadowOffset: shadowOffsetMap,\n shadowBlur: shadowOffsetMap,\n },\n },\n }),\n);\n\nexport { shadowsPlugin };\n"],"mappings":";;;;;;AAOA,MAAM,gBAAgB,OAAO,aAC1B,EAAE,cACA,EAAE,cAAc,cAAc;;AAE7B,KAAI,CAAC,OAAO,OACV;CAIF,MAAM,sBAAsB,sBAAsB;EAAE;EAAQ,YAAY;EAAQ,CAAC;CACjF,MAAM,uBAAuB,sBAAsB;EAAE;EAAQ,YAAY;EAAS,CAAC;AACnF,SAAQ;EAAE,GAAG;EAAqB,GAAG;EAAsB,CAAC;CAG5D,MAAM,mBAAmB,gBAAgB;EAAE;EAAQ,YAAY;EAAQ,CAAC;CACxE,MAAM,oBAAoB,gBAAgB;EAAE;EAAQ,YAAY;EAAS,CAAC;AAC1E,cAAa;EAAE,GAAG;EAAkB,GAAG;EAAmB,CAAC;UAGxD,EACL,OAAO,EACL,QAAQ;CACN,eAAe;CACf,cAAc;CACd,cAAc;CACd,YAAY;CACb,EACF,EACF,EACF"}
1
+ {"version":3,"file":"shadows.js","names":[],"sources":["../../../src/tailwind/plugins/shadows.ts"],"sourcesContent":["import { shadowOffsetMap, shadowOpacityMap, shadowSpreadRadiusMap } from '@yahoo/uds-fixtures';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { getShadowPresetValues } from '../utils/getShadowPresetValues';\nimport { getShadowStyles } from '../utils/getShadowStyles';\n\nconst shadowsPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config }) =>\n ({ addUtilities, addBase }) => {\n /** Add shadow utilities to make shadow props available in Tailwind */\n if (!config.shadow) {\n return;\n }\n\n // Add _all_ shadow variables (drop & inset) variants to the root\n const dropShadowVariables = getShadowPresetValues({ config, shadowType: 'drop' });\n const insetShadowVariables = getShadowPresetValues({ config, shadowType: 'inset' });\n addBase({ ...dropShadowVariables, ...insetShadowVariables });\n\n // Setup variants for drop & inset shadows\n const dropShadowStyles = getShadowStyles({ config, shadowType: 'drop' });\n const insetShadowStyles = getShadowStyles({ config, shadowType: 'inset' });\n addUtilities({ ...dropShadowStyles, ...insetShadowStyles });\n },\n\n () => ({\n theme: {\n extend: {\n shadowOpacity: shadowOpacityMap,\n shadowSpread: shadowSpreadRadiusMap,\n shadowOffset: shadowOffsetMap,\n shadowBlur: shadowOffsetMap,\n },\n },\n }),\n);\n\nexport { shadowsPlugin };\n"],"mappings":";;;;;;AAOA,MAAM,gBAAgB,OAAO,aAC1B,EAAE,cACA,EAAE,cAAc,cAAc;;CAE7B,IAAI,CAAC,OAAO,QACV;CAIF,MAAM,sBAAsB,sBAAsB;EAAE;EAAQ,YAAY;EAAQ,CAAC;CACjF,MAAM,uBAAuB,sBAAsB;EAAE;EAAQ,YAAY;EAAS,CAAC;CACnF,QAAQ;EAAE,GAAG;EAAqB,GAAG;EAAsB,CAAC;CAG5D,MAAM,mBAAmB,gBAAgB;EAAE;EAAQ,YAAY;EAAQ,CAAC;CACxE,MAAM,oBAAoB,gBAAgB;EAAE;EAAQ,YAAY;EAAS,CAAC;CAC1E,aAAa;EAAE,GAAG;EAAkB,GAAG;EAAmB,CAAC;UAGxD,EACL,OAAO,EACL,QAAQ;CACN,eAAe;CACf,cAAc;CACd,cAAc;CACd,YAAY;CACb,EACF,EACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"sizing.js","names":[],"sources":["../../../src/tailwind/plugins/sizing.ts"],"sourcesContent":["import { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { parseTokens } from '../../utils/parseTokens';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated The resulting CSS does not seem to be in use anywhere.\n */\nconst sizingPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n iconSize: (value) => ({\n width: value,\n height: value,\n fontSize: value,\n lineHeight: value,\n }),\n },\n {\n values: theme('sizing.icon'),\n },\n );\n\n matchUtilities(\n {\n avatarSize: (value) => ({\n width: value,\n height: value,\n }),\n },\n {\n values: theme('sizing.avatar'),\n },\n );\n },\n\n ({ config }) => {\n const tokens = parseTokens(config);\n const scaleModeToken = tokens.scaleMode[DEFAULT_SCALE_MODE];\n\n return {\n theme: {\n extend: {\n sizing: {\n icon: scaleModeToken.iconSizes.tailwindConfig,\n avatar: scaleModeToken.avatarSizes.tailwindConfig,\n },\n },\n },\n };\n },\n);\n\nexport { sizingPlugin };\n"],"mappings":";;;;;;;;AASA,MAAM,eAAe,OAAO,mBAEvB,EAAE,gBAAgB,YAAY;AAC7B,gBACE,EACE,WAAW,WAAW;EACpB,OAAO;EACP,QAAQ;EACR,UAAU;EACV,YAAY;EACb,GACF,EACD,EACE,QAAQ,MAAM,cAAc,EAC7B,CACF;AAED,gBACE,EACE,aAAa,WAAW;EACtB,OAAO;EACP,QAAQ;EACT,GACF,EACD,EACE,QAAQ,MAAM,gBAAgB,EAC/B,CACF;IAGJ,EAAE,aAAa;CAEd,MAAM,iBADS,YAAY,OACE,CAAC,UAAU;AAExC,QAAO,EACL,OAAO,EACL,QAAQ,EACN,QAAQ;EACN,MAAM,eAAe,UAAU;EAC/B,QAAQ,eAAe,YAAY;EACpC,EACF,EACF,EACF;EAEJ"}
1
+ {"version":3,"file":"sizing.js","names":[],"sources":["../../../src/tailwind/plugins/sizing.ts"],"sourcesContent":["import { DEFAULT_SCALE_MODE } from '@yahoo/uds-modes';\nimport plugin from 'tailwindcss/plugin.js';\n\nimport { parseTokens } from '../../utils/parseTokens';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\n\n/**\n * @deprecated The resulting CSS does not seem to be in use anywhere.\n */\nconst sizingPlugin = plugin.withOptions<TailwindPluginOptions>(\n () =>\n ({ matchUtilities, theme }) => {\n matchUtilities(\n {\n iconSize: (value) => ({\n width: value,\n height: value,\n fontSize: value,\n lineHeight: value,\n }),\n },\n {\n values: theme('sizing.icon'),\n },\n );\n\n matchUtilities(\n {\n avatarSize: (value) => ({\n width: value,\n height: value,\n }),\n },\n {\n values: theme('sizing.avatar'),\n },\n );\n },\n\n ({ config }) => {\n const tokens = parseTokens(config);\n const scaleModeToken = tokens.scaleMode[DEFAULT_SCALE_MODE];\n\n return {\n theme: {\n extend: {\n sizing: {\n icon: scaleModeToken.iconSizes.tailwindConfig,\n avatar: scaleModeToken.avatarSizes.tailwindConfig,\n },\n },\n },\n };\n },\n);\n\nexport { sizingPlugin };\n"],"mappings":";;;;;;;;AASA,MAAM,eAAe,OAAO,mBAEvB,EAAE,gBAAgB,YAAY;CAC7B,eACE,EACE,WAAW,WAAW;EACpB,OAAO;EACP,QAAQ;EACR,UAAU;EACV,YAAY;EACb,GACF,EACD,EACE,QAAQ,MAAM,cAAc,EAC7B,CACF;CAED,eACE,EACE,aAAa,WAAW;EACtB,OAAO;EACP,QAAQ;EACT,GACF,EACD,EACE,QAAQ,MAAM,gBAAgB,EAC/B,CACF;IAGJ,EAAE,aAAa;CAEd,MAAM,iBADS,YAAY,OACE,CAAC,UAAU;CAExC,OAAO,EACL,OAAO,EACL,QAAQ,EACN,QAAQ;EACN,MAAM,eAAe,UAAU;EAC/B,QAAQ,eAAe,YAAY;EACpC,EACF,EACF,EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"typography.js","names":[],"sources":["../../../src/tailwind/plugins/typography.ts"],"sourcesContent":["import {\n FONT_SIZE_PREFIX,\n LINE_HEIGHT_PREFIX,\n TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,\n TEXT_RESPONSIVE_CLASSNAME,\n} from '@yahoo/uds-css-tokens';\nimport { textVariants } from '@yahoo/uds-fixtures';\nimport type { FontID } from '@yahoo/uds-fonts';\nimport type {\n BreakpointWithBase,\n FontWeightDescriptive,\n FontWeightNumeric,\n TextVariant,\n} from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\nimport type { CSSRuleObject } from 'tailwindcss/types/config';\nimport type { DefaultTheme } from 'tailwindcss/types/generated/default-theme';\n\nimport { entries } from '../../utils/entries';\nimport { fromEntries } from '../../utils/fromEntries';\nimport { addFontFaceDeclarations } from '../base/addFontFaceDeclarations';\nimport { addFontVars } from '../base/addFontVars';\nimport { getGroupedTextStyles } from '../components/getGroupedTextStyles';\nimport {\n getBaseTextVars,\n getResponsiveTextStyles,\n RESPONSIVE_TAILWIND_CONFIG_MAP,\n textVariantsSafe,\n} from '../components/getResponsiveTextStyles';\nimport { udsToTailwindMap } from '../defaultTailwindThemeAsUdsConfig';\nimport { getFontFamilyTheme } from '../theme/getFontFamilyTheme';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_FONT_FAMILY_THEME_KEY = 'udsFontFamily';\nconst UDS_FONT_SIZE_THEME_KEY = 'udsFontSize';\nconst UDS_FONT_WEIGHT_THEME_KEY = 'udsFontWeight';\nconst UDS_FONT_SLANT_THEME_KEY = 'udsFontSlant';\nconst UDS_LINE_HEIGHT_THEME_KEY = 'udsLineHeight';\nconst UDS_LETTER_SPACING_THEME_KEY = 'udsLetterSpacing';\nconst UDS_TEXT_TRANSFORM_THEME_KEY = 'udsTextTransform';\nconst UDS_FONT_WIDTH_THEME_KEY = 'udsFontWidth';\n\n/** @deprecated Descriptive font weights vary based on font, so this is not correct for each font we support\n * This is used as a baseline for using native font weights in the system IE. <Text fontWeight=\"bold\" />\n */\nconst fontWeightMap: Record<FontWeightDescriptive, FontWeightNumeric> = {\n thin: '100',\n extralight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n extrabold: '800',\n black: '900',\n};\n\nconst typographyPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config, disableOverrideTailwindTheme, disableFontFaceDeclarations = false }) =>\n (api) => {\n const shouldMergeTypographyTokensIntoTailwindTheme = !shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'typography',\n );\n\n const { addBase, addUtilities, addComponents, matchUtilities, theme } = api;\n\n const fontIds = Object.values(config.font) as FontID[];\n\n // TODO: Skip when `useImportNamespace`?\n if (disableFontFaceDeclarations === false) {\n addFontFaceDeclarations(fontIds, api);\n }\n\n addFontVars(config.font, api);\n\n // Use the base typography to setup text styles (no longer using scaleMode.large)\n addBase(getBaseTextVars(config));\n\n // Utility short-hand for grouped text styles\n addBase(getGroupedTextStyles());\n\n // Add responsive text styles\n const enableResponsiveTypeRamp = config.globalDefaults.enableResponsiveType ?? false;\n if (enableResponsiveTypeRamp && config.typography && config.breakpoints) {\n addComponents(getResponsiveTextStyles(config));\n }\n\n // Retrieve the font weight map from the tailwind config\n const namedFontWeightsFromPlugin =\n (theme('udsFontWeight') as Record<FontWeightDescriptive | TextVariant | string, string>) ||\n {};\n\n // Combine any of the named font weights passed into the plugin (label1, myCrazyFontWeight)\n // with the default font weight map (thin, extralight, light, regular, medium, semibold, bold, extrabold, black)\n const fontWeightsWithDescriptives = {\n ...fontWeightMap, // Remove when fontWeightMap is deprecated\n ...namedFontWeightsFromPlugin,\n };\n\n Object.entries(fontWeightsWithDescriptives).forEach(([fontWeight, value]) => {\n const styles: CSSRuleObject = {};\n\n // If this font weight is one of the text variants, we need to use font-variation-settings\n if (textVariants.map(textVariantsSafe).includes(fontWeight as TextVariant)) {\n const textVariant = fontWeight as TextVariant;\n const slantValue = theme(`udsFontSlant.${textVariant}`);\n const widthValue = theme(`udsFontWidth.${textVariant}`);\n styles['font-weight'] = value;\n // Include both slnt and ital axes to support fonts using either axis type\n styles['font-variation-settings'] =\n `\"wght\" ${value}, \"slnt\" ${slantValue}, \"ital\" ${slantValue}, \"wdth\" ${widthValue}`;\n\n // Reset font-variation-settings for b/strong tags to ensure they appear bolder.\n const bolderStyles = { 'font-variation-settings': 'normal' };\n styles['b'] = bolderStyles;\n styles['strong'] = bolderStyles;\n } else {\n // Otherwise, we can just use the font-weight property\n styles['font-weight'] = value;\n }\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n // add .font-weight-bold, .font-weight-label1, .font-weight-myCrazyFontWeight, etc.\n addUtilities({ [`.font-weight-${fontWeight}`]: styles });\n }\n\n addUtilities({ [`.uds-font-weight-${fontWeight}`]: styles });\n });\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n matchUtilities(\n {\n 'font-size': (value) => ({\n 'font-size': value,\n }),\n },\n {\n values: theme(UDS_FONT_SIZE_THEME_KEY),\n },\n );\n }\n\n matchUtilities(\n {\n 'uds-font-size': (value) => ({\n 'font-size': value,\n }),\n },\n {\n values: theme(UDS_FONT_SIZE_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-font-family': (value) => ({\n 'font-family': value,\n }),\n },\n {\n values: theme(UDS_FONT_FAMILY_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-line-height': (value) => ({\n 'line-height': value,\n }),\n },\n {\n values: theme(UDS_LINE_HEIGHT_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-letter-spacing': (value) => ({\n 'letter-spacing': value,\n }),\n },\n {\n values: theme(UDS_LETTER_SPACING_THEME_KEY),\n },\n );\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n matchUtilities(\n {\n case: (value) => ({\n 'text-transform': value,\n }),\n },\n {\n values: theme(UDS_TEXT_TRANSFORM_THEME_KEY),\n },\n );\n }\n\n matchUtilities(\n {\n 'uds-text-transform': (value) => {\n return {\n 'text-transform': value,\n };\n },\n },\n {\n values: theme(UDS_TEXT_TRANSFORM_THEME_KEY),\n },\n );\n },\n\n ({ disableOverrideTailwindTheme }) => {\n const shouldNotMergeTypographyTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'typography',\n );\n\n /* -------------------------------- FONT SIZE ------------------------------- */\n /**\n * UDS does not offer enough text variants to cover all of Tailwind's font sizes\n * so we are going to exclude the following from the UDS config:\n */\n type ExcludedTwFontSizes = '7xl' | '8xl' | '9xl';\n type TwFontSizeAlias = Exclude<keyof DefaultTheme['fontSize'], ExcludedTwFontSizes>;\n type TwFontSizeConfig = Record<TwFontSizeAlias, [string, { lineHeight: string }]>;\n\n /**\n * Reassign Tailwind's font size aliases to UDS's font size aliases\n * This makes it so UDS configs can power both Tailwind and UDS components\n */\n const tailwindFontSize: TwFontSizeConfig = fromEntries(\n entries(udsToTailwindMap.fontSize).map(([udsAlias, twAlias]) => {\n return [\n twAlias,\n [\n `var(--${FONT_SIZE_PREFIX}-${textVariantsSafe(udsAlias)})`,\n { lineHeight: `var(--${LINE_HEIGHT_PREFIX}-${textVariantsSafe(udsAlias)})` },\n ],\n ] as const;\n }),\n );\n\n const textClasses = textVariants.map((variant) => `uds-text-${textVariantsSafe(variant)}`);\n const responsiveTextClasses = [\n TEXT_RESPONSIVE_CLASSNAME,\n ...Object.keys(TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES).map(\n (variant) => TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[variant as BreakpointWithBase],\n ),\n ];\n\n const fontFamily = getFontFamilyTheme();\n const { lineHeight, letterSpacing, fontSize, textTransform, fontWeight, fontSlant, fontWidth } =\n RESPONSIVE_TAILWIND_CONFIG_MAP;\n\n return {\n safelist: [...textClasses, ...responsiveTextClasses],\n theme: {\n extend: {\n ...(shouldNotMergeTypographyTokensIntoTailwindTheme\n ? {}\n : {\n fontFamily,\n fontSize: tailwindFontSize,\n lineHeight,\n letterSpacing,\n }),\n\n [UDS_FONT_FAMILY_THEME_KEY]: fontFamily,\n [UDS_FONT_SIZE_THEME_KEY]: fontSize,\n [UDS_FONT_WEIGHT_THEME_KEY]: fontWeight,\n [UDS_FONT_SLANT_THEME_KEY]: fontSlant,\n [UDS_LINE_HEIGHT_THEME_KEY]: lineHeight,\n [UDS_LETTER_SPACING_THEME_KEY]: letterSpacing,\n [UDS_TEXT_TRANSFORM_THEME_KEY]: textTransform,\n [UDS_FONT_WIDTH_THEME_KEY]: fontWidth,\n },\n },\n };\n },\n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AK,CAAC,UAAU,aAAa;AAC9D,SAAO,CACL,SACA,CACE,SAAS,iBAAiB,GAAG,iBAAiB,SAAS,CAAC,IACxD,EAAE,YAAY,SAAS,mBAAmB,GAAG,iBAAiB,SAAS,CAAC,IAAI,CAC7E,CACF;GACD,CACH;CAED,MAAM,cAAc,aAAa,KAAK,YAAY,YAAY,iBAAiB,QAAQ,GAAG;CAC1F,MAAM,wBAAwB,CAC5B,2BACA,GAAG,OAAO,KAAK,sCAAsC,CAAC,KACnD,YAAY,sCAAsC,SACpD,CACF;CAED,MAAM,aAAa,oBAAoB;CACvC,MAAM,EAAE,YAAY,eAAe,UAAU,eAAe,YAAY,WAAW,cACjF;AAEF,QAAO;EACL,UAAU,CAAC,GAAG,aAAa,GAAG,sBAAsB;EACpD,OAAO,EACL,QAAQ;GACN,GAAI,kDACA,EAAE,GACF;IACE;IACA,UAAU;IACV;IACA;IACD;IAEJ,4BAA4B;IAC5B,0BAA0B;IAC1B,4BAA4B;IAC5B,2BAA2B;IAC3B,4BAA4B;IAC5B,+BAA+B;IAC/B,+BAA+B;IAC/B,2BAA2B;GAC7B,EACF;EACF;EAEJ"}
1
+ {"version":3,"file":"typography.js","names":[],"sources":["../../../src/tailwind/plugins/typography.ts"],"sourcesContent":["import {\n FONT_SIZE_PREFIX,\n LINE_HEIGHT_PREFIX,\n TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,\n TEXT_RESPONSIVE_CLASSNAME,\n} from '@yahoo/uds-css-tokens';\nimport { textVariants } from '@yahoo/uds-fixtures';\nimport type { FontID } from '@yahoo/uds-fonts';\nimport type {\n BreakpointWithBase,\n FontWeightDescriptive,\n FontWeightNumeric,\n TextVariant,\n} from '@yahoo/uds-types';\nimport plugin from 'tailwindcss/plugin.js';\nimport type { CSSRuleObject } from 'tailwindcss/types/config';\nimport type { DefaultTheme } from 'tailwindcss/types/generated/default-theme';\n\nimport { entries } from '../../utils/entries';\nimport { fromEntries } from '../../utils/fromEntries';\nimport { addFontFaceDeclarations } from '../base/addFontFaceDeclarations';\nimport { addFontVars } from '../base/addFontVars';\nimport { getGroupedTextStyles } from '../components/getGroupedTextStyles';\nimport {\n getBaseTextVars,\n getResponsiveTextStyles,\n RESPONSIVE_TAILWIND_CONFIG_MAP,\n textVariantsSafe,\n} from '../components/getResponsiveTextStyles';\nimport { udsToTailwindMap } from '../defaultTailwindThemeAsUdsConfig';\nimport { getFontFamilyTheme } from '../theme/getFontFamilyTheme';\nimport type { TailwindPluginOptions } from '../utils/composeTailwindPlugins';\nimport { shouldNotMergeTokensIntoTailwindTheme } from '../utils/composeTailwindPlugins';\n\nconst UDS_FONT_FAMILY_THEME_KEY = 'udsFontFamily';\nconst UDS_FONT_SIZE_THEME_KEY = 'udsFontSize';\nconst UDS_FONT_WEIGHT_THEME_KEY = 'udsFontWeight';\nconst UDS_FONT_SLANT_THEME_KEY = 'udsFontSlant';\nconst UDS_LINE_HEIGHT_THEME_KEY = 'udsLineHeight';\nconst UDS_LETTER_SPACING_THEME_KEY = 'udsLetterSpacing';\nconst UDS_TEXT_TRANSFORM_THEME_KEY = 'udsTextTransform';\nconst UDS_FONT_WIDTH_THEME_KEY = 'udsFontWidth';\n\n/** @deprecated Descriptive font weights vary based on font, so this is not correct for each font we support\n * This is used as a baseline for using native font weights in the system IE. <Text fontWeight=\"bold\" />\n */\nconst fontWeightMap: Record<FontWeightDescriptive, FontWeightNumeric> = {\n thin: '100',\n extralight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n extrabold: '800',\n black: '900',\n};\n\nconst typographyPlugin = plugin.withOptions<TailwindPluginOptions>(\n ({ config, disableOverrideTailwindTheme, disableFontFaceDeclarations = false }) =>\n (api) => {\n const shouldMergeTypographyTokensIntoTailwindTheme = !shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'typography',\n );\n\n const { addBase, addUtilities, addComponents, matchUtilities, theme } = api;\n\n const fontIds = Object.values(config.font) as FontID[];\n\n // TODO: Skip when `useImportNamespace`?\n if (disableFontFaceDeclarations === false) {\n addFontFaceDeclarations(fontIds, api);\n }\n\n addFontVars(config.font, api);\n\n // Use the base typography to setup text styles (no longer using scaleMode.large)\n addBase(getBaseTextVars(config));\n\n // Utility short-hand for grouped text styles\n addBase(getGroupedTextStyles());\n\n // Add responsive text styles\n const enableResponsiveTypeRamp = config.globalDefaults.enableResponsiveType ?? false;\n if (enableResponsiveTypeRamp && config.typography && config.breakpoints) {\n addComponents(getResponsiveTextStyles(config));\n }\n\n // Retrieve the font weight map from the tailwind config\n const namedFontWeightsFromPlugin =\n (theme('udsFontWeight') as Record<FontWeightDescriptive | TextVariant | string, string>) ||\n {};\n\n // Combine any of the named font weights passed into the plugin (label1, myCrazyFontWeight)\n // with the default font weight map (thin, extralight, light, regular, medium, semibold, bold, extrabold, black)\n const fontWeightsWithDescriptives = {\n ...fontWeightMap, // Remove when fontWeightMap is deprecated\n ...namedFontWeightsFromPlugin,\n };\n\n Object.entries(fontWeightsWithDescriptives).forEach(([fontWeight, value]) => {\n const styles: CSSRuleObject = {};\n\n // If this font weight is one of the text variants, we need to use font-variation-settings\n if (textVariants.map(textVariantsSafe).includes(fontWeight as TextVariant)) {\n const textVariant = fontWeight as TextVariant;\n const slantValue = theme(`udsFontSlant.${textVariant}`);\n const widthValue = theme(`udsFontWidth.${textVariant}`);\n styles['font-weight'] = value;\n // Include both slnt and ital axes to support fonts using either axis type\n styles['font-variation-settings'] =\n `\"wght\" ${value}, \"slnt\" ${slantValue}, \"ital\" ${slantValue}, \"wdth\" ${widthValue}`;\n\n // Reset font-variation-settings for b/strong tags to ensure they appear bolder.\n const bolderStyles = { 'font-variation-settings': 'normal' };\n styles['b'] = bolderStyles;\n styles['strong'] = bolderStyles;\n } else {\n // Otherwise, we can just use the font-weight property\n styles['font-weight'] = value;\n }\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n // add .font-weight-bold, .font-weight-label1, .font-weight-myCrazyFontWeight, etc.\n addUtilities({ [`.font-weight-${fontWeight}`]: styles });\n }\n\n addUtilities({ [`.uds-font-weight-${fontWeight}`]: styles });\n });\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n matchUtilities(\n {\n 'font-size': (value) => ({\n 'font-size': value,\n }),\n },\n {\n values: theme(UDS_FONT_SIZE_THEME_KEY),\n },\n );\n }\n\n matchUtilities(\n {\n 'uds-font-size': (value) => ({\n 'font-size': value,\n }),\n },\n {\n values: theme(UDS_FONT_SIZE_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-font-family': (value) => ({\n 'font-family': value,\n }),\n },\n {\n values: theme(UDS_FONT_FAMILY_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-line-height': (value) => ({\n 'line-height': value,\n }),\n },\n {\n values: theme(UDS_LINE_HEIGHT_THEME_KEY),\n },\n );\n\n matchUtilities(\n {\n 'uds-letter-spacing': (value) => ({\n 'letter-spacing': value,\n }),\n },\n {\n values: theme(UDS_LETTER_SPACING_THEME_KEY),\n },\n );\n\n if (shouldMergeTypographyTokensIntoTailwindTheme) {\n matchUtilities(\n {\n case: (value) => ({\n 'text-transform': value,\n }),\n },\n {\n values: theme(UDS_TEXT_TRANSFORM_THEME_KEY),\n },\n );\n }\n\n matchUtilities(\n {\n 'uds-text-transform': (value) => {\n return {\n 'text-transform': value,\n };\n },\n },\n {\n values: theme(UDS_TEXT_TRANSFORM_THEME_KEY),\n },\n );\n },\n\n ({ disableOverrideTailwindTheme }) => {\n const shouldNotMergeTypographyTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(\n disableOverrideTailwindTheme,\n 'typography',\n );\n\n /* -------------------------------- FONT SIZE ------------------------------- */\n /**\n * UDS does not offer enough text variants to cover all of Tailwind's font sizes\n * so we are going to exclude the following from the UDS config:\n */\n type ExcludedTwFontSizes = '7xl' | '8xl' | '9xl';\n type TwFontSizeAlias = Exclude<keyof DefaultTheme['fontSize'], ExcludedTwFontSizes>;\n type TwFontSizeConfig = Record<TwFontSizeAlias, [string, { lineHeight: string }]>;\n\n /**\n * Reassign Tailwind's font size aliases to UDS's font size aliases\n * This makes it so UDS configs can power both Tailwind and UDS components\n */\n const tailwindFontSize: TwFontSizeConfig = fromEntries(\n entries(udsToTailwindMap.fontSize).map(([udsAlias, twAlias]) => {\n return [\n twAlias,\n [\n `var(--${FONT_SIZE_PREFIX}-${textVariantsSafe(udsAlias)})`,\n { lineHeight: `var(--${LINE_HEIGHT_PREFIX}-${textVariantsSafe(udsAlias)})` },\n ],\n ] as const;\n }),\n );\n\n const textClasses = textVariants.map((variant) => `uds-text-${textVariantsSafe(variant)}`);\n const responsiveTextClasses = [\n TEXT_RESPONSIVE_CLASSNAME,\n ...Object.keys(TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES).map(\n (variant) => TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[variant as BreakpointWithBase],\n ),\n ];\n\n const fontFamily = getFontFamilyTheme();\n const { lineHeight, letterSpacing, fontSize, textTransform, fontWeight, fontSlant, fontWidth } =\n RESPONSIVE_TAILWIND_CONFIG_MAP;\n\n return {\n safelist: [...textClasses, ...responsiveTextClasses],\n theme: {\n extend: {\n ...(shouldNotMergeTypographyTokensIntoTailwindTheme\n ? {}\n : {\n fontFamily,\n fontSize: tailwindFontSize,\n lineHeight,\n letterSpacing,\n }),\n\n [UDS_FONT_FAMILY_THEME_KEY]: fontFamily,\n [UDS_FONT_SIZE_THEME_KEY]: fontSize,\n [UDS_FONT_WEIGHT_THEME_KEY]: fontWeight,\n [UDS_FONT_SLANT_THEME_KEY]: fontSlant,\n [UDS_LINE_HEIGHT_THEME_KEY]: lineHeight,\n [UDS_LETTER_SPACING_THEME_KEY]: letterSpacing,\n [UDS_TEXT_TRANSFORM_THEME_KEY]: textTransform,\n [UDS_FONT_WIDTH_THEME_KEY]: fontWidth,\n },\n },\n };\n },\n);\n\nexport {\n typographyPlugin,\n UDS_FONT_FAMILY_THEME_KEY,\n UDS_FONT_SIZE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B,SAAS,CAAC,IACxD,EAAE,YAAY,SAAS,mBAAmB,GAAG,iBAAiB,SAAS,CAAC,IAAI,CAC7E,CACF;GACD,CACH;CAED,MAAM,cAAc,aAAa,KAAK,YAAY,YAAY,iBAAiB,QAAQ,GAAG;CAC1F,MAAM,wBAAwB,CAC5B,2BACA,GAAG,OAAO,KAAK,sCAAsC,CAAC,KACnD,YAAY,sCAAsC,SACpD,CACF;CAED,MAAM,aAAa,oBAAoB;CACvC,MAAM,EAAE,YAAY,eAAe,UAAU,eAAe,YAAY,WAAW,cACjF;CAEF,OAAO;EACL,UAAU,CAAC,GAAG,aAAa,GAAG,sBAAsB;EACpD,OAAO,EACL,QAAQ;GACN,GAAI,kDACA,EAAE,GACF;IACE;IACA,UAAU;IACV;IACA;IACD;IAEJ,4BAA4B;IAC5B,0BAA0B;IAC1B,4BAA4B;IAC5B,2BAA2B;IAC3B,4BAA4B;IAC5B,+BAA+B;IAC/B,+BAA+B;IAC/B,2BAA2B;GAC7B,EACF;EACF;EAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"getFontFamilyTheme.js","names":[],"sources":["../../../src/tailwind/theme/getFontFamilyTheme.ts"],"sourcesContent":["import { FONT_FAMILY_PREFIX } from '@yahoo/uds-css-tokens';\nimport { fontAliases, textVariants } from '@yahoo/uds-fixtures';\nimport type { ThemeConfig } from 'tailwindcss/types/config';\n\nimport { textVariantsSafe } from '../components/getResponsiveTextStyles';\n\nexport function getFontFamilyTheme(): ThemeConfig['fontFamily'] {\n /** Global font family aliases i.e. font-sans, font-serif, etc */\n const globalFonts = Object.fromEntries(\n fontAliases.map((fontAlias) => {\n const cssVar = `var(--${FONT_FAMILY_PREFIX}-${fontAlias})` as const;\n return [fontAlias, cssVar] as const;\n }),\n );\n\n /** Text variant font family assignments i.e. font-display1 */\n const textVariantFonts = Object.fromEntries(\n textVariants.map(textVariantsSafe).map((textVariant) => {\n const cssVar = `var(--${FONT_FAMILY_PREFIX}-${textVariant})` as const;\n return [textVariant, cssVar] as const;\n }),\n );\n\n return {\n ...globalFonts,\n ...textVariantFonts,\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,qBAAgD;;CAE9D,MAAM,cAAc,OAAO,YACzB,YAAY,KAAK,cAAc;AAE7B,SAAO,CAAC,WAAW,SADK,mBAAmB,GAAG,UAAU,GAC9B;GAC1B,CACH;;CAGD,MAAM,mBAAmB,OAAO,YAC9B,aAAa,IAAI,iBAAiB,CAAC,KAAK,gBAAgB;AAEtD,SAAO,CAAC,aAAa,SADG,mBAAmB,GAAG,YAAY,GAC9B;GAC5B,CACH;AAED,QAAO;EACL,GAAG;EACH,GAAG;EACJ"}
1
+ {"version":3,"file":"getFontFamilyTheme.js","names":[],"sources":["../../../src/tailwind/theme/getFontFamilyTheme.ts"],"sourcesContent":["import { FONT_FAMILY_PREFIX } from '@yahoo/uds-css-tokens';\nimport { fontAliases, textVariants } from '@yahoo/uds-fixtures';\nimport type { ThemeConfig } from 'tailwindcss/types/config';\n\nimport { textVariantsSafe } from '../components/getResponsiveTextStyles';\n\nexport function getFontFamilyTheme(): ThemeConfig['fontFamily'] {\n /** Global font family aliases i.e. font-sans, font-serif, etc */\n const globalFonts = Object.fromEntries(\n fontAliases.map((fontAlias) => {\n const cssVar = `var(--${FONT_FAMILY_PREFIX}-${fontAlias})` as const;\n return [fontAlias, cssVar] as const;\n }),\n );\n\n /** Text variant font family assignments i.e. font-display1 */\n const textVariantFonts = Object.fromEntries(\n textVariants.map(textVariantsSafe).map((textVariant) => {\n const cssVar = `var(--${FONT_FAMILY_PREFIX}-${textVariant})` as const;\n return [textVariant, cssVar] as const;\n }),\n );\n\n return {\n ...globalFonts,\n ...textVariantFonts,\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,qBAAgD;;CAE9D,MAAM,cAAc,OAAO,YACzB,YAAY,KAAK,cAAc;EAE7B,OAAO,CAAC,WAAW,SADK,mBAAmB,GAAG,UAAU,GAC9B;GAC1B,CACH;;CAGD,MAAM,mBAAmB,OAAO,YAC9B,aAAa,IAAI,iBAAiB,CAAC,KAAK,gBAAgB;EAEtD,OAAO,CAAC,aAAa,SADG,mBAAmB,GAAG,YAAY,GAC9B;GAC5B,CACH;CAED,OAAO;EACL,GAAG;EACH,GAAG;EACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"addFontsPlugin.js","names":[],"sources":["../../../src/tailwind/utils/addFontsPlugin.ts"],"sourcesContent":["import type { FontID } from '@yahoo/uds-fonts';\n// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.\nimport plugin from 'tailwindcss/plugin.js';\nimport type { PluginAPI } from 'tailwindcss/types/config';\n\nimport { addFontFaceDeclarations } from '../base/addFontFaceDeclarations';\n\nexport interface AddFontsPluginOptions {\n fontIds: FontID[];\n}\nexport const addFontsPlugin = plugin.withOptions(function addFontsPlugin({\n fontIds,\n}: AddFontsPluginOptions) {\n return function ({ addBase }) {\n addFontFaceDeclarations(fontIds, { addBase } as PluginAPI);\n };\n});\n"],"mappings":";;;;AAUA,MAAa,iBAAiB,OAAO,YAAY,SAAS,eAAe,EACvE,WACwB;AACxB,QAAO,SAAU,EAAE,WAAW;AAC5B,0BAAwB,SAAS,EAAE,SAAS,CAAc;;EAE5D"}
1
+ {"version":3,"file":"addFontsPlugin.js","names":[],"sources":["../../../src/tailwind/utils/addFontsPlugin.ts"],"sourcesContent":["import type { FontID } from '@yahoo/uds-fonts';\n// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.\nimport plugin from 'tailwindcss/plugin.js';\nimport type { PluginAPI } from 'tailwindcss/types/config';\n\nimport { addFontFaceDeclarations } from '../base/addFontFaceDeclarations';\n\nexport interface AddFontsPluginOptions {\n fontIds: FontID[];\n}\nexport const addFontsPlugin = plugin.withOptions(function addFontsPlugin({\n fontIds,\n}: AddFontsPluginOptions) {\n return function ({ addBase }) {\n addFontFaceDeclarations(fontIds, { addBase } as PluginAPI);\n };\n});\n"],"mappings":";;;;AAUA,MAAa,iBAAiB,OAAO,YAAY,SAAS,eAAe,EACvE,WACwB;CACxB,OAAO,SAAU,EAAE,WAAW;EAC5B,wBAAwB,SAAS,EAAE,SAAS,CAAc;;EAE5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"composeTailwindPlugins.js","names":[],"sources":["../../../src/tailwind/utils/composeTailwindPlugins.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport { isFunction, isString, merge, partition } from 'lodash';\nimport type { Config } from 'tailwindcss';\n// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.\nimport plugin from 'tailwindcss/plugin.js';\nimport type { CSSRuleObject, PluginAPI } from 'tailwindcss/types/config';\n\nimport { entries } from '../../utils/entries';\n\ninterface TailwindPluginOptions {\n config: UniversalTokensConfig;\n\n /**\n * Safelisting is a last-resort, and should only be used in situations where\n * it’s impossible to scan certain content for class names. These situations\n * are rare, and you should almost never need this feature.\n *\n * {@link https://v3.tailwindcss.com/docs/content-configuration#safelisting-classes}\n */\n safelist?: Config['safelist'];\n\n /**\n * Disable generating font face declarations through Tailwind\n * @default false\n */\n disableFontFaceDeclarations?: boolean;\n\n /**\n * Enable responsive type ramp styles.\n * @default false\n * @deprecated This is now set in the uds.config\n */\n enableResponsiveTypeRamp?: boolean;\n\n /**\n * Enable opt-in automatice color mode based on media query.\n * @default false\n */\n enableSystemColorMode?: boolean;\n\n /**\n * Which UDS tokens should be merged into the tailwind theme.\n * @default false\n */\n disableOverrideTailwindTheme?:\n | boolean\n | Array<'typography' | 'borderRadius' | 'borderWidth' | 'screens'>;\n\n /**\n * If we are in standalone (aka `uds css`) mode, only apply theme values\n * @default false\n */\n onlyTheme?: boolean;\n\n /**\n * Whether to ignore the safelists requested by plugins (for optimized purger use only)\n */\n ignorePluginSafelists?: boolean;\n\n previewOptions?: {\n /**\n * Generates CSS classes for visually forcing components into a pseudo state (hover, focus, etc)\n * @default false\n */\n generatePseudoStateClassModifier: boolean;\n };\n}\n\ntype Plugin = ReturnType<typeof plugin.withOptions<TailwindPluginOptions>>;\ntype PossiblePlugins = Array<Plugin>;\n\nconst shouldNotMergeTokensIntoTailwindTheme = (\n disableOverrideTailwindTheme: TailwindPluginOptions['disableOverrideTailwindTheme'],\n feature: Exclude<\n TailwindPluginOptions['disableOverrideTailwindTheme'],\n boolean | undefined\n >[number],\n) => {\n return (\n disableOverrideTailwindTheme === true ||\n (Array.isArray(disableOverrideTailwindTheme) && disableOverrideTailwindTheme.includes(feature))\n );\n};\n\nconst composeTailwindPlugins = (...plugins: PossiblePlugins) =>\n plugin.withOptions<TailwindPluginOptions>(\n (options) => {\n if (!options.config) {\n throw new Error(\n \"`tailwindPlugin` requires a config object. If your project has not yet sync'd a config, you can import `defaultTokensConfig` from `@yahoo/uds/defaultTokensConfig` and pass it to `tailwindPlugin`.\",\n );\n }\n\n // Default value\n options.disableOverrideTailwindTheme ??= false;\n options.onlyTheme ??= false;\n options.ignorePluginSafelists ??= false;\n\n return (api) => {\n if (options.onlyTheme) {\n return;\n }\n\n const { addBase, addComponents, addUtilities, config } = api;\n\n const parentConfigImportant = config().important;\n const useImportNamespace = isString(parentConfigImportant);\n const rootSelector = useImportNamespace ? parentConfigImportant : ':root';\n\n const fns: PluginAPI = {\n ...api,\n\n addBase(css) {\n const cssArray: CSSRuleObject[] = Array.isArray(css) ? css : [css];\n\n // Split out root variables from other classes\n const [vars, classes] = cssArray\n .map((rule) => entries(rule))\n .map((pairs) => partition(pairs, ([key]) => key.startsWith('--')))\n .reduce(\n (acc, [vars, classes]) => [\n { ...acc[0], ...Object.fromEntries(vars) },\n { ...acc[1], ...Object.fromEntries(classes) },\n ],\n [{}, {}] as [CSSRuleObject, CSSRuleObject],\n );\n\n // Scope root variables to :root or the import namespace\n addBase({\n [rootSelector]: vars,\n });\n\n // Add the remaining classes normally\n addBase(classes);\n },\n\n addComponents(css, options = {}) {\n addComponents(css, {\n respectImportant: useImportNamespace,\n ...options,\n });\n },\n\n addUtilities(css, options = {}) {\n addUtilities(css, {\n respectPrefix: true,\n respectImportant: useImportNamespace,\n ...options,\n });\n },\n };\n\n for (const plugin of plugins) {\n plugin(options).handler(fns);\n }\n };\n },\n (options) => {\n if (!options.config) {\n throw new Error(\n \"`tailwindPlugin` requires a config object. If your project has not yet sync'd a config, you can import `defaultTokensConfig` from `@yahoo/uds/defaultTokensConfig` and pass it to `tailwindPlugin`.\",\n );\n }\n\n const pluginConfigs = plugins.map((plugin) => plugin(options).config ?? {});\n\n for (const config of pluginConfigs) {\n for (const [key, value] of entries(config.theme?.extend ?? {})) {\n if (!isFunction(value)) {\n continue;\n }\n\n throw new Error(\n `The theme.extend.${key} value cannot be a function when using composeTailwindPlugins. Please resolve the function to an object instead.`,\n );\n }\n }\n\n const mergedConfig = merge({}, ...pluginConfigs);\n\n mergedConfig.safelist = options.ignorePluginSafelists\n ? options.safelist\n : Array.from(\n new Set([\n ...(options.safelist ?? []),\n ...pluginConfigs.flatMap((c) => c.safelist ?? []),\n ]),\n );\n\n return mergedConfig;\n },\n );\n\nexport type { TailwindPluginOptions };\nexport { composeTailwindPlugins, shouldNotMergeTokensIntoTailwindTheme };\n"],"mappings":";;;;;AAuEA,MAAM,yCACJ,8BACA,YAIG;AACH,QACE,iCAAiC,QAChC,MAAM,QAAQ,6BAA6B,IAAI,6BAA6B,SAAS,QAAQ;;AAIlG,MAAM,0BAA0B,GAAG,YACjC,OAAO,aACJ,YAAY;AACX,KAAI,CAAC,QAAQ,OACX,OAAM,IAAI,MACR,sMACD;AAIH,SAAQ,iCAAiC;AACzC,SAAQ,cAAc;AACtB,SAAQ,0BAA0B;AAElC,SAAQ,QAAQ;AACd,MAAI,QAAQ,UACV;EAGF,MAAM,EAAE,SAAS,eAAe,cAAc,WAAW;EAEzD,MAAM,wBAAwB,QAAQ,CAAC;EACvC,MAAM,qBAAqB,SAAS,sBAAsB;EAC1D,MAAM,eAAe,qBAAqB,wBAAwB;EAElE,MAAM,MAAiB;GACrB,GAAG;GAEH,QAAQ,KAAK;IAIX,MAAM,CAAC,M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,CAAC,CAClD,CAAC,CACH;AAEL,QAAO;EAEV"}
1
+ {"version":3,"file":"composeTailwindPlugins.js","names":[],"sources":["../../../src/tailwind/utils/composeTailwindPlugins.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport { isFunction, isString, merge, partition } from 'lodash';\nimport type { Config } from 'tailwindcss';\n// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.\nimport plugin from 'tailwindcss/plugin.js';\nimport type { CSSRuleObject, PluginAPI } from 'tailwindcss/types/config';\n\nimport { entries } from '../../utils/entries';\n\ninterface TailwindPluginOptions {\n config: UniversalTokensConfig;\n\n /**\n * Safelisting is a last-resort, and should only be used in situations where\n * it’s impossible to scan certain content for class names. These situations\n * are rare, and you should almost never need this feature.\n *\n * {@link https://v3.tailwindcss.com/docs/content-configuration#safelisting-classes}\n */\n safelist?: Config['safelist'];\n\n /**\n * Disable generating font face declarations through Tailwind\n * @default false\n */\n disableFontFaceDeclarations?: boolean;\n\n /**\n * Enable responsive type ramp styles.\n * @default false\n * @deprecated This is now set in the uds.config\n */\n enableResponsiveTypeRamp?: boolean;\n\n /**\n * Enable opt-in automatice color mode based on media query.\n * @default false\n */\n enableSystemColorMode?: boolean;\n\n /**\n * Which UDS tokens should be merged into the tailwind theme.\n * @default false\n */\n disableOverrideTailwindTheme?:\n | boolean\n | Array<'typography' | 'borderRadius' | 'borderWidth' | 'screens'>;\n\n /**\n * If we are in standalone (aka `uds css`) mode, only apply theme values\n * @default false\n */\n onlyTheme?: boolean;\n\n /**\n * Whether to ignore the safelists requested by plugins (for optimized purger use only)\n */\n ignorePluginSafelists?: boolean;\n\n previewOptions?: {\n /**\n * Generates CSS classes for visually forcing components into a pseudo state (hover, focus, etc)\n * @default false\n */\n generatePseudoStateClassModifier: boolean;\n };\n}\n\ntype Plugin = ReturnType<typeof plugin.withOptions<TailwindPluginOptions>>;\ntype PossiblePlugins = Array<Plugin>;\n\nconst shouldNotMergeTokensIntoTailwindTheme = (\n disableOverrideTailwindTheme: TailwindPluginOptions['disableOverrideTailwindTheme'],\n feature: Exclude<\n TailwindPluginOptions['disableOverrideTailwindTheme'],\n boolean | undefined\n >[number],\n) => {\n return (\n disableOverrideTailwindTheme === true ||\n (Array.isArray(disableOverrideTailwindTheme) && disableOverrideTailwindTheme.includes(feature))\n );\n};\n\nconst composeTailwindPlugins = (...plugins: PossiblePlugins) =>\n plugin.withOptions<TailwindPluginOptions>(\n (options) => {\n if (!options.config) {\n throw new Error(\n \"`tailwindPlugin` requires a config object. If your project has not yet sync'd a config, you can import `defaultTokensConfig` from `@yahoo/uds/defaultTokensConfig` and pass it to `tailwindPlugin`.\",\n );\n }\n\n // Default value\n options.disableOverrideTailwindTheme ??= false;\n options.onlyTheme ??= false;\n options.ignorePluginSafelists ??= false;\n\n return (api) => {\n if (options.onlyTheme) {\n return;\n }\n\n const { addBase, addComponents, addUtilities, config } = api;\n\n const parentConfigImportant = config().important;\n const useImportNamespace = isString(parentConfigImportant);\n const rootSelector = useImportNamespace ? parentConfigImportant : ':root';\n\n const fns: PluginAPI = {\n ...api,\n\n addBase(css) {\n const cssArray: CSSRuleObject[] = Array.isArray(css) ? css : [css];\n\n // Split out root variables from other classes\n const [vars, classes] = cssArray\n .map((rule) => entries(rule))\n .map((pairs) => partition(pairs, ([key]) => key.startsWith('--')))\n .reduce(\n (acc, [vars, classes]) => [\n { ...acc[0], ...Object.fromEntries(vars) },\n { ...acc[1], ...Object.fromEntries(classes) },\n ],\n [{}, {}] as [CSSRuleObject, CSSRuleObject],\n );\n\n // Scope root variables to :root or the import namespace\n addBase({\n [rootSelector]: vars,\n });\n\n // Add the remaining classes normally\n addBase(classes);\n },\n\n addComponents(css, options = {}) {\n addComponents(css, {\n respectImportant: useImportNamespace,\n ...options,\n });\n },\n\n addUtilities(css, options = {}) {\n addUtilities(css, {\n respectPrefix: true,\n respectImportant: useImportNamespace,\n ...options,\n });\n },\n };\n\n for (const plugin of plugins) {\n plugin(options).handler(fns);\n }\n };\n },\n (options) => {\n if (!options.config) {\n throw new Error(\n \"`tailwindPlugin` requires a config object. If your project has not yet sync'd a config, you can import `defaultTokensConfig` from `@yahoo/uds/defaultTokensConfig` and pass it to `tailwindPlugin`.\",\n );\n }\n\n const pluginConfigs = plugins.map((plugin) => plugin(options).config ?? {});\n\n for (const config of pluginConfigs) {\n for (const [key, value] of entries(config.theme?.extend ?? {})) {\n if (!isFunction(value)) {\n continue;\n }\n\n throw new Error(\n `The theme.extend.${key} value cannot be a function when using composeTailwindPlugins. Please resolve the function to an object instead.`,\n );\n }\n }\n\n const mergedConfig = merge({}, ...pluginConfigs);\n\n mergedConfig.safelist = options.ignorePluginSafelists\n ? options.safelist\n : Array.from(\n new Set([\n ...(options.safelist ?? []),\n ...pluginConfigs.flatMap((c) => c.safelist ?? []),\n ]),\n );\n\n return mergedConfig;\n },\n );\n\nexport type { TailwindPluginOptions };\nexport { composeTailwindPlugins, shouldNotMergeTokensIntoTailwindTheme };\n"],"mappings":";;;;;AAuEA,MAAM,yCACJ,8BACA,YAIG;CACH,OACE,iCAAiC,QAChC,MAAM,QAAQ,6BAA6B,IAAI,6BAA6B,SAAS,QAAQ;;AAIlG,MAAM,0BAA0B,GAAG,YACjC,OAAO,aACJ,YAAY;CACX,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MACR,sMACD;CAIH,QAAQ,iCAAiC;CACzC,QAAQ,cAAc;CACtB,QAAQ,0BAA0B;CAElC,QAAQ,QAAQ;EACd,IAAI,QAAQ,WACV;EAGF,MAAM,EAAE,SAAS,eAAe,cAAc,WAAW;EAEzD,MAAM,wBAAwB,QAAQ,CAAC;EACvC,MAAM,qBAAqB,SAAS,sBAAsB;EAC1D,MAAM,eAAe,qBAAqB,wBAAwB;EAElE,MAAM,MAAiB;GACrB,GAAG;GAEH,QAAQ,KAAK;IAIX,MAAM,CAAC,MAAM,YAHqB,MAAM,QAAQ,IAAI,GAAG,MAAM,CAAC,IAAI,EAI/D,KAAK,SAAS,Q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ModeStyles.js","names":[],"sources":["../../../src/tailwind/utils/getColorModeStyles.ts"],"sourcesContent":["import type { WebTokens } from '../../utils/parseTokens';\n\nexport function getColorModeStyles(tokens: WebTokens) {\n if (!tokens.colorMode?.light?._vars || !tokens.colorMode?.dark?._vars) {\n throw new Error(\n 'Invalid tokens configuration: missing colorMode.light._vars or colorMode.dark._vars. ' +\n 'Ensure your uds.config.ts exports a valid UniversalTokensConfig.',\n );\n }\n\n const lightStyles = {\n colorScheme: 'light',\n '--uds-light-mode-icon': 'inline',\n '--uds-dark-mode-icon': 'none',\n ...tokens.colorMode.light._vars,\n };\n const darkStyles = {\n colorScheme: 'dark',\n '--uds-light-mode-icon': 'none',\n '--uds-dark-mode-icon': 'inline',\n ...tokens.colorMode.dark._vars,\n };\n\n return {\n light: lightStyles,\n dark: darkStyles,\n };\n}\n"],"mappings":";;AAEA,SAAgB,mBAAmB,QAAmB;AACpD,KAAI,CAAC,OAAO,WAAW,OAAO,SAAS,CAAC,OAAO,WAAW,MAAM,MAC9D,OAAM,IAAI,MACR,wJAED;AAgBH,QAAO;EACL,OAAO;GAbP,aAAa;GACb,yBAAyB;GACzB,wBAAwB;GACxB,GAAG,OAAO,UAAU,MAAM;GAUR;EAClB,MAAM;GARN,aAAa;GACb,yBAAyB;GACzB,wBAAwB;GACxB,GAAG,OAAO,UAAU,KAAK;GAKT;EACjB"}
1
+ {"version":3,"file":"getColorModeStyles.js","names":[],"sources":["../../../src/tailwind/utils/getColorModeStyles.ts"],"sourcesContent":["import type { WebTokens } from '../../utils/parseTokens';\n\nexport function getColorModeStyles(tokens: WebTokens) {\n if (!tokens.colorMode?.light?._vars || !tokens.colorMode?.dark?._vars) {\n throw new Error(\n 'Invalid tokens configuration: missing colorMode.light._vars or colorMode.dark._vars. ' +\n 'Ensure your uds.config.ts exports a valid UniversalTokensConfig.',\n );\n }\n\n const lightStyles = {\n colorScheme: 'light',\n '--uds-light-mode-icon': 'inline',\n '--uds-dark-mode-icon': 'none',\n ...tokens.colorMode.light._vars,\n };\n const darkStyles = {\n colorScheme: 'dark',\n '--uds-light-mode-icon': 'none',\n '--uds-dark-mode-icon': 'inline',\n ...tokens.colorMode.dark._vars,\n };\n\n return {\n light: lightStyles,\n dark: darkStyles,\n };\n}\n"],"mappings":";;AAEA,SAAgB,mBAAmB,QAAmB;CACpD,IAAI,CAAC,OAAO,WAAW,OAAO,SAAS,CAAC,OAAO,WAAW,MAAM,OAC9D,MAAM,IAAI,MACR,wJAED;CAgBH,OAAO;EACL,OAAO;GAbP,aAAa;GACb,yBAAyB;GACzB,wBAAwB;GACxB,GAAG,OAAO,UAAU,MAAM;GAUR;EAClB,MAAM;GARN,aAAa;GACb,yBAAyB;GACzB,wBAAwB;GACxB,GAAG,OAAO,UAAU,KAAK;GAKT;EACjB"}