From da7c4ea49f36948a208d83f72501a07fe607276f Mon Sep 17 00:00:00 2001 From: jorenbroekema Date: Thu, 2 May 2024 12:22:42 +0200 Subject: [PATCH] chore: change themeable analysis --- build-tokens.js | 15 ++++++++++++++- styles/core.css | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build-tokens.js b/build-tokens.js index 23c6024..9b20ea7 100644 --- a/build-tokens.js +++ b/build-tokens.js @@ -15,6 +15,19 @@ const components = ["button"]; async function run() { const $themes = JSON.parse(await promises.readFile("tokens/$themes.json")); + const tokensets = [ + ...new Set( + $themes.reduce( + (acc, theme) => [...acc, ...Object.keys(theme.selectedTokenSets)], + [] + ) + ), + ]; + const themeableSets = tokensets.filter((set) => { + return !$themes.every((theme) => + Object.keys(theme.selectedTokenSets).includes(set) + ); + }); const configs = $themes.map((theme) => ({ __theme__: theme, @@ -69,7 +82,7 @@ async function run() { const set = token.filePath .replace(/^tokens\//g, "") .replace(/.json$/g, ""); - return cfg.__theme__.selectedTokenSets[set] === "enabled"; + return themeableSets.includes(set); } // Set token to themeable if it's part of an enabled set diff --git a/styles/core.css b/styles/core.css index 6dc18f6..c4b14fa 100644 --- a/styles/core.css +++ b/styles/core.css @@ -1,6 +1,6 @@ /** * Do not edit directly - * Generated on Tue, 12 Mar 2024 13:49:57 GMT + * Generated on Thu, 02 May 2024 09:30:52 GMT */ :root {