diff --git a/.changeset/fresh-paws-cry.md b/.changeset/fresh-paws-cry.md new file mode 100644 index 000000000..0ff5c1f56 --- /dev/null +++ b/.changeset/fresh-paws-cry.md @@ -0,0 +1,7 @@ +--- +'@pandacss/extractor': minor +'@pandacss/parser': minor +'@pandacss/types': minor +--- + +refactor: swap dependency from @box-extractor/core to @pandacss/extractor diff --git a/docs/recipe/03-atomic-recipe.mdx b/docs/recipe/03-atomic-recipe.mdx index 5c9abf9b6..bbd9dfd34 100644 --- a/docs/recipe/03-atomic-recipe.mdx +++ b/docs/recipe/03-atomic-recipe.mdx @@ -8,12 +8,12 @@ The inline recipe takes the following properties: - `variants`: The variant styles for the recipe - `defaultVariants`: The default variants for the recipe -To define an inline recipe, you’d need to use the `recipe` function like this. +To define an inline recipe, you’d need to use the `cva` function like this. ```jsx -import { recipe } from '../panda/css' +import { cva } from '../panda/css' -const button = recipe({ +const button = cva({ base: { display: 'flex', }, diff --git a/package.json b/package.json index f6b7ea946..8576c0101 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,11 @@ "@types/node": "18.15.11", "@typescript-eslint/eslint-plugin": "5.58.0", "@typescript-eslint/parser": "5.58.0", - "concurrently": "^8.0.0", + "concurrently": "^8.0.1", "husky": "8.0.3", "lint-staged": "13.2.1", "prettier": "2.8.7", - "ts-morph": "17.0.1", + "ts-morph": "18.0.0", "tsup": "6.7.0", "tsx": "3.12.6", "typescript": "5.0.4", diff --git a/packages/extractor/__tests__/create-project.ts b/packages/extractor/__tests__/create-project.ts new file mode 100644 index 000000000..f63979d4b --- /dev/null +++ b/packages/extractor/__tests__/create-project.ts @@ -0,0 +1,48 @@ +import { Project, ts } from 'ts-morph' +import { extract } from '../src/extract' +import { type ExtractOptions } from '../src/types' + +export const createProject = () => { + return new Project({ + compilerOptions: { + jsx: ts.JsxEmit.React, + jsxFactory: 'React.createElement', + jsxFragmentFactory: 'React.Fragment', + module: ts.ModuleKind.ESNext, + target: ts.ScriptTarget.ESNext, + noUnusedParameters: false, + noEmit: true, + useVirtualFileSystem: true, + allowJs: true, + }, + skipAddingFilesFromTsConfig: true, + skipFileDependencyResolution: true, + skipLoadingLibFiles: true, + }) +} + +export type TestExtractOptions = Omit & { tagNameList?: string[]; functionNameList?: string[] } +export const getTestExtract = ( + project: Project, + code: string, + { tagNameList, functionNameList, ...options }: TestExtractOptions, +) => { + const sourceFile = project.createSourceFile('file.tsx', code, { overwrite: true, scriptKind: ts.ScriptKind.TSX }) + return extract({ + ast: sourceFile, + ...options, + components: tagNameList + ? { + matchTag: ({ tagName }) => tagNameList.includes(tagName), + matchProp: () => true, + } + : options.components, + functions: functionNameList + ? { + matchFn: ({ fnName }) => functionNameList.includes(fnName), + matchProp: () => true, + matchArg: () => true, + } + : options.functions, + }) +} diff --git a/packages/extractor/__tests__/declarations-files.test.ts b/packages/extractor/__tests__/declarations-files.test.ts new file mode 100644 index 000000000..5e05ef18c --- /dev/null +++ b/packages/extractor/__tests__/declarations-files.test.ts @@ -0,0 +1,4840 @@ +import { expect, it } from 'vitest' +import { createProject, getTestExtract, type TestExtractOptions } from './create-project' +// @ts-ignore +import { default as ThemeSample } from './samples/theme?raw' + +const project = createProject() +const getExtract = (code: string, options: TestExtractOptions) => getTestExtract(project, code, options) + +it('can extract theme with tokens from another package with declaration files', () => { + const extracted = getExtract(ThemeSample, { functionNameList: ['defineProperties'] }) + const defineProperties = extracted.get('defineProperties')! + + expect(defineProperties.nodesByProp).toMatchInlineSnapshot(` + Map { + "conditions" => [ + BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "mobile" => BoxNodeObject { + "isEmpty": undefined, + "node": CallExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + SpreadAssignment, + CallExpression, + ], + "type": "object", + "value": { + "@media": "screen and (max-width: 599px)", + }, + }, + "tablet" => BoxNodeObject { + "isEmpty": undefined, + "node": CallExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + SpreadAssignment, + CallExpression, + ], + "type": "object", + "value": { + "@media": "screen and (min-width: 600px) and (max-width: 1023px)", + }, + }, + "desktop" => BoxNodeObject { + "isEmpty": undefined, + "node": CallExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + SpreadAssignment, + CallExpression, + ], + "type": "object", + "value": { + "@media": "screen and (min-width: 1024px)", + }, + }, + "default" => BoxNodeObject { + "isEmpty": true, + "node": ObjectLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "object", + "value": {}, + }, + "hover" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:hover,&[data-hover]", + }, + }, + }, + "active" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:active,&[data-active]", + }, + }, + }, + "focus" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:focus,&[data-focus]", + }, + }, + }, + "highlighted" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-highlighted]", + }, + }, + }, + "focusWithin" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:focus-within", + }, + }, + }, + "focusVisible" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:focus-visible", + }, + }, + }, + "disabled" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[disabled],&[aria-disabled=true],&[data-disabled]", + }, + }, + }, + "readOnly" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-readonly=true],&[readonly],&[data-readonly]", + }, + }, + }, + "before" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&::before", + }, + }, + }, + "after" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&::after", + }, + }, + }, + "empty" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:empty", + }, + }, + }, + "expanded" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-expanded=true]", + }, + }, + }, + "checked" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-checked=true],&[data-checked]", + }, + }, + }, + "grabbed" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-grabbed=true],&[data-grabbed]", + }, + }, + }, + "pressed" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-pressed=true],&[data-pressed]", + }, + }, + }, + "invalid" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-invalid=true],&[data-invalid]", + }, + }, + }, + "valid" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-invalid=false],&[data-valid]", + }, + }, + }, + "loading" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-busy=true],&[data-loading]", + }, + }, + }, + "selected" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-selected=true],&[data-selected]", + }, + }, + }, + "hidden" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-hidden=true],&[data-hidden]", + }, + }, + }, + "autofill" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:-webkit-autofill", + }, + }, + }, + "even" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:nth-of-type(even)", + }, + }, + }, + "odd" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:nth-of-type(odd)", + }, + }, + }, + "first" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:first-of-type", + }, + }, + }, + "last" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:last-of-type", + }, + }, + }, + "notFirst" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:not(:first-of-type)", + }, + }, + }, + "notLast" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:not(:last-of-type)", + }, + }, + }, + "visited" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:visited", + }, + }, + }, + "activeLink" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-current=page]", + }, + }, + }, + "activeStep" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[aria-current=step]", + }, + }, + }, + "indeterminate" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:indeterminate,&[aria-checked=mixed],&[data-indeterminate]", + }, + }, + }, + "groupHover" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:hover &,[role=group][data-hover] &,[data-group]:hover &,[data-group][data-hover] &,.group:hover &,.group[data-hover] &", + }, + }, + }, + "peerHover" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[data-peer]:hover ~ &, [data-peer][data-hover] ~ &, .peer:hover ~ &, .peer[data-hover] ~ &", + }, + }, + }, + "groupFocus" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:focus &,[role=group][data-focus] &,[data-group]:focus &,[data-group][data-focus] &,.group:focus &,.group[data-focus] &", + }, + }, + }, + "peerFocus" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[data-peer]:focus ~ &, [data-peer][data-focus] ~ &, .peer:focus ~ &, .peer[data-focus] ~ &", + }, + }, + }, + "groupFocusVisible" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[role=group]:focus-visible[data-group]:focus-visible.group:focus-visible", + }, + }, + }, + "peerFocusVisible" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[data-peer]:focus-visible ~ &, .peer:focus-visible ~ &", + }, + }, + }, + "groupActive" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:active &,[role=group][data-active] &,[data-group]:active &,[data-group][data-active] &,.group:active &,.group[data-active] &", + }, + }, + }, + "peerActive" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[data-peer]:active ~ &, [data-peer][data-active] ~ &, .peer:active ~ &, .peer[data-active] ~ &", + }, + }, + }, + "groupDisabled" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:disabled &,[role=group][data-disabled] &,[data-group]:disabled &,[data-group][data-disabled] &,.group:disabled &,.group[data-disabled] &", + }, + }, + }, + "peerDisabled" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-peer]:disabled ~ &,[data-peer][data-disabled] ~ &,.peer:disabled ~ &,.peer[data-disabled] ~ &", + }, + }, + }, + "groupInvalid" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:invalid &,[role=group][data-invalid] &,[data-group]:invalid &,[data-group][data-invalid] &,.group:invalid &,.group[data-invalid] &", + }, + }, + }, + "peerInvalid" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-peer]:invalid ~ &,[data-peer][data-invalid] ~ &,.peer:invalid ~ &,.peer[data-invalid] ~ &", + }, + }, + }, + "groupChecked" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "[role=group]:checked &,[role=group][data-checked] &,[data-group]:checked &,[data-group][data-checked] &,.group:checked &,.group[data-checked] &", + }, + }, + }, + "peerChecked" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-peer]:checked ~ &,[data-peer][data-checked] ~ &,.peer:checked ~ &,.peer[data-checked] ~ &", + }, + }, + }, + "groupFocusWithin" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[role=group]:focus-within &, [data-group]:focus-within &, .group:focus-within &", + }, + }, + }, + "peerFocusWithin" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-peer]:focus-within ~ &,.peer:focus-within ~ &", + }, + }, + }, + "peerPlaceholderShown" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-peer]::placeholder-shown ~ &,.peer::placeholder-shown ~ &", + }, + }, + }, + "placeholder" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&::placeholder", + }, + }, + }, + "placeholderShown" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&::placeholder-shown", + }, + }, + }, + "fullScreen" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&:fullscreen", + }, + }, + }, + "selection" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&::selection", + }, + }, + }, + "rtl" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[dir=rtl] &,&[dir=rtl]", + }, + }, + }, + "ltr" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[dir=ltr] &,&[dir=ltr]", + }, + }, + }, + "mediaDark" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "@media" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "(prefers-color-scheme: dark)", + }, + }, + }, + "mediaReduceMotion" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "@media" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "(prefers-reduced-motion: reduce)", + }, + }, + }, + "dark" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-theme=dark] &,&[data-theme=dark]", + }, + }, + }, + "light" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "selector" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "&[data-theme=light] &,&[data-theme=light]", + }, + }, + }, + }, + }, + ], + "properties" => [ + BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "boxShadow" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)", + "base": "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", + "dark-lg": "rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px", + "inner": "inset 0 2px 4px 0 rgba(0,0,0,0.06)", + "lg": "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)", + "md": "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)", + "none": "none", + "outline": "0 0 0 3px rgba(66, 153, 225, 0.6)", + "sm": "0 1px 2px 0 rgba(0, 0, 0, 0.05)", + "xl": "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)", + "xs": "0 0 0 1px rgba(0, 0, 0, 0.05)", + }, + }, + "textShadow" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)", + "base": "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", + "dark-lg": "rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px", + "inner": "inset 0 2px 4px 0 rgba(0,0,0,0.06)", + "lg": "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)", + "md": "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)", + "none": "none", + "outline": "0 0 0 3px rgba(66, 153, 225, 0.6)", + "sm": "0 1px 2px 0 rgba(0, 0, 0, 0.05)", + "xl": "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)", + "xs": "0 0 0 1px rgba(0, 0, 0, 0.05)", + }, + }, + "opacity" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "0" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "0", + }, + "0.4" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "0.6", + }, + "0.6" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "0.6", + }, + "1" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "1", + }, + }, + }, + "cursor" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "pointerEvents" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "userSelect" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "fontFamily" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + PropertySignature, + TypeLiteral, + ], + "type": "object", + "value": { + "body": "-apple-system, BlinkMacSystemFont, \\"Segoe UI\\", Helvetica, Arial, sans-serif, \\"Apple Color Emoji\\", \\"Segoe UI Emoji\\", \\"Segoe UI Symbol\\"", + "heading": "-apple-system, BlinkMacSystemFont, \\"Segoe UI\\", Helvetica, Arial, sans-serif, \\"Apple Color Emoji\\", \\"Segoe UI Emoji\\", \\"Segoe UI Symbol\\"", + "mono": "SFMono-Regular,Menlo,Monaco,Consolas,\\"Liberation Mono\\",\\"Courier New\\",monospace", + }, + }, + "fontWeight" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + PropertySignature, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "900", + "bold": "700", + "extrabold": "800", + "hairline": "100", + "light": "300", + "medium": "500", + "normal": "400", + "semibold": "600", + "thin": "200", + }, + }, + "lineHeight" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + PropertySignature, + TypeLiteral, + ], + "type": "object", + "value": { + "10": "2.5rem", + "3": ".75rem", + "4": "1rem", + "5": "1.25rem", + "6": "1.5rem", + "7": "1.75rem", + "8": "2rem", + "9": "2.25rem", + "base": "1.5", + "none": "1", + "normal": "normal", + "short": "1.375", + "shorter": "1.25", + "tall": "1.625", + "taller": "2", + }, + }, + "letterSpacing" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + PropertySignature, + TypeLiteral, + ], + "type": "object", + "value": { + "normal": "0", + "tight": "-0.025em", + "tighter": "-0.05em", + "wide": "0.025em", + "wider": "0.05em", + "widest": "0.1em", + }, + }, + "textAlign" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "fontStyle" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "textTransform" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "textDecoration" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "position" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "display" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "flexDirection" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "flexShrink" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "flexGrow" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "flex" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "flexWrap" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "justifyContent" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "justifySelf" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "alignItems" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "alignSelf" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "top" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "bottom" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "left" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "right" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "inset" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "width" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "minWidth" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "maxWidth" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "height" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "minHeight" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "maxHeight" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "whiteSpace" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "textOverflow" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "overflow" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "overflowX" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "overflowY" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "visibility" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "verticalAlign" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "borderStyle" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "borderRadius" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "1rem", + "3xl": "1.5rem", + "base": "0.25rem", + "full": "9999px", + "lg": "0.5rem", + "md": "0.375rem", + "none": "0", + "sm": "0.125rem", + "xl": "0.75rem", + }, + }, + "borderTopLeftRadius" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "1rem", + "3xl": "1.5rem", + "base": "0.25rem", + "full": "9999px", + "lg": "0.5rem", + "md": "0.375rem", + "none": "0", + "sm": "0.125rem", + "xl": "0.75rem", + }, + }, + "borderTopRightRadius" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "1rem", + "3xl": "1.5rem", + "base": "0.25rem", + "full": "9999px", + "lg": "0.5rem", + "md": "0.375rem", + "none": "0", + "sm": "0.125rem", + "xl": "0.75rem", + }, + }, + "borderBottomLeftRadius" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "1rem", + "3xl": "1.5rem", + "base": "0.25rem", + "full": "9999px", + "lg": "0.5rem", + "md": "0.375rem", + "none": "0", + "sm": "0.125rem", + "xl": "0.75rem", + }, + }, + "borderBottomRightRadius" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "2xl": "1rem", + "3xl": "1.5rem", + "base": "0.25rem", + "full": "9999px", + "lg": "0.5rem", + "md": "0.375rem", + "none": "0", + "sm": "0.125rem", + "xl": "0.75rem", + }, + }, + "color" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "background" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "backgroundColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "borderColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "borderTopColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "borderBottomColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "borderLeftColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "borderRightColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "outlineColor" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "fill" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "stroke" => BoxNodeObject { + "isEmpty": undefined, + "node": TypeLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + TypeLiteral, + ], + "type": "object", + "value": { + "black": "#000000", + "current": "currentColor", + "transparent": "transparent", + "white": "#FFFFFF", + "whiteAlpha": { + "100": "rgba(255, 255, 255, 0.06)", + "200": "rgba(255, 255, 255, 0.08)", + "300": "rgba(255, 255, 255, 0.16)", + "400": "rgba(255, 255, 255, 0.24)", + "50": "rgba(255, 255, 255, 0.04)", + "500": "rgba(255, 255, 255, 0.36)", + "600": "rgba(255, 255, 255, 0.48)", + "700": "rgba(255, 255, 255, 0.64)", + "800": "rgba(255, 255, 255, 0.80)", + "900": "rgba(255, 255, 255, 0.92)", + }, + }, + }, + "transform" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + "transformOrigin" => BoxNodeLiteral { + "kind": "boolean", + "node": TrueKeyword, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + TrueKeyword, + ], + "type": "literal", + "value": true, + }, + }, + }, + ], + "shorthands" => [ + BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "d" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "display", + }, + ], + }, + "pos" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "position", + }, + ], + }, + "t" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "top", + }, + ], + }, + "b" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "bottom", + }, + ], + }, + "l" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "left", + }, + ], + }, + "r" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "right", + }, + ], + }, + "boxSize" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "width", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "height", + }, + ], + }, + "w" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "width", + }, + ], + }, + "h" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "height", + }, + ], + }, + "minW" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "minWidth", + }, + ], + }, + "maxW" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "maxWidth", + }, + ], + }, + "minH" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "minHeight", + }, + ], + }, + "maxH" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "maxHeight", + }, + ], + }, + "placeItems" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "justifyContent", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "alignItems", + }, + ], + }, + "ta" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "textAlign", + }, + ], + }, + "tt" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "textTransform", + }, + ], + }, + "fs" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "fontSize", + }, + ], + }, + "fw" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "fontWeight", + }, + ], + }, + "m" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "margin", + }, + ], + }, + "mt" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginTop", + }, + ], + }, + "mr" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginRight", + }, + ], + }, + "mb" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginBottom", + }, + ], + }, + "ml" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginLeft", + }, + ], + }, + "mx" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginRight", + }, + ], + }, + "my" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginBottom", + }, + ], + }, + "ms" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginInlineStart", + }, + ], + }, + "me" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginInlineEnd", + }, + ], + }, + "p" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "padding", + }, + ], + }, + "marginX" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginRight", + }, + ], + }, + "marginY" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "marginBottom", + }, + ], + }, + "pt" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingTop", + }, + ], + }, + "pr" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingRight", + }, + ], + }, + "pb" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingBottom", + }, + ], + }, + "pl" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingLeft", + }, + ], + }, + "px" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingRight", + }, + ], + }, + "paddingX" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingRight", + }, + ], + }, + "paddingY" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingBottom", + }, + ], + }, + "ps" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingInlineStart", + }, + ], + }, + "pe" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingInlineEnd", + }, + ], + }, + "py" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "paddingBottom", + }, + ], + }, + "bw" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderWidth", + }, + ], + }, + "bx" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderRight", + }, + ], + }, + "borderX" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderLeft", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderRight", + }, + ], + }, + "by" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderBottom", + }, + ], + }, + "borderY" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderTop", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderBottom", + }, + ], + }, + "bg" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "background", + }, + ], + }, + "bgColor" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "backgroundColor", + }, + ], + }, + "borderXColor" => BoxNodeArray { + "node": ArrayLiteralExpression, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "array", + "value": [ + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderLeftColor", + }, + BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + CallExpression, + ObjectLiteralExpression, + PropertyAssignment, + ObjectLiteralExpression, + PropertyAssignment, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "borderRightColor", + }, + ], + }, + }, + }, + ], + } + `) +}) diff --git a/packages/extractor/__tests__/extract.test.ts b/packages/extractor/__tests__/extract.test.ts new file mode 100644 index 000000000..427882e98 --- /dev/null +++ b/packages/extractor/__tests__/extract.test.ts @@ -0,0 +1,6137 @@ +import { SourceFile } from 'ts-morph' +import { afterEach, expect, it } from 'vitest' +import type { ComponentMatchers, ExtractOptions } from '../src/types' +import { createProject, getTestExtract } from './create-project' +import { unbox } from '../src/unbox' +// @ts-ignore +import { default as ExtractSample } from './samples/ExtractSample?raw' + +const project = createProject() + +let sourceFile: SourceFile +afterEach(() => { + if (!sourceFile) return + + if (sourceFile.wasForgotten()) return + project.removeSourceFile(sourceFile) +}) + +const config: Record = { + ColorBox: ['color', 'backgroundColor', 'zIndex', 'fontSize', 'display', 'mobile', 'tablet', 'desktop', 'css'], +} + +const componentsMatcher: ComponentMatchers = { + matchTag: ({ tagName }) => Boolean(config[tagName]), + matchProp: ({ tagName, propName }) => config[tagName].includes(propName), +} + +type TestExtractOptions = Omit & { tagNameList?: string[]; functionNameList?: string[] } +const getExtract = (code: string, options: TestExtractOptions) => getTestExtract(project, code, options) + +const extractFromCode = (code: string, options?: TestExtractOptions) => { + const extracted = getExtract(code, { components: componentsMatcher, ...options }) + const entries = Array.from(extracted.entries()).map(([name]) => [ + name, + extracted.get(name)!.queryList.map((query) => unbox(query.box)), + ]) + return Object.fromEntries(entries) +} + +it('extract it all', () => { + expect(extractFromCode(ExtractSample)).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.200", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": "blackAlpha.100", + "color": "yellow.300", + }, + "spreadConditions": [], + }, + { + "conditions": [ + { + "color": "cyan.400", + }, + { + "color": "cyan.500", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.400", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.500", + }, + "spreadConditions": [], + }, + { + "conditions": [ + { + "color": "facebook.600", + }, + { + "color": "gray.200", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [ + { + "color": "gray.200", + }, + { + "color": "gray.300", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [ + { + "color": "gray.600", + }, + { + "color": "gray.800", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [ + { + "color": "gray.700", + }, + { + "color": "gray.100", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "gray.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "blackAlpha.400", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": "blackAlpha.100", + "color": "facebook.200", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": "twitter.200", + "color": "twitter.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": "twitter.200", + "color": "orange.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "orange.200", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "orange.400", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": "telegram.400", + "color": "telegram.300", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": { + "default": "red.100", + "focus": "blue.100", + "hover": "green.100", + }, + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "backgroundColor": { + "default": "orange.800", + "focus": "yellow.700", + "hover": "telegram.200", + }, + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "facebook.900", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "red.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "red.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "green.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "blue.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "yellow.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "orange.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "orange.300", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "red.100", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": { + "color": "orange.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > StringLiteral (multiple)', () => { + expect(extractFromCode(``)) + .toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "blackAlpha.100", + "color": "red.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('minimal - groups extract props in parent component instance', () => { + const extracted = getExtract( + ` + + + children + + `, + { tagNameList: ['ColorBox'] }, + ) + expect(extracted.get('ColorBox')!.queryList).toMatchInlineSnapshot(` + [ + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "red.200", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "blue.100", + }, + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "blackAlpha.100", + }, + "display" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "flex", + }, + }, + }, + "name": "ColorBox", + }, + ] + `) +}) + +it('ExtractSample - groups extract props in parent component instance', () => { + const extracted = getExtract(ExtractSample, { tagNameList: ['ColorBox'] }) + expect(extracted.get('ColorBox')!.queryList).toMatchInlineSnapshot(` + [ + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "red.200", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "yellow.300", + }, + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "blackAlpha.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeConditional { + "kind": "ternary", + "node": ConditionalExpression, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + ], + "type": "conditional", + "whenFalse": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + ], + "type": "literal", + "value": "cyan.500", + }, + "whenTrue": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + ], + "type": "literal", + "value": "cyan.400", + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + StringLiteral, + ], + "type": "literal", + "value": "facebook.400", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + ], + "type": "literal", + "value": "facebook.500", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeConditional { + "kind": "ternary", + "node": ConditionalExpression, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + ], + "type": "conditional", + "whenFalse": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.200", + }, + "whenTrue": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + ], + "type": "literal", + "value": "facebook.600", + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeConditional { + "kind": "ternary", + "node": ConditionalExpression, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + Identifier, + VariableDeclaration, + ], + "type": "conditional", + "whenFalse": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.300", + }, + "whenTrue": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.200", + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + ObjectLiteralExpression, + StringLiteral, + PropertyAssignment, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + ArrayLiteralExpression, + NumericLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + NumericLiteral, + Identifier, + VariableDeclaration, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "pink.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + NumericLiteral, + Identifier, + VariableDeclaration, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "pink.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + NumericLiteral, + Identifier, + VariableDeclaration, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "pink.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + NumericLiteral, + Identifier, + VariableDeclaration, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "pink.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + NumericLiteral, + Identifier, + VariableDeclaration, + ArrayLiteralExpression, + ], + "type": "literal", + "value": "pink.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + ElementAccessExpression, + StringLiteral, + ArrayLiteralExpression, + NumericLiteral, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + ElementAccessExpression, + StringLiteral, + ArrayLiteralExpression, + NumericLiteral, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + ElementAccessExpression, + StringLiteral, + ArrayLiteralExpression, + NumericLiteral, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeConditional { + "kind": "ternary", + "node": ConditionalExpression, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + ConditionalExpression, + Identifier, + VariableDeclaration, + ObjectLiteralExpression, + Identifier, + VariableDeclaration, + ObjectLiteralExpression, + ], + "type": "conditional", + "whenFalse": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + ConditionalExpression, + Identifier, + VariableDeclaration, + ObjectLiteralExpression, + Identifier, + VariableDeclaration, + ShorthandPropertyAssignment, + Identifier, + VariableDeclaration, + PropertyAccessExpression, + Identifier, + Identifier, + VariableDeclaration, + PropertyAssignment, + ], + "type": "literal", + "value": "gray.800", + }, + "whenTrue": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ElementAccessExpression, + Identifier, + ConditionalExpression, + Identifier, + VariableDeclaration, + PropertyAssignment, + ], + "type": "literal", + "value": "gray.600", + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeConditional { + "kind": "ternary", + "node": ConditionalExpression, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + VariableDeclaration, + ], + "type": "conditional", + "whenFalse": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + "whenTrue": BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ConditionalExpression, + Identifier, + Identifier, + Identifier, + VariableDeclaration, + Identifier, + VariableDeclaration, + PropertyAssignment, + ], + "type": "literal", + "value": "gray.700", + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "gray.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "facebook.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + Identifier, + VariableDeclaration, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "blackAlpha.400", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map {}, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "facebook.200", + }, + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "blackAlpha.100", + }, + "borderColor" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + Identifier, + Identifier, + VariableDeclaration, + StringLiteral, + ], + "type": "literal", + "value": "blackAlpha.300", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map {}, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map {}, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": CallExpression, + "stack": [], + "type": "literal", + "value": "twitter.100", + }, + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": CallExpression, + "stack": [], + "type": "literal", + "value": "twitter.200", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": CallExpression, + "stack": [ + SpreadAssignment, + CallExpression, + ], + "type": "literal", + "value": "twitter.200", + }, + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "orange.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "orange.200", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "orange.400", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "telegram.300", + }, + "backgroundColor" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "telegram.400", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "default" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "red.100", + }, + "hover" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "green.100", + }, + "focus" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "blue.100", + }, + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "backgroundColor" => BoxNodeMap { + "node": ObjectLiteralExpression, + "spreadConditions": undefined, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + ], + "type": "map", + "value": Map { + "default" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "orange.800", + }, + "hover" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "telegram.200", + }, + "focus" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + JsxExpression, + ObjectLiteralExpression, + PropertyAssignment, + StringLiteral, + ], + "type": "literal", + "value": "yellow.700", + }, + }, + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "facebook.900", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "red.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxOpeningElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "red.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "green.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "blue.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "yellow.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "orange.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "orange.300", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "red.100", + }, + }, + }, + "name": "ColorBox", + }, + { + "box": BoxNodeMap { + "node": JsxSelfClosingElement, + "spreadConditions": undefined, + "stack": [], + "type": "map", + "value": Map { + "color" => BoxNodeLiteral { + "kind": "string", + "node": StringLiteral, + "stack": [ + JsxAttribute, + StringLiteral, + ], + "type": "literal", + "value": "orange.400", + }, + }, + }, + "name": "ColorBox", + }, + ] + `) +}) + +it('extract JsxAttribute > JsxExpression > StringLiteral', () => { + expect(extractFromCode(``)).toMatchInlineSnapshot( + ` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.300", + }, + "spreadConditions": [], + }, + ], + } + `, + ) +}) + +it('extract JsxAttribute > JsxExpression > Identifier', () => { + expect( + extractFromCode(` + const color = "red.400"; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditonalExpression > Identifier|Value', () => { + expect( + extractFromCode(` + const darkValue = "red.500"; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "red.500", + }, + { + "color": "whiteAlpha.100", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression', () => { + expect( + extractFromCode(` + const colorMap = { + red: "red.600", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression without as const', () => { + expect( + extractFromCode(` + const colorMap = { + red: "red.600", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression optional', () => { + expect( + extractFromCode(` + const colorMap = { + red: "red.700", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression optional without as const', () => { + expect( + extractFromCode(` + const colorMap = { + red: "red.700", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > Identifier', () => { + expect( + extractFromCode(` + const propName = "red"; + const colorMap = { + red: "red.800", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > Identifier without as const', () => { + expect( + extractFromCode(` + const propName = "red"; + const colorMap = { + red: "red.800", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > StringLiteral on map with ComputedProperty name', () => { + expect( + extractFromCode(` + const propName = "red"; + const colorMap = { + [propName]: "red.900", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > StringLiteral on map with ComputedProperty name without as const', () => { + expect( + extractFromCode(` + const propName = "red"; + const colorMap = { + [propName]: "red.900", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "red.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ComputedProperty name', () => { + expect( + extractFromCode(` + const propName = "blue"; + const colorMap = { + [propName]: "blue.100", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ComputedProperty name without as const', () => { + expect( + extractFromCode(` + const propName = "blue"; + const colorMap = { + [propName]: "blue.100", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > PropertyAccessExpression', () => { + expect( + extractFromCode(` + const colorMap = { + blue: "blue.200", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > PropertyAccessExpression optional', () => { + expect( + extractFromCode(` + const colorMap = { + blue: "blue.300", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > PropertyAccessExpression optional without as const', () => { + expect( + extractFromCode(` + const colorMap = { + blue: "blue.300", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > StringLiteral', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "blue.400", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > StringLiteral without as const', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "blue.400", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > StringLiteral + Identifier without as const', () => { + expect( + extractFromCode(` + const part2 = "Prop"; + const colorMap = { + longProp: "blue.500", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > NoSubstitionTemplateLiteral', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "blue.600", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > NoSubstitionTemplateLiteral without as const', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "blue.600", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > TemplateStringLiteral & Identifier', () => { + expect( + extractFromCode(` + const part2 = "Prop" as const; + const colorMap = { + longProp: "blue.700", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > TemplateStringLiteral > Identifier x2', () => { + expect( + extractFromCode(` + const part1 = "long" as const; + const part2 = "Prop" as const; + const colorMap = { + longProp: "blue.800", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditonalExpression > AsExpression (StringLiteral) + Identifier', () => { + expect( + extractFromCode(` + const isDark = true; + const lightRef = "light" as const; + const colorMap = { + dark: "blue.900", + light: "blue.900", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "blue.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > TemplateStringLiteral + Identifier (StringLiteral)', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "green.100", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > StringLiteral + TemplateStringLiteral > ElementAccessExpression > Identifier (StringLiteral)', () => { + expect( + extractFromCode(` + const dynamic = { + part2: "Prop", + } as const; + const colorMap = { + longProp: "green.200", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > PropertyAccessExpression + ElementAccessExpression > Identifier', () => { + expect( + extractFromCode(` + const part2ref = "part2" as const; + const dynamic = { + part1: "long", + part2: "Prop", + } as const; + const colorMap = { + longProp: "green.300", + } as const; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ObjectLiteralExpression', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression (AsExpression) > Identifier (StringLiteral) x2', () => { + expect( + extractFromCode(` + const colorMap = { + longProp: "green.500", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression (AsExpression) > Identifier (StringLiteral) x2 on ShorthandPropertyAssignment', () => { + expect( + extractFromCode(` + const longProp = "green.600" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > StringLiteral (AsExpression) + TemplateStringLiteral > Identifier (StringLiteral) (AsExpression)', () => { + expect( + extractFromCode(` + const dynamicPart2 = "Prop"; + const withDynamicPart = { + dynamicPart2: dynamicPart2, + }; + const longProp = "green.700" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ElementAccessExpression > Identifier > Identifier', () => { + expect( + extractFromCode(` + const dynamicElement = "longProp"; + const secondRef = "secondLevel"; + const wrapperMap = { + [secondRef]: dynamicElement, + }; + const longProp = "green.800" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ArrayLiteralExpression > NumericLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "green.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ArrayLiteralExpression > StringLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ArrayLiteralExpression > Identifier > NumericLiteral', () => { + expect( + extractFromCode(` + const nbIndex = 1; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ArrayLiteralExpression > Identifier > StringLiteral', () => { + expect( + extractFromCode(` + const strIndex = "0"; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ParenthesizedExpression > AsExpression > NumericLiteral', () => { + expect( + extractFromCode(` + const array = ["pink.400"]; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ArrayLiteralExpression > ElementAccessExpression > NonNullExpression > ElementAccessExpression > NumericLiteral', () => { + expect( + extractFromCode(` + const array = ["pink.500"]; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ElementAccessExpression > ArrayLiteralExpression > ObjectLiteralExpresssion > PropertyAssignment > StringLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression', () => { + expect( + extractFromCode(` + const isShown = true; + const dynamicColorName = "something"; + const nestedReference = { ref: dynamicColorName } as const; + const deepReference = nestedReference.ref; + + const colorMap = { + literalColor: "pink.700", + [deepReference]: "pink.800", + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > TemplateExpression > Identifier > TemplateExpression', () => { + expect( + extractFromCode(` + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + const dynamicPartsAsTemplateString = \`\${dynamicPart1}\${dynamicPart2}\` as const; + + const longProp = "pink.900" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > TemplateExpression > Identifier > TemplateExpression without as const', () => { + expect( + extractFromCode(` + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + const dynamicPartsAsTemplateString = \`\${dynamicPart1}\${dynamicPart2}\`; + + const longProp = "pink.900" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "pink.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > BinaryExpression > PropertyAccessExpression + ElementAccessExpression', () => { + expect( + extractFromCode(` + const dynamicElement = "longProp"; + const secondRef = "secondLevel"; + + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + const withDynamicPart = { + dynamicPart1, + dynamicPart2: dynamicPart2, + }; + + const wrapperMap = { + [secondRef]: dynamicElement, + thirdRef: withDynamicPart.dynamicPart1, + fourthRef: withDynamicPart["dynamicPart2"], + }; + const longProp = "yellow.100" + const colorMap = { + longProp, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression evaluate (first when true is right)', () => { + expect( + extractFromCode(` + const isShown = true; + const dynamicColorName = "something"; + const nestedReference = { ref: dynamicColorName } as const; + const deepReference = nestedReference.ref; + + const colorMap = { + literalColor: "yellow.200", + [deepReference]: "yellow.300", + refToAnother: "another", + another: "yellow.400", + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression evaluate (second when true is right)', () => { + expect( + extractFromCode(` + const dynamicColorName = "something"; + const nestedReference = { ref: dynamicColorName } as const; + const deepReference = nestedReference.ref; + + const colorMap = { + literalColor: "yellow.200", + [deepReference]: "yellow.300", + refToAnother: "another", + another: "yellow.500", + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > ArrowFunction > Identifier (StringLiteral)', () => { + expect( + extractFromCode(` + const getColor = () => "yellow.600"; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > FunctionDeclaration > Identifier (StringLiteral)', () => { + expect( + extractFromCode(` + function getColor() { + return "yellow.700"; + } + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression with Parameter > ElementAccessExpression > ArrayLiteralExpression > StringLiteral', () => { + expect( + extractFromCode(` + const pickSecondElement = (arr: string[]) => arr[1]; + const array = ["yellow.800", "yellow.900"]; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "yellow.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression with non-deterministic results > should return nothing', () => { + expect( + extractFromCode(` + const pickRandom = (arr: T[]) => arr[Math.floor(Math.random() * arr.length)]; + const array = ["purple.never1", "purple.alsoNever"]; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > BinaryExpression > StringLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "purple.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ConditionalExpression > ParenthesizedExpression > BinaryExpression', () => { + expect( + extractFromCode(` + const colorMap = { + literalColor: "purple.200", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "purple.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > ElementAccessExpression > ArrowFunction > ElementAccessExpression > ArrayLiteralExpression > Identifier > CallExpression > ConditionalExpression > BinaryExpression', () => { + expect( + extractFromCode(` + const array = ["never1", "literalColor"] + const getter = () => array[1]; + const colorMap = { + literalColor: () => (1 + 1) === 3 ? "never2" : "purple.300", + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "purple.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > BinaryExpression > StringLiteral', () => { + expect( + extractFromCode(` + const dot = "."; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "purple.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > resolvable ConditionalExpression result', () => { + expect( + extractFromCode(` + const isShown = true; + const dynamicColorName = "something"; + const dynamicElement = "staticColor"; + const staticColor = "never.100" as const; + + const colorMap = { + staticColor, + [dynamicColorName]: "purple.500", + }; + const dynamicColor = colorMap[dynamicElement]; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "purple.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it("extract JsxAttribute > JsxExpression > ConditionalExpression with Unexpected Node: 'BindingElement' cause of useState should fallback to both possible outcome", () => { + expect( + extractFromCode(` + const [isShown] = useState(true); + const dynamicColorName = "something"; + const dynamicElement = "staticColor"; + const staticColor = "purple.700" as const; + + const colorMap = { + staticColor, + [dynamicColorName]: "purple.600", + }; + const dynamicColor = colorMap[dynamicElement]; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "purple.600", + }, + { + "color": "purple.700", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > unresolvable expression will output both outcome ', () => { + expect( + extractFromCode(` + const [unresolvableBoolean, setUnresolvableBoolean] = useState(false) + const knownCondition = true; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "purple.900", + }, + { + "color": "purple.950", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > ElementAccessExpression > nested unresolvable expression will output both outcome ', () => { + expect( + extractFromCode(` + const [unresolvableBoolean, setUnresolvableBoolean] = useState(false) + const knownCondition = true; + + const colorMap = { + staticColor: "orange.200", + another: "orange.300", + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "orange.200", + }, + { + "color": "orange.300", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > ElementAccessExpression > with nested unresolvable expression will stop at first resolved truthy condition', () => { + expect( + extractFromCode(` + const [unresolvableBoolean, setUnresolvableBoolean] = useState(false) + const knownTruthy = true; + + const colorMap = { + staticColor: "never.200", + another: "never.300", + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > multiple variables with same name but different scope', () => { + expect( + extractFromCode(` + const color = "never.500"; + + const Wrapper = () => { + const color = "orange.500"; + return + } + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > variables referencing another var in above scope', () => { + expect( + extractFromCode(` + const referenced = "orange.600"; + + const Wrapper = () => { + const color = referenced; + return + } + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ObjectLiteralExpression', () => { + expect( + extractFromCode(` + spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ObjectLiteralExpression with allowed properties list', () => { + expect( + extractFromCode(` + spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "orange.750", + "color": "orange.725", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > Identifier > ObjectLiteralExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "orange.800" } as any; + var spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +// TODO same with ts-evaluator if flag is enabled +it('extract JsxSpreadAttribute > ConditionalExpression > Identifier/NullKeyword > falsy', () => { + expect( + extractFromCode(` + const isShown = false; + const objectWithAttributes = { color: "never.400" } as any; + conditional var spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ConditionalExpression > Identifier/NullKeyword > truthy', () => { + expect( + extractFromCode(` + const isShown = true; + const objectWithAttributes = { color: "orange.900" } as any; + conditional var spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "orange.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > PropertyAssignment / ComputedProperty', () => { + expect( + extractFromCode(` + const dynamicThemeProp = "backgroundColor"; + const dynamicAttribute = "notThemeProp"; + + multiple spread + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "teal.200", + "color": "teal.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ConditionalExpression > ObjectLiteralExpression/Identifier', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "teal.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > BinaryExpression > AmpersandAmpersandToken / ObjectLiteralExpression', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "teal.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > CallExpression', () => { + expect( + extractFromCode(` + const getColorConfig = () => ({ color: "teal.600", backgroundColor: "teal.650" }); + spread fn result + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "teal.650", + "color": "teal.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > CallExpression with allowed properties list', () => { + expect( + extractFromCode(` + const getColorConfig = () => ({ color: "teal.625", backgroundColor: "teal.675", flexDirection: "flex", ...{ backgroundColor: "teal.699", justifyContent: "center" } }); + spread fn result + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "teal.699", + "color": "teal.625", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ObjectLiteralExpression > SpreadAssignment > CallExpression', () => { + expect( + extractFromCode(` + const getColorConfig = () => ({ color: "never.700", backgroundColor: "teal.800" }); + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "teal.800", + "color": "teal.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ObjectLiteralExpression > SpreadAssignment > ConditionalExpression > CallExpression', () => { + expect( + extractFromCode(` + const isShown = true; + const getColorConfig = () => ({ color: "teal.900", backgroundColor: "cyan.100" }); + + nested spread conditional fn result and override + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "cyan.100", + "color": "cyan.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > BinaryExpression > AmpersandAmpersandToken / ObjectLiteralExpression', () => { + expect( + extractFromCode(` + const isShown = true; + const getColorConfig = () => ({ color: "never.300", backgroundColor: "never.400" }); + const dynamicAttribute = "background" + "Color"; + + nested spread conditional fn result and override with object literal expression and dynamic + attribute + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "cyan.300", + "color": "cyan.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > 3 depth spread', () => { + expect( + extractFromCode(` + const getColorConfig = () => ({ color: "cyan.500", backgroundColor: "never.600" }); + + spread with nested spread with nested spread and override + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "backgroundColor": "cyan.600", + "color": "cyan.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it("extract JsxSpreadAttribute > ConditionalExpression > unresolvable expression with Unexpected Node: 'BindingElement' cause of useState should fallback to both possible outcome ", () => { + expect( + extractFromCode(` + const [isShown] = useState(true); + const objectWithAttributes = { color: "cyan.700" } as any; + conditional var spread + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": {}, + "spreadConditions": [ + { + "color": "cyan.700", + }, + { + "backgroundColor": "cyan.800", + }, + ], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "cyan.900" } as any; + const themeObjectsMap = { + basic: objectWithAttributes, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "cyan.900", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > PropertyAccessExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.100" } as any; + const themeObjectsMap = { + basic: objectWithAttributes, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > PropertyAccessExpression > nested', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.200" } as any; + const themeObjectsMap = { + basic: { + nested: objectWithAttributes + }, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression + PropertyAccessExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.300" } as any; + const themeObjectsMap = { + basic: { nested: objectWithAttributes }, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.300", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression > nested', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.400" } as any; + const themeObjectsMap = { + basic: { nested: objectWithAttributes }, + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.400", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression > Identifier / ComputedProperty', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.500" } as any; + const dynamicAttribute = "basic"; + const themeObjectsMap = { + [dynamicAttribute]: objectWithAttributes + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.500", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression > ComputedProperty / TemplateStringLiteral', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "salmon.600" } as any; + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + const dynamicPartsAsTemplateString = \`\${dynamicPart1}\${dynamicPart2}\`; + + const themeObjectsMap = { + longProp: objectWithAttributes + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > JsxExpression > ConditionalExpression > complex nested condition > truthy + truthy', () => { + expect( + extractFromCode(` + const knownCondition = true; + + const objectWithAttributes = { color: "salmon.700" } as any; + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + + const themeObjectsMap = { + basic: objectWithAttributes, + ['long' + 'Prop']: { color: "never.500" }, + }; + const getBasic = () => (themeObjectsMap as any)?.basic!; + const getMap = { getter: getBasic }; + const assertMap = { isTrue: () => !!Boolean(true) && 1 }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > JsxExpression > ConditionalExpression > complex nested condition > truthy + falsy', () => { + expect( + extractFromCode(` + const knownCondition = true; + + const objectWithAttributes = { color: "never.700" } as any; + const dynamicPart1 = "long"; + const dynamicPart2 = "Prop"; + + const themeObjectsMap = { + basic: objectWithAttributes, + ['long' + 'Prop']: { color: "salmon.800" }, + }; + const getBasic = () => (themeObjectsMap as any)?.basic!; + const getMap = { getter: getBasic }; + const assertMap = { isFalse: () => false }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "salmon.800", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > JsxExpression > ConditionalExpression > unresolvable expression will output both outcome ', () => { + expect( + extractFromCode(` + const [unresolvableBoolean, setUnresolvableBoolean] = useState(false) + const knownCondition = true; + + const objectWithAttributes = { color: "salmon.850" } as any; + + const themeObjectsMap = { + basic: objectWithAttributes, + ['long' + 'Prop']: { color: "salmon.900" }, + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": {}, + "spreadConditions": [ + { + "color": "salmon.850", + }, + { + "color": "salmon.900", + }, + ], + }, + ], + } + `) +}) + +it('extract JsxSpreadAttribute > ElementAccessExpression > CallExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "white.100" } as any; + const getDynamicAttribute = () => "basic"; + const themeObjectsMap = { + basic: objectWithAttributes + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "white.100", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > ElementAccessExpression > CallExpression > PropertyAccessExpression', () => { + expect( + extractFromCode(` + const objectWithAttributes = { color: "white.200" } as any; + const getDynamicAttribute = () => "basic"; + const themeObjectsMap = { + basic: objectWithAttributes + }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "white.200", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > NumericLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 1, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > NumericLiteral > PrefixUnaryExpression', () => { + expect( + extractFromCode( + ` + + `, + { tagNameList: ['ThreeBox'] }, + ), + ).toMatchInlineSnapshot(` + { + "ThreeBox": [ + { + "conditions": [], + "raw": { + "position": [ + -1.2466866852487384, + 0.3325255778835592, + -0.6517939595349769, + ], + "scale": 1.25, + "someProp": -2, + "zIndex": 1, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > NumericLiteral', () => { + expect( + extractFromCode(` + const nbIndex = 2; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 2, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > ConditionExpression > NumericLiteral', () => { + expect( + extractFromCode(` + const nbIndex = 1; + const isShown = true; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 3, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > immediately invoked > NumericLiteral', () => { + expect( + extractFromCode(` + 4)()}> + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 4, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > optional + NonNullable + AsExpression > NumericLiteral', () => { + expect( + extractFromCode(` + const getMap = { get: () => 5 }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 5, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > NumericLiteral', () => { + expect( + extractFromCode(` + const map = { thing: 6 }; + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "zIndex": 6, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ObjectLiteralExpression > conditional sprinkles', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": { + "desktop": "white.500", + "mobile": "white.300", + "tablet": "white.400", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > PropertyAccessExpression > ObjectLiteralExpression', () => { + expect( + extractFromCode(` + const map = { + responsiveColor: { + mobile: "white.600", + tablet: "white.700", + desktop: "white.800", + } + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": { + "desktop": "white.800", + "mobile": "white.600", + "tablet": "white.700", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > PropertyAccessExpression > CallExpression > ObjectLiteralExpression', () => { + expect( + extractFromCode(` + const map = { + responsiveColor: () => ({ + mobile: "white.600", + tablet: "white.700", + desktop: "white.800", + }) + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": { + "desktop": "white.800", + "mobile": "white.600", + "tablet": "white.700", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression + AsExpression + QuestionMarkToken + TemplateExpression + BinaryExpression + CallExpression', () => { + expect( + extractFromCode(` + const colorRef = "Color"; + const dynamic = "responsiveColor"; + const responsiveColor = ({ + mobile: "black.100", + tablet: "black.200", + desktop: "black.300", + }); + + const map = { + [dynamic]: () => responsiveColor + }; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": { + "desktop": "black.300", + "mobile": "black.100", + "tablet": "black.200", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > StringLiteral/ObjectLiteralExpression (conditional sprinkles) > truthy', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": { + "desktop": "black.600", + "mobile": "black.400", + "tablet": "black.500", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > StringLiteral/ObjectLiteralExpression (conditional sprinkles) > falsy', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "black.700", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ConditionalExpression > StringLiteral/ObjectLiteralExpression (conditional sprinkles) > unresolvable condition', () => { + expect( + extractFromCode(` + const [isShown] = useState(true); + + `), + ).toMatchInlineSnapshot( + ` + { + "ColorBox": [ + { + "conditions": [ + { + "color": { + "desktop": "black.600", + "mobile": "black.400", + "tablet": "black.500", + }, + }, + { + "color": "black.700", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `, + ) +}) + +it('extract JsxAttribute > JsxExpression > reversed', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "mobile": { + "color": "sky.100", + "desktop": "sky.300", + "tablet": "sky.200", + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > ObjectLiteralExpression > css prop', () => { + expect( + extractFromCode(` + + css prop + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "css": { + "__color": "##ff0", + "backgroundColor": "sky.500", + "mobile": { + "display": "flex", + "fontSize": "2xl", + }, + "zIndex": { + "desktop": "10", + }, + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > ObjectLiteralExpression > css prop > ConditionalExpression', () => { + expect( + extractFromCode(` + const [isShown] = useState(true); + + css prop + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "css": { + "mobile": { + "display": "flex", + }, + }, + }, + { + "css": { + "mobile": { + "display": "block", + }, + }, + }, + ], + "raw": { + "css": { + "__color": "##ff0", + "backgroundColor": "sky.600", + "mobile": { + "fontSize": "2xl", + }, + "zIndex": { + "desktop": "10", + }, + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > ObjectLiteralExpression > css prop > PropertyAssignment > ConditionalExpression', () => { + expect( + extractFromCode(` + const [isShown] = useState(true); + + css prop + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "css": { + "backgroundColor": "sky.800", + }, + }, + { + "css": { + "backgroundColor": "sky.900", + }, + }, + { + "css": { + "mobile": { + "display": "flex", + "fontSize": "2xl", + }, + }, + }, + { + "css": { + "mobile": "crimson.900", + }, + }, + ], + "raw": { + "css": { + "__color": "##ff0", + "zIndex": { + "desktop": "10", + }, + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > BinaryExpression > (PropertyAccessExpression + QuestionQuestionToken + StringLiteral)', () => { + expect( + extractFromCode(` + const Demo = (props) => { + const color = props.color ?? "apple.100"; + + + } + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "apple.100", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > BinaryExpression > (PropertyAccessExpression + AmpersandAmpersandToken + StringLiteral)', () => { + expect( + extractFromCode(` + const color = props.color && "apple.200"; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "apple.200", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > BinaryExpression > (PropertyAccessExpression + BarBarToken + StringLiteral)', () => { + expect( + extractFromCode(` + const color = props.color || "apple.300"; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [ + { + "color": "apple.300", + }, + ], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > Identifier > ArrayLiteralExpression)', () => { + expect( + extractFromCode(` + const color = ["apple.400", "apple.500"]; + + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": [ + "apple.400", + "apple.500", + ], + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ElementAccessExpression > ObjectLiteralExpression > PropertyAssignment > StringLiteral', () => { + expect( + extractFromCode(` + + `), + ).toMatchInlineSnapshot(` + { + "ColorBox": [ + { + "conditions": [], + "raw": { + "color": "apple.600", + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute + CallExpression > booleans', () => { + expect( + extractFromCode( + ` + + `, + { tagNameList: ['Container'], functionNameList: ['someFn'] }, + ), + ).toMatchInlineSnapshot(` + { + "Container": [ + { + "conditions": [], + "raw": { + "withBorder": true, + }, + "spreadConditions": [], + }, + ], + "someFn": [ + { + "conditions": [], + "raw": [ + { + "isFlex": false, + }, + ], + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > ArrayLiteralExpression', () => { + expect( + extractFromCode( + ` + + `, + { tagNameList: ['Container'] }, + ), + ).toMatchInlineSnapshot(` + { + "Container": [ + { + "conditions": [], + "raw": { + "classNames": [ + "color:main", + "hover:secondary", + ], + "config": { + "state": [ + "hovered", + "focused", + ], + }, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > Identifier without initializer', () => { + expect( + extractFromCode( + ` + + `, + { tagNameList: ['Flex'] }, + ), + ).toMatchInlineSnapshot(` + { + "Flex": [ + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract CallExpression > ObjectLiteralExpression > PropertyAssignment > ObjectLiteralExpression > PropertyAssignment > ArrayLiteralExpression > StringLiteral)', () => { + expect( + extractFromCode( + ` + const props = defineProperties({ + properties: { + position: ["relative", "absolute"], + display: ["block", "inline-block", "flex", "inline-flex"], + }, + shorthands: { + p: ["position"], + d: ["display"], + }, + }); + `, + { tagNameList: [], functionNameList: ['defineProperties'] }, + ), + ).toMatchInlineSnapshot(` + { + "defineProperties": [ + { + "conditions": [], + "raw": [ + { + "properties": { + "display": [ + "block", + "inline-block", + "flex", + "inline-flex", + ], + "position": [ + "relative", + "absolute", + ], + }, + "shorthands": { + "d": [ + "display", + ], + "p": [ + "position", + ], + }, + }, + ], + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract real-world Stack example ', () => { + expect( + extractFromCode( + ` + export const Stack = ( + props: PolymorphicComponentProps + ) => { + const { children, as, spacing, ...rest } = props; + const stackItems = Children.toArray(children); + const direction = props.flexDirection ?? "column"; + + return ( + + {stackItems.map((item, index) => ( + + {item} + + ))} + + ); + }; + + const Something = () => { + return ( + + ); + }; + `, + { tagNameList: ['Box', 'Stack'] }, + ), + ).toMatchInlineSnapshot(` + { + "Box": [ + { + "conditions": [ + { + "flexDirection": "column", + }, + ], + "raw": { + "display": "flex", + }, + "spreadConditions": [], + }, + { + "conditions": [], + "raw": {}, + "spreadConditions": [], + }, + ], + "Stack": [ + { + "conditions": [], + "raw": { + "_tablet": { + "justifyContent": "space-between", + }, + "alignItems": "flex-end", + "as": "header", + "borderBottomColor": "gray.400", + "borderBottomWidth": "1px", + "flexWrap": "wrap", + "justifyContent": "flex-end", + "paddingBottom": 2, + "paddingRight": 2, + }, + "spreadConditions": [], + }, + ], + } + `) +}) + +it('extract JsxAttribute > JsxExpression > CallExpression > ObjectLiteralExpression > PropertyAssignment > TrueKeyword', () => { + expect( + extractFromCode( + ` +