-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
131 changed files
with
51,210 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { AST, buildContext, css, Document, parse } from "@seed-design/rootage-core"; | ||
|
||
export function stringifyVariants(variants: AST.VariantExpression[]) { | ||
if (variants.length === 0) { | ||
return "base"; | ||
} | ||
|
||
return variants.map(({ name, value }) => `${name}=${value}`).join(", "); | ||
} | ||
|
||
export function stringifyStates(states: AST.StateExpression[]) { | ||
return states.map(({ value }) => value).join(", "); | ||
} | ||
|
||
export function stringifyTokenLit(token: AST.TokenLit): Document.TokenRef { | ||
return `$${[...token.group, token.key].join(".")}`; | ||
} | ||
|
||
export function stringifyValueLit(lit: AST.ValueLit): string { | ||
switch (lit.kind) { | ||
case "DimensionLit": | ||
return lit.unit === "rem" | ||
? `${css.stringifyValueLit(lit)} (${lit.value}rem)` | ||
: css.stringifyValueLit(lit); | ||
default: | ||
return css.stringifyValueLit(lit); | ||
} | ||
} | ||
|
||
export const getRootage = async () => { | ||
const index: { resources: { path: string }[] } = await import( | ||
"@/public/rootage-next/index.json" | ||
).then((module) => { | ||
return module.default; | ||
}); | ||
const models: Document.Model[] = await Promise.all( | ||
index.resources.map((resource) => import(`@/public/rootage-next${resource.path}`)), | ||
); | ||
return buildContext(parse(models)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.