From 4ab24221687563eec911fce9bc49b9d9100a79e0 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Thu, 26 Dec 2024 14:03:52 +0530 Subject: [PATCH 01/12] First working version of pigment-css/react@v1 --- .codesandbox/ci.json | 1 + .eslintignore | 2 + .eslintrc.js | 2 + packages/pigment-css-react-new/README.md | 29 + packages/pigment-css-react-new/exports/css.js | 5 + .../pigment-css-react-new/exports/styled.js | 5 + packages/pigment-css-react-new/package.json | 132 ++++ packages/pigment-css-react-new/src/index.ts | 2 + .../src/processors/css.ts | 5 + .../src/processors/styled.ts | 117 ++++ .../src/runtime/index.ts | 2 + .../src/runtime/styled.js | 13 + .../pigment-css-react-new/src/styled.d.ts | 1 + packages/pigment-css-react-new/src/styled.js | 1 + packages/pigment-css-react-new/src/sx.d.ts | 10 + packages/pigment-css-react-new/styles.css | 3 + .../styled-import-replacement.input.js | 37 ++ .../styled-import-replacement.output.css | 5 + .../styled-import-replacement.output.js | 14 + .../styled/fixtures/styled-no-layer.input.js | 107 +++ .../fixtures/styled-no-layer.output.css | 12 + .../styled/fixtures/styled-no-layer.output.js | 70 ++ .../tests/styled/fixtures/styled.input.js | 116 ++++ .../tests/styled/fixtures/styled.output.css | 13 + .../tests/styled/fixtures/styled.output.js | 72 ++ .../tests/styled/styled.spec.tsx | 20 + .../tests/styled/styled.test.tsx | 44 ++ .../pigment-css-react-new/tests/testUtils.ts | 136 ++++ .../pigment-css-react-new/tsconfig.build.json | 7 + packages/pigment-css-react-new/tsconfig.json | 12 + packages/pigment-css-react-new/tsup.config.ts | 29 + pnpm-lock.yaml | 615 +++++++++++++++--- tsconfig.json | 8 +- 33 files changed, 1566 insertions(+), 81 deletions(-) create mode 100644 packages/pigment-css-react-new/README.md create mode 100644 packages/pigment-css-react-new/exports/css.js create mode 100644 packages/pigment-css-react-new/exports/styled.js create mode 100644 packages/pigment-css-react-new/package.json create mode 100644 packages/pigment-css-react-new/src/index.ts create mode 100644 packages/pigment-css-react-new/src/processors/css.ts create mode 100644 packages/pigment-css-react-new/src/processors/styled.ts create mode 100644 packages/pigment-css-react-new/src/runtime/index.ts create mode 100644 packages/pigment-css-react-new/src/runtime/styled.js create mode 100644 packages/pigment-css-react-new/src/styled.d.ts create mode 100644 packages/pigment-css-react-new/src/styled.js create mode 100644 packages/pigment-css-react-new/src/sx.d.ts create mode 100644 packages/pigment-css-react-new/styles.css create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.input.js create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.css create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.js create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.input.js create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.css create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.js create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js create mode 100644 packages/pigment-css-react-new/tests/styled/styled.spec.tsx create mode 100644 packages/pigment-css-react-new/tests/styled/styled.test.tsx create mode 100644 packages/pigment-css-react-new/tests/testUtils.ts create mode 100644 packages/pigment-css-react-new/tsconfig.build.json create mode 100644 packages/pigment-css-react-new/tsconfig.json create mode 100644 packages/pigment-css-react-new/tsup.config.ts diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index 29b9c589..61f524d8 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -6,6 +6,7 @@ "packages/pigment-css-core", "packages/pigment-css-nextjs-plugin", "packages/pigment-css-react", + "packages/pigment-css-react-new", "packages/pigment-css-theme", "packages/pigment-css-unplugin", "packages/pigment-css-utils", diff --git a/.eslintignore b/.eslintignore index 1a9209a1..3b7fdb07 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,6 +11,8 @@ /packages/pigment-css-react/tests/**/fixtures /packages/pigment-css-core/exports/ /packages/pigment-css-core/tests/**/fixtures +/packages/pigment-css-react-new/exports/ +/packages/pigment-css-react-new/tests/**/fixtures /packages/pigment-css-nextjs-plugin/loader.js # Ignore fixtures /packages-internal/scripts/typescript-to-proptypes/test/*/* diff --git a/.eslintrc.js b/.eslintrc.js index d36b0c24..c8de7cfe 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -83,6 +83,8 @@ module.exports = { ], 'no-use-before-define': 'off', + 'react/react-in-jsx-scope': 'off', + // disabled type-aware linting due to performance considerations '@typescript-eslint/dot-notation': 'off', 'dot-notation': 'error', diff --git a/packages/pigment-css-react-new/README.md b/packages/pigment-css-react-new/README.md new file mode 100644 index 00000000..f00cca52 --- /dev/null +++ b/packages/pigment-css-react-new/README.md @@ -0,0 +1,29 @@ +# Pigment CSS + +Pigment CSS is a zero-runtime CSS-in-JS library that extracts the colocated styles to their own CSS files at build time. + +## Getting started + +Pigment CSS supports Next.js and Vite with support for more bundlers in the future. + +### Why choose Pigment CSS + +Thanks to recent advancements in CSS (like CSS variables and `color-mix()`), "traditional" CSS-in-JS solutions that process styles at runtime are no longer required for unlocking features like color transformations and theme variables which are necessary for maintaining a sophisticated design system. + +Pigment CSS addresses the needs of the modern React developer by providing a zero-runtime CSS-in-JS styling solution as a successor to tools like Emotion and styled-components. + +Compared to its predecessors, Pigment CSS offers improved DX and runtime performance (though at the cost of increased build time) while also being compatible with React Server Components. +Pigment CSS is built on top of [WyW-in-JS](https://wyw-in-js.dev/), enabling to provide the smoothest possible experience for Material UI users when migrating from Emotion in v5 to Pigment CSS in v6. + +### Installation + + + +```bash +npm install @pigment-css/core +npm install --save-dev @pigment-css/nextjs-plugin +``` + + + +For more information and getting started guide, check the [repository README.md](https://github.com/mui/pigment-css). diff --git a/packages/pigment-css-react-new/exports/css.js b/packages/pigment-css-react-new/exports/css.js new file mode 100644 index 00000000..90873c69 --- /dev/null +++ b/packages/pigment-css-react-new/exports/css.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../build/processors/css').StyledCssProcessor; diff --git a/packages/pigment-css-react-new/exports/styled.js b/packages/pigment-css-react-new/exports/styled.js new file mode 100644 index 00000000..88af3fd0 --- /dev/null +++ b/packages/pigment-css-react-new/exports/styled.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../build/processors/styled').StyledProcessor; diff --git a/packages/pigment-css-react-new/package.json b/packages/pigment-css-react-new/package.json new file mode 100644 index 00000000..c508d437 --- /dev/null +++ b/packages/pigment-css-react-new/package.json @@ -0,0 +1,132 @@ +{ + "name": "@pigment-css/react-new", + "version": "0.0.27", + "main": "build/index.js", + "module": "build/index.mjs", + "types": "build/index.d.ts", + "author": "MUI Team", + "description": "A zero-runtime CSS-in-JS library to be used with React.", + "repository": { + "type": "git", + "url": "git+https://github.com/mui/pigment-css.git", + "directory": "packages/pigment-css-react-new" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/mui/pigment-css/issues" + }, + "homepage": "https://github.com/mui/pigment-css/tree/master/README.md", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "scripts": { + "clean": "rimraf build", + "watch": "tsup --watch --clean false", + "copy-license": "node ../../scripts/pigment-license.mjs", + "build": "tsup", + "test": "cd ../../ && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/pigment-css-react-new/**/*.test.{js,ts,tsx}'", + "test:update": "cd ../../ && cross-env NODE_ENV=test UPDATE_FIXTURES=true mocha 'packages/pigment-css-react-new/**/*.test.{js,ts,tsx}'", + "test:ci": "cd ../../ && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --report-dir=./coverage/pigment-css-react-new mocha 'packages/pigment-css-react-new/**/*.test.{js,ts,tsx}'", + "typescript": "tsc --noEmit -p ." + }, + "dependencies": { + "@babel/plugin-syntax-jsx": "^7.25.9", + "@babel/types": "^7.25.8", + "@pigment-css/core": "workspace:*", + "@pigment-css/utils": "workspace:*", + "@pigment-css/theme": "workspace:^", + "@wyw-in-js/processor-utils": "^0.6.0", + "@wyw-in-js/shared": "^0.6.0", + "@wyw-in-js/transform": "^0.6.0", + "csstype": "^3.1.3" + }, + "peerDependencies": { + "react": "^17 || ^18 || ^19 || ^19.0.0-rc" + }, + "devDependencies": { + "@types/react": "^19.0.2", + "@types/chai": "^4.3.14", + "chai": "^4.4.1", + "prettier": "^3.3.3", + "react": "^19.0.0" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "wyw-in-js": { + "tags": { + "styled": "./exports/styled.js", + "sx": "./exports/sx.js", + "keyframes": "@pigment-css/core/exports/keyframes", + "css": "./exports/css.js" + } + }, + "files": [ + "src", + "build", + "exports", + "package.json", + "styles.css", + "LICENSE" + ], + "exports": { + ".": { + "types": "./build/index.d.ts", + "import": { + "types": "./build/index.d.mts", + "default": "./build/index.mjs" + }, + "require": "./build/index.js", + "default": "./build/index.js" + }, + "./package.json": "./package.json", + "./styles.css": "./styles.css", + "./processors/css": { + "import": "./build/processors/css.mjs", + "require": "./build/processors/css.js", + "default": "./build/processors/css.js" + }, + "./processors/styled": { + "import": "./build/processors/styled.mjs", + "require": "./build/processors/styled.js", + "default": "./build/processors/styled.js" + }, + "./exports/*": { + "default": "./exports/*.js" + }, + "./runtime": { + "import": "./build/runtime/index.mjs", + "require": "./build/runtime/index.js", + "default": "./build/runtime/index.js" + } + }, + "nx": { + "targets": { + "test": { + "cache": false, + "dependsOn": [ + "build" + ] + }, + "test:update": { + "cache": false, + "dependsOn": [ + "build" + ] + }, + "test:ci": { + "cache": false, + "dependsOn": [ + "build" + ] + }, + "build": { + "outputs": [ + "{projectRoot}/build" + ] + } + } + } +} diff --git a/packages/pigment-css-react-new/src/index.ts b/packages/pigment-css-react-new/src/index.ts new file mode 100644 index 00000000..5cb0efb9 --- /dev/null +++ b/packages/pigment-css-react-new/src/index.ts @@ -0,0 +1,2 @@ +export * from '@pigment-css/core'; +export * from './styled'; diff --git a/packages/pigment-css-react-new/src/processors/css.ts b/packages/pigment-css-react-new/src/processors/css.ts new file mode 100644 index 00000000..7d9832ae --- /dev/null +++ b/packages/pigment-css-react-new/src/processors/css.ts @@ -0,0 +1,5 @@ +import { CssProcessor } from '@pigment-css/core/processors/css'; + +export class StyledCssProcessor extends CssProcessor { + basePath = `${process.env.PACKAGE_NAME}/runtime`; +} diff --git a/packages/pigment-css-react-new/src/processors/styled.ts b/packages/pigment-css-react-new/src/processors/styled.ts new file mode 100644 index 00000000..f4dd7e43 --- /dev/null +++ b/packages/pigment-css-react-new/src/processors/styled.ts @@ -0,0 +1,117 @@ +import { Identifier } from '@babel/types'; +import { evaluateClassNameArg } from '@pigment-css/utils'; +import { + type CallParam, + type Expression, + type MemberParam, + type Params, + type TailProcessorParams, + validateParams, +} from '@wyw-in-js/processor-utils'; +import { ValueType } from '@wyw-in-js/shared'; +import { CssProcessor } from '@pigment-css/core/processors/css'; +import { BaseInterface } from '@pigment-css/core/css'; + +export type TemplateCallback = (params: Record | undefined) => string | number; + +type WrappedNode = + | string + | { + node: Identifier; + source: string; + }; + +const REACT_COMPONENT = '$$reactComponent'; + +export class StyledProcessor extends CssProcessor { + tagName: WrappedNode = ''; + + // eslint-disable-next-line class-methods-use-this + get packageName() { + return process.env.PACKAGE_NAME as string; + } + + basePath = `${this.packageName}/runtime`; + + constructor(params: Params, ...args: TailProcessorParams) { + const [callee, callOrMember, callOrTemplate] = params; + super([callee, callOrTemplate], ...args); + + if (params.length === 3) { + validateParams( + params, + ['callee', ['call', 'member'], ['call', 'template']], + `Invalid use of ${this.tagSource.imported} function.`, + ); + + this.setTagName(callOrMember as CallParam | MemberParam); + } else { + throw new Error(`${this.packageName} Invalid call to ${this.tagSource.imported} function.`); + } + } + + private setTagName(param: CallParam | MemberParam) { + if (param[0] === 'member') { + this.tagName = param[1]; + } else { + const [, element, callOpt] = param; + switch (element.kind) { + case ValueType.CONST: { + if (typeof element.value === 'string') { + this.tagName = element.value; + } + break; + } + case ValueType.LAZY: { + this.tagName = { + node: element.ex, + source: element.source, + }; + this.dependencies.push(element); + break; + } + case ValueType.FUNCTION: { + this.tagName = REACT_COMPONENT; + break; + } + default: + break; + } + + if (callOpt) { + this.processor.staticClass = evaluateClassNameArg(callOpt.source) as BaseInterface; + } + } + } + + getBaseClass(): string { + return this.className; + } + + get asSelector(): string { + return this.processor.getBaseClass(); + } + + get value(): Expression { + return this.astService.stringLiteral(`.${this.processor.getBaseClass()}`); + } + + createReplacement() { + const t = this.astService; + const callId = t.addNamedImport('styled', this.getImportPath()); + const elementOrComponent = (() => { + if (typeof this.tagName === 'string') { + if (this.tagName === REACT_COMPONENT) { + return t.arrowFunctionExpression([], t.blockStatement([])); + } + return t.stringLiteral(this.tagName); + } + if (this.tagName?.node) { + return t.callExpression(t.identifier(this.tagName.node.name), []); + } + return t.nullLiteral(); + })(); + const firstCall = t.callExpression(callId, [elementOrComponent]); + return t.callExpression(firstCall, [this.getStyleArgs()]); + } +} diff --git a/packages/pigment-css-react-new/src/runtime/index.ts b/packages/pigment-css-react-new/src/runtime/index.ts new file mode 100644 index 00000000..85fa192f --- /dev/null +++ b/packages/pigment-css-react-new/src/runtime/index.ts @@ -0,0 +1,2 @@ +export * from '@pigment-css/core/runtime'; +export * from './styled'; diff --git a/packages/pigment-css-react-new/src/runtime/styled.js b/packages/pigment-css-react-new/src/runtime/styled.js new file mode 100644 index 00000000..27a0892d --- /dev/null +++ b/packages/pigment-css-react-new/src/runtime/styled.js @@ -0,0 +1,13 @@ +import * as React from 'react'; + +export function styled(component) { + function classWrapper({ displayName }) { + // eslint-disable-next-line react/prop-types + const WrappedComponent = React.forwardRef(function WrappedComponent({ as: asProp, ...rest }) { + const FinalComponent = asProp ?? component; + return ; + }); + WrappedComponent.displayName = `Pigment(${displayName ?? 'Styled'})`; + } + return classWrapper; +} diff --git a/packages/pigment-css-react-new/src/styled.d.ts b/packages/pigment-css-react-new/src/styled.d.ts new file mode 100644 index 00000000..fa6a253e --- /dev/null +++ b/packages/pigment-css-react-new/src/styled.d.ts @@ -0,0 +1 @@ +export declare function styled(): void; diff --git a/packages/pigment-css-react-new/src/styled.js b/packages/pigment-css-react-new/src/styled.js new file mode 100644 index 00000000..9a82254a --- /dev/null +++ b/packages/pigment-css-react-new/src/styled.js @@ -0,0 +1 @@ +export { styled } from './runtime/styled'; diff --git a/packages/pigment-css-react-new/src/sx.d.ts b/packages/pigment-css-react-new/src/sx.d.ts new file mode 100644 index 00000000..ba4394ec --- /dev/null +++ b/packages/pigment-css-react-new/src/sx.d.ts @@ -0,0 +1,10 @@ +import type { CSSObjectNoCallback, ThemeArgs } from '@pigment-css/core'; + +type GetTheme = Argument extends { theme: infer Theme } ? Theme : never; + +export type SxProp = + | CSSObjectNoCallback + | ((theme: GetTheme) => CSSObjectNoCallback) + | ReadonlyArray) => CSSObjectNoCallback)>; + +export default function sx(arg: SxProp, componentClass?: string): string; diff --git a/packages/pigment-css-react-new/styles.css b/packages/pigment-css-react-new/styles.css new file mode 100644 index 00000000..87774e54 --- /dev/null +++ b/packages/pigment-css-react-new/styles.css @@ -0,0 +1,3 @@ +/** + * Placeholder css file where theme contents will be injected by the bundler + */ diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.input.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.input.js new file mode 100644 index 00000000..26a8765a --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.input.js @@ -0,0 +1,37 @@ +import { styled, keyframes } from '@pigment-css/react-new'; + +function TestComponent() { + return

