From 25e7f9b2531b605f02f8c5d4e637b8db5a0cea0f Mon Sep 17 00:00:00 2001 From: Ali Stump Date: Tue, 5 Dec 2023 21:42:38 -0800 Subject: [PATCH 1/2] fix(color context tokens): only apply when .calcite-mode-auto is applied and default to light --- .../styleDictionary/formatter/utils/formatExtraOutput.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts b/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts index 21c5196f71f..3d03b7057d6 100644 --- a/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts +++ b/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts @@ -43,10 +43,11 @@ export function formatExtraOutput( const medias = index.media ? index.media.map(([mediaSchemed, output]) => { const m = ensureIfArray(outputObject[`${output}.${args.platform}`]); + const cssProps = m.map((o) => `${o}`.replace("$", "--")); return Array.isArray(m) - ? `@media (${mediaSchemed}) {\n\t:root {\n\t\t${m - .map((o) => `${o}`.replace("$", "--")) - .join("\n\t\t")}\n\t}\n}` + ? `${ + output === "light" ? `:root {\n\t${cssProps.join("\n\t")}\n}\n` : "" + }@media (${mediaSchemed}) {\n\t.calcite-mode-auto {\n\t\t${cssProps.join("\n\t\t")}\n\t}\n}` : ""; }) : []; From 48ecd08db38dde8635bb737e77575ed22089f3eb Mon Sep 17 00:00:00 2001 From: Ali Stump Date: Wed, 6 Dec 2023 09:51:02 -0800 Subject: [PATCH 2/2] fix: git code scanning issue --- .../styleDictionary/formatter/utils/formatExtraOutput.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts b/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts index 3d03b7057d6..3e63ddba90d 100644 --- a/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts +++ b/packages/calcite-design-tokens/support/token-transformer/styleDictionary/formatter/utils/formatExtraOutput.ts @@ -36,14 +36,14 @@ export function formatExtraOutput( ? index.mixin.map(([mixinName, output]) => { const m = ensureIfArray(outputObject[`${output}.${args.platform}`]); return Array.isArray(m) - ? `@mixin ${mixinName} {\n\t${m.map((o) => `${o}`.replace("$", "--")).join("\n\t")}\n}` + ? `@mixin ${mixinName} {\n\t${m.map((o) => `${o}`.replaceAll("$", "--")).join("\n\t")}\n}` : ""; }) : []; const medias = index.media ? index.media.map(([mediaSchemed, output]) => { const m = ensureIfArray(outputObject[`${output}.${args.platform}`]); - const cssProps = m.map((o) => `${o}`.replace("$", "--")); + const cssProps = m.map((o) => `${o}`.replaceAll("$", "--")); return Array.isArray(m) ? `${ output === "light" ? `:root {\n\t${cssProps.join("\n\t")}\n}\n` : ""