Skip to content

Commit

Permalink
feat: add themes to styles object (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredLunde committed Oct 28, 2022
1 parent 6321892 commit 0da9f76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/create-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export function createStyles<
dash,
hash,
tokens,
themes,
};

Object.defineProperty(styles, "tokens", {
Expand All @@ -246,6 +247,12 @@ export function createStyles<
},
configurable: false,
});
Object.defineProperty(styles, "themes", {
get() {
return themes;
},
configurable: false,
});
styles.insertTokens(options.tokens || emptyObj);
styles.insertThemes(options.themes || emptyObj);
return typeof process !== "undefined" && process.env.NODE_ENV !== "production"
Expand Down Expand Up @@ -585,6 +592,10 @@ export interface Styles<
* The CSS tokens currently defined in the instance
*/
tokens: TokensUnion<Tokens, Themes>;
/**
* The themes defined in the instance
*/
themes: Themes;
/**
* A hashing function for creating unique selector names
*
Expand Down

0 comments on commit 0da9f76

Please sign in to comment.