Hello World

; +} + +const rotateKeyframe = keyframes({ + from: { + transform: 'translateX(0%)', + }, + to: { + transform: 'translateX(100%)', + }, +}); + +const Component = styled.div({ + animation: `${rotateKeyframe} 2s ease-out 0s infinite`, + marginLeft: 10, +}); + +export const SliderRail = styled(TestComponent, { + name: 'MuiSlider', + slot: 'Rail', +})` + display: block; + position: absolute; + left: 0; + top: 0; + border-top-left-radius: 3px; +`; + +const SliderRail2 = styled.span` + ${SliderRail} { + padding-inline-start: none; + margin: 0px 10px 10px 30px; + } +`; diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.css b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.css new file mode 100644 index 00000000..ad7f38c2 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.css @@ -0,0 +1,5 @@ +@layer pigment.base{@keyframes r1gkqk0p{from{transform:translateX(0%);}to{transform:translateX(100%);}}} +@layer pigment.base{.cor4ri8{animation:r1gkqk0p 2s ease-out 0s infinite;margin-left:10px;}} +@layer pigment.base{.sn659j3{display:block;position:absolute;left:0;top:0;border-top-left-radius:3px;}} +@layer pigment.base{.s9z6p60 .sn659j3{padding-inline-start:none;margin:0px 10px 10px 30px;}} +/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9wYWNrYWdlcy9waWdtZW50LWNzcy1yZWFjdC1uZXcvdGVzdHMvc3R5bGVkL2ZpeHR1cmVzL3N0eWxlZC1pbXBvcnQtcmVwbGFjZW1lbnQuaW5wdXQuanMiXSwibmFtZXMiOlsiLnIxZ2txazBwIiwiLmNvcjRyaTgiLCIuc242NTlqMyIsIi5zOXo2cDYwIl0sIm1hcHBpbmdzIjoiQUFNaUNBO0FBU0pDO0FBS0hDO0FBV05DIiwiZmlsZSI6Ii9wYWNrYWdlcy9waWdtZW50LWNzcy1yZWFjdC1uZXcvdGVzdHMvc3R5bGVkL2ZpeHR1cmVzL3N0eWxlZC1pbXBvcnQtcmVwbGFjZW1lbnQuaW5wdXQuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3R5bGVkLCBrZXlmcmFtZXMgfSBmcm9tICdAcGlnbWVudC1jc3MvcmVhY3QtbmV3JztcblxuZnVuY3Rpb24gVGVzdENvbXBvbmVudCgpIHtcbiAgcmV0dXJuIDxoMT5IZWxsbyBXb3JsZDwvaDE+O1xufVxuXG5jb25zdCByb3RhdGVLZXlmcmFtZSA9IGtleWZyYW1lcyh7XG4gIGZyb206IHtcbiAgICB0cmFuc2Zvcm06ICd0cmFuc2xhdGVYKDAlKScsXG4gIH0sXG4gIHRvOiB7XG4gICAgdHJhbnNmb3JtOiAndHJhbnNsYXRlWCgxMDAlKScsXG4gIH0sXG59KTtcblxuY29uc3QgQ29tcG9uZW50ID0gc3R5bGVkLmRpdih7XG4gIGFuaW1hdGlvbjogYCR7cm90YXRlS2V5ZnJhbWV9IDJzIGVhc2Utb3V0IDBzIGluZmluaXRlYCxcbiAgbWFyZ2luTGVmdDogMTAsXG59KTtcblxuZXhwb3J0IGNvbnN0IFNsaWRlclJhaWwgPSBzdHlsZWQoVGVzdENvbXBvbmVudCwge1xuICBuYW1lOiAnTXVpU2xpZGVyJyxcbiAgc2xvdDogJ1JhaWwnLFxufSlgXG4gIGRpc3BsYXk6IGJsb2NrO1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIGxlZnQ6IDA7XG4gIHRvcDogMDtcbiAgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogM3B4O1xuYDtcblxuY29uc3QgU2xpZGVyUmFpbDIgPSBzdHlsZWQuc3BhbmBcbiAgJHtTbGlkZXJSYWlsfSB7XG4gICAgcGFkZGluZy1pbmxpbmUtc3RhcnQ6IG5vbmU7XG4gICAgbWFyZ2luOiAwcHggMTBweCAxMHB4IDMwcHg7XG4gIH1cbmA7XG4iXX0=*/ \ No newline at end of file diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.js new file mode 100644 index 00000000..784ed810 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-import-replacement.output.js @@ -0,0 +1,14 @@ +import { styled as _styled, styled as _styled2, styled as _styled3 } from '@my-lib/react/styled'; +function TestComponent() { + return

Hello World

; +} +const Component = /*#__PURE__*/ _styled('div')({ + classes: 'cor4ri8', +}); +const _exp3 = /*#__PURE__*/ () => TestComponent; +export const SliderRail = /*#__PURE__*/ _styled2(_exp3())({ + classes: 'sn659j3', +}); +const SliderRail2 = /*#__PURE__*/ _styled3('span')({ + classes: 's9z6p60', +}); diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.input.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.input.js new file mode 100644 index 00000000..cd06929d --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.input.js @@ -0,0 +1,107 @@ +import { styled, keyframes } from '@pigment-css/react-new'; + +const rotateKeyframe = keyframes({ + from: { + transform: 'rotate(360deg)', + }, + to: { + transform: 'rotate(0deg)', + }, +}); + +function TestComponent() { + return

Hello

; +} + +const StyledTest = styled(TestComponent)({ + $$id: 0, + display: 'block', + position: 'absolute', + borderRadius: 'inherit', + color(props) { + return props.size === 'small' ? 'red' : 'blue'; + }, + variants: { + size: { + small: { + $$id: '01', + padding: 0, + margin: 0, + borderColor: 'red', + }, + medium: { + $$id: '02', + padding: 5, + }, + large: { + $$id: '03', + padding: 10, + }, + }, + }, +}); + +export const SliderRail3 = styled('span', { + name: 'MuiSlider', + slot: 'Rail', +})({ + $$id: 1, + display: 'block', + position: 'absolute', + borderRadius: 'inherit', + backgroundColor: 'currentColor', + opacity: 0.38, +}); + +export const SliderRail = styled('span', { + name: 'MuiSlider', + slot: 'Rail', +})` + ---id: 2; + display: block; + position: absolute; + border-radius: inherit; + background-color: currentColor; + opacity: 0.38; +`; + +const SliderRail5 = styled.span({ + display: 'block', + opacity: 0.38, + [SliderRail]: { + display: 'none', + }, +}); + +const Component = styled.div({ + $$id: 3, + color: '#ff5252', + animation: `${rotateKeyframe} 2s ease-out 0s infinite`, +}); + +const SliderRail2 = styled('span')` + ---id: 4; + display: block; + opacity: 0.38; + ${SliderRail} { + display: none; + } +`; + +const SliderRail4 = styled.span` + ---id: 5; + display: block; + opacity: 0.38; + ${SliderRail} { + display: none; + } +`; + +export function App() { + return ( + + + + + ); +} diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.css b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.css new file mode 100644 index 00000000..d7a8cecf --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.css @@ -0,0 +1,12 @@ +@keyframes rl9f3t2 {from{transform:rotate(360deg);}to{transform:rotate(0deg);}} +.s1k22dj{---id:0;display:block;position:absolute;border-radius:inherit;color:var(--s1k22dj-1);} +.s1k22dj-size-small{---id:01;padding:0;margin:0;border-color:red;} +.s1k22dj-size-medium{---id:02;padding:5px;} +.s1k22dj-size-large{---id:03;padding:10px;} +.scx6lci{---id:1;display:block;position:absolute;border-radius:inherit;background-color:currentColor;opacity:0.38;} +.s1uutepx{---id:2;display:block;position:absolute;border-radius:inherit;background-color:currentColor;opacity:0.38;} +.s1czomkm{display:block;opacity:0.38;}.s1czomkm .s1uutepx{display:none;} +.camj2o9{---id:3;color:#ff5252;animation:rl9f3t2 2s ease-out 0s infinite;} +.s9jspa8{---id:4;display:block;opacity:0.38;}.s9jspa8 .s1uutepx{display:none;} +.sg47azp{---id:5;display:block;opacity:0.38;}.sg47azp .s1uutepx{display:none;} +/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9wYWNrYWdlcy9waWdtZW50LWNzcy1yZWFjdC1uZXcvdGVzdHMvc3R5bGVkL2ZpeHR1cmVzL3N0eWxlZC1uby1sYXllci5pbnB1dC5qcyJdLCJuYW1lcyI6WyIucmw5ZjN0MiIsIi5zMWsyMmRqIiwiLnMxazIyZGotc2l6ZS1zbWFsbCIsIi5zMWsyMmRqLXNpemUtbWVkaXVtIiwiLnMxazIyZGotc2l6ZS1sYXJnZSIsIi5zY3g2bGNpIiwiLnMxdXV0ZXB4IiwiLnMxY3pvb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JCRpZDogMyxcbiAgY29sb3I6ICcjZmY1MjUyJyxcbiAgYW5pbWF0aW9uOiBgJHtyb3RhdGVLZXlmcmFtZX0gMnMgZWFzZS1vdXQgMHMgaW5maW5pdGVgLFxufSk7XG5cbmNvbnN0IFNsaWRlclJhaWwyID0gc3R5bGVkKCdzcGFuJylgXG4gIC0tLWlkOiA0O1xuICBkaXNwbGF5OiBibG9jaztcbiAgb3BhY2l0eTogMC4zODtcbiAgJHtTbGlkZXJSYWlsfSB7XG4gICAgZGlzcGxheTogbm9uZTtcbiAgfVxuYDtcblxuY29uc3QgU2xpZGVyUmFpbDQgPSBzdHlsZWQuc3BhbmBcbiAgLS0taWQ6IDU7XG4gIGRpc3BsYXk6IGJsb2NrO1xuICBvcGFjaXR5OiAwLjM4O1xuICAke1NsaWRlclJhaWx9IHtcbiAgICBkaXNwbGF5OiBub25lO1xuICB9XG5gO1xuXG5leHBvcnQgZnVuY3Rpb24gQXBwKCkge1xuICByZXR1cm4gKFxuICAgIDxDb21wb25lbnQ+XG4gICAgICA8U2xpZGVyUmFpbCAvPlxuICAgICAgPFNsaWRlclJhaWwyIC8+XG4gICAgPC9Db21wb25lbnQ+XG4gICk7XG59XG4iXX0=*/ \ No newline at end of file diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.js new file mode 100644 index 00000000..ca3e3e5c --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled-no-layer.output.js @@ -0,0 +1,70 @@ +import { + styled as _styled, + styled as _styled2, + styled as _styled3, + styled as _styled4, + styled as _styled5, + styled as _styled6, + styled as _styled7, +} from '@pigment-css/react-new/runtime'; +function TestComponent() { + return

Hello

; +} +const _exp2 = /*#__PURE__*/ () => TestComponent; +const StyledTest = /*#__PURE__*/ _styled(_exp2())({ + classes: 's1k22dj', + variants: [ + { + $$cls: 's1k22dj-size-small', + props: { + size: 'small', + }, + }, + { + $$cls: 's1k22dj-size-medium', + props: { + size: 'medium', + }, + }, + { + $$cls: 's1k22dj-size-large', + props: { + size: 'large', + }, + }, + ], + vars: { + '--s1k22dj-1': [ + (props) => { + return props.size === 'small' ? 'red' : 'blue'; + }, + 0, + ], + }, +}); +export const SliderRail3 = /*#__PURE__*/ _styled2('span')({ + classes: 'scx6lci', +}); +export const SliderRail = /*#__PURE__*/ _styled3('span')({ + classes: 's1uutepx', +}); +const SliderRail5 = /*#__PURE__*/ _styled4('span')({ + classes: 's1czomkm', +}); +const Component = /*#__PURE__*/ _styled5('div')({ + classes: 'camj2o9', +}); +const SliderRail2 = /*#__PURE__*/ _styled6('span')({ + classes: 's9jspa8', +}); +const SliderRail4 = /*#__PURE__*/ _styled7('span')({ + classes: 'sg47azp', +}); +export function App() { + return ( + + + + + ); +} diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js new file mode 100644 index 00000000..e4689c85 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js @@ -0,0 +1,116 @@ +import { styled, keyframes, css } from '@pigment-css/react-new'; + +const cls1 = css({ + color: 'red', +}); + +export const rotateKeyframe = keyframes({ className: 'rotate' })({ + from: { + transform: 'rotate(360deg)', + }, + to: { + transform: 'rotate(0deg)', + }, +}); + +function TestComponent() { + return

Hello

; +} + +const StyledTest = styled(TestComponent, { + className: 'StyledTest', +})({ + $$id: 0, + display: 'block', + position: 'absolute', + borderRadius: 'inherit', + [`.${cls1}`]: { + color: 'blue', + }, + color(props) { + return props.size === 'small' ? 'red' : 'blue'; + }, + variants: { + size: { + small: { + $$id: '01', + padding: 0, + margin: 0, + borderColor: 'red', + }, + medium: { + $$id: '02', + padding: 5, + }, + large: { + $$id: '03', + padding: 10, + }, + }, + }, +}); + +export const SliderRail3 = styled('span', { + name: 'MuiSlider', + slot: 'Rail', +})({ + $$id: 1, + display: 'block', + position: 'absolute', + borderRadius: 'inherit', + backgroundColor: 'currentColor', + opacity: 0.38, +}); + +export const SliderRail = styled('span', { + name: 'MuiSlider', + slot: 'Rail', +})` + ---id: 2; + display: block; + position: absolute; + border-radius: inherit; + background-color: currentColor; + opacity: 0.38; +`; + +const SliderRail5 = styled.span({ + display: 'block', + opacity: 0.38, + [SliderRail]: { + display: 'none', + }, +}); + +const Component = styled.div({ + $$id: 3, + color: '#ff5252', + animation: `${rotateKeyframe} 2s ease-out 0s infinite`, +}); + +const SliderRail2 = styled('span')` + ---id: 4; + display: block; + opacity: 0.38; + ${SliderRail} { + display: none; + } +`; + +const SliderRail4 = styled.span` + ---id: 5; + display: block; + opacity: 0.38; + ${SliderRail} { + display: none; + } +`; + +export function App() { + return ( + + + + + ); +} diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css new file mode 100644 index 00000000..7b82483a --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css @@ -0,0 +1,13 @@ +@layer pigment.base{.c1dgsgnh{color:red;}} +@layer pigment.base{@keyframes rotate{from{transform:rotate(360deg);}to{transform:rotate(0deg);}}} +@layer pigment.base{.StyledTest{---id:0;display:block;position:absolute;border-radius:inherit;color:var(--StyledTest-1);}.StyledTest .c1dgsgnh{color:blue;}} +@layer pigment.variants{.StyledTest-size-small{---id:01;padding:0;margin:0;border-color:red;}} +@layer pigment.variants{.StyledTest-size-medium{---id:02;padding:5px;}} +@layer pigment.variants{.StyledTest-size-large{---id:03;padding:10px;}} +@layer pigment.base{.s4ekdda{---id:1;display:block;position:absolute;border-radius:inherit;background-color:currentColor;opacity:0.38;}} +@layer pigment.base{.sqpzee{---id:2;display:block;position:absolute;border-radius:inherit;background-color:currentColor;opacity:0.38;}} +@layer pigment.base{.s1o48m17{display:block;opacity:0.38;}.s1o48m17 .sqpzee{display:none;}} +@layer pigment.base{.c13e7k7c{---id:3;color:#ff5252;animation:rotate 2s ease-out 0s infinite;}} +@layer pigment.base{.sqzgjb7{---id:4;display:block;opacity:0.38;}.sqzgjb7 .sqpzee{display:none;}} +@layer pigment.base{.sxcjuwu{---id:5;display:block;opacity:0.38;}.sxcjuwu .sqpzee{display:none;}} +/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9wYWNrYWdlcy9waWdtZW50LWNzcy1yZWFjdC1uZXcvdGVzdHMvc3R5bGVkL2ZpeHR1cmVzL3N0eWxlZC5pbnB1dC5qcyJdLCJuYW1lcyI6WyIuYzFkZ3NnbmgiLCIucm90YXRlIiwiLlN0eWxlZFRlc3QiLCIuU3R5bGVkVGVzdC1zaXplLXNtYWxsIiwiLlN0eWxlZFRlc3Qtc2l6ZS1tZWRpdW0iLCIuU3R5bGVkVGVzdC1zaXplLWxhcmdlIiwiLnM0ZWtkZGEiLCIuc3FwemVlIiwiLnMxbzQ4bTE3IiwiLmMxM2U3azdjIiwiLnNxemdqYjciLCIuc3hjanV3dSJdLCJtYXBwaW5ncyI6IkFBRWlCQTtBQUlnREM7QUFlOURDO0FBQUFDO0FBQUFDO0FBQUFDO0FBa0NBQztBQVN1QkM7QUFZTUM7QUFRSEM7QUFNVEM7QUFTQUMiLCJmaWxlIjoiL3BhY2thZ2VzL3BpZ21lbnQtY3NzLXJlYWN0LW5ldy90ZXN0cy9zdHlsZWQvZml4dHVyZXMvc3R5bGVkLmlucHV0LmNzcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHN0eWxlZCwga2V5ZnJhbWVzLCBjc3MgfSBmcm9tICdAcGlnbWVudC1jc3MvcmVhY3QtbmV3JztcblxuY29uc3QgY2xzMSA9IGNzcyh7XG4gIGNvbG9yOiAncmVkJyxcbn0pO1xuXG5leHBvcnQgY29uc3Qgcm90YXRlS2V5ZnJhbWUgPSBrZXlmcmFtZXMoeyBjbGFzc05hbWU6ICdyb3RhdGUnIH0pKHtcbiAgZnJvbToge1xuICAgIHRyYW5zZm9ybTogJ3JvdGF0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BsYXk6IGJsb2NrO1xuICBvcGFjaXR5OiAwLjM4O1xuICAke1NsaWRlclJhaWx9IHtcbiAgICBkaXNwbGF5OiBub25lO1xuICB9XG5gO1xuXG5leHBvcnQgZnVuY3Rpb24gQXBwKCkge1xuICByZXR1cm4gKFxuICAgIDxDb21wb25lbnQ+XG4gICAgICA8U2xpZGVyUmFpbCAvPlxuICAgICAgPFNsaWRlclJhaWwyIC8+XG4gICAgPC9Db21wb25lbnQ+XG4gICk7XG59XG4iXX0=*/ \ No newline at end of file diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js new file mode 100644 index 00000000..ae6085e3 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js @@ -0,0 +1,72 @@ +import { + css as _css, + styled as _styled, + styled as _styled2, + styled as _styled3, + styled as _styled4, + styled as _styled5, + styled as _styled6, + styled as _styled7, +} from '@pigment-css/react-new/runtime'; +export const rotateKeyframe = 'rotate'; +function TestComponent() { + return

Hello

; +} +const _exp4 = /*#__PURE__*/ () => TestComponent; +const StyledTest = /*#__PURE__*/ _styled(_exp4())({ + classes: 'StyledTest', + variants: [ + { + $$cls: 'StyledTest-size-small', + props: { + size: 'small', + }, + }, + { + $$cls: 'StyledTest-size-medium', + props: { + size: 'medium', + }, + }, + { + $$cls: 'StyledTest-size-large', + props: { + size: 'large', + }, + }, + ], + vars: { + '--StyledTest-1': [ + (props) => { + return props.size === 'small' ? 'red' : 'blue'; + }, + 0, + ], + }, +}); +export const SliderRail3 = /*#__PURE__*/ _styled2('span')({ + classes: 's4ekdda', +}); +export const SliderRail = /*#__PURE__*/ _styled3('span')({ + classes: 'sqpzee', +}); +const SliderRail5 = /*#__PURE__*/ _styled4('span')({ + classes: 's1o48m17', +}); +const Component = /*#__PURE__*/ _styled5('div')({ + classes: 'c13e7k7c', +}); +const SliderRail2 = /*#__PURE__*/ _styled6('span')({ + classes: 'sqzgjb7', +}); +const SliderRail4 = /*#__PURE__*/ _styled7('span')({ + classes: 'sxcjuwu', +}); +export function App() { + return ( + + + + + ); +} diff --git a/packages/pigment-css-react-new/tests/styled/styled.spec.tsx b/packages/pigment-css-react-new/tests/styled/styled.spec.tsx new file mode 100644 index 00000000..8e2858f3 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/styled.spec.tsx @@ -0,0 +1,20 @@ +// import { styled } from '../../src/styled'; + +// const Button = styled('button')({ +// color: 'red', +// variants: { +// hue: { +// primary: { +// color: 'red', +// backgroundColor: 'blue', +// }, +// }, +// }, +// }); + +// // @ts-expect-error `download` does not exist on button +// ; + +// ; diff --git a/packages/pigment-css-react-new/tests/styled/styled.test.tsx b/packages/pigment-css-react-new/tests/styled/styled.test.tsx new file mode 100644 index 00000000..324de6ad --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/styled.test.tsx @@ -0,0 +1,44 @@ +import path from 'node:path'; +import { runTransformation, expect } from '../testUtils'; + +describe('Pigment CSS - styled', () => { + it('basics', async () => { + const { output, fixture } = await runTransformation( + path.join(__dirname, 'fixtures/styled.input.js'), + ); + + expect(output.js).to.equal(fixture.js); + expect(output.css).to.equal(fixture.css); + }); + + it('should replace the import paths to the ones specified in config', async () => { + const { output, fixture } = await runTransformation( + path.join(__dirname, 'fixtures/styled-import-replacement.input.js'), + { + runtimeReplacementPath(tag) { + if (tag === 'styled') { + return `@my-lib/react/styled`; + } + return null; + }, + }, + ); + + expect(output.js).to.equal(fixture.js); + expect(output.css).to.equal(fixture.css); + }); + + it('should not use css layers if the feature is disabled', async () => { + const { output, fixture } = await runTransformation( + path.join(__dirname, 'fixtures/styled-no-layer.input.js'), + { + features: { + useLayer: false, + }, + }, + ); + + expect(output.js).to.equal(fixture.js); + expect(output.css).to.equal(fixture.css); + }); +}); diff --git a/packages/pigment-css-react-new/tests/testUtils.ts b/packages/pigment-css-react-new/tests/testUtils.ts new file mode 100644 index 00000000..24ac2236 --- /dev/null +++ b/packages/pigment-css-react-new/tests/testUtils.ts @@ -0,0 +1,136 @@ +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { expect as chaiExpect } from 'chai'; +import { asyncResolveFallback } from '@wyw-in-js/shared'; +import { TransformCacheCollection, createFileReporter, transform } from '@wyw-in-js/transform'; +import * as prettier from 'prettier'; +import { PigmentConfig, preprocessor, transformPigmentConfig } from '@pigment-css/utils'; + +import pkgJson from '../package.json'; + +type TransformOptions = { + outputDir?: string; +} & PigmentConfig; + +const shouldUpdateOutput = process.env.UPDATE_FIXTURES === 'true'; + +function replaceAbsolutePathInSourceMap(sourcemap: string) { + const sourceMapJson = JSON.parse(sourcemap) as { sources: string[]; file: string }; + sourceMapJson.sources = sourceMapJson.sources.map((absPath) => + absPath.replace(process.cwd(), ''), + ); + sourceMapJson.file = sourceMapJson.file.replace(process.cwd(), ''); + return JSON.stringify(sourceMapJson); +} + +export async function runTransformation(absolutePath: string, options?: TransformOptions) { + const cache = new TransformCacheCollection(); + const { emitter: eventEmitter } = createFileReporter(false); + const inputFilePath = absolutePath; + const { outputDir, ...restOptions } = options ?? {}; + let outputFilePath = ( + outputDir ? path.join(outputDir, inputFilePath.split(path.sep).pop() as string) : absolutePath + ).replace('.input.', '.output.'); + let outputCssFilePath = ( + outputDir ? path.join(outputDir, inputFilePath.split(path.sep).pop() as string) : absolutePath + ) + .replace('.input.js', '.output.css') + .replace('.input.jsx', '.output.css'); + + if (!outputFilePath.includes('output')) { + outputFilePath = outputFilePath.replace(path.extname(outputFilePath), '.output.js'); + } + + if (!outputCssFilePath.includes('output')) { + outputCssFilePath = outputCssFilePath.replace(path.extname(outputCssFilePath), '.output.css'); + } + + const inputContent = fs.readFileSync(inputFilePath, 'utf8'); + let outputContent = fs.existsSync(outputFilePath) ? fs.readFileSync(outputFilePath, 'utf8') : ''; + let outputCssContent = fs.existsSync(outputCssFilePath) + ? fs.readFileSync(outputCssFilePath, 'utf8') + : ''; + + const pluginOptions = transformPigmentConfig({ + babelOptions: { + configFile: false, + babelrc: false, + plugins: ['@babel/plugin-syntax-jsx'], + }, + tagResolver(source: string, tag: string) { + if (source !== '@pigment-css/react-new') { + return null; + } + const tagPath = pkgJson['wyw-in-js'].tags[tag] as string | undefined; + if (!tagPath) { + return null; + } + const res = tagPath.startsWith('.') + ? require.resolve(`../${tagPath}`) + : require.resolve(tagPath); + return res; + }, + ...restOptions, + }); + + const result = await transform( + { + options: { + filename: inputFilePath, + // preprocessor: (selector, css) => preprocessor(selector, css, options?.css), + preprocessor, + pluginOptions, + }, + cache, + eventEmitter, + }, + inputContent, + asyncResolveFallback, + ); + + const prettierConfig = await prettier.resolveConfig( + path.join(process.cwd(), 'prettier.config.js'), + ); + const formattedJs = await prettier.format(result.code, { + ...prettierConfig, + parser: 'babel', + }); + // let formattedCss = await prettier.format(result.cssText ?? '', { + // ...prettierConfig, + // parser: 'css', + // }); + const formattedCss = + (result.cssText ?? '') + + (result.cssSourceMapText + ? `/*# sourceMappingURL=data:application/json;base64,${Buffer.from(replaceAbsolutePathInSourceMap(result.cssSourceMapText)).toString('base64')}*/` + : ''); + + if (!outputContent || shouldUpdateOutput) { + fs.mkdirSync(path.dirname(outputFilePath), { recursive: true }); + fs.writeFileSync(outputFilePath, formattedJs, 'utf-8'); + outputContent = formattedJs; + } + + if (!outputCssContent || shouldUpdateOutput) { + fs.mkdirSync(path.dirname(outputCssFilePath), { recursive: true }); + fs.writeFileSync(outputCssFilePath, formattedCss, 'utf-8'); + outputCssContent = formattedCss; + } + + return { + output: { + js: formattedJs, + css: formattedCss, + }, + fixture: { + js: outputContent, + css: outputCssContent, + }, + }; +} + +export function expect(val: any): ReturnType { + const CUSTOM_ERROR = + 'The file contents have changed. Run "test:update" command to update the file if this is expected.'; + return chaiExpect(val, CUSTOM_ERROR); +} diff --git a/packages/pigment-css-react-new/tsconfig.build.json b/packages/pigment-css-react-new/tsconfig.build.json new file mode 100644 index 00000000..2639ca1b --- /dev/null +++ b/packages/pigment-css-react-new/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "composite": false + }, + "exclude": ["./tsup.config.ts", "src/**/*.d.ts"] +} diff --git a/packages/pigment-css-react-new/tsconfig.json b/packages/pigment-css-react-new/tsconfig.json new file mode 100644 index 00000000..e851de14 --- /dev/null +++ b/packages/pigment-css-react-new/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.json", + "include": [ + "src/**/*.tsx", + "src/**/*.js", + "src/**/*.ts", + "tests/**/*.spec.ts", + "tests/**/*.spec.tsx", + "src/exports/css.cjs" + ], + "exclude": ["./tsup.config.ts"] +} diff --git a/packages/pigment-css-react-new/tsup.config.ts b/packages/pigment-css-react-new/tsup.config.ts new file mode 100644 index 00000000..6509ad28 --- /dev/null +++ b/packages/pigment-css-react-new/tsup.config.ts @@ -0,0 +1,29 @@ +import { Options, defineConfig } from 'tsup'; +import config from '../../tsup.config'; + +const processors = ['styled', 'css']; + +const baseConfig: Options = { + ...(config as Options), + tsconfig: './tsconfig.build.json', +}; + +const BASE_FILES = ['index.ts']; + +export default defineConfig([ + { + ...baseConfig, + entry: BASE_FILES.map((file) => `./src/${file}`), + }, + { + ...baseConfig, + entry: ['./src/runtime/index.ts'], + outDir: 'build/runtime', + }, + { + ...baseConfig, + entry: processors.map((file) => `./src/processors/${file}.ts`), + outDir: 'build/processors', + cjsInterop: true, + }, +]); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0435a9f1..76bb728a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -131,7 +131,7 @@ importers: version: 9.1.0(eslint@8.57.0) eslint-import-resolver-webpack: specifier: ^0.13.8 - version: 0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)) + version: 0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)) eslint-plugin-babel: specifier: ^5.3.1 version: 5.3.1(eslint@8.57.0) @@ -164,7 +164,7 @@ importers: version: 11.2.0 lerna: specifier: ^8.1.2 - version: 8.1.2(encoding@0.1.13) + version: 8.1.2(@swc/core@1.10.3(@swc/helpers@0.5.15))(encoding@0.1.13) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -176,7 +176,7 @@ importers: version: 10.8.2 nx: specifier: ^18.2.3 - version: 18.2.4 + version: 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) nyc: specifier: ^15.1.0 version: 15.1.0 @@ -218,7 +218,7 @@ importers: version: 36.0.0(stylelint@16.3.1(typescript@5.6.3)) tsup: specifier: ^8.3.5 - version: 8.3.5(jiti@1.21.6)(postcss@8.4.49)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) + version: 8.3.5(@swc/core@1.10.3(@swc/helpers@0.5.15))(jiti@1.21.6)(postcss@8.4.49)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) tsx: specifier: ^4.19.2 version: 4.19.2 @@ -431,7 +431,7 @@ importers: version: 18.3.1 eslint-config-next: specifier: 15.0.2 - version: 15.0.2(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0)(typescript@5.6.3) + version: 15.0.2(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) serve: specifier: 14.2.4 version: 14.2.4 @@ -446,10 +446,10 @@ importers: version: 8.56.7 '@typescript-eslint/experimental-utils': specifier: ^5.62.0 - version: 5.62.0(eslint@8.57.0)(typescript@5.6.3) + version: 5.62.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) '@typescript-eslint/parser': specifier: ^7.5.0 - version: 7.6.0(eslint@8.57.0)(typescript@5.6.3) + version: 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) packages/pigment-css-core: dependencies: @@ -622,6 +622,52 @@ importers: specifier: ^18.3.1 version: 18.3.1 + packages/pigment-css-react-new: + dependencies: + '@babel/plugin-syntax-jsx': + specifier: ^7.25.9 + version: 7.25.9(@babel/core@7.26.0) + '@babel/types': + specifier: ^7.25.8 + version: 7.26.5 + '@pigment-css/core': + specifier: workspace:* + version: link:../pigment-css-core + '@pigment-css/theme': + specifier: workspace:^ + version: link:../pigment-css-theme + '@pigment-css/utils': + specifier: workspace:* + version: link:../pigment-css-utils + '@wyw-in-js/processor-utils': + specifier: ^0.6.0 + version: 0.6.0 + '@wyw-in-js/shared': + specifier: ^0.6.0 + version: 0.6.0 + '@wyw-in-js/transform': + specifier: ^0.6.0 + version: 0.6.0(typescript@5.6.3) + csstype: + specifier: ^3.1.3 + version: 3.1.3 + devDependencies: + '@types/chai': + specifier: ^4.3.14 + version: 4.3.14 + '@types/react': + specifier: ^19.0.2 + version: 19.0.2 + chai: + specifier: ^4.4.1 + version: 4.5.0 + prettier: + specifier: ^3.3.3 + version: 3.3.3 + react: + specifier: ^19.0.0 + version: 19.0.0 + packages/pigment-css-theme: devDependencies: '@types/chai': @@ -666,7 +712,7 @@ importers: version: 4.5.0 webpack: specifier: ^5.91.0 - version: 5.91.0(esbuild@0.24.0) + version: 5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0) packages/pigment-css-utils: dependencies: @@ -1903,18 +1949,42 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.10.0': - resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/config-array@0.19.1': + resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/core@0.9.1': + resolution: {integrity: sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/eslintrc@2.1.4': resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/eslintrc@3.2.0': + resolution: {integrity: sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/js@8.57.0': resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/js@9.17.0': + resolution: {integrity: sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/object-schema@2.1.5': + resolution: {integrity: sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/plugin-kit@0.2.4': + resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@floating-ui/core@1.6.0': resolution: {integrity: sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==} @@ -1953,6 +2023,14 @@ packages: resolution: {integrity: sha512-nPgzOiDs/FSFhE+dX2KfkmsmkXM3WfXYP06FoW8cXvHshwxHSI3FbXwe5XJYstDAWXP9YA7AMSvmwnuD4OAl2w==} engines: {node: '>=12.0.0'} + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/config-array@0.11.14': resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} @@ -1966,6 +2044,14 @@ packages: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} deprecated: Use @eslint/object-schema instead + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@humanwhocodes/retry@0.4.1': + resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} + engines: {node: '>=18.18'} + '@hutson/parse-repository-url@3.0.2': resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==} engines: {node: '>=6.9.0'} @@ -2205,7 +2291,7 @@ packages: '@emotion/react': ^11.5.0 '@emotion/styled': ^11.3.0 '@mui/material-pigment-css': ^6.1.6 - '@types/react': 19.0.8 + '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 react: ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0 peerDependenciesMeta: @@ -2265,7 +2351,7 @@ packages: '@mui/types@7.2.19': resolution: {integrity: sha512-6XpZEM/Q3epK9RN8ENoXuygnqUQxE+siN/6rGRi2iwJPgBUR25mphYQ9ZI87plGh58YoZ5pp40bFvKYOCDJ3tA==} peerDependencies: - '@types/react': 19.0.8 + '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 peerDependenciesMeta: '@types/react': optional: true @@ -2901,6 +2987,75 @@ packages: resolution: {integrity: sha512-/4UjstX8ploZklY8MmlOQoXB1jWIo3Go4MP0R39sbkoWuN6rJ7Zt6l4bjkDPM4hKsjoODh9SSKn2otlp3XL3/A==} engines: {node: '>=14.17'} + '@swc/core-darwin-arm64@1.10.3': + resolution: {integrity: sha512-LFFCxAUKBy69AUE+01rgazQcafIXrYs6tBa9SyKPR51ft6Tp66dAVrWg9MTykaWskuXEe80LPUvUw1ga3bOH3A==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + + '@swc/core-darwin-x64@1.10.3': + resolution: {integrity: sha512-yZNv1+yPg0GvYdThsMI8WpaPRAPuw2gQDMdgijLFfRcRlr2l1sTWsDHqGd7QMTx+acYM3uB537gyd31WjUAwlQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + + '@swc/core-linux-arm-gnueabihf@1.10.3': + resolution: {integrity: sha512-Qa6hu5ASoKV4rcYUBGG3y3z+9UT042KAG4A7ivqqYQFcMfkB4NbZb5So2YWOpUc0/5YlSVkgL22h3Mbj5EXy7A==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + + '@swc/core-linux-arm64-gnu@1.10.3': + resolution: {integrity: sha512-BGnoZrmo0nlkXrOxVHk5U3j9u4BuquFviC+LvMe+HrDc5YLVe1gSXMUSBKhIz9MY9uFgxXW977TnB1XjLSKe5Q==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/core-linux-arm64-musl@1.10.3': + resolution: {integrity: sha512-L07/4zKnIY2S/00bE+Yn3oEHkyGjWmGGE8Ta4luVCL+00s04EIwMoE1Hc8E8xFB5zLew5ViKFc5kNb5YZ/tRFQ==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/core-linux-x64-gnu@1.10.3': + resolution: {integrity: sha512-cvTCekY4u0fBIDNfhv/2UxcOXqH4XJE2iNxKuQejS5KIapFJwrZ+fRQ2lha3+yopI/d2p96BlBEWTAcBzeTntw==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/core-linux-x64-musl@1.10.3': + resolution: {integrity: sha512-h9kUOTrSSpY9JNc41a+NMAwK62USk/pvNE9Fi/Pfoklmlf9j9j8gRCitqvHpmZcEF4PPIsoMdiGetDipTwvWlw==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/core-win32-arm64-msvc@1.10.3': + resolution: {integrity: sha512-iHOmLYkZYn3r1Ff4rfyczdrYGt/wVIWyY0t8swsO9o1TE+zmucGFZuYZzgj3ng8Kp4sojJrydAGz8TINQZDBzQ==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + + '@swc/core-win32-ia32-msvc@1.10.3': + resolution: {integrity: sha512-4SqLSE4Ozh8SxuVuHIZhkSyJQru5+WbQMRs5ggLRqeUy3vkUPHOAFAY3oMwDJUN6BwbAr8+664TmdrMwaWh8Ng==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + + '@swc/core-win32-x64-msvc@1.10.3': + resolution: {integrity: sha512-jTyf/IbNq7NVyqqDIEDzgjALjWu1IMfXKLXXAJArreklIMzkfHU1sV32ZJLOBmRKPyslCoalxIAU+hTx4reUTQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + + '@swc/core@1.10.3': + resolution: {integrity: sha512-2yjqCcsBx6SNBQZIYNlwxED9aYXW/7QBZyr8LYAxTx5bzmoNhKiClYbsNLe1NJ6ccf5uSbcInw12PjXLduNEdQ==} + engines: {node: '>=10'} + peerDependencies: + '@swc/helpers': '*' + peerDependenciesMeta: + '@swc/helpers': + optional: true + '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} @@ -2910,6 +3065,9 @@ packages: '@swc/helpers@0.5.15': resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==} + '@swc/types@0.1.17': + resolution: {integrity: sha512-V5gRru+aD8YVyCOMAjMpWR1Ui577DD5KSJsHP8RAxopAH22jFz6GZd/qxqjO6MJHQhcsjvjOFXyDhyLQUnMveQ==} + '@szmarczak/http-timer@4.0.6': resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==} engines: {node: '>=10'} @@ -4129,8 +4287,8 @@ packages: engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} hasBin: true - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} css-functions-list@3.2.1: @@ -4707,6 +4865,10 @@ packages: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.2.0: + resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint-utils@3.0.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} @@ -4721,12 +4883,30 @@ packages: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true + eslint@9.17.0: + resolution: {integrity: sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5200,6 +5380,10 @@ packages: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + globalthis@1.0.4: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} @@ -10284,7 +10468,24 @@ snapshots: eslint: 8.57.0 eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.10.0': {} + '@eslint-community/eslint-utils@4.4.0(eslint@9.17.0(jiti@1.21.6))': + dependencies: + eslint: 9.17.0(jiti@1.21.6) + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/config-array@0.19.1': + dependencies: + '@eslint/object-schema': 2.1.5 + debug: 4.3.7(supports-color@8.1.1) + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/core@0.9.1': + dependencies: + '@types/json-schema': 7.0.15 '@eslint/eslintrc@2.1.4': dependencies: @@ -10300,8 +10501,30 @@ snapshots: transitivePeerDependencies: - supports-color + '@eslint/eslintrc@3.2.0': + dependencies: + ajv: 6.12.6 + debug: 4.3.7(supports-color@8.1.1) + espree: 10.3.0 + globals: 14.0.0 + ignore: 5.3.1 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + '@eslint/js@8.57.0': {} + '@eslint/js@9.17.0': {} + + '@eslint/object-schema@2.1.5': {} + + '@eslint/plugin-kit@0.2.4': + dependencies: + levn: 0.4.1 + '@floating-ui/core@1.6.0': dependencies: '@floating-ui/utils': 0.2.8 @@ -10357,6 +10580,13 @@ snapshots: - encoding - supports-color + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/config-array@0.11.14': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -10369,6 +10599,10 @@ snapshots: '@humanwhocodes/object-schema@2.0.3': {} + '@humanwhocodes/retry@0.3.1': {} + + '@humanwhocodes/retry@0.4.1': {} + '@hutson/parse-repository-url@3.0.2': {} '@img/sharp-darwin-arm64@0.33.5': @@ -10491,10 +10725,10 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@lerna/create@8.1.2(encoding@0.1.13)(typescript@5.6.3)': + '@lerna/create@8.1.2(@swc/core@1.10.3(@swc/helpers@0.5.15))(encoding@0.1.13)(typescript@5.6.3)': dependencies: '@npmcli/run-script': 7.0.2 - '@nx/devkit': 18.2.4(nx@18.2.4) + '@nx/devkit': 18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15))) '@octokit/plugin-enterprise-rest': 6.0.1 '@octokit/rest': 19.0.11(encoding@0.1.13) byte-size: 8.1.1 @@ -10531,7 +10765,7 @@ snapshots: npm-packlist: 5.1.1 npm-registry-fetch: 14.0.5 npmlog: 6.0.2 - nx: 18.2.4 + nx: 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) p-map: 4.0.0 p-map-series: 2.1.0 p-queue: 6.6.2 @@ -11005,28 +11239,28 @@ snapshots: transitivePeerDependencies: - supports-color - '@nrwl/devkit@18.2.4(nx@18.2.4)': + '@nrwl/devkit@18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)))': dependencies: - '@nx/devkit': 18.2.4(nx@18.2.4) + '@nx/devkit': 18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15))) transitivePeerDependencies: - nx - '@nrwl/tao@18.2.4': + '@nrwl/tao@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15))': dependencies: - nx: 18.2.4 + nx: 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) tslib: 2.8.1 transitivePeerDependencies: - '@swc-node/register' - '@swc/core' - debug - '@nx/devkit@18.2.4(nx@18.2.4)': + '@nx/devkit@18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)))': dependencies: - '@nrwl/devkit': 18.2.4(nx@18.2.4) + '@nrwl/devkit': 18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15))) ejs: 3.1.9 enquirer: 2.3.6 ignore: 5.3.1 - nx: 18.2.4 + nx: 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) semver: 7.6.3 tmp: 0.2.3 tslib: 2.8.1 @@ -11538,6 +11772,54 @@ snapshots: hast-util-to-string: 2.0.0 unist-util-visit: 4.1.2 + '@swc/core-darwin-arm64@1.10.3': + optional: true + + '@swc/core-darwin-x64@1.10.3': + optional: true + + '@swc/core-linux-arm-gnueabihf@1.10.3': + optional: true + + '@swc/core-linux-arm64-gnu@1.10.3': + optional: true + + '@swc/core-linux-arm64-musl@1.10.3': + optional: true + + '@swc/core-linux-x64-gnu@1.10.3': + optional: true + + '@swc/core-linux-x64-musl@1.10.3': + optional: true + + '@swc/core-win32-arm64-msvc@1.10.3': + optional: true + + '@swc/core-win32-ia32-msvc@1.10.3': + optional: true + + '@swc/core-win32-x64-msvc@1.10.3': + optional: true + + '@swc/core@1.10.3(@swc/helpers@0.5.15)': + dependencies: + '@swc/counter': 0.1.3 + '@swc/types': 0.1.17 + optionalDependencies: + '@swc/core-darwin-arm64': 1.10.3 + '@swc/core-darwin-x64': 1.10.3 + '@swc/core-linux-arm-gnueabihf': 1.10.3 + '@swc/core-linux-arm64-gnu': 1.10.3 + '@swc/core-linux-arm64-musl': 1.10.3 + '@swc/core-linux-x64-gnu': 1.10.3 + '@swc/core-linux-x64-musl': 1.10.3 + '@swc/core-win32-arm64-msvc': 1.10.3 + '@swc/core-win32-ia32-msvc': 1.10.3 + '@swc/core-win32-x64-msvc': 1.10.3 + '@swc/helpers': 0.5.15 + optional: true + '@swc/counter@0.1.3': {} '@swc/helpers@0.5.13': @@ -11548,6 +11830,11 @@ snapshots: dependencies: tslib: 2.8.1 + '@swc/types@0.1.17': + dependencies: + '@swc/counter': 0.1.3 + optional: true + '@szmarczak/http-timer@4.0.6': dependencies: defer-to-connect: 2.0.1 @@ -11816,7 +12103,7 @@ snapshots: '@typescript-eslint/eslint-plugin@7.6.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0)(typescript@5.6.3)': dependencies: - '@eslint-community/regexpp': 4.10.0 + '@eslint-community/regexpp': 4.12.1 '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.6.3) '@typescript-eslint/scope-manager': 7.6.0 '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.6.3) @@ -11834,10 +12121,30 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/experimental-utils@5.62.0(eslint@8.57.0)(typescript@5.6.3)': + '@typescript-eslint/eslint-plugin@7.6.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': dependencies: - '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.6.3) - eslint: 8.57.0 + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/utils': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 7.6.0 + debug: 4.3.7(supports-color@8.1.1) + eslint: 9.17.0(jiti@1.21.6) + graphemer: 1.4.0 + ignore: 5.3.1 + natural-compare: 1.4.0 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/experimental-utils@5.62.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@typescript-eslint/utils': 5.62.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + eslint: 9.17.0(jiti@1.21.6) transitivePeerDependencies: - supports-color - typescript @@ -11855,6 +12162,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 7.6.0 + debug: 4.3.7(supports-color@8.1.1) + eslint: 9.17.0(jiti@1.21.6) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/scope-manager@5.62.0': dependencies: '@typescript-eslint/types': 5.62.0 @@ -11877,6 +12197,18 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/type-utils@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.6.3) + '@typescript-eslint/utils': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + debug: 4.3.7(supports-color@8.1.1) + eslint: 9.17.0(jiti@1.21.6) + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/types@5.62.0': {} '@typescript-eslint/types@7.6.0': {} @@ -11910,15 +12242,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@5.62.0(eslint@8.57.0)(typescript@5.6.3)': + '@typescript-eslint/utils@5.62.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.17.0(jiti@1.21.6)) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.6.3) - eslint: 8.57.0 + eslint: 9.17.0(jiti@1.21.6) eslint-scope: 5.1.1 semver: 7.6.3 transitivePeerDependencies: @@ -11939,6 +12271,20 @@ snapshots: - supports-color - typescript + '@typescript-eslint/utils@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.17.0(jiti@1.21.6)) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.8 + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.6.3) + eslint: 9.17.0(jiti@1.21.6) + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + - typescript + '@typescript-eslint/visitor-keys@5.62.0': dependencies: '@typescript-eslint/types': 5.62.0 @@ -12999,9 +13345,9 @@ snapshots: cross-env@7.0.3: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 - cross-spawn@7.0.3: + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 shebang-command: 2.0.0 @@ -13586,19 +13932,19 @@ snapshots: object.assign: 4.1.5 object.entries: 1.1.8 - eslint-config-next@15.0.2(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0)(typescript@5.6.3): + eslint-config-next@15.0.2(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3): dependencies: '@next/eslint-plugin-next': 15.0.2 '@rushstack/eslint-patch': 1.10.4 - '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0)(typescript@5.6.3) - '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.6.3) - eslint: 8.57.0 + '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/parser': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + eslint: 9.17.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0) - eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.0) - eslint-plugin-react: 7.37.2(eslint@8.57.0) - eslint-plugin-react-hooks: 5.0.0(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)) + eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@1.21.6)) + eslint-plugin-react: 7.37.2(eslint@9.17.0(jiti@1.21.6)) + eslint-plugin-react-hooks: 5.0.0(eslint@9.17.0(jiti@1.21.6)) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -13618,26 +13964,26 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.7(supports-color@8.1.1) enhanced-resolve: 5.16.0 - eslint: 8.57.0 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0) + eslint: 9.17.0(jiti@1.21.6) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)): + eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)): dependencies: array.prototype.find: 2.2.3 debug: 3.2.7 @@ -13651,19 +13997,30 @@ snapshots: lodash: 4.17.21 resolve: 2.0.0-next.5 semver: 5.7.2 - webpack: 5.91.0(esbuild@0.24.0) + webpack: 5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0) transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0): + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.6.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0) - eslint-import-resolver-webpack: 0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)) + eslint-import-resolver-webpack: 0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)) + transitivePeerDependencies: + - supports-color + + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) + eslint: 9.17.0(jiti@1.21.6) + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)) + eslint-import-resolver-webpack: 0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)) transitivePeerDependencies: - supports-color @@ -13680,7 +14037,7 @@ snapshots: lodash.snakecase: 4.1.1 lodash.upperfirst: 4.3.1 - eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-webpack@0.13.8)(eslint@8.57.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -13691,7 +14048,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -13709,7 +14066,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-webpack@0.13.8)(eslint@8.57.0): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -13718,9 +14075,9 @@ snapshots: array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.57.0 + eslint: 9.17.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(esbuild@0.24.0)))(eslint@8.57.0) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@1.21.6)))(eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.31.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)))(eslint@9.17.0(jiti@1.21.6)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -13732,7 +14089,7 @@ snapshots: string.prototype.trimend: 1.0.8 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.6.3) + '@typescript-eslint/parser': 7.6.0(eslint@9.17.0(jiti@1.21.6))(typescript@5.6.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -13757,6 +14114,25 @@ snapshots: safe-regex-test: 1.0.3 string.prototype.includes: 2.0.1 + eslint-plugin-jsx-a11y@6.10.2(eslint@9.17.0(jiti@1.21.6)): + dependencies: + aria-query: 5.3.2 + array-includes: 3.1.8 + array.prototype.flatmap: 1.3.2 + ast-types-flow: 0.0.8 + axe-core: 4.10.2 + axobject-query: 4.1.0 + damerau-levenshtein: 1.0.8 + emoji-regex: 9.2.2 + eslint: 9.17.0(jiti@1.21.6) + hasown: 2.0.2 + jsx-ast-utils: 3.3.5 + language-tags: 1.0.9 + minimatch: 3.1.2 + object.fromentries: 2.0.8 + safe-regex-test: 1.0.3 + string.prototype.includes: 2.0.1 + eslint-plugin-mocha@10.4.1(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -13768,9 +14144,9 @@ snapshots: dependencies: eslint: 8.57.0 - eslint-plugin-react-hooks@5.0.0(eslint@8.57.0): + eslint-plugin-react-hooks@5.0.0(eslint@9.17.0(jiti@1.21.6)): dependencies: - eslint: 8.57.0 + eslint: 9.17.0(jiti@1.21.6) eslint-plugin-react@7.37.2(eslint@8.57.0): dependencies: @@ -13794,6 +14170,28 @@ snapshots: string.prototype.matchall: 4.0.11 string.prototype.repeat: 1.0.0 + eslint-plugin-react@7.37.2(eslint@9.17.0(jiti@1.21.6)): + dependencies: + array-includes: 3.1.8 + array.prototype.findlast: 1.2.5 + array.prototype.flatmap: 1.3.2 + array.prototype.tosorted: 1.1.4 + doctrine: 2.1.0 + es-iterator-helpers: 1.1.0 + eslint: 9.17.0(jiti@1.21.6) + estraverse: 5.3.0 + hasown: 2.0.2 + jsx-ast-utils: 3.3.5 + minimatch: 3.1.2 + object.entries: 1.1.8 + object.fromentries: 2.0.8 + object.values: 1.2.0 + prop-types: 15.8.1 + resolve: 2.0.0-next.5 + semver: 6.3.1 + string.prototype.matchall: 4.0.11 + string.prototype.repeat: 1.0.0 + eslint-rule-composer@0.3.0: {} eslint-scope@5.1.1: @@ -13806,6 +14204,11 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 + eslint-scope@8.2.0: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + eslint-utils@3.0.0(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -13815,10 +14218,12 @@ snapshots: eslint-visitor-keys@3.4.3: {} + eslint-visitor-keys@4.2.0: {} + eslint@8.57.0: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@eslint-community/regexpp': 4.10.0 + '@eslint-community/regexpp': 4.12.1 '@eslint/eslintrc': 2.1.4 '@eslint/js': 8.57.0 '@humanwhocodes/config-array': 0.11.14 @@ -13827,7 +14232,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.7(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -13858,6 +14263,53 @@ snapshots: transitivePeerDependencies: - supports-color + eslint@9.17.0(jiti@1.21.6): + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.17.0(jiti@1.21.6)) + '@eslint-community/regexpp': 4.12.1 + '@eslint/config-array': 0.19.1 + '@eslint/core': 0.9.1 + '@eslint/eslintrc': 3.2.0 + '@eslint/js': 9.17.0 + '@eslint/plugin-kit': 0.2.4 + '@humanfs/node': 0.16.6 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.1 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.3.7(supports-color@8.1.1) + escape-string-regexp: 4.0.0 + eslint-scope: 8.2.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + esquery: 1.5.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.1 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.3 + optionalDependencies: + jiti: 1.21.6 + transitivePeerDependencies: + - supports-color + + espree@10.3.0: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.2.0 + espree@9.6.1: dependencies: acorn: 8.14.0 @@ -13945,7 +14397,7 @@ snapshots: execa@5.0.0: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -13957,7 +14409,7 @@ snapshots: execa@5.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -13970,7 +14422,7 @@ snapshots: execa@9.5.1: dependencies: '@sindresorhus/merge-streams': 4.0.0 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 figures: 6.1.0 get-stream: 9.0.1 human-signals: 8.0.0 @@ -14179,12 +14631,12 @@ snapshots: foreground-child@2.0.0: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 3.0.7 foreground-child@3.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 form-data@4.0.0: @@ -14428,6 +14880,8 @@ snapshots: dependencies: type-fest: 0.20.2 + globals@14.0.0: {} + globalthis@1.0.4: dependencies: define-properties: 1.2.1 @@ -15108,7 +15562,7 @@ snapshots: istanbul-lib-processinfo@2.0.3: dependencies: archy: 1.0.0 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 istanbul-lib-coverage: 3.2.2 p-map: 3.0.0 rimraf: 3.0.2 @@ -15320,11 +15774,11 @@ snapshots: dependencies: language-subtag-registry: 0.3.22 - lerna@8.1.2(encoding@0.1.13): + lerna@8.1.2(@swc/core@1.10.3(@swc/helpers@0.5.15))(encoding@0.1.13): dependencies: - '@lerna/create': 8.1.2(encoding@0.1.13)(typescript@5.6.3) + '@lerna/create': 8.1.2(@swc/core@1.10.3(@swc/helpers@0.5.15))(encoding@0.1.13)(typescript@5.6.3) '@npmcli/run-script': 7.0.2 - '@nx/devkit': 18.2.4(nx@18.2.4) + '@nx/devkit': 18.2.4(nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15))) '@octokit/plugin-enterprise-rest': 6.0.1 '@octokit/rest': 19.0.11(encoding@0.1.13) byte-size: 8.1.1 @@ -15367,7 +15821,7 @@ snapshots: npm-packlist: 5.1.1 npm-registry-fetch: 14.0.5 npmlog: 6.0.2 - nx: 18.2.4 + nx: 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) p-map: 4.0.0 p-map-series: 2.1.0 p-pipe: 3.1.0 @@ -16621,9 +17075,9 @@ snapshots: nwsapi@2.2.7: {} - nx@18.2.4: + nx@18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)): dependencies: - '@nrwl/tao': 18.2.4 + '@nrwl/tao': 18.2.4(@swc/core@1.10.3(@swc/helpers@0.5.15)) '@yarnpkg/lockfile': 1.1.0 '@yarnpkg/parsers': 3.0.0-rc.46 '@zkochan/js-yaml': 0.0.6 @@ -16668,6 +17122,7 @@ snapshots: '@nx/nx-linux-x64-musl': 18.2.4 '@nx/nx-win32-arm64-msvc': 18.2.4 '@nx/nx-win32-x64-msvc': 18.2.4 + '@swc/core': 1.10.3(@swc/helpers@0.5.15) transitivePeerDependencies: - debug @@ -18406,15 +18861,16 @@ snapshots: temp-dir@1.0.0: {} - terser-webpack-plugin@5.3.10(esbuild@0.24.0)(webpack@5.91.0(esbuild@0.24.0)): + terser-webpack-plugin@5.3.10(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.30.3 - webpack: 5.91.0(esbuild@0.24.0) + webpack: 5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0) optionalDependencies: + '@swc/core': 1.10.3(@swc/helpers@0.5.15) esbuild: 0.24.0 terser@5.30.3: @@ -18530,7 +18986,7 @@ snapshots: tsscmp@1.0.6: {} - tsup@8.3.5(jiti@1.21.6)(postcss@8.4.49)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0): + tsup@8.3.5(@swc/core@1.10.3(@swc/helpers@0.5.15))(jiti@1.21.6)(postcss@8.4.49)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0): dependencies: bundle-require: 5.0.0(esbuild@0.24.0) cac: 6.7.14 @@ -18549,6 +19005,7 @@ snapshots: tinyglobby: 0.2.10 tree-kill: 1.2.2 optionalDependencies: + '@swc/core': 1.10.3(@swc/helpers@0.5.15) postcss: 8.4.49 typescript: 5.6.3 transitivePeerDependencies: @@ -18955,7 +19412,7 @@ snapshots: webpack-virtual-modules@0.6.2: {} - webpack@5.91.0(esbuild@0.24.0): + webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.6 @@ -18978,7 +19435,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.24.0)(webpack@5.91.0(esbuild@0.24.0)) + terser-webpack-plugin: 5.3.10(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)(webpack@5.91.0(@swc/core@1.10.3(@swc/helpers@0.5.15))(esbuild@0.24.0)) watchpack: 2.4.1 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/tsconfig.json b/tsconfig.json index 5c4728e4..37b3cc7a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ // aligning with Node18 recommendation: https://www.npmjs.com/package/@tsconfig/node18 "target": "es2022", "lib": ["es2020", "dom", "ES2021.String"], - "jsx": "preserve", + "jsx": "react-jsx", "moduleResolution": "bundler", "forceConsistentCasingInFileNames": true, "strict": true, @@ -31,7 +31,11 @@ "@pigment-css/theme": ["./packages/pigment-css-theme/src"], "@pigment-css/theme/*": ["./packages/pigment-css-theme/src/*"], "@pigment-css/utils": ["./packages/pigment-css-utils/src"], - "@pigment-css/utils/*": ["./packages/pigment-css-utils/src/*"] + "@pigment-css/utils/*": ["./packages/pigment-css-utils/src/*"], + "@pigment-css/core": ["./packages/pigment-css-core/src"], + "@pigment-css/core/*": ["./packages/pigment-css-core/src/*"], + "@pigment-css/react-new": ["./packages/pigment-css-react-new/src"], + "@pigment-css/react-new/*": ["./packages/pigment-css-react-new/src/*"] }, // Otherwise we get react-native typings which conflict with dom.lib. "types": ["node", "react", "mocha"] From 841238df5a38550b99ccb1d6d1278373da6c9fb0 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Mon, 3 Feb 2025 10:36:46 +0530 Subject: [PATCH 02/12] Implement styled runtime --- packages/pigment-css-react-new/package.json | 1 + .../src/runtime/styled.js | 13 -- .../src/runtime/styled.tsx | 119 ++++++++++++++++++ .../pigment-css-react-new/src/styled.d.ts | 76 ++++++++++- .../fixtures/dummy-component.fixture.js | 3 + .../tests/styled/fixtures/styled.input.js | 5 +- .../tests/styled/fixtures/styled.output.css | 2 +- .../tests/styled/fixtures/styled.output.js | 4 +- .../tests/styled/styled.spec.tsx | 72 ++++++++--- pnpm-lock.yaml | 3 + 10 files changed, 256 insertions(+), 42 deletions(-) delete mode 100644 packages/pigment-css-react-new/src/runtime/styled.js create mode 100644 packages/pigment-css-react-new/src/runtime/styled.tsx create mode 100644 packages/pigment-css-react-new/tests/styled/fixtures/dummy-component.fixture.js diff --git a/packages/pigment-css-react-new/package.json b/packages/pigment-css-react-new/package.json index c508d437..d3ee00d4 100644 --- a/packages/pigment-css-react-new/package.json +++ b/packages/pigment-css-react-new/package.json @@ -33,6 +33,7 @@ "dependencies": { "@babel/plugin-syntax-jsx": "^7.25.9", "@babel/types": "^7.25.8", + "@emotion/is-prop-valid": "^1.3.1", "@pigment-css/core": "workspace:*", "@pigment-css/utils": "workspace:*", "@pigment-css/theme": "workspace:^", diff --git a/packages/pigment-css-react-new/src/runtime/styled.js b/packages/pigment-css-react-new/src/runtime/styled.js deleted file mode 100644 index 27a0892d..00000000 --- a/packages/pigment-css-react-new/src/runtime/styled.js +++ /dev/null @@ -1,13 +0,0 @@ -import * as React from 'react'; - -export function styled(component) { - function classWrapper({ displayName }) { - // eslint-disable-next-line react/prop-types - const WrappedComponent = React.forwardRef(function WrappedComponent({ as: asProp, ...rest }) { - const FinalComponent = asProp ?? component; - return ; - }); - WrappedComponent.displayName = `Pigment(${displayName ?? 'Styled'})`; - } - return classWrapper; -} diff --git a/packages/pigment-css-react-new/src/runtime/styled.tsx b/packages/pigment-css-react-new/src/runtime/styled.tsx new file mode 100644 index 00000000..19c9f127 --- /dev/null +++ b/packages/pigment-css-react-new/src/runtime/styled.tsx @@ -0,0 +1,119 @@ +import { Primitive } from '@pigment-css/core'; +import { ClassInfo, css } from '@pigment-css/core/runtime'; +import * as React from 'react'; +import isPropValid from '@emotion/is-prop-valid'; + +type StyledInfo = ClassInfo & { + displayName?: string; + vars?: Record Primitive, boolean]>; +}; + +function defaultShouldForwardProp(propName: string): boolean { + // if first character is $ + if (propName.charCodeAt(0) === 36) { + return false; + } + if (propName === 'as') { + return false; + } + return true; +} + +function shouldForwardProp(propName: string) { + if (defaultShouldForwardProp(propName)) { + return isPropValid(propName); + } + return false; +} + +function getStyle(props: ClassInfo['defaultVariants'], vars: StyledInfo['vars']) { + const newStyle: Record = {}; + if (!props || !vars) { + return newStyle; + } + // eslint-disable-next-line no-restricted-syntax + for (const key in vars) { + if (!vars.hasOwnProperty(key)) { + continue; + } + const [variableFunction, isUnitLess] = vars[key]; + const value = variableFunction(props); + if (typeof value === 'undefined') { + continue; + } + if (typeof value === 'string' || isUnitLess) { + newStyle[key] = value; + } else { + newStyle[key] = `${value}px`; + } + } + return newStyle; +} + +export function styled(tag: T) { + if (process.env.NODE_ENV === 'development') { + if (tag === undefined) { + throw new Error( + 'You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.', + ); + } + } + const shouldForwardPropLocal = + typeof tag === 'string' ? shouldForwardProp : defaultShouldForwardProp; + + function scopedStyled({ + classes, + variants = [], + defaultVariants = {}, + vars, + displayName = '', + }: StyledInfo) { + const cssFn = css({ + classes, + variants, + defaultVariants, + }); + const baseClasses = cssFn(); + + const StyledComponent = React.forwardRef< + React.ComponentRef, + React.ComponentPropsWithoutRef & { + as?: React.ElementType; + className?: string; + style?: React.CSSProperties; + } + >(function render(props, ref) { + const newProps: Record = {}; + + // eslint-disable-next-line no-restricted-syntax + for (const key in props) { + // if first char is $ + if (shouldForwardPropLocal(key)) { + newProps[key] = props[key]; + } + } + newProps.className = variants.length === 0 ? baseClasses : baseClasses; + newProps.style = { + ...props.style, + ...getStyle(props, vars), + }; + + const Component = props.as ?? tag; + return ; + }); + + if (displayName) { + StyledComponent.displayName = displayName; + } else { + StyledComponent.displayName = 'Styled(Pigment)'; + } + + // @ts-expect-error No TS check required + // eslint-disable-next-line no-underscore-dangle + StyledComponent.__styled_by_pigment_css = true; + + return StyledComponent; + } + + return scopedStyled; +} diff --git a/packages/pigment-css-react-new/src/styled.d.ts b/packages/pigment-css-react-new/src/styled.d.ts index fa6a253e..8fa73427 100644 --- a/packages/pigment-css-react-new/src/styled.d.ts +++ b/packages/pigment-css-react-new/src/styled.d.ts @@ -1 +1,75 @@ -export declare function styled(): void; +import type * as React from 'react'; +import { Variants, BaseInterface, CssArg, VariantNames, Primitive } from '@pigment-css/core'; + +export type NoInfer = [T][T extends any ? 0 : never]; +type FastOmit = { + [K in keyof T as K extends U ? never : K]: T[K]; +}; + +export type Substitute = FastOmit & B; + +interface RequiredProps { + className?: string; + style?: React.CSSProperties; +} + +export type PolymorphicComponentProps< + Props extends {}, + AsTarget extends React.ElementType | undefined, + AsTargetProps extends object = AsTarget extends React.ElementType + ? React.ComponentPropsWithRef + : {}, +> = NoInfer, 'as'>> & { + as?: AsTarget; + children?: React.ReactNode; +}; + +export interface PolymorphicComponent + extends React.ForwardRefExoticComponent { + ( + props: PolymorphicComponentProps, + ): React.JSX.Element; +} + +type StyledArgument = CssArg; + +interface StyledComponent extends PolymorphicComponent { + defaultProps?: Partial | undefined; + toString: () => string; +} + +interface StyledOptions extends BaseInterface {} + +export interface CreateStyledComponent< + Component extends React.ElementType, + OuterProps extends object, +> { + ( + arg: TemplateStringsArray, + ...templateArgs: (Primitive | ((props: Props) => Primitive))[] + ): StyledComponent> & (Component extends string ? {} : Component); + + ( + ...styles: Array> + ): StyledComponent : V>> & + (Component extends string ? {} : Component); +} + +export interface CreateStyled { + < + TagOrComponent extends React.ElementType, + FinalProps extends {} = React.ComponentPropsWithRef, + >( + tag: TagOrComponent, + options?: StyledOptions, + ): CreateStyledComponent; +} + +export type CreateStyledIndex = { + [Key in keyof React.JSX.IntrinsicElements]: CreateStyledComponent< + Key, + React.JSX.IntrinsicElements[Key] + >; +}; + +export declare const styled: CreateStyled & CreateStyledIndex; diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/dummy-component.fixture.js b/packages/pigment-css-react-new/tests/styled/fixtures/dummy-component.fixture.js new file mode 100644 index 00000000..ade8d673 --- /dev/null +++ b/packages/pigment-css-react-new/tests/styled/fixtures/dummy-component.fixture.js @@ -0,0 +1,3 @@ +export function TestComponent() { + return

Hello

; +} diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js index e4689c85..58d8415c 100644 --- a/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.input.js @@ -1,4 +1,5 @@ import { styled, keyframes, css } from '@pigment-css/react-new'; +import { TestComponent } from './dummy-component.fixture'; const cls1 = css({ color: 'red', @@ -13,10 +14,6 @@ export const rotateKeyframe = keyframes({ className: 'rotate' })({ }, }); -function TestComponent() { - return

Hello

; -} - const StyledTest = styled(TestComponent, { className: 'StyledTest', })({ diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css index 7b82483a..b7a759ad 100644 --- a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.css @@ -10,4 +10,4 @@ @layer pigment.base{.c13e7k7c{---id:3;color:#ff5252;animation:rotate 2s ease-out 0s infinite;}} @layer pigment.base{.sqzgjb7{---id:4;display:block;opacity:0.38;}.sqzgjb7 .sqpzee{display:none;}} @layer pigment.base{.sxcjuwu{---id:5;display:block;opacity:0.38;}.sxcjuwu .sqpzee{display:none;}} -/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9wYWNrYWdlcy9waWdtZW50LWNzcy1yZWFjdC1uZXcvdGVzdHMvc3R5bGVkL2ZpeHR1cmVzL3N0eWxlZC5pbnB1dC5qcyJdLCJuYW1lcyI6WyIuYzFkZ3NnbmgiLCIucm90YXRlIiwiLlN0eWxlZFRlc3QiLCIuU3R5bGVkVGVzdC1zaXplLXNtYWxsIiwiLlN0eWxlZFRlc3Qtc2l6ZS1tZWRpdW0iLCIuU3R5bGVkVGVzdC1zaXplLWxhcmdlIiwiLnM0ZWtkZGEiLCIuc3FwemVlIiwiLnMxbzQ4bTE3IiwiLmMxM2U3azdjIiwiLnNxemdqYjciLCIuc3hjanV3dSJdLCJtYXBwaW5ncyI6IkFBRWlCQTtBQUlnREM7QUFlOURDO0FBQUFDO0FBQUFDO0FBQUFDO0FBa0NBQztBQVN1QkM7QUFZTUM7QUFRSEM7QUFNVEM7QUFTQUMiLCJmaWxlIjoiL3BhY2thZ2VzL3BpZ21lbnQtY3NzLXJlYWN0LW5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mxvY2snLFxuICBvcGFjaXR5OiAwLjM4LFxuICBbU2xpZGVyUmFpbF06IHtcbiAgICBkaXNwbGF5OiAnbm9uZScsXG4gIH0sXG59KTtcblxuY29uc3QgQ29tcG9uZW50ID0gc3R5bGVkLmRpdih7XG4gICQkaWQ6IDMsXG4gIGNvbG9yOiAnI2ZmNTI1MicsXG4gIGFuaW1hdGlvbjogYCR7cm90YXRlS2V5ZnJhbWV9IDJzIGVhc2Utb3V0IDBzIGluZmluaXRlYCxcbn0pO1xuXG5jb25zdCBTbGlkZXJSYWlsMiA9IHN0eWxlZCgnc3BhbicpYFxuICAtLS1pZDogNDtcbiAgZGlzcGxheTogYmxvY2s7XG4gIG9wYWNpdHk6IDAuMzg7XG4gICR7U2xpZGVyUmFpbH0ge1xuICAgIGRpc3BsYXk6IG5vbmU7XG4gIH1cbmA7XG5cbmNvbnN0IFNsaWRlclJhaWw0ID0gc3R5bGVkLnNwYW5gXG4gIC0tLWlkOiA1O1xuICBkaXNwbGF5OiBibG9jaztcbiAgb3BhY2l0eTogMC4zODtcbiAgJHtTbGlkZXJSYWlsfSB7XG4gICAgZGlzcGxheTogbm9uZTtcbiAgfVxuYDtcblxuZXhwb3J0IGZ1bmN0aW9uIEFwcCgpIHtcbiAgcmV0dXJuIChcbiAgICA8Q29tcG9uZW50PlxuICAgICAgPFNsaWRlclJhaWwgLz5cbiAgICAgIDxTbGlkZXJSYWlsMiAvPlxuICAgIDwvQ29tcG9uZW50PlxuICApO1xufVxuIl19*/ \ No newline at end of file diff --git a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js index ae6085e3..4e921e30 100644 --- a/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js +++ b/packages/pigment-css-react-new/tests/styled/fixtures/styled.output.js @@ -8,10 +8,8 @@ import { styled as _styled6, styled as _styled7, } from '@pigment-css/react-new/runtime'; +import { TestComponent } from './dummy-component.fixture'; export const rotateKeyframe = 'rotate'; -function TestComponent() { - return

Hello

; -} const _exp4 = /*#__PURE__*/ () => TestComponent; const StyledTest = /*#__PURE__*/ _styled(_exp4())({ classes: 'StyledTest', diff --git a/packages/pigment-css-react-new/tests/styled/styled.spec.tsx b/packages/pigment-css-react-new/tests/styled/styled.spec.tsx index 8e2858f3..86f4acb8 100644 --- a/packages/pigment-css-react-new/tests/styled/styled.spec.tsx +++ b/packages/pigment-css-react-new/tests/styled/styled.spec.tsx @@ -1,20 +1,52 @@ -// import { styled } from '../../src/styled'; - -// const Button = styled('button')({ -// color: 'red', -// variants: { -// hue: { -// primary: { -// color: 'red', -// backgroundColor: 'blue', -// }, -// }, -// }, -// }); - -// // @ts-expect-error `download` does not exist on button -// ; - -// ; +import { t } from '@pigment-css/theme'; +import { styled } from '../../src/styled'; + +declare module '@pigment-css/theme' { + interface Theme { + palette: { + main: string; + }; + } +} + +const Button = styled('button')({ + color: 'red', + variants: { + btnSize: { + small: { + padding: 0, + }, + medium: { + padding: '1rem', + }, + large: { + padding: '2rem', + }, + }, + }, +}); + +const Div1 = styled.div<{ $size?: 'small' | 'medium' | 'large' }>` + color: red; + padding: ${({ $size }) => ($size === 'small' ? 2 : 4)}; +`; + + undefined}> +