From 7b0d1620079894a69f7731e9ed8bef4f44ba1280 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Wed, 27 Dec 2023 14:45:45 +0530 Subject: [PATCH 01/11] [zero]: Move zero runtime related packages from the separate repo --- apps/.gitignore | 1 - .../index.d.ts | 1 + apps/{local-library => local-ui-lib}/index.js | 3 +- .../package.json | 4 +- apps/local-ui-lib/tsconfig.json | 8 + apps/zero-runtime-next-app/.eslintrc | 6 + apps/zero-runtime-next-app/.eslintrc.json | 5 - apps/zero-runtime-next-app/README.md | 41 +- apps/zero-runtime-next-app/next.config.js | 42 +- apps/zero-runtime-next-app/package.json | 32 +- .../src/app/box/page.tsx | 54 + .../zero-runtime-next-app/src/app/globals.css | 8 - apps/zero-runtime-next-app/src/app/layout.tsx | 20 +- .../src/app/page.module.css | 125 + apps/zero-runtime-next-app/src/app/page.tsx | 161 +- .../src/app/slider/page.tsx | 17 - apps/zero-runtime-next-app/src/augment.d.ts | 10 + .../src/components/Box.jsx | 66 + .../src/components/Grid.tsx | 27 - .../src/components/SliderWrapper.tsx | 134 - .../src/components/utils/colorManipulator.js | 351 --- .../src/extend-zero.d.ts | 19 - apps/zero-runtime-vite-app/.babelrc | 7 - apps/zero-runtime-vite-app/.eslintrc | 8 - apps/zero-runtime-vite-app/.gitignore | 1 - apps/zero-runtime-vite-app/README.md | 33 - apps/zero-runtime-vite-app/index.html | 2 - apps/zero-runtime-vite-app/jest.config.js | 28 - apps/zero-runtime-vite-app/package.json | 35 - apps/zero-runtime-vite-app/src/App.tsx | 126 - .../src/Slider/ZeroSlider.test.jsx | 23 - .../src/Slider/ZeroSlider.tsx | 945 ------- apps/zero-runtime-vite-app/src/component.tsx | 9 - .../src/extend-zero.d.ts | 19 - apps/zero-runtime-vite-app/src/main.tsx | 8 - .../src/utils/colorManipulator.js | 351 --- apps/zero-runtime-vite-app/tsconfig.json | 19 - apps/zero-runtime-vite-app/vite-env.d.ts | 2 - apps/zero-runtime-vite-app/vite.config.ts | 51 - package.json | 5 +- packages/zero-jest/README.md | 3 - packages/zero-jest/package.json | 56 - packages/zero-jest/src/index.js | 96 - packages/zero-next-plugin/.eslintrc.json | 5 - packages/zero-next-plugin/LICENSE | 21 - packages/zero-next-plugin/README.md | 3 - packages/zero-next-plugin/loader.js | 5 + packages/zero-next-plugin/next-font.js | 5 + packages/zero-next-plugin/next-image.js | 2 + packages/zero-next-plugin/package.json | 69 +- .../src/VirtualModuleStore.ts | 78 - packages/zero-next-plugin/src/index.ts | 206 +- .../src/loaders/outputCssLoader.ts | 32 - .../src/loaders/transformLoader.ts | 153 -- .../src/plugins/errorPlugin.ts | 32 - .../plugins/webpack-virtual-modules/index.ts | 225 -- .../webpack-virtual-modules/virtual-stats.js | 63 - .../webpack-virtual-modules/vmUtils.js | 95 - packages/zero-next-plugin/src/utils.ts | 54 - .../src/virtual-css-loader.js | 6 + packages/zero-next-plugin/tsconfig.build.json | 22 +- packages/zero-next-plugin/tsconfig.json | 17 +- packages/zero-next-plugin/tsup.config.ts | 13 + packages/zero-next-plugin/zero-virtual.css | 1 + packages/zero-runtime/.eslintrc.json | 5 - packages/zero-runtime/.gitignore | 2 + packages/zero-runtime/README.md | 3 - .../zero-runtime/exports/generateAtomics.js | 5 + packages/zero-runtime/exports/keyframes.js | 5 + packages/zero-runtime/exports/styled.js | 5 + packages/zero-runtime/exports/sx-plugin.js | 5 + packages/zero-runtime/exports/sx.js | 5 + packages/zero-runtime/package.json | 126 +- packages/zero-runtime/src/base.d.ts | 12 +- .../zero-runtime/src/generateAtomics.d.ts | 30 + packages/zero-runtime/src/generateAtomics.js | 64 + packages/zero-runtime/src/index.ts | 3 +- .../src/processors}/base-processor.ts | 1 - .../src/processors/generateAtomics.ts | 105 + .../src/processors}/keyframes.ts | 12 +- .../src/processors}/styled.ts | 86 +- .../src => zero-runtime/src/processors}/sx.ts | 9 +- packages/zero-runtime/src/styled.d.ts | 11 +- packages/zero-runtime/src/styled.js | 158 -- packages/zero-runtime/src/styled.jsx | 169 ++ packages/zero-runtime/src/styled.spec.tsx | 269 -- packages/zero-runtime/src/styled.test.js | 31 - .../zero-runtime/src/{theme.d.ts => theme.ts} | 0 .../src/utils/checkStaticObjectOrArray.ts | 0 .../src/utils/convertAtomicsToCss.ts | 92 + .../src/utils/cssFnValueToVariable.ts | 85 +- .../src/utils/cssFunctionTransformerPlugin.ts | 29 +- .../src/utils/emotion.ts | 0 .../zero-runtime/src/utils/generateCss.ts | 158 ++ .../src/utils/index.ts | 2 + .../src/utils/isUnitLess.ts | 2 +- .../src/utils}/pre-linaria-plugin.ts | 10 +- .../src/utils}/preprocessor.ts | 2 +- .../src/utils/processCssObject.ts | 0 .../src/utils/sxObjectExtractor.ts | 2 +- .../zero-runtime/src/utils/valueToLiteral.ts | 124 + packages/zero-runtime/styles.css | 2 +- packages/zero-runtime/theme/index.d.ts | 1 + packages/zero-runtime/theme/index.js | 1 + packages/zero-runtime/theme/index.mjs | 1 + packages/zero-runtime/tsconfig.build.json | 14 +- packages/zero-runtime/tsconfig.json | 12 +- packages/zero-runtime/tsup.config.ts | 32 + packages/zero-tag-processor/.eslintrc.json | 6 - packages/zero-tag-processor/README.md | 15 - packages/zero-tag-processor/package.json | 73 - .../zero-tag-processor/src/generateCss.ts | 78 - .../src/utils/valueToLiteral.ts | 75 - .../zero-tag-processor/tsconfig.build.json | 20 - packages/zero-tag-processor/tsconfig.json | 9 - packages/zero-unplugin/package.json | 35 + packages/zero-unplugin/src/index.ts | 311 +++ packages/zero-unplugin/tsconfig.build.json | 6 + packages/zero-unplugin/tsconfig.json | 12 + packages/zero-unplugin/tsup.config.ts | 13 + packages/zero-vite-plugin/.eslintrc.json | 5 - packages/zero-vite-plugin/README.md | 3 - packages/zero-vite-plugin/package.json | 72 +- packages/zero-vite-plugin/src/index.ts | 125 +- .../zero-vite-plugin/src/zero-vite-plugin.ts | 148 +- packages/zero-vite-plugin/tsconfig.build.json | 20 +- packages/zero-vite-plugin/tsconfig.json | 7 +- packages/zero-vite-plugin/tsup.config.ts | 17 + pnpm-lock.yaml | 2352 +++++------------ tsup.config.ts | 14 + 130 files changed, 2791 insertions(+), 6384 deletions(-) delete mode 100644 apps/.gitignore rename apps/{local-library => local-ui-lib}/index.d.ts (88%) rename apps/{local-library => local-ui-lib}/index.js (90%) rename apps/{local-library => local-ui-lib}/package.json (54%) create mode 100644 apps/local-ui-lib/tsconfig.json create mode 100644 apps/zero-runtime-next-app/.eslintrc delete mode 100644 apps/zero-runtime-next-app/.eslintrc.json create mode 100644 apps/zero-runtime-next-app/src/app/box/page.tsx delete mode 100644 apps/zero-runtime-next-app/src/app/slider/page.tsx create mode 100644 apps/zero-runtime-next-app/src/augment.d.ts create mode 100644 apps/zero-runtime-next-app/src/components/Box.jsx delete mode 100644 apps/zero-runtime-next-app/src/components/Grid.tsx delete mode 100644 apps/zero-runtime-next-app/src/components/SliderWrapper.tsx delete mode 100644 apps/zero-runtime-next-app/src/components/utils/colorManipulator.js delete mode 100644 apps/zero-runtime-next-app/src/extend-zero.d.ts delete mode 100644 apps/zero-runtime-vite-app/.babelrc delete mode 100644 apps/zero-runtime-vite-app/.eslintrc delete mode 100644 apps/zero-runtime-vite-app/.gitignore delete mode 100644 apps/zero-runtime-vite-app/README.md delete mode 100644 apps/zero-runtime-vite-app/index.html delete mode 100644 apps/zero-runtime-vite-app/jest.config.js delete mode 100644 apps/zero-runtime-vite-app/package.json delete mode 100644 apps/zero-runtime-vite-app/src/App.tsx delete mode 100644 apps/zero-runtime-vite-app/src/Slider/ZeroSlider.test.jsx delete mode 100644 apps/zero-runtime-vite-app/src/Slider/ZeroSlider.tsx delete mode 100644 apps/zero-runtime-vite-app/src/component.tsx delete mode 100644 apps/zero-runtime-vite-app/src/extend-zero.d.ts delete mode 100644 apps/zero-runtime-vite-app/src/main.tsx delete mode 100644 apps/zero-runtime-vite-app/src/utils/colorManipulator.js delete mode 100644 apps/zero-runtime-vite-app/tsconfig.json delete mode 100644 apps/zero-runtime-vite-app/vite-env.d.ts delete mode 100644 apps/zero-runtime-vite-app/vite.config.ts delete mode 100644 packages/zero-jest/README.md delete mode 100644 packages/zero-jest/package.json delete mode 100644 packages/zero-jest/src/index.js delete mode 100644 packages/zero-next-plugin/.eslintrc.json delete mode 100644 packages/zero-next-plugin/LICENSE delete mode 100644 packages/zero-next-plugin/README.md create mode 100644 packages/zero-next-plugin/loader.js create mode 100644 packages/zero-next-plugin/next-font.js create mode 100644 packages/zero-next-plugin/next-image.js delete mode 100644 packages/zero-next-plugin/src/VirtualModuleStore.ts delete mode 100644 packages/zero-next-plugin/src/loaders/outputCssLoader.ts delete mode 100644 packages/zero-next-plugin/src/loaders/transformLoader.ts delete mode 100644 packages/zero-next-plugin/src/plugins/errorPlugin.ts delete mode 100644 packages/zero-next-plugin/src/plugins/webpack-virtual-modules/index.ts delete mode 100644 packages/zero-next-plugin/src/plugins/webpack-virtual-modules/virtual-stats.js delete mode 100644 packages/zero-next-plugin/src/plugins/webpack-virtual-modules/vmUtils.js delete mode 100644 packages/zero-next-plugin/src/utils.ts create mode 100644 packages/zero-next-plugin/src/virtual-css-loader.js create mode 100644 packages/zero-next-plugin/tsup.config.ts create mode 100644 packages/zero-next-plugin/zero-virtual.css delete mode 100644 packages/zero-runtime/.eslintrc.json create mode 100644 packages/zero-runtime/.gitignore delete mode 100644 packages/zero-runtime/README.md create mode 100644 packages/zero-runtime/exports/generateAtomics.js create mode 100644 packages/zero-runtime/exports/keyframes.js create mode 100644 packages/zero-runtime/exports/styled.js create mode 100644 packages/zero-runtime/exports/sx-plugin.js create mode 100644 packages/zero-runtime/exports/sx.js create mode 100644 packages/zero-runtime/src/generateAtomics.d.ts create mode 100644 packages/zero-runtime/src/generateAtomics.js rename packages/{zero-tag-processor/src => zero-runtime/src/processors}/base-processor.ts (96%) create mode 100644 packages/zero-runtime/src/processors/generateAtomics.ts rename packages/{zero-tag-processor/src => zero-runtime/src/processors}/keyframes.ts (92%) rename packages/{zero-tag-processor/src => zero-runtime/src/processors}/styled.ts (83%) rename packages/{zero-tag-processor/src => zero-runtime/src/processors}/sx.ts (95%) delete mode 100644 packages/zero-runtime/src/styled.js create mode 100644 packages/zero-runtime/src/styled.jsx delete mode 100644 packages/zero-runtime/src/styled.spec.tsx delete mode 100644 packages/zero-runtime/src/styled.test.js rename packages/zero-runtime/src/{theme.d.ts => theme.ts} (100%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/checkStaticObjectOrArray.ts (100%) create mode 100644 packages/zero-runtime/src/utils/convertAtomicsToCss.ts rename packages/{zero-tag-processor => zero-runtime}/src/utils/cssFnValueToVariable.ts (54%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/cssFunctionTransformerPlugin.ts (79%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/emotion.ts (100%) create mode 100644 packages/zero-runtime/src/utils/generateCss.ts rename packages/{zero-tag-processor => zero-runtime}/src/utils/index.ts (51%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/isUnitLess.ts (94%) rename packages/{zero-tag-processor/src => zero-runtime/src/utils}/pre-linaria-plugin.ts (89%) rename packages/{zero-tag-processor/src => zero-runtime/src/utils}/preprocessor.ts (91%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/processCssObject.ts (100%) rename packages/{zero-tag-processor => zero-runtime}/src/utils/sxObjectExtractor.ts (98%) create mode 100644 packages/zero-runtime/src/utils/valueToLiteral.ts create mode 100644 packages/zero-runtime/theme/index.d.ts create mode 100644 packages/zero-runtime/theme/index.js create mode 100644 packages/zero-runtime/theme/index.mjs create mode 100644 packages/zero-runtime/tsup.config.ts delete mode 100644 packages/zero-tag-processor/.eslintrc.json delete mode 100644 packages/zero-tag-processor/README.md delete mode 100644 packages/zero-tag-processor/package.json delete mode 100644 packages/zero-tag-processor/src/generateCss.ts delete mode 100644 packages/zero-tag-processor/src/utils/valueToLiteral.ts delete mode 100644 packages/zero-tag-processor/tsconfig.build.json delete mode 100644 packages/zero-tag-processor/tsconfig.json create mode 100644 packages/zero-unplugin/package.json create mode 100644 packages/zero-unplugin/src/index.ts create mode 100644 packages/zero-unplugin/tsconfig.build.json create mode 100644 packages/zero-unplugin/tsconfig.json create mode 100644 packages/zero-unplugin/tsup.config.ts delete mode 100644 packages/zero-vite-plugin/.eslintrc.json delete mode 100644 packages/zero-vite-plugin/README.md create mode 100644 packages/zero-vite-plugin/tsup.config.ts create mode 100644 tsup.config.ts diff --git a/apps/.gitignore b/apps/.gitignore deleted file mode 100644 index 8ee01d321b721a..00000000000000 --- a/apps/.gitignore +++ /dev/null @@ -1 +0,0 @@ -yarn.lock diff --git a/apps/local-library/index.d.ts b/apps/local-ui-lib/index.d.ts similarity index 88% rename from apps/local-library/index.d.ts rename to apps/local-ui-lib/index.d.ts index a16407b10c6bb2..a24be41b8decc5 100644 --- a/apps/local-library/index.d.ts +++ b/apps/local-ui-lib/index.d.ts @@ -2,5 +2,6 @@ export const bounceAnim: string; export const Button: React.ComponentType< JSX.IntrinsicElements['button'] & { isRed?: boolean; + sx?: unknown; } >; diff --git a/apps/local-library/index.js b/apps/local-ui-lib/index.js similarity index 90% rename from apps/local-library/index.js rename to apps/local-ui-lib/index.js index 7b77321a9ecdd7..b0e3fbde00685d 100644 --- a/apps/local-library/index.js +++ b/apps/local-ui-lib/index.js @@ -19,9 +19,8 @@ export const Button = styled('button', { name: 'MuiButton', slot: 'Root', })( - ({ theme }) => ({ + () => ({ fontFamily: 'sans-serif', - backgroundColor: theme.palette.primary.main, }), { fontFamily: 'sans-serif', diff --git a/apps/local-library/package.json b/apps/local-ui-lib/package.json similarity index 54% rename from apps/local-library/package.json rename to apps/local-ui-lib/package.json index fcbeb6446c41f3..7f21f39f2e3db8 100644 --- a/apps/local-library/package.json +++ b/apps/local-ui-lib/package.json @@ -1,8 +1,8 @@ { "name": "local-ui-lib", + "version": "0.0.1", "private": true, - "version": "0.0.0", "dependencies": { - "@mui/zero-runtime": "workspace:*" + "@mui/zero-runtime": "workspace:^" } } diff --git a/apps/local-ui-lib/tsconfig.json b/apps/local-ui-lib/tsconfig.json new file mode 100644 index 00000000000000..0373760617c181 --- /dev/null +++ b/apps/local-ui-lib/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "references": [ + { + "path": "../../packages/zero-runtime" + } + ] +} diff --git a/apps/zero-runtime-next-app/.eslintrc b/apps/zero-runtime-next-app/.eslintrc new file mode 100644 index 00000000000000..facef445d20386 --- /dev/null +++ b/apps/zero-runtime-next-app/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": ["next"], + "rules": { + "@next/next/no-html-link-for-pages": "off" + } +} diff --git a/apps/zero-runtime-next-app/.eslintrc.json b/apps/zero-runtime-next-app/.eslintrc.json deleted file mode 100644 index 68004cb09cc653..00000000000000 --- a/apps/zero-runtime-next-app/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "react/react-in-jsx-scope": "off" - } -} diff --git a/apps/zero-runtime-next-app/README.md b/apps/zero-runtime-next-app/README.md index 4e9e05140aa95d..39fc5a02d2dafb 100644 --- a/apps/zero-runtime-next-app/README.md +++ b/apps/zero-runtime-next-app/README.md @@ -1,26 +1,37 @@ -# Next App +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). -A sample vite application to test the working of zero runtime library. -This project is not part of the workspace yet. +## Getting Started -## How to run +First, build all the packages in the workspace atleast once. Run -You can either `yarn build` command to build all the packages, or you need to build, the the minimum - +```bash +pnpm build +``` + +Then start the Next.js development server: + +```bash +pnpm run --filter=@app/next-app dev +``` -1. `@mui/zero-runtime` -2. `@mui/zero-tag-processor` -3. `@mui/zero-next-plugin` +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. -Make sure you have also run `yarn build` at least once because we also use `@mui/material` and `@mui/system` packages. On subsequent runs, you can only build the above packages using - +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. + +### Note + +If you are testing changes in zero-runtime packages itself while also running this demo app, start the watch command in a separate terminal to watch and build zero-runtime package files as they change - ```bash -yarn build +pnpm watch:zero ``` -After building, you can run the project by changing into the directory and then +You might have to restart the next.js server. + +## Build -1. Install dependencies using `yarn install` -2. Start the dev server using `yarn dev` -3. Build the code using `yarn build` +To build the project, run the `build` command in this package: -Optionally, before running the dev server, you can run `yarn vite optimize --force` if it logged some error during `yarn vite`. +```bash +pnpm run --filter=@app/next-app build +``` diff --git a/apps/zero-runtime-next-app/next.config.js b/apps/zero-runtime-next-app/next.config.js index 968f7998237f54..40b2a8c1201522 100644 --- a/apps/zero-runtime-next-app/next.config.js +++ b/apps/zero-runtime-next-app/next.config.js @@ -1,25 +1,33 @@ -const { createTheme } = require('@mui/material/styles'); -const withZero = require('@mui/zero-next-plugin').default; +/* eslint-disable */ +/* eslint-env node */ +const { withZeroPlugin } = require('@mui/zero-next-plugin'); +const { experimental_extendTheme: extendTheme } = require('@mui/material/styles'); -const theme = createTheme({ - typography: { - fontFamilyCode: 'Menlo,Consolas,"Droid Sans Mono",monospace', - }, -}); -// @TODO - Make this part of the main package -theme.applyDarkStyles = function applyDarkStyles(obj) { - return { - ':where([data-mui-color-scheme="dark"]) &': obj, - }; -}; +const theme = extendTheme(); + +/** + * @typedef {import('@mui/zero-next-plugin').ZeroPluginConfig} ZeroPluginConfig + */ -/** @type {import('@mui/zero-webpack-plugin').ZeroPluginOptions} */ -const zeroPluginConfig = { +/** + * @type {ZeroPluginConfig} + */ +const zeroPluginOptions = { theme, cssVariablesPrefix: 'app', + transformLibraries: ['local-ui-lib'], + sourceMap: true, + displayName: true, }; /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + eslint: { + ignoreDuringBuilds: true, + }, + typescript: { + ignoreBuildErrors: true, + }, +}; -module.exports = withZero(nextConfig, zeroPluginConfig); +module.exports = withZeroPlugin(nextConfig, zeroPluginOptions); diff --git a/apps/zero-runtime-next-app/package.json b/apps/zero-runtime-next-app/package.json index 637cb89cbced95..d92369cb161cb1 100644 --- a/apps/zero-runtime-next-app/package.json +++ b/apps/zero-runtime-next-app/package.json @@ -1,28 +1,26 @@ { - "name": "@app/zero-runtime-next-app", + "name": "@app/next-app", "version": "0.1.0", "private": true, "scripts": { - "dev": "next", + "dev": "next dev", "build": "next build", - "start": "next start", - "lint": "next lint" + "preview": "next start", + "clean": "rimraf .next" }, "dependencies": { - "@mui/base": "workspace:*", - "@mui/material": "workspace:*", - "@mui/utils": "workspace:*", - "@mui/zero-runtime": "workspace:*", - "next": "13.5.6", - "react": "18.2.0", - "react-dom": "18.2.0" + "@mui/zero-runtime": "workspace:^", + "react": "^18", + "react-dom": "^18", + "next": "14.0.1" }, "devDependencies": { - "@mui/zero-tag-processor": "workspace:*", - "@mui/zero-next-plugin": "workspace:*", - "@types/node": "20.5.7", - "@types/react": "18.2.46", - "@types/react-dom": "18.2.18", - "typescript": "5.3.3" + "@mui/material": "^5.15.2", + "@mui/zero-next-plugin": "workspace:^", + "@types/node": "^20.5.7", + "@types/react": "^18.2.45", + "@types/react-dom": "^18.2.18", + "eslint": "^8.52.0", + "typescript": "^5.3.3" } } diff --git a/apps/zero-runtime-next-app/src/app/box/page.tsx b/apps/zero-runtime-next-app/src/app/box/page.tsx new file mode 100644 index 00000000000000..631b81bd3471db --- /dev/null +++ b/apps/zero-runtime-next-app/src/app/box/page.tsx @@ -0,0 +1,54 @@ +import { styled } from '@mui/zero-runtime'; +import { Box as MuiBox } from '../../components/Box'; +import { Fragment } from 'react'; + +const Box = styled(MuiBox)(({ theme }) => ({ + border: `1px dashed ${(theme.vars ?? theme).palette.primary.main}`, + padding: 10, +})); +const Paragraph = styled.p({ + margin: 0, + marginBottom: 5, +}); + +export default function DemoBox() { + return ( +
+ {[...Array(500)].map((_, i) => ( + + Flex with column for "sm" breakpoint + + 1 + 2 + 3 + + Row Reverse + + 1 + 2 + 3 + + Column + + 1 + 2 + 3 + + Column Reverse + + 1 + 2 + 3 + + + ))} +
+ ); +} diff --git a/apps/zero-runtime-next-app/src/app/globals.css b/apps/zero-runtime-next-app/src/app/globals.css index 60ab0f7768c88c..1a51ef7fd13c01 100644 --- a/apps/zero-runtime-next-app/src/app/globals.css +++ b/apps/zero-runtime-next-app/src/app/globals.css @@ -1,5 +1,3 @@ -@import '~@mui/zero-runtime/styles.css'; - :root { --max-width: 1100px; --border-radius: 12px; @@ -84,12 +82,6 @@ body { overflow-x: hidden; } -body { - color: rgb(var(--foreground-rgb)); - background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) - rgb(var(--background-start-rgb)); -} - a { color: inherit; text-decoration: none; diff --git a/apps/zero-runtime-next-app/src/app/layout.tsx b/apps/zero-runtime-next-app/src/app/layout.tsx index ab0434f3465b12..bb634f29fa01e5 100644 --- a/apps/zero-runtime-next-app/src/app/layout.tsx +++ b/apps/zero-runtime-next-app/src/app/layout.tsx @@ -1,6 +1,9 @@ -import './globals.css'; import type { Metadata } from 'next'; +import { styled } from '@mui/zero-runtime'; import { Inter } from 'next/font/google'; +import '@mui/zero-runtime/styles.css'; + +import './globals.css'; const inter = Inter({ subsets: ['latin'] }); @@ -9,10 +12,19 @@ export const metadata: Metadata = { description: 'Generated by create next app', }; +const Html = styled.html({ + color: 'red', +}); + +const Body = styled.body({ + color: 'rgb(var(--foreground-rgb))', + background: `linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb))`, +}); + export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - - {children} - + + {children} + ); } diff --git a/apps/zero-runtime-next-app/src/app/page.module.css b/apps/zero-runtime-next-app/src/app/page.module.css index f77d83e753ddd5..207eebe4120bdd 100644 --- a/apps/zero-runtime-next-app/src/app/page.module.css +++ b/apps/zero-runtime-next-app/src/app/page.module.css @@ -1,6 +1,131 @@ +.code { + font-weight: 700; + font-family: var(--font-mono); +} + +.grid { + display: grid; + grid-template-columns: repeat(4, minmax(25%, auto)); + max-width: 100%; + width: var(--max-width); +} + +.card { + padding: 1rem 1.2rem; + border-radius: var(--border-radius); + background: rgba(var(--card-rgb), 0); + border: 1px solid rgba(var(--card-border-rgb), 0); + transition: background 200ms, border 200ms; +} + +.card span { + display: inline-block; + transition: transform 200ms; +} + +.card h2 { + font-weight: 600; + margin-bottom: 0.7rem; +} + +.card p { + margin: 0; + opacity: 0.6; + font-size: 0.9rem; + line-height: 1.5; + max-width: 30ch; +} + +.center { + display: flex; + justify-content: center; + align-items: center; + position: relative; + padding: 4rem 0; +} + +.center::before { + background: var(--secondary-glow); + border-radius: 50%; + width: 480px; + height: 360px; + margin-left: -400px; +} + +.center::after { + background: var(--primary-glow); + width: 240px; + height: 180px; + z-index: -1; +} + +.center::before, +.center::after { + content: ''; + left: 50%; + position: absolute; + filter: blur(45px); + transform: translateZ(0); +} + .logo { position: relative; } +/* Enable hover only on non-touch devices */ +@media (hover: hover) and (pointer: fine) { + .card:hover { + background: rgba(var(--card-rgb), 0.1); + border: 1px solid rgba(var(--card-border-rgb), 0.15); + } + + .card:hover span { + transform: translateX(4px); + } +} + +@media (prefers-reduced-motion) { + .card:hover span { + transform: none; + } +} + +/* Mobile */ +@media (max-width: 700px) { + .content { + padding: 4rem; + } + + .grid { + grid-template-columns: 1fr; + margin-bottom: 120px; + max-width: 320px; + text-align: center; + } + + .card { + padding: 1rem 2.5rem; + } + + .card h2 { + margin-bottom: 0.5rem; + } + + .center { + padding: 8rem 0 6rem; + } + + .center::before { + transform: none; + height: 300px; + } +} + +/* Tablet and Smaller Desktop */ +@media (min-width: 701px) and (max-width: 1120px) { + .grid { + grid-template-columns: repeat(2, 50%); + } +} @media (prefers-color-scheme: dark) { .vercelLogo { diff --git a/apps/zero-runtime-next-app/src/app/page.tsx b/apps/zero-runtime-next-app/src/app/page.tsx index def91c8f2b4af6..325e49b09124ac 100644 --- a/apps/zero-runtime-next-app/src/app/page.tsx +++ b/apps/zero-runtime-next-app/src/app/page.tsx @@ -1,10 +1,8 @@ import Image from 'next/image'; -import { styled } from '@mui/zero-runtime'; -import Link from 'next/link'; import styles from './page.module.css'; -import Grid from '../components/Grid'; +import { styled } from '@mui/zero-runtime'; -export const Main = styled('main')({ +const Main = styled.main({ display: 'flex', flexDirection: 'column', justifyContent: 'space-between', @@ -13,7 +11,7 @@ export const Main = styled('main')({ minHeight: '100vh', }); -const Description = styled.div(({ theme }: any) => ({ +const Description = styled.div({ display: 'inherit', justifyContent: 'inherit', alignItems: 'inherit', @@ -21,7 +19,7 @@ const Description = styled.div(({ theme }: any) => ({ maxWidth: 'var(--max-width)', width: '100%', zIndex: 2, - fontFamily: theme.typography.fontFamilyCode, + fontFamily: 'var(--font-mono)', '& a': { display: 'flex', justifyContent: 'center', @@ -30,18 +28,23 @@ const Description = styled.div(({ theme }: any) => ({ }, '& p': { position: 'relative', - margin: '0', + margin: 0, padding: '1rem', backgroundColor: 'rgba(var(--callout-rgb), 0.5)', border: '1px solid rgba(var(--callout-border-rgb), 0.3)', borderRadius: 'var(--border-radius)', }, - - [theme.breakpoints.down(700.05)]: { + '@media (max-width: 700px)': { fontSize: '0.8rem', '& a': { padding: '1rem', }, + '& p, & div': { + display: 'flex', + justifyContent: 'center', + position: 'fixed', + width: '100%', + }, '& p': { alignItems: 'center', inset: '0 0 auto', @@ -49,8 +52,11 @@ const Description = styled.div(({ theme }: any) => ({ borderRadius: '0', border: 'none', borderBottom: '1px solid rgba(var(--callout-border-rgb), 0.25)', - background: - 'linear-gradient(to bottom,rgba(var(--background-start-rgb), 1),rgba(var(--callout-rgb), 0.5))', + background: `linear-gradient( + to bottom, + rgba(var(--background-start-rgb), 1), + rgba(var(--callout-rgb), 0.5) +)`, backgroundClip: 'padding-box', backdropFilter: 'blur(24px)', }, @@ -60,103 +66,11 @@ const Description = styled.div(({ theme }: any) => ({ inset: 'auto 0 0', padding: '2rem', height: '200px', - background: 'linear-gradient(to bottom,transparent 0%,rgb(var(--background-end-rgb)) 40%)', + background: `linear-gradient(to bottom, transparent 0%, rgb(var(--background-end-rgb)) 40%)`, zIndex: 1, }, - '& p, & div': { - display: 'flex', - justifyContent: 'center', - position: 'fixed', - width: '100%', - }, - }, -})); - -const Code = styled('code')(({ theme }: any) => ({ - fontWeight: 700, - fontFamily: theme.typography.fontFamilyCode, -})); - -const Card = styled('a')(({ theme }: any) => ({ - padding: '1rem 1.2rem', - borderRadius: 'var(--border-radius)', - background: 'rgba(var(--card-rgb), 0)', - border: '1px solid rgba(var(--card-border-rgb), 0)', - transition: 'background 200ms, border 200ms', - - '& span': { - display: 'inline-block', - transition: 'transform 200ms', - }, - - '& h2': { - fontWeight: 600, - marginBottom: '0.7rem', - }, - - '& p': { - margin: '0', - opacity: 0.6, - fontSize: '0.9rem', - lineHeight: 1.5, - maxWidth: '30ch', - }, - '@media (hover: hover) and (pointer: fine)': { - '&:hover': { - background: 'rgba(var(--card-rgb), 0.1)', - border: '1px solid rgba(var(--card-border-rgb), 0.15)', - }, - '&:hover span': { - transform: 'translateX(4px)', - }, - }, - - '@media (prefers-reduced-motion)': { - '&:hover span': { - transform: 'none', - }, - }, - - [theme.breakpoints.down(700.05)]: { - padding: '1rem 2.5rem', - - '& h2': { - marginBottom: '0.5rem', - }, }, -})); - -const Center = styled('div')(() => ({ - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - position: 'relative', - padding: '4rem 0', - '&::before': { - background: 'var(--secondary-glow)', - borderRadius: '50%', - width: '480px', - height: '360px', - marginLeft: '-400px', - }, - '&::after': { - background: 'var(--primary-glow)', - width: '240px', - height: '180px', - zIndex: -1, - }, - '&::before,&::after': { - content: "''", - left: '50%', - position: 'absolute', - filter: 'blur(45px)', - transform: 'translateZ(0)', - }, - '@media (max-width: 700px)': { - padding: '8rem 0 6rem', - '&::before': { transform: 'none', height: '300px' }, - }, -})); +}); export default function Home() { return ( @@ -164,7 +78,7 @@ export default function Home() {

Get started by editing  - src/app/page.tsx + src/app/page.tsx

-
+
-
+
- - + @@ -206,10 +121,11 @@ export default function Home() { Docs ->

Find in-depth information about Next.js features and API.

- +
- @@ -217,10 +133,11 @@ export default function Home() { Learn ->

Learn about Next.js in an interactive course with quizzes!

-
+ - @@ -228,14 +145,20 @@ export default function Home() { Templates ->

Explore the Next.js 13 playground.

-
+ - +

- Checkout Slider -> + Deploy ->

-
- +

Instantly deploy your Next.js site to a shareable URL with Vercel.

+
+ ); } diff --git a/apps/zero-runtime-next-app/src/app/slider/page.tsx b/apps/zero-runtime-next-app/src/app/slider/page.tsx deleted file mode 100644 index 9b6f7b8903e14c..00000000000000 --- a/apps/zero-runtime-next-app/src/app/slider/page.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { styled } from '@mui/zero-runtime'; -import { Main as BaseMain } from '../page'; -import SliderWrapper from '../../components/SliderWrapper'; - -const Main = styled(BaseMain)({ - padding: '1rem', -}); - -export default function Slider() { - return ( -
-
- -
-
- ); -} diff --git a/apps/zero-runtime-next-app/src/augment.d.ts b/apps/zero-runtime-next-app/src/augment.d.ts new file mode 100644 index 00000000000000..d68ef6f18f37e6 --- /dev/null +++ b/apps/zero-runtime-next-app/src/augment.d.ts @@ -0,0 +1,10 @@ +import type { experimental_extendTheme } from '@mui/material/styles'; +import '@mui/zero-runtime/theme'; + +declare module '@mui/zero-runtime/theme' { + export interface ThemeArgs { + theme: ReturnType & { + applyDarkStyles(obj: T): Record; + }; + } +} diff --git a/apps/zero-runtime-next-app/src/components/Box.jsx b/apps/zero-runtime-next-app/src/components/Box.jsx new file mode 100644 index 00000000000000..f5dcc83a94a67c --- /dev/null +++ b/apps/zero-runtime-next-app/src/components/Box.jsx @@ -0,0 +1,66 @@ +import { generateAtomics, styled } from '@mui/zero-runtime'; + +const atomics = generateAtomics(({ theme }) => ({ + conditions: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => { + acc[breakpoint] = `@media (min-width: ${theme.breakpoints.values[breakpoint]}${ + theme.breakpoints.unit ?? 'px' + })`; + return acc; + }, {}), + defaultCondition: 'xs', + properties: { + display: [ + 'block', + 'inline-flex', + 'contents', + 'none', + 'flex', + 'inline-flex', + 'grid', + 'inline-grid', + ], + flexDirection: ['row', 'row-reverse', 'column', 'column-reverse'], + justifyContent: [ + 'center', + 'end', + 'flex-end', + 'flex-start', + 'left', + 'right', + 'space-around', + 'space-between', + 'space-evenly', + 'start', + ], + alignItems: [ + 'baseline', + 'center', + 'end', + 'flex-end', + 'flex-start', + 'self-end', + 'self-start', + 'start', + 'stretch', + ], + position: ['relative', 'absolute', 'static', 'sticky', 'fixed'], + }, + shorthands: { + direction: ['flexDirection'], + }, +})); + +export function Box({ children, as = 'div', className = '', style = undefined, ...rest }) { + const Component = as; + const atomicsResult = atomics(rest); + const componentClass = `${atomicsResult.className} ${className ?? ''}`.trim(); + const finalStyles = { + ...(atomicsResult.style ?? {}), + ...style, + }; + return ( + + {children} + + ); +} diff --git a/apps/zero-runtime-next-app/src/components/Grid.tsx b/apps/zero-runtime-next-app/src/components/Grid.tsx deleted file mode 100644 index 6a3fd6b874d3f3..00000000000000 --- a/apps/zero-runtime-next-app/src/components/Grid.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { styled } from '@mui/zero-runtime'; - -const Grid = styled('div')(({ theme }) => ({ - display: 'grid', - gridTemplateColumns: 'repeat(4, minmax(25%, auto))', - maxWidth: '100%', - width: 'var(--max-width)', - [theme.breakpoints.down(700.05)]: { - gridTemplateColumns: '1fr', - marginBottom: '120px', - maxWidth: '320px', - textAlign: 'center', - }, - [theme.breakpoints.between(701, 1120.05)]: { - gridTemplateColumns: 'repeat(2, 50%)', - }, -})); - -export const HalfWidth = styled.div({ - marginLeft: 20, - width: '50%', - maxHeight: 100, - padding: 20, - border: '1px solid #ccc', -}); - -export default Grid; diff --git a/apps/zero-runtime-next-app/src/components/SliderWrapper.tsx b/apps/zero-runtime-next-app/src/components/SliderWrapper.tsx deleted file mode 100644 index 8329b543f69255..00000000000000 --- a/apps/zero-runtime-next-app/src/components/SliderWrapper.tsx +++ /dev/null @@ -1,134 +0,0 @@ -'use client'; -import * as React from 'react'; -import { styled } from '@mui/zero-runtime'; -import Slider from './Slider/ZeroSlider'; -import { HalfWidth } from './Grid'; - -const Button = styled('button', { - name: 'MuiButton', - slot: 'Root', -})<{ isRed?: boolean }>( - ({ theme }) => ({ - fontFamily: 'sans-serif', - backgroundColor: [theme.palette.primary.main, 'text.primary', 'background.paper'], - }), - { - fontFamily: 'sans-serif', - color: (props) => (props.isRed ? 'primary.main' : 'secondary.main'), - }, -); - -const ShowCaseDiv = styled('div')({ - [`.${Button}`]: { - color: '#f94564', - }, -}); - -export default function SliderWrapper({ isRed }: { isRed?: boolean }) { - const [count, setCount] = React.useState(0); - const [value, setValue] = React.useState(50); - const [isColorPrimary, setIsColorPrimary] = React.useState(true); - const [size, setSize] = React.useState('medium'); - const [showMarks, setShowMarks] = React.useState(true); - const [isTrackInverted, setIsTrackInverted] = React.useState(false); - const [disabled, setDisabled] = React.useState(false); - const [isHorizontal, setIsHorizontal] = React.useState(true); - - return ( - - - - - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- ({ - color: theme.palette.primary.main, - fontSize: isRed ? 'h1.fontSize' : 'h2.fontSize', - ':hover': { - backgroundColor: ['primary.dark', 'secondary.main'], - color: { - sm: 'primary.dark', - md: 'secondary.main', - }, - }, - })} - > - setValue(val as number)} - /> - -
-
- ); -} diff --git a/apps/zero-runtime-next-app/src/components/utils/colorManipulator.js b/apps/zero-runtime-next-app/src/components/utils/colorManipulator.js deleted file mode 100644 index aaea25ca505c0e..00000000000000 --- a/apps/zero-runtime-next-app/src/components/utils/colorManipulator.js +++ /dev/null @@ -1,351 +0,0 @@ -/** - * Returns a number whose value is limited to the given range. - * @param {number} value The value to be clamped - * @param {number} min The lower boundary of the output range - * @param {number} max The upper boundary of the output range - * @returns {number} A number in the range [min, max] - */ -function clamp(value, min = 0, max = 1) { - if (process.env.NODE_ENV !== 'production') { - if (value < min || value > max) { - console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`); - } - } - - return Math.min(Math.max(min, value), max); -} - -/** - * Converts a color from CSS hex format to CSS rgb format. - * @param {string} color - Hex color, i.e. #nnn or #nnnnnn - * @returns {string} A CSS rgb color string - */ -export function hexToRgb(color) { - color = color.slice(1); - - const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g'); - let colors = color.match(re); - - if (colors && colors[0].length === 1) { - colors = colors.map((n) => n + n); - } - - return colors - ? `rgb${colors.length === 4 ? 'a' : ''}(${colors - .map((n, index) => { - return index < 3 ? parseInt(n, 16) : Math.round((parseInt(n, 16) / 255) * 1000) / 1000; - }) - .join(', ')})` - : ''; -} - -function intToHex(int) { - const hex = int.toString(16); - return hex.length === 1 ? `0${hex}` : hex; -} - -/** - * Returns an object with the type and values of a color. - * - * Note: Does not support rgb % values. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {object} - A MUI color object: {type: string, values: number[]} - */ -export function decomposeColor(color) { - // Idempotent - if (color.type) { - return color; - } - - if (color.charAt(0) === '#') { - return decomposeColor(hexToRgb(color)); - } - - const marker = color.indexOf('('); - const type = color.substring(0, marker); - - if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) { - throw new Error( - 'MUI: Unsupported `%s` color.\n' + - 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().', - color, - ); - } - - let values = color.substring(marker + 1, color.length - 1); - let colorSpace; - - if (type === 'color') { - values = values.split(' '); - colorSpace = values.shift(); - if (values.length === 4 && values[3].charAt(0) === '/') { - values[3] = values[3].slice(1); - } - if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) { - throw new Error( - 'MUI: unsupported `%s` color space.\n' + - 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.', - colorSpace, - ); - } - } else { - values = values.split(','); - } - values = values.map((value) => parseFloat(value)); - - return { type, values, colorSpace }; -} - -/** - * Returns a channel created from the input color. - * - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {string} - The channel for the color, that can be used in rgba or hsla colors - */ -export const colorChannel = (color) => { - const decomposedColor = decomposeColor(color); - return decomposedColor.values - .slice(0, 3) - .map((val, idx) => (decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val)) - .join(' '); -}; -// eslint-disable-next-line @typescript-eslint/naming-convention -export const private_safeColorChannel = (color, warning) => { - try { - return colorChannel(color); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -}; - -/** - * Converts a color object with type and values to a string. - * @param {object} color - Decomposed color - * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color' - * @param {array} color.values - [n,n,n] or [n,n,n,n] - * @returns {string} A CSS color string - */ -export function recomposeColor(color) { - const { type, colorSpace } = color; - let { values } = color; - - if (type.indexOf('rgb') !== -1) { - // Only convert the first 3 values to int (i.e. not alpha) - values = values.map((n, i) => (i < 3 ? parseInt(n, 10) : n)); - } else if (type.indexOf('hsl') !== -1) { - values[1] = `${values[1]}%`; - values[2] = `${values[2]}%`; - } - if (type.indexOf('color') !== -1) { - values = `${colorSpace} ${values.join(' ')}`; - } else { - values = `${values.join(', ')}`; - } - - return `${type}(${values})`; -} - -/** - * Converts a color from CSS rgb format to CSS hex format. - * @param {string} color - RGB color, i.e. rgb(n, n, n) - * @returns {string} A CSS rgb color string, i.e. #nnnnnn - */ -export function rgbToHex(color) { - // Idempotent - if (color.indexOf('#') === 0) { - return color; - } - - const { values } = decomposeColor(color); - return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`; -} - -/** - * Converts a color from hsl format to rgb format. - * @param {string} color - HSL color values - * @returns {string} rgb color values - */ -export function hslToRgb(color) { - color = decomposeColor(color); - const { values } = color; - const h = values[0]; - const s = values[1] / 100; - const l = values[2] / 100; - const a = s * Math.min(l, 1 - l); - const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); - - let type = 'rgb'; - const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)]; - - if (color.type === 'hsla') { - type += 'a'; - rgb.push(values[3]); - } - - return recomposeColor({ type, values: rgb }); -} -/** - * The relative brightness of any point in a color space, - * normalized to 0 for darkest black and 1 for lightest white. - * - * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {number} The relative brightness of the color in the range 0 - 1 - */ -export function getLuminance(color) { - color = decomposeColor(color); - - let rgb = - color.type === 'hsl' || color.type === 'hsla' - ? decomposeColor(hslToRgb(color)).values - : color.values; - rgb = rgb.map((val) => { - if (color.type !== 'color') { - val /= 255; // normalized - } - return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4; - }); - - // Truncate at 3 digits - return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3)); -} - -/** - * Calculates the contrast ratio between two colors. - * - * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests - * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() - * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() - * @returns {number} A contrast ratio value in the range 0 - 21. - */ -export function getContrastRatio(foreground, background) { - const lumA = getLuminance(foreground); - const lumB = getLuminance(background); - return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05); -} - -/** - * Sets the absolute transparency of a color. - * Any existing alpha values are overwritten. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} value - value to set the alpha channel to in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function alpha(color, value) { - color = decomposeColor(color); - value = clamp(value); - - if (color.type === 'rgb' || color.type === 'hsl') { - color.type += 'a'; - } - if (color.type === 'color') { - color.values[3] = `/${value}`; - } else { - color.values[3] = value; - } - - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeAlpha(color, value, warning) { - try { - return alpha(color, value); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Darkens a color. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function darken(color, coefficient) { - color = decomposeColor(color); - coefficient = clamp(coefficient); - - if (color.type.indexOf('hsl') !== -1) { - color.values[2] *= 1 - coefficient; - } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] *= 1 - coefficient; - } - } - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeDarken(color, coefficient, warning) { - try { - return darken(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Lightens a color. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function lighten(color, coefficient) { - color = decomposeColor(color); - coefficient = clamp(coefficient); - - if (color.type.indexOf('hsl') !== -1) { - color.values[2] += (100 - color.values[2]) * coefficient; - } else if (color.type.indexOf('rgb') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] += (255 - color.values[i]) * coefficient; - } - } else if (color.type.indexOf('color') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] += (1 - color.values[i]) * coefficient; - } - } - - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeLighten(color, coefficient, warning) { - try { - return lighten(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Darken or lighten a color, depending on its luminance. - * Light colors are darkened, dark colors are lightened. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient=0.15 - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function emphasize(color, coefficient = 0.15) { - return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeEmphasize(color, coefficient, warning) { - try { - return private_safeEmphasize(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} diff --git a/apps/zero-runtime-next-app/src/extend-zero.d.ts b/apps/zero-runtime-next-app/src/extend-zero.d.ts deleted file mode 100644 index b3f8a8870c14e0..00000000000000 --- a/apps/zero-runtime-next-app/src/extend-zero.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Theme } from '@mui/material/styles'; - -declare module '@mui/zero-runtime/theme' { - interface ThemeArgs { - theme: Theme & { - applyDarkStyles(obj: T): Record; - vars?: Theme; - }; - } -} - -declare module '@mui/material' { - interface Palette { - Slider: Record; - } - interface PaletteColor { - mainChannel: string; - } -} diff --git a/apps/zero-runtime-vite-app/.babelrc b/apps/zero-runtime-vite-app/.babelrc deleted file mode 100644 index 79ba76aff2dd2e..00000000000000 --- a/apps/zero-runtime-vite-app/.babelrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "presets": [ - "@babel/preset-react", - ["@babel/preset-env", { "targets": { "node": "current" } }], - "@babel/preset-typescript" - ] -} diff --git a/apps/zero-runtime-vite-app/.eslintrc b/apps/zero-runtime-vite-app/.eslintrc deleted file mode 100644 index 3733818e0f8c84..00000000000000 --- a/apps/zero-runtime-vite-app/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "env": { - "jest": true - }, - "rules": { - "react/react-in-jsx-scope": "off" - } -} diff --git a/apps/zero-runtime-vite-app/.gitignore b/apps/zero-runtime-vite-app/.gitignore deleted file mode 100644 index 849ddff3b7ec91..00000000000000 --- a/apps/zero-runtime-vite-app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist/ diff --git a/apps/zero-runtime-vite-app/README.md b/apps/zero-runtime-vite-app/README.md deleted file mode 100644 index a2dc4bbf2d07c5..00000000000000 --- a/apps/zero-runtime-vite-app/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Vite App - -A sample vite application to test the working of zero runtime library. -This project is not part of the workspace yet. - -## How to run - -You can either run `pnpm release:build` command to build all the packages, or you need to build, the the minimum - - -1. `@mui/zero-runtime` -2. `@mui/zero-tag-processor` -3. `@mui/zero-vite-plugin` - -Make sure you have also run `pnpm release:build` at least once because we also use `@mui/material` and `@mui/system` packages. On subsequent runs, you can only build the above packages using - - -```bash -pnpm build -``` - -After building, you can run the project by changing into the directory and then - -1. Install dependencies using `pnpm install` -2. Start the dev server using `pnpm dev` -3. Build the code using `pnpm build` - -Optionally, before running the dev server, you can run `pnpm vite optimize --force` if it logged some error during `pnpm vite`. - -### Testing - -This demo app has been configured to run tests using both vitest or jest. - -1. Vitest - You can run `pnpm test` to run the tests using vitest -2. Jest - You can run `pnpm jest` to run the tests using jest diff --git a/apps/zero-runtime-vite-app/index.html b/apps/zero-runtime-vite-app/index.html deleted file mode 100644 index 29a2b783ed6ea0..00000000000000 --- a/apps/zero-runtime-vite-app/index.html +++ /dev/null @@ -1,2 +0,0 @@ -
- diff --git a/apps/zero-runtime-vite-app/jest.config.js b/apps/zero-runtime-vite-app/jest.config.js deleted file mode 100644 index b7e748b256c126..00000000000000 --- a/apps/zero-runtime-vite-app/jest.config.js +++ /dev/null @@ -1,28 +0,0 @@ -// Mandatory to map so that the imports translate to cjs files -const { createTheme } = require('@mui/material/styles'); - -const theme = createTheme(); -// @TODO - Make this part of the main package -// @ts-ignore -theme.applyDarkStyles = function applyDarkStyles(obj) { - return { - // @TODO - Use custom stylis plugin as in docs/src/createEmotionCache.ts - // so that we don't need to use * - '* :where([data-mui-color-scheme="dark"]) &': obj, - }; -}; - -/** - * @type {import('jest').Config} - */ -module.exports = { - transform: { - '\\.[jt]sx?': ['@mui/zero-jest', { theme }], - }, - // Mandatory to map so that the imports translate to cjs files - moduleNameMapper: { - '^@mui/material(.*)$': '@mui/material/node/$1', - }, - verbose: true, - testEnvironment: 'jsdom', -}; diff --git a/apps/zero-runtime-vite-app/package.json b/apps/zero-runtime-vite-app/package.json deleted file mode 100644 index 90798c506cae93..00000000000000 --- a/apps/zero-runtime-vite-app/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@app/zero-runtime-vite-app", - "version": "0.0.0", - "private": true, - "scripts": { - "dev": "vite", - "build": "vite build", - "test": "vitest" - }, - "dependencies": { - "@mui/zero-runtime": "workspace:*", - "@mui/zero-tag-processor": "workspace:*", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@babel/preset-env": "^7.23.7", - "@babel/preset-react": "^7.23.3", - "@babel/preset-typescript": "^7.23.3", - "@mui/material": "workspace:*", - "@mui/utils": "workspace:*", - "@mui/zero-jest": "workspace:*", - "@mui/zero-vite-plugin": "workspace:*", - "@testing-library/jest-dom": "^6.2.0", - "@testing-library/react": "^14.1.2", - "@vitejs/plugin-react": "^4.2.1", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jsdom": "^22.1.0", - "local-ui-lib": "workspace:*", - "vite": "4.5.1", - "vitest": "^0.34.6", - "typescript": "5.3.3" - } -} diff --git a/apps/zero-runtime-vite-app/src/App.tsx b/apps/zero-runtime-vite-app/src/App.tsx deleted file mode 100644 index 6a1ac6014fdc54..00000000000000 --- a/apps/zero-runtime-vite-app/src/App.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import * as React from 'react'; -import { styled } from '@mui/zero-runtime'; -import { Button, bounceAnim } from 'local-ui-lib'; -import Slider from './Slider/ZeroSlider'; - -const ShowCaseDiv = styled('div')({ - [`.${Button}`]: { - color: '#f94564', - }, -}); - -const HalfWidth = styled.div({ - marginLeft: 20, - width: '50%', - maxHeight: 100, - padding: 20, - border: '1px solid #ccc', - animation: `${bounceAnim} 1s ease infinite`, -}); - -export default function App({ isRed }: any) { - const [count, setCount] = React.useState(0); - const [value, setValue] = React.useState(50); - const [isColorPrimary, setIsColorPrimary] = React.useState(true); - const [size, setSize] = React.useState('medium'); - const [showMarks, setShowMarks] = React.useState(true); - const [isTrackInverted, setIsTrackInverted] = React.useState(false); - const [disabled, setDisabled] = React.useState(false); - const [isHorizontal, setIsHorizontal] = React.useState(true); - - return ( -
- - - - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- ({ - color: theme.palette.primary.main, - fontSize: isRed ? 'h1.fontSize' : 'h2.fontSize', - ':hover': { - backgroundColor: ['primary.dark', 'secondary.main'], - color: { - sm: 'primary.dark', - md: 'secondary.main', - }, - }, - })} - > - setValue(val as number)} - /> - -
-
- ); -} diff --git a/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.test.jsx b/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.test.jsx deleted file mode 100644 index ee5cfef2cd2b82..00000000000000 --- a/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.test.jsx +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable react/jsx-filename-extension */ -import * as React from 'react'; -import { render } from '@testing-library/react'; -import Slider from './ZeroSlider'; - -describe('Slider', () => { - it('should render', () => { - const { rerender, container } = render(); - - const root = container.getElementsByClassName('MuiSlider-root')[0]; - expect(root.classList.contains('MuiSlider-colorPrimary')).toBeTruthy(); - rerender(); - expect(root.classList.contains('MuiSlider-colorSecondary')).toBeTruthy(); - - let rootComputedStyles = window.getComputedStyle(root); - expect(rootComputedStyles.borderRadius).toEqual('12px'); - expect(rootComputedStyles.cursor).toEqual('pointer'); - - rerender(); - rootComputedStyles = window.getComputedStyle(root); - expect(rootComputedStyles.cursor).toEqual('default'); - }); -}); diff --git a/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.tsx b/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.tsx deleted file mode 100644 index ea6ae8cf090f6f..00000000000000 --- a/apps/zero-runtime-vite-app/src/Slider/ZeroSlider.tsx +++ /dev/null @@ -1,945 +0,0 @@ -import * as React from 'react'; -import clsx from 'clsx'; -import { unstable_composeClasses as composeClasses } from '@mui/utils'; -import { - type SliderOwnerState, - type SliderProps, - sliderClasses, - getSliderUtilityClass, -} from '@mui/material/Slider'; -import { isHostComponent, useSlotProps } from '@mui/base/utils'; -import { styled } from '@mui/zero-runtime'; -import { capitalize } from '@mui/material/utils'; -import SliderValueLabel from '@mui/material/Slider/SliderValueLabel'; -import { useSlider, valueToPercent } from '@mui/base/useSlider'; -import { alpha, lighten, darken } from '../utils/colorManipulator'; - -const shouldSpreadAdditionalProps = (Slot?: React.ElementType) => { - return !Slot || !isHostComponent(Slot); -}; - -function Identity(x: T): T { - return x; -} - -type SliderNestedOwnerState = SliderOwnerState & { - ownerState: SliderOwnerState; -}; - -const SliderRoot = styled('span', { - name: 'MuiSlider', - slot: 'Root', - overridesResolver(props, styles) { - const { ownerState } = props; - return [ - styles.root, - styles[`color${capitalize(ownerState.color ?? '')}`], - ownerState.size !== 'medium' && styles[`size${capitalize(ownerState.size ?? '')}`], - ownerState.marked && styles.marked, - ownerState.orientation === 'vertical' && styles.vertical, - ownerState.track === 'inverted' && styles.trackInverted, - ownerState.track === false && styles.trackFalse, - ]; - }, -})(({ theme }) => ({ - borderRadius: '12px', - boxSizing: 'content-box', - display: 'inline-block', - position: 'relative', - cursor: 'pointer', - touchAction: 'none', - WebkitTapHighlightColor: 'transparent', - '@media print': { - printColorAdjust: 'exact', - }, - [`&.${sliderClasses.disabled}`]: { - pointerEvents: 'none', - cursor: 'default', - color: theme.palette.grey[400], - }, - [`&.${sliderClasses.dragging}`]: { - [`& .${sliderClasses.thumb}, & .${sliderClasses.track}`]: { - transition: 'none', - }, - }, - variants: [ - { - props: { - color: 'primary', - }, - style: { - color: theme.palette.primary.main, - }, - }, - { - props: { - color: 'secondary', - }, - style: { - color: theme.palette.secondary.main, - }, - }, - { - props: { - orientation: 'horizontal', - }, - style: { - height: 4, - width: '100%', - padding: '13px 0', - // The primary input mechanism of the device includes a pointing device of limited accuracy. - '@media (pointer: coarse)': { - // Reach 42px touch target, about ~8mm on screen. - padding: '20px 0', - }, - }, - }, - { - props: { - orientation: 'horizontal', - size: 'small', - }, - style: { - height: 2, - }, - }, - { - props: { - orientation: 'horizontal', - marked: true, - }, - style: { - marginBottom: 20, - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - height: '100%', - width: 4, - padding: '0 13px', - // The primary input mechanism of the device includes a pointing device of limited accuracy. - '@media (pointer: coarse)': { - // Reach 42px touch target, about ~8mm on screen. - padding: '0 20px', - }, - }, - }, - { - props: { - orientation: 'vertical', - size: 'small', - }, - style: { - width: 2, - }, - }, - { - props: { - orientation: 'vertical', - marked: true, - }, - style: { - marginRight: 44, - }, - }, - ], -})); - -export { SliderRoot }; - -const SliderRail = styled('span', { - name: 'MuiSlider', - slot: 'Rail', - overridesResolver: (props, styles) => styles.rail, -})({ - display: 'block', - position: 'absolute', - borderRadius: 'inherit', - backgroundColor: 'currentColor', - opacity: 0.38, - variants: [ - { - props: { - orientation: 'horizontal', - }, - style: { - width: '100%', - height: 'inherit', - top: '50%', - transform: 'translateY(-50%)', - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - height: '100%', - width: 'inherit', - left: '50%', - transform: 'translateX(-50%)', - }, - }, - { - props: { - track: 'inverted', - }, - style: { - opacity: 1, - }, - }, - ], -}); - -export { SliderRail }; - -const SliderTrack = styled('span', { - name: 'MuiSlider', - slot: 'Track', - overridesResolver: (props, styles) => styles.track, -})(({ theme }) => { - const lightPrimaryColor = lighten(theme.palette.primary.main, 0.62); - const lightSecondaryColor = lighten(theme.palette.secondary.main, 0.62); - const darkPrimaryColor = darken(theme.palette.primary.main, 0.5); - const darkSecondaryColor = darken(theme.palette.secondary.main, 0.5); - - return { - display: 'block', - position: 'absolute', - borderRadius: 'inherit', - border: '1px solid currentColor', - backgroundColor: 'currentColor', - transition: theme.transitions.create(['left', 'width', 'bottom', 'height'], { - duration: theme.transitions.duration.shortest, - }), - variants: [ - { - props: { - color: 'primary', - }, - style: { - '--slider-track-color': lightPrimaryColor, - ...theme.applyDarkStyles({ - '--slider-track-color': darkPrimaryColor, - }), - }, - }, - { - props: { - color: 'secondary', - }, - style: { - '--slider-track-color': lightSecondaryColor, - ...theme.applyDarkStyles({ - '--slider-track-color': darkSecondaryColor, - }), - }, - }, - { - props: { - size: 'small', - }, - style: { - border: 'none', - }, - }, - { - props: { - orientation: 'horizontal', - }, - style: { - height: 'inherit', - top: '50%', - transform: 'translateY(-50%)', - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - width: 'inherit', - left: '50%', - transform: 'translateX(-50%)', - }, - }, - { - props: { - track: false, - }, - style: { - display: 'none', - }, - }, - { - props: { - track: 'inverted', - color: 'primary', - }, - style: { - backgroundColor: (theme.vars ?? theme).palette.Slider?.primaryTrack, - borderColor: (theme.vars ?? theme).palette.Slider?.primaryTrack, - }, - }, - { - props: { - track: 'inverted', - color: 'secondary', - }, - style: { - backgroundColor: (theme.vars ?? theme).palette.Slider?.secondaryTrack, - borderColor: (theme.vars ?? theme).palette.Slider?.secondaryTrack, - }, - }, - ], - }; -}); - -export { SliderTrack }; - -const SliderThumb = styled('span', { - name: 'MuiSlider', - slot: 'Thumb', - overridesResolver: (props, styles) => { - const { ownerState } = props; - return [ - styles.thumb, - styles[`thumbColor${capitalize(ownerState.color ?? '')}`], - ownerState.size !== 'medium' && styles[`thumbSize${capitalize(ownerState.size ?? '')}`], - ]; - }, -})(({ theme }) => ({ - position: 'absolute', - width: 20, - height: 20, - boxSizing: 'border-box', - borderRadius: '50%', - outline: 0, - backgroundColor: 'currentColor', - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - transition: theme.transitions.create(['box-shadow', 'left', 'bottom'], { - duration: theme.transitions.duration.shortest, - }), - '&::before': { - position: 'absolute', - content: '""', - borderRadius: 'inherit', - width: '100%', - height: '100%', - boxShadow: (theme.vars || theme).shadows[2], - }, - '&::after': { - position: 'absolute', - content: '""', - borderRadius: '50%', - // 42px is the hit target - width: 42, - height: 42, - top: '50%', - left: '50%', - transform: 'translate(-50%, -50%)', - }, - [`&:hover, &.${sliderClasses.focusVisible}`]: { - boxShadow: `0px 0px 0px 8px var(--slider-thumb-shadow-color)`, - '@media (hover: none)': { - boxShadow: 'none', - }, - }, - [`&.${sliderClasses.active}`]: { - boxShadow: `0px 0px 0px 14px var(--slider-thumb-shadow-color)`, - }, - [`&.${sliderClasses.disabled}`]: { - '&:hover': { - boxShadow: 'none', - }, - }, - variants: [ - { - props: { - color: 'primary', - }, - style: { - '--slider-thumb-shadow-color': theme.vars - ? `rgba(${theme.vars.palette.primary.mainChannel} / 0.16)` - : alpha(theme.palette.primary.main, 0.16), - }, - }, - { - props: { - color: 'secondary', - }, - style: { - '--slider-thumb-shadow-color': theme.vars - ? `rgba(${theme.vars.palette.secondary.mainChannel} / 0.16)` - : alpha(theme.palette.secondary.main, 0.16), - }, - }, - { - props: { - size: 'small', - }, - style: { - width: 12, - height: 12, - '&::before': { - boxShadow: 'none', - }, - }, - }, - { - props: { - orientation: 'horizontal', - }, - style: { - top: '50%', - transform: 'translate(-50%, -50%)', - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - left: '50%', - transform: 'translate(-50%, 50%)', - }, - }, - ], -})); - -export { SliderThumb }; - -const StyledSliderValueLabel = styled(SliderValueLabel, { - name: 'MuiSlider', - slot: 'ValueLabel', - overridesResolver: (props, styles) => styles.valueLabel, -})(({ theme }) => ({ - zIndex: 1, - whiteSpace: 'nowrap', - ...theme.typography.body2, - fontWeight: 500, - transition: theme.transitions.create(['transform'], { - duration: theme.transitions.duration.shortest, - }), - position: 'absolute', - backgroundColor: (theme.vars || theme).palette.grey[600], - borderRadius: '2px', - color: (theme.vars || theme).palette.common.white, - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - padding: '0.25rem 0.75rem', - variants: [ - { - props: { - size: 'small', - }, - style: { - fontSize: theme.typography.pxToRem(12), - padding: '0.25rem 0.5rem', - }, - }, - { - props: { - orientation: 'horizontal', - }, - style: { - top: '-10px', - transformOrigin: 'bottom center', - transform: 'translateY(-100%) scale(0)', - '&::before': { - position: 'absolute', - content: '""', - width: 8, - height: 8, - transform: 'translate(-50%, 50%) rotate(45deg)', - backgroundColor: 'inherit', - bottom: 0, - left: '50%', - }, - [`&.${sliderClasses.valueLabelOpen}`]: { - transform: 'translateY(-100%) scale(1)', - }, - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - top: '50%', - right: '30px', - transform: 'translateY(-50%) scale(0)', - transformOrigin: 'right center', - '&::before': { - position: 'absolute', - content: '""', - width: 8, - height: 8, - transform: 'translate(-50%, -50%) rotate(45deg)', - backgroundColor: 'inherit', - right: -8, - top: '50%', - }, - [`&.${sliderClasses.valueLabelOpen}`]: { - transform: 'translateY(-50%) scale(1)', - }, - }, - }, - { - props: { - orientation: 'vertical', - size: 'small', - }, - style: { - right: '20px', - }, - }, - ], -})); - -export { StyledSliderValueLabel as SliderValueLabel }; - -const SliderMark = styled('span', { - name: 'MuiSlider', - slot: 'Mark', - // @TODO - Support this in `styled` implementation - // shouldForwardProp: (prop) => slotShouldForwardProp(prop) && prop !== 'markActive', - overridesResolver: (props, styles) => { - const { markActive } = props; - - return [styles.mark, markActive && styles.markActive]; - }, -})(({ theme }) => ({ - position: 'absolute', - width: 2, - height: 2, - borderRadius: 1, - backgroundColor: 'currentColor', - variants: [ - { - props: { - orientation: 'horizontal', - }, - style: { - top: '50%', - transform: 'translate(-1px, -50%)', - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - left: '50%', - transform: 'translate(-50%, 1px)', - }, - }, - { - props: { - markActive: true, - }, - style: { - backgroundColor: (theme.vars || theme).palette.background.paper, - opacity: 0.8, - }, - }, - ], -})); - -export { SliderMark }; - -const SliderMarkLabel = styled('span', { - name: 'MuiSlider', - slot: 'MarkLabel', - // @TODO - // shouldForwardProp: (prop) => slotShouldForwardProp(prop) && prop !== 'markLabelActive', - overridesResolver: (props, styles) => styles.markLabel, -})(({ theme }) => ({ - ...theme.typography.body2, - color: (theme.vars || theme).palette.text.secondary, - position: 'absolute', - whiteSpace: 'nowrap', - variants: [ - { - props: { - orientation: 'horizontal', - }, - style: { - top: 30, - transform: 'translateX(-50%)', - '@media (pointer: coarse)': { - top: 40, - }, - }, - }, - { - props: { - orientation: 'vertical', - }, - style: { - left: 36, - transform: 'translateY(50%)', - '@media (pointer: coarse)': { - left: 44, - }, - }, - }, - { - props: { - markLabelActive: true, - }, - style: { - color: (theme.vars || theme).palette.text.primary, - }, - }, - ], -})); - -const useUtilityClasses = (ownerState: SliderOwnerState) => { - const { disabled, dragging, marked, orientation, track, classes, color, size } = ownerState; - - const slots = { - root: [ - 'root', - disabled && 'disabled', - dragging && 'dragging', - marked && 'marked', - orientation === 'vertical' && 'vertical', - track === 'inverted' && 'trackInverted', - track === false && 'trackFalse', - color && `color${capitalize(color)}`, - size && `size${capitalize(size)}`, - ], - rail: ['rail'], - track: ['track'], - mark: ['mark'], - markActive: ['markActive'], - markLabel: ['markLabel'], - markLabelActive: ['markLabelActive'], - valueLabel: ['valueLabel'], - thumb: [ - 'thumb', - disabled && 'disabled', - size && `thumbSize${capitalize(size)}`, - color && `thumbColor${capitalize(color)}`, - ], - active: ['active'], - disabled: ['disabled'], - focusVisible: ['focusVisible'], - }; - - return composeClasses(slots, getSliderUtilityClass, classes); -}; - -export { SliderMarkLabel }; - -const Forward = ({ children }: React.PropsWithChildren) => children; - -const Slider = React.forwardRef(function Slider(props, ref) { - // @TODO - Figure out how to persist this information - const isRtl = false; // theme.direction === 'rtl'; - - const { - 'aria-label': ariaLabel, - 'aria-valuetext': ariaValuetext, - 'aria-labelledby': ariaLabelledby, - component = 'span', - components = {}, - componentsProps = {}, - color = 'primary', - classes: classesProp, - className, - disableSwap = false, - disabled = false, - getAriaLabel, - getAriaValueText, - marks: marksProp = false, - max = 100, - min = 0, - name, - onChange, - onChangeCommitted, - orientation = 'horizontal', - size = 'medium', - step = 1, - scale = Identity, - slotProps, - slots, - tabIndex, - track = 'normal', - value: valueProp, - valueLabelDisplay = 'off', - valueLabelFormat = Identity, - ...other - } = props; - - const ownerState: SliderOwnerState = { - ...props, - // @ts-expect-error @TODO - Figure out how to support rtl/ltr with themes - isRtl, - max, - min, - classes: classesProp, - disabled, - disableSwap, - orientation, - marks: marksProp, - color, - size, - step, - scale, - track, - valueLabelDisplay, - valueLabelFormat, - }; - - const { - axisProps, - getRootProps, - getHiddenInputProps, - getThumbProps, - open, - active, - axis, - focusedThumbIndex, - range, - dragging, - marks, - values, - trackOffset, - trackLeap, - getThumbStyle, - } = useSlider({ - ...ownerState, - rootRef: ref, - }); - - ownerState.marked = marks.length > 0 && marks.some((mark) => mark.label); - ownerState.dragging = dragging; - ownerState.focusedThumbIndex = focusedThumbIndex; - - const classes = useUtilityClasses(ownerState); - - const RootSlot = slots?.root ?? components.Root ?? SliderRoot; - const RailSlot = slots?.rail ?? components.Rail ?? SliderRail; - const TrackSlot = slots?.track ?? components.Track ?? SliderTrack; - const ThumbSlot = slots?.thumb ?? components.Thumb ?? SliderThumb; - const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ?? StyledSliderValueLabel; - const MarkSlot = slots?.mark ?? components.Mark ?? SliderMark; - const MarkLabelSlot = slots?.markLabel ?? components.MarkLabel ?? SliderMarkLabel; - const InputSlot = slots?.input ?? components.Input ?? 'input'; - - const rootSlotProps = slotProps?.root ?? componentsProps.root; - const railSlotProps = slotProps?.rail ?? componentsProps.rail; - const trackSlotProps = slotProps?.track ?? componentsProps.track; - const thumbSlotProps = slotProps?.thumb ?? componentsProps.thumb; - const valueLabelSlotProps = slotProps?.valueLabel ?? componentsProps.valueLabel; - const markSlotProps = slotProps?.mark ?? componentsProps.mark; - const markLabelSlotProps = slotProps?.markLabel ?? componentsProps.markLabel; - const inputSlotProps = slotProps?.input ?? componentsProps.input; - - const rootProps = useSlotProps({ - elementType: RootSlot, - getSlotProps: getRootProps, - externalSlotProps: rootSlotProps, - externalForwardedProps: other, - additionalProps: { - ...(shouldSpreadAdditionalProps(RootSlot) && { - as: component, - }), - }, - ownerState: { - ...ownerState, - // @ts-expect-error - ...rootSlotProps?.ownerState, - }, - className: [classes.root, className], - }); - - const railProps = useSlotProps({ - elementType: RailSlot, - externalSlotProps: railSlotProps, - ownerState, - className: classes.rail, - }); - - const trackProps = useSlotProps({ - elementType: TrackSlot, - externalSlotProps: trackSlotProps, - additionalProps: { - style: { - ...axisProps[axis].offset(trackOffset), - ...axisProps[axis].leap(trackLeap), - }, - }, - ownerState: { - ...ownerState, - // @ts-expect-error - ...trackSlotProps?.ownerState, - }, - className: classes.track, - }); - - const thumbProps = useSlotProps({ - elementType: ThumbSlot, - getSlotProps: getThumbProps, - externalSlotProps: thumbSlotProps, - ownerState: { - ...ownerState, - // @ts-expect-error - ...thumbSlotProps?.ownerState, - }, - className: classes.thumb, - }); - - const valueLabelProps = useSlotProps({ - elementType: ValueLabelSlot, - externalSlotProps: valueLabelSlotProps, - ownerState: { - ...ownerState, - // @ts-expect-error - ...valueLabelSlotProps?.ownerState, - }, - className: classes.valueLabel, - }); - - const markProps = useSlotProps({ - elementType: MarkSlot, - externalSlotProps: markSlotProps, - ownerState, - className: classes.mark, - }); - - const markLabelProps = useSlotProps({ - elementType: MarkLabelSlot, - externalSlotProps: markLabelSlotProps, - ownerState, - className: classes.markLabel, - }); - - const inputSliderProps = useSlotProps({ - elementType: InputSlot, - getSlotProps: getHiddenInputProps, - externalSlotProps: inputSlotProps, - ownerState, - }); - - return ( - - - - {marks - .filter((mark) => mark.value >= min && mark.value <= max) - .map((mark, index) => { - const percent = valueToPercent(mark.value, min, max); - const style = axisProps[axis].offset(percent); - - let markActive; - if (track === false) { - markActive = values.indexOf(mark.value) !== -1; - } else { - markActive = - (track === 'normal' && - (range - ? mark.value >= values[0] && mark.value <= values[values.length - 1] - : mark.value <= values[0])) || - (track === 'inverted' && - (range - ? mark.value <= values[0] || mark.value >= values[values.length - 1] - : mark.value >= values[0])); - } - - return ( - - - {mark.label != null ? ( - - {mark.label} - - ) : null} - - ); - })} - {values.map((value, index) => { - const percent = valueToPercent(value, min, max); - const style = axisProps[axis].offset(percent); - - const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot; - - return ( - /* TODO v6: Change component structure. It will help in avoiding the complicated React.cloneElement API added in SliderValueLabel component. Should be: Thumb -> Input, ValueLabel. Follow Joy UI's Slider structure. */ - - - - - - ); - })} - - ); -}); - -export default Slider; diff --git a/apps/zero-runtime-vite-app/src/component.tsx b/apps/zero-runtime-vite-app/src/component.tsx deleted file mode 100644 index 1da254676d8cf1..00000000000000 --- a/apps/zero-runtime-vite-app/src/component.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { styled } from '@mui/zero-runtime'; - -export function Component() { - return null; -} - -export const Component2 = styled('div')({ - color: 'red', -}); diff --git a/apps/zero-runtime-vite-app/src/extend-zero.d.ts b/apps/zero-runtime-vite-app/src/extend-zero.d.ts deleted file mode 100644 index b3f8a8870c14e0..00000000000000 --- a/apps/zero-runtime-vite-app/src/extend-zero.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Theme } from '@mui/material/styles'; - -declare module '@mui/zero-runtime/theme' { - interface ThemeArgs { - theme: Theme & { - applyDarkStyles(obj: T): Record; - vars?: Theme; - }; - } -} - -declare module '@mui/material' { - interface Palette { - Slider: Record; - } - interface PaletteColor { - mainChannel: string; - } -} diff --git a/apps/zero-runtime-vite-app/src/main.tsx b/apps/zero-runtime-vite-app/src/main.tsx deleted file mode 100644 index d3ecd80210a119..00000000000000 --- a/apps/zero-runtime-vite-app/src/main.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import '@mui/zero-runtime/styles.css'; - -import * as ReactDOMClient from 'react-dom/client'; - -import App from './App'; - -const root = ReactDOMClient.createRoot(document.getElementById('root') as HTMLElement); -root.render(); diff --git a/apps/zero-runtime-vite-app/src/utils/colorManipulator.js b/apps/zero-runtime-vite-app/src/utils/colorManipulator.js deleted file mode 100644 index aaea25ca505c0e..00000000000000 --- a/apps/zero-runtime-vite-app/src/utils/colorManipulator.js +++ /dev/null @@ -1,351 +0,0 @@ -/** - * Returns a number whose value is limited to the given range. - * @param {number} value The value to be clamped - * @param {number} min The lower boundary of the output range - * @param {number} max The upper boundary of the output range - * @returns {number} A number in the range [min, max] - */ -function clamp(value, min = 0, max = 1) { - if (process.env.NODE_ENV !== 'production') { - if (value < min || value > max) { - console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`); - } - } - - return Math.min(Math.max(min, value), max); -} - -/** - * Converts a color from CSS hex format to CSS rgb format. - * @param {string} color - Hex color, i.e. #nnn or #nnnnnn - * @returns {string} A CSS rgb color string - */ -export function hexToRgb(color) { - color = color.slice(1); - - const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g'); - let colors = color.match(re); - - if (colors && colors[0].length === 1) { - colors = colors.map((n) => n + n); - } - - return colors - ? `rgb${colors.length === 4 ? 'a' : ''}(${colors - .map((n, index) => { - return index < 3 ? parseInt(n, 16) : Math.round((parseInt(n, 16) / 255) * 1000) / 1000; - }) - .join(', ')})` - : ''; -} - -function intToHex(int) { - const hex = int.toString(16); - return hex.length === 1 ? `0${hex}` : hex; -} - -/** - * Returns an object with the type and values of a color. - * - * Note: Does not support rgb % values. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {object} - A MUI color object: {type: string, values: number[]} - */ -export function decomposeColor(color) { - // Idempotent - if (color.type) { - return color; - } - - if (color.charAt(0) === '#') { - return decomposeColor(hexToRgb(color)); - } - - const marker = color.indexOf('('); - const type = color.substring(0, marker); - - if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) { - throw new Error( - 'MUI: Unsupported `%s` color.\n' + - 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().', - color, - ); - } - - let values = color.substring(marker + 1, color.length - 1); - let colorSpace; - - if (type === 'color') { - values = values.split(' '); - colorSpace = values.shift(); - if (values.length === 4 && values[3].charAt(0) === '/') { - values[3] = values[3].slice(1); - } - if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) { - throw new Error( - 'MUI: unsupported `%s` color space.\n' + - 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.', - colorSpace, - ); - } - } else { - values = values.split(','); - } - values = values.map((value) => parseFloat(value)); - - return { type, values, colorSpace }; -} - -/** - * Returns a channel created from the input color. - * - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {string} - The channel for the color, that can be used in rgba or hsla colors - */ -export const colorChannel = (color) => { - const decomposedColor = decomposeColor(color); - return decomposedColor.values - .slice(0, 3) - .map((val, idx) => (decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val)) - .join(' '); -}; -// eslint-disable-next-line @typescript-eslint/naming-convention -export const private_safeColorChannel = (color, warning) => { - try { - return colorChannel(color); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -}; - -/** - * Converts a color object with type and values to a string. - * @param {object} color - Decomposed color - * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color' - * @param {array} color.values - [n,n,n] or [n,n,n,n] - * @returns {string} A CSS color string - */ -export function recomposeColor(color) { - const { type, colorSpace } = color; - let { values } = color; - - if (type.indexOf('rgb') !== -1) { - // Only convert the first 3 values to int (i.e. not alpha) - values = values.map((n, i) => (i < 3 ? parseInt(n, 10) : n)); - } else if (type.indexOf('hsl') !== -1) { - values[1] = `${values[1]}%`; - values[2] = `${values[2]}%`; - } - if (type.indexOf('color') !== -1) { - values = `${colorSpace} ${values.join(' ')}`; - } else { - values = `${values.join(', ')}`; - } - - return `${type}(${values})`; -} - -/** - * Converts a color from CSS rgb format to CSS hex format. - * @param {string} color - RGB color, i.e. rgb(n, n, n) - * @returns {string} A CSS rgb color string, i.e. #nnnnnn - */ -export function rgbToHex(color) { - // Idempotent - if (color.indexOf('#') === 0) { - return color; - } - - const { values } = decomposeColor(color); - return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`; -} - -/** - * Converts a color from hsl format to rgb format. - * @param {string} color - HSL color values - * @returns {string} rgb color values - */ -export function hslToRgb(color) { - color = decomposeColor(color); - const { values } = color; - const h = values[0]; - const s = values[1] / 100; - const l = values[2] / 100; - const a = s * Math.min(l, 1 - l); - const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); - - let type = 'rgb'; - const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)]; - - if (color.type === 'hsla') { - type += 'a'; - rgb.push(values[3]); - } - - return recomposeColor({ type, values: rgb }); -} -/** - * The relative brightness of any point in a color space, - * normalized to 0 for darkest black and 1 for lightest white. - * - * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @returns {number} The relative brightness of the color in the range 0 - 1 - */ -export function getLuminance(color) { - color = decomposeColor(color); - - let rgb = - color.type === 'hsl' || color.type === 'hsla' - ? decomposeColor(hslToRgb(color)).values - : color.values; - rgb = rgb.map((val) => { - if (color.type !== 'color') { - val /= 255; // normalized - } - return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4; - }); - - // Truncate at 3 digits - return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3)); -} - -/** - * Calculates the contrast ratio between two colors. - * - * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests - * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() - * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() - * @returns {number} A contrast ratio value in the range 0 - 21. - */ -export function getContrastRatio(foreground, background) { - const lumA = getLuminance(foreground); - const lumB = getLuminance(background); - return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05); -} - -/** - * Sets the absolute transparency of a color. - * Any existing alpha values are overwritten. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} value - value to set the alpha channel to in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function alpha(color, value) { - color = decomposeColor(color); - value = clamp(value); - - if (color.type === 'rgb' || color.type === 'hsl') { - color.type += 'a'; - } - if (color.type === 'color') { - color.values[3] = `/${value}`; - } else { - color.values[3] = value; - } - - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeAlpha(color, value, warning) { - try { - return alpha(color, value); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Darkens a color. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function darken(color, coefficient) { - color = decomposeColor(color); - coefficient = clamp(coefficient); - - if (color.type.indexOf('hsl') !== -1) { - color.values[2] *= 1 - coefficient; - } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] *= 1 - coefficient; - } - } - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeDarken(color, coefficient, warning) { - try { - return darken(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Lightens a color. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function lighten(color, coefficient) { - color = decomposeColor(color); - coefficient = clamp(coefficient); - - if (color.type.indexOf('hsl') !== -1) { - color.values[2] += (100 - color.values[2]) * coefficient; - } else if (color.type.indexOf('rgb') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] += (255 - color.values[i]) * coefficient; - } - } else if (color.type.indexOf('color') !== -1) { - for (let i = 0; i < 3; i += 1) { - color.values[i] += (1 - color.values[i]) * coefficient; - } - } - - return recomposeColor(color); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeLighten(color, coefficient, warning) { - try { - return lighten(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} - -/** - * Darken or lighten a color, depending on its luminance. - * Light colors are darkened, dark colors are lightened. - * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() - * @param {number} coefficient=0.15 - multiplier in the range 0 - 1 - * @returns {string} A CSS color string. Hex input values are returned as rgb - */ -export function emphasize(color, coefficient = 0.15) { - return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient); -} -// eslint-disable-next-line @typescript-eslint/naming-convention -export function private_safeEmphasize(color, coefficient, warning) { - try { - return private_safeEmphasize(color, coefficient); - } catch (error) { - if (warning && process.env.NODE_ENV !== 'production') { - console.warn(warning); - } - return color; - } -} diff --git a/apps/zero-runtime-vite-app/tsconfig.json b/apps/zero-runtime-vite-app/tsconfig.json deleted file mode 100644 index 423d4ec97208d5..00000000000000 --- a/apps/zero-runtime-vite-app/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "include": ["src", "vite.config.ts"], - "compilerOptions": { - "composite": true, - "isolatedModules": true, - "moduleResolution": "node", - "module": "ESNext", - /* files are emitted by babel */ - "noEmit": true, - "noUnusedLocals": true, - "skipLibCheck": true, - "esModuleInterop": true, - "types": ["react", "vitest/globals"], - "incremental": true, - "jsx": "react-jsx" - }, - "exclude": ["node_modules"], - "references": [] -} diff --git a/apps/zero-runtime-vite-app/vite-env.d.ts b/apps/zero-runtime-vite-app/vite-env.d.ts deleted file mode 100644 index d3a8309b593ee5..00000000000000 --- a/apps/zero-runtime-vite-app/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/apps/zero-runtime-vite-app/vite.config.ts b/apps/zero-runtime-vite-app/vite.config.ts deleted file mode 100644 index 1463914238bbe4..00000000000000 --- a/apps/zero-runtime-vite-app/vite.config.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { join, dirname, basename } from 'node:path'; -import { defineConfig, splitVendorChunkPlugin } from 'vite'; -import { UserConfig as VitestConfig } from 'vitest'; -import reactPlugin from '@vitejs/plugin-react'; -import { zeroVitePlugin } from '@mui/zero-vite-plugin'; -import { createTheme } from '@mui/material/styles'; - -declare module 'vite' { - interface UserConfig { - test: VitestConfig; - } -} - -const theme = createTheme(); -// @TODO - Make this part of the main package -// @ts-ignore -theme.applyDarkStyles = function applyDarkStyles(obj) { - return { - ':where([data-mui-color-scheme="dark"]) &': obj, - }; -}; - -export default defineConfig({ - plugins: [ - zeroVitePlugin({ - cssVariablesPrefix: 'app', - theme, - transformLibraries: ['local-library'], - }), - reactPlugin(), - splitVendorChunkPlugin(), - ], - test: { - globals: true, - watch: false, - environment: 'jsdom', - resolveSnapshotPath(testPath, extension) { - return join( - join(dirname(testPath), '__vite_snapshots__'), - `${basename(testPath)}${extension}`, - ); - }, - passWithNoTests: true, - css: { - // to render the final css in the output html to test - // computed styles. Users will need to add this if they - // want to test computed styles. - include: [/.+/], - }, - }, -}); diff --git a/package.json b/package.json index e6d6b74375d4ed..5db8b32b8666a5 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "deduplicate": "pnpm dedupe", "benchmark:browser": "pnpm --filter benchmark browser", "build": "lerna run --parallel --scope \"@mui/*\" build", + "build:zero": "lerna run --parallel --scope \"@mui/zero-*\" build", "build:codesandbox": "NODE_OPTIONS=\"–max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" build", "release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private --force-publish=@mui/core-downloads-tracker", "release:build": "lerna run --concurrency 8 --scope \"@mui/*\" build --skip-nx-cache", @@ -73,7 +74,8 @@ "typescript": "lerna run --no-bail --parallel typescript", "typescript:ci": "lerna run --concurrency 5 --no-bail --no-sort typescript", "validate-declarations": "tsx scripts/validateTypescriptDeclarations.mts", - "generate-codeowners": "node scripts/generateCodeowners.mjs" + "generate-codeowners": "node scripts/generateCodeowners.mjs", + "watch:zero": "lerna watch -- lerna run watch --scope=$LERNA_PACKAGE_NAME" }, "dependencies": { "@googleapis/sheets": "^5.0.5", @@ -178,6 +180,7 @@ "stylelint-processor-styled-components": "^1.10.0", "terser-webpack-plugin": "^5.3.10", "tsx": "^4.7.0", + "tsup": "^8.0.1", "typescript": "^5.3.3", "typescript-to-proptypes": "workspace:^", "webpack": "^5.89.0", diff --git a/packages/zero-jest/README.md b/packages/zero-jest/README.md deleted file mode 100644 index ceab25d62b63ee..00000000000000 --- a/packages/zero-jest/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @mui/zero-jest - -Jest transformer for zero-runtime styled testing support. diff --git a/packages/zero-jest/package.json b/packages/zero-jest/package.json deleted file mode 100644 index 3c71a617a454f4..00000000000000 --- a/packages/zero-jest/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@mui/zero-jest", - "version": "0.0.1-alpha.0", - "private": true, - "author": "MUI Team", - "description": "Jest transformer for zero-runtime styled testing support.", - "main": "./src/index.ts", - "keywords": [ - "zero runtime", - "css-in-js", - "mui", - "jest" - ], - "repository": { - "type": "git", - "url": "https://github.com/mui/material-ui.git", - "directory": "packages/zero-jest" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/mui/material-ui/issues" - }, - "homepage": "@TODO", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", - "build:modern": "node ../../scripts/build.mjs modern", - "build:node": "node ../../scripts/build.mjs node", - "build:stable": "node ../../scripts/build.mjs stable", - "build:copy-files": "node ../../scripts/copyFiles.mjs", - "prebuild": "rimraf build tsconfig.build.tsbuildinfo", - "release": "pnpm build && npm publish build", - "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-babel-plugin/**/*.test.{js,ts,tsx}'" - }, - "dependencies": { - "@linaria/babel-preset": "^4.5.4", - "@linaria/utils": "^4.5.3", - "@mui/zero-tag-processor": "workspace:^", - "babel-jest": "^29.7.0", - "style-inject": "^0.3.0" - }, - "devDependencies": { - "@jest/transform": "^29.7.0" - }, - "sideEffects": false, - "publishConfig": { - "access": "public" - }, - "engines": { - "node": ">=12.0.0" - } -} diff --git a/packages/zero-jest/src/index.js b/packages/zero-jest/src/index.js deleted file mode 100644 index 589fb47a661194..00000000000000 --- a/packages/zero-jest/src/index.js +++ /dev/null @@ -1,96 +0,0 @@ -import { TransformCacheCollection, transform as linariaTransform } from '@linaria/babel-preset'; -import { syncResolve, asyncResolveFallback } from '@linaria/utils'; -import babelJest from 'babel-jest'; - -const transformCache = new TransformCacheCollection(); - -function getLinariaConfig(filename, options) { - const { theme = {}, cssVariablesPrefix = 'mui' } = options ?? {}; - return { - filename, - pluginOptions: { - themeArgs: { - theme, - }, - cssVariablesPrefix, - }, - }; -} - -/** - * @param {import('@linaria/babel-preset/types/types').Result} result - * @returns {import('@jest/transform').TransformedSource} - */ -function getReturnValue(result, injectCss = true) { - const { code: transformedCode, cssText, map: resultMap } = result; - const finalCode = - injectCss && cssText - ? `const styleInject = require('style-inject'); -styleInject(${JSON.stringify(cssText)}); -${transformedCode} -` - : transformedCode; - return { - code: finalCode, - map: resultMap, - }; -} - -/** - * @typedef {Object} TransformerConfig - * @property {unknown} theme - * @property {boolean} [injectCss] - */ - -/** - * @param {TransformerConfig} userOptions - * @returns - */ -function createZeroTransformer(userOptions) { - const { theme, cssVariablesPrefix = 'mui', injectCss = true, ...rest } = userOptions; - const babelTransformer = babelJest.createTransformer({ - ...rest, - plugins: (rest?.plugins ?? []).concat('@mui/zero-tag-processor/pre-linaria-plugin'), - }); - // eslint-disable-next-line global-require - const { transformSync: linariaTransformSync } = require('@linaria/babel-preset/lib/transform'); - - /** @type {import("@jest/transform").Transformer} */ - const zeroTransformer = { - ...babelTransformer, - process(sourceText, sourcePath, options) { - const { code } = babelTransformer.process(sourceText, sourcePath, options); - const linariaResult = linariaTransformSync( - code ?? sourceText, - getLinariaConfig(sourcePath, { - theme, - cssVariablesPrefix, - }), - syncResolve, - {}, - transformCache, - ); - return getReturnValue(linariaResult, injectCss); - }, - async processAsync(sourceText, sourcePath, options) { - const { code } = babelTransformer.processAsync(sourceText, sourcePath, options); - const result = await linariaTransform( - code ?? sourceText, - getLinariaConfig(sourcePath, { - theme, - cssVariablesPrefix, - }), - asyncResolveFallback, - {}, - transformCache, - ); - return getReturnValue(result, injectCss); - }, - }; - - return zeroTransformer; -} - -const transformerFactory = { createTransformer: createZeroTransformer }; - -export default transformerFactory; diff --git a/packages/zero-next-plugin/.eslintrc.json b/packages/zero-next-plugin/.eslintrc.json deleted file mode 100644 index 54a33fd127fb66..00000000000000 --- a/packages/zero-next-plugin/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@typescript-eslint/consistent-type-imports": "error" - } -} diff --git a/packages/zero-next-plugin/LICENSE b/packages/zero-next-plugin/LICENSE deleted file mode 100644 index 6d201297b4f70f..00000000000000 --- a/packages/zero-next-plugin/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Dario Lehmhus - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/zero-next-plugin/README.md b/packages/zero-next-plugin/README.md deleted file mode 100644 index cec32be4e491c7..00000000000000 --- a/packages/zero-next-plugin/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @mui/zero-vite-plugin - -Vite plugin to support MUI's `styled` processor. diff --git a/packages/zero-next-plugin/loader.js b/packages/zero-next-plugin/loader.js new file mode 100644 index 00000000000000..f39de0b8dc089d --- /dev/null +++ b/packages/zero-next-plugin/loader.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('./build/virtual-css-loader').loader; diff --git a/packages/zero-next-plugin/next-font.js b/packages/zero-next-plugin/next-font.js new file mode 100644 index 00000000000000..6f40c9a23ab5cf --- /dev/null +++ b/packages/zero-next-plugin/next-font.js @@ -0,0 +1,5 @@ +/* eslint-env node */ +module.exports = { + className: 'next-font-dummy-className', + style: {}, +}; diff --git a/packages/zero-next-plugin/next-image.js b/packages/zero-next-plugin/next-image.js new file mode 100644 index 00000000000000..fd25c1a989c782 --- /dev/null +++ b/packages/zero-next-plugin/next-image.js @@ -0,0 +1,2 @@ +/* eslint-env node */ +module.exports = function DummyNextImage() {}; diff --git a/packages/zero-next-plugin/package.json b/packages/zero-next-plugin/package.json index c1b3d21660878b..d62a6d72650ba1 100644 --- a/packages/zero-next-plugin/package.json +++ b/packages/zero-next-plugin/package.json @@ -1,65 +1,34 @@ { "name": "@mui/zero-next-plugin", - "version": "0.0.1-alpha.0", - "private": true, - "author": "MUI Team", - "description": "Vite plugin for MUI zero styled implementation.", - "main": "./src/index.ts", - "keywords": [ - "zero runtime", - "css-in-js", - "mui" - ], - "repository": { - "type": "git", - "url": "https://github.com/mui/material-ui.git", - "directory": "packages/zero-next-plugin" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/mui/material-ui/issues" - }, - "homepage": "@TODO", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, + "version": "0.0.1-alpha.5", + "main": "build/index.js", + "module": "build/index.mjs", + "types": "build/index.d.ts", "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", - "build:modern": "node ../../scripts/build.mjs modern", - "build:node": "node ../../scripts/build.mjs node", - "build:stable": "node ../../scripts/build.mjs stable", - "build:copy-files": "node ../../scripts/copyFiles.mjs", - "build:types": "node ../../scripts/buildTypes.mjs", - "prebuild": "rimraf build tsconfig.build.tsbuildinfo", - "release": "pnpm build && npm publish build", - "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-babel-plugin/**/*.test.{js,ts,tsx}'", - "typescript": "tsc -p tsconfig.json", - "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" + "clean": "rimraf build types", + "watch": "tsup --watch --tsconfig tsconfig.build.json", + "build": "tsup --tsconfig tsconfig.build.json", + "typecheck": "tsc --noEmit -p ." }, "dependencies": { - "@babel/core": "^7.23.7", - "@babel/plugin-syntax-jsx": "^7.23.3", - "@babel/preset-typescript": "^7.23.3", - "@linaria/babel-preset": "^4.5.4", - "@mui/zero-tag-processor": "workspace:^", - "file-system-cache": "2.4.4" + "@mui/zero-unplugin": "workspace:^" }, "devDependencies": { - "@types/babel__core": "^7.20.5", - "@types/chai": "^4.3.11", - "chai": "^4.4.0", - "next": "^13.4.19" + "next": "^14.0.1" }, "peerDependencies": { - "next": ">=12.0.0 <14.0.0" + "next": "^12.0.0 || ^13.0.0 || ^14.0.0" }, "sideEffects": false, "publishConfig": { "access": "public" }, - "engines": { - "node": ">=12.0.0" - } + "files": [ + "build", + "loader.js", + "next-font.js", + "next-image.js", + "zero-virtual.css", + "package.json" + ] } diff --git a/packages/zero-next-plugin/src/VirtualModuleStore.ts b/packages/zero-next-plugin/src/VirtualModuleStore.ts deleted file mode 100644 index c2ee5030dd28fc..00000000000000 --- a/packages/zero-next-plugin/src/VirtualModuleStore.ts +++ /dev/null @@ -1,78 +0,0 @@ -import Cache, { type FileSystemCache } from 'file-system-cache'; -import path from 'path'; -import type * as Webpack from 'webpack'; - -import VirtualModulesPlugin from './plugins/webpack-virtual-modules'; -import { isFSCache } from './utils'; - -type CachedFile = { - path: string; - value: { - content: string; - path: string; - }; -}; - -export default class VirtualModuleStore { - private vmInstances: Map = new Map(); - - private initialCachedFiles: Record = {}; - - private cssCache: FileSystemCache | undefined; - - private dependencyCache: FileSystemCache | undefined; - - constructor(config: Webpack.Configuration) { - this.addModule = this.addModule.bind(this); - - if (isFSCache(config.cache)) { - const baseDir = config.cache.cacheDirectory || path.join(process.cwd(), '.linaria-cache'); - - const cachePath = path.join(baseDir, `linaria-${config.mode}`); - this.cssCache = Cache({ - basePath: cachePath, - ns: config.cache.version, - }); - - this.cssCache.load().then((cachedFiles) => { - cachedFiles.files.forEach(({ value: { content, path: filePath } }: CachedFile) => { - this.initialCachedFiles[filePath] = content; - this.addModule(filePath, content, false); - }); - }); - - this.dependencyCache = Cache({ - basePath: cachePath, - ns: `${config.cache.version}-deps`, - }); - } - } - - public createStore(name = 'default') { - const vm = new VirtualModulesPlugin(this.initialCachedFiles); - this.vmInstances.set(name, vm); - return vm; - } - - public addModule(filePath: string, content: string, addToCache = true) { - this.vmInstances.forEach((vm) => { - vm.writeModule(filePath, content); - }); - if (this.cssCache && addToCache) { - this.cssCache.set(filePath, { content, path: filePath }); - } - } - - public addModuleDependencies(modulePath: string, deps: string[]) { - if (this.dependencyCache) { - this.dependencyCache.set(modulePath, deps); - } - } - - public async getModuleDependencies(modulePath: string): Promise { - if (this.dependencyCache) { - return this.dependencyCache.get(modulePath); - } - return null; - } -} diff --git a/packages/zero-next-plugin/src/index.ts b/packages/zero-next-plugin/src/index.ts index 495d983caf848b..bad1f50dda198d 100644 --- a/packages/zero-next-plugin/src/index.ts +++ b/packages/zero-next-plugin/src/index.ts @@ -1,163 +1,81 @@ +import * as path from 'node:path'; import type { NextConfig } from 'next'; -import type * as NextServer from 'next/dist/server/config-shared'; -import path from 'path'; -import type * as Webpack from 'webpack'; -import { generateCss } from '@mui/zero-tag-processor/generateCss'; +import { findPagesDir } from 'next/dist/lib/find-pages-dir'; +import { + webpack as zeroWebpackPlugin, + PluginOptions as BaseZeroPluginConfig, +} from '@mui/zero-unplugin'; -import type { PluginOptions, Preprocessor } from '@linaria/babel-preset'; -import type { LinariaLoaderOptions } from './loaders/transformLoader'; -import { regexLinariaCSS, regexLinariaGlobalCSS } from './loaders/transformLoader'; -import ErrorPlugin from './plugins/errorPlugin'; -import { isCssLoader, isCssModule } from './utils'; -import VirtualModuleStore from './VirtualModuleStore'; +export type ZeroPluginConfig = BaseZeroPluginConfig & { + asyncResolve?: (what: string) => string | null; +}; -export interface ZeroPluginOptions extends PluginOptions { - /** - * An object of the themes that you want passed in as an argument in the callback argument of `styled`. - */ - theme: unknown; - /** - * Prefix string to use in the generated css variables. - */ - cssVariablesPrefix?: string; - /** - * Whether the css variables for the default theme should target the :root selector or not. - * @default true - */ - injectDefaultThemeInRoot?: boolean; - // exclude?: FilterPattern; - sourceMap?: boolean; - preprocessor?: Preprocessor; -} - -// Thanks https://github.com/Mistereo/next-linaria/blob/de4fd15269bd059e35797bb7250ce84cc8c5067c/index.js#L3 -// for the inspiration -function traverseLoaders(rules: Webpack.RuleSetRule[]) { - for (let i = 0; i < rules.length; i += 1) { - const rule = rules[i]; - if (isCssLoader(rule)) { - if (isCssModule(rule)) { - const nextGetLocalIdent = rule.options.modules.getLocalIdent; - const nextMode = rule.options.modules.mode; - - // allow global css for *.linaria.global.css files - rule.options.modules.mode = (innerPath) => { - const isGlobal = regexLinariaGlobalCSS.test(innerPath); - if (isGlobal) { - return 'local'; - } - return typeof nextMode === 'function' ? nextMode(innerPath) : nextMode; - }; - - // We don't want the default css-loader to generate classnames - // for linaria modules, since those are generated by linaria. - rule.options.modules.getLocalIdent = (context, _, exportName, ...rest) => { - if (regexLinariaCSS.test(context.resourcePath)) { - return exportName; - } - return nextGetLocalIdent(context, _, exportName, ...rest); - }; - } - } - if (typeof rule.use === 'object') { - // FIXME: Can we do it without the typecast? - const useRules = rule.use as Webpack.RuleSetRule | Webpack.RuleSetRule[]; - traverseLoaders(Array.isArray(useRules) ? useRules : [useRules]); - } - if (Array.isArray(rule.oneOf)) { - traverseLoaders(rule.oneOf as Webpack.RuleSetRule[]); - } - } -} +const extractionFile = path.join( + path.dirname(require.resolve('../package.json')), + 'zero-virtual.css', +); -let moduleStore: VirtualModuleStore; +export function withZeroPlugin(nextConfig: NextConfig, zeroConfig: ZeroPluginConfig) { + const { babelOptions, asyncResolve, ...rest } = zeroConfig; + const webpack: Exclude = (config, context) => { + const { dir, dev, isServer, config: resolvedNextConfig } = context; -export default function withZero(nextConfig: NextConfig, zeroConfig: ZeroPluginOptions) { - const { - theme, - cssVariablesPrefix = 'mui', - injectDefaultThemeInRoot = true, - babelOptions = {}, - sourceMap = false, - displayName = false, - } = zeroConfig; + const findPagesDirResult = findPagesDir( + dir, + // @ts-expect-error next.js v12 accepts 2 arguments, while v13 only accepts 1 + resolvedNextConfig.experimental?.appDir ?? false, + ); - const webpack = (config: Webpack.Configuration, options: NextServer.WebpackConfigContext) => { - if (config.module?.rules && config.plugins) { - traverseLoaders(config.module.rules as Webpack.RuleSetRule[]); + let hasAppDir = false; - // Add our store for virtual linaria css modules - if (!moduleStore) { - moduleStore = new VirtualModuleStore(config); - } - const vmPlugin = moduleStore.createStore(config.name); - vmPlugin.writeModule( - 'node_modules/@mui/zero-runtime/styles.css', - generateCss( - { - cssVariablesPrefix, - themeArgs: { - theme, - }, - }, - { - defaultThemeKey: 'theme', - injectInRoot: injectDefaultThemeInRoot, - }, - ), - ); - config.plugins.push(vmPlugin); - - // Show message when linaria cache is out of sync with webpack - config.plugins.push(new ErrorPlugin()); - - // Add css output loader with access to the module store - // in order to set the correct dependencies - config.module.rules.push({ - test: regexLinariaCSS, - exclude: /node_modules/, - use: [ - { - loader: path.resolve(__dirname, './loaders/outputCssLoader'), - options: { - moduleStore, - }, - }, - ], - }); + if ('appDir' in resolvedNextConfig.experimental) { + hasAppDir = + !!resolvedNextConfig.experimental.appDir && + !!(findPagesDirResult && findPagesDirResult.appDir); + } else { + hasAppDir = !!(findPagesDirResult && findPagesDirResult.appDir); + } - // Add linaria loader to transform files - const linariaLoaderOptions: LinariaLoaderOptions = { - ...zeroConfig, + config.module.rules.unshift({ + enforce: 'pre', + test: (filename: string) => filename.endsWith('zero-virtual.css'), + use: require.resolve('../loader'), + }); + config.plugins.push( + zeroWebpackPlugin({ + ...rest, + meta: { + type: 'next', + dev, + isServer, + outputCss: dev || hasAppDir || !isServer, + placeholderCssFile: extractionFile, + }, + asyncResolve(what) { + if (what === 'next/image') { + return require.resolve('../next-image'); + } + if (what.startsWith('next/font')) { + return require.resolve('../next-font'); + } + return asyncResolve?.(what) ?? null; + }, babelOptions: { ...babelOptions, - presets: [...(babelOptions.presets ?? []), 'next/babel', '@linaria'], - }, - themeArgs: { - theme, + presets: [...(babelOptions?.presets ?? []), 'next/babel'], }, - sourceMap: sourceMap ?? process.env.NODE_ENV !== 'production', - displayName: displayName ?? process.env.NODE_ENV !== 'production', - moduleStore, - }; - config.module.rules.push({ - test: /\.(tsx|ts|js|mjs|jsx)$/, - exclude: /node_modules/, - use: [ - { - loader: path.resolve(__dirname, './loaders/transformLoader'), - options: linariaLoaderOptions, - }, - ], - }); - } + }), + ); if (typeof nextConfig.webpack === 'function') { - return nextConfig.webpack(config, options); + return nextConfig.webpack(config, context); } + config.ignoreWarnings = config.ignoreWarnings ?? []; + config.ignoreWarnings.push({ + module: /(zero-virtual\.css)|(runtime\/styles\.css)/, + }); return config; }; - return { ...nextConfig, webpack, diff --git a/packages/zero-next-plugin/src/loaders/outputCssLoader.ts b/packages/zero-next-plugin/src/loaders/outputCssLoader.ts deleted file mode 100644 index 10bf84b275f35a..00000000000000 --- a/packages/zero-next-plugin/src/loaders/outputCssLoader.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { RawLoaderDefinitionFunction } from 'webpack'; -import type VirtualModuleStore from '../VirtualModuleStore'; - -type OutputLoaderOptions = { - moduleStore: VirtualModuleStore; -}; - -type LoaderType = RawLoaderDefinitionFunction; - -const cssOutputLoader: LoaderType = function cssOutputLoader(content, inputSourceMap) { - this.async(); - - const { moduleStore } = this.getOptions(); - moduleStore - .getModuleDependencies(this.resourcePath) - .then((deps) => { - if (deps) { - deps.forEach((dep) => { - this.addDependency(dep); - }); - } - }) - .catch((err) => { - this.emitError(err); - console.error(`Error getting dependencies for ${this.resourcePath}`); - }) - .finally(() => { - this.callback(null, content, inputSourceMap); - }); -}; - -export default cssOutputLoader; diff --git a/packages/zero-next-plugin/src/loaders/transformLoader.ts b/packages/zero-next-plugin/src/loaders/transformLoader.ts deleted file mode 100644 index e92548624f273d..00000000000000 --- a/packages/zero-next-plugin/src/loaders/transformLoader.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * This loader is based on the linaria webpack loader. Just some minor changes to support virtual modules and also adds support for sx prop transform to be able to be processed by linaria. - * https://github.com/callstack/linaria/blob/462739a781e31d5a8266957c0a4800292f452441/packages/webpack5-loader/src/index.ts - * - * This file contains a Webpack loader for Linaria. - * It uses the transform.ts function to generate class names from source code, - * returns transformed code without template literals and attaches generated source maps - */ - -import type { PluginOptions, Preprocessor, Result } from '@linaria/babel-preset'; -import { transform } from '@linaria/babel-preset'; -import path from 'path'; -import { preprocessor as baseProcessor } from '@mui/zero-tag-processor/preprocessor'; -import { transformAsync as babelTransformAsync } from '@babel/core'; -import type { RawLoaderDefinitionFunction } from 'webpack'; - -import type VirtualModuleStore from '../VirtualModuleStore'; - -export const LINARIA_MODULE_EXTENSION = '.linaria.module'; -export const LINARIA_GLOBAL_EXTENSION = '.linaria.global'; - -export const regexLinariaModuleCSS = /\.linaria\.module\.css$/; -export const regexLinariaGlobalCSS = /\.linaria\.global\.css$/; -export const regexLinariaCSS = /\.linaria\.(module|global)\.css$/; - -export type LinariaLoaderOptions = { - themeArgs?: Record; - moduleStore: VirtualModuleStore; - preprocessor?: Preprocessor; - sourceMap?: boolean; -} & Partial; - -type LoaderType = RawLoaderDefinitionFunction; - -function convertSourceMap( - value: Parameters[1], - filename: string, -): Parameters[1]['inputSourceMap'] { - if (typeof value === 'string' || !value) { - return undefined; - } - - return { - ...value, - file: value.file ?? filename, - mappings: value.mappings ?? '', - names: value.names ?? [], - sources: value.sources ?? [], - version: value.version ?? 3, - }; -} - -const transformLoader: LoaderType = function transformLoader(content, inputSourceMap) { - // tell Webpack this loader is async - this.async(); - - const { - sourceMap = undefined, - preprocessor = baseProcessor, - moduleStore, - ...rest - } = this.getOptions() || {}; - - const asyncResolve = (token: string, importer: string): Promise => { - const context = path.isAbsolute(importer) - ? path.dirname(importer) - : path.join(process.cwd(), path.dirname(importer)); - return new Promise((resolve, reject) => { - this.resolve(context, token, (err, result) => { - if (err) { - console.error(err); - reject(err); - } else if (result) { - this.addDependency(result); - resolve(result); - } else { - reject(new Error(`Cannot resolve ${token}`)); - } - }); - }); - }; - const contentString = content.toString(); - - babelTransformAsync(contentString, { - filename: this.resourcePath, - babelrc: false, - configFile: false, - presets: ['@babel/preset-typescript'], - plugins: ['@babel/plugin-syntax-jsx', ['@mui/zero-tag-processor/pre-linaria-plugin']], - }).then( - (babelResult) => { - transform( - babelResult?.code ?? contentString, - { - filename: this.resourcePath, - inputSourceMap: convertSourceMap(inputSourceMap, this.resourcePath), - pluginOptions: rest, - preprocessor, - }, - asyncResolve, - ).then( - async (result: Result) => { - if (result.cssText) { - let { cssText } = result; - - if (sourceMap) { - cssText += `/*# sourceMappingURL=data:application/json;base64,${Buffer.from( - result.cssSourceMapText || '', - ).toString('base64')}*/`; - } - - await Promise.all( - result.dependencies?.map((dep) => asyncResolve(dep, this.resourcePath)) ?? [], - ); - - try { - const filename = path.basename(this.resourcePath, path.extname(this.resourcePath)); - const fileDir = path.dirname(this.resourcePath); - const isGlobalStyle = filename.endsWith(LINARIA_GLOBAL_EXTENSION); - - const cssModuleName = `${filename}${ - isGlobalStyle ? '' : LINARIA_MODULE_EXTENSION - }.css`; - - const fullPathToModule = path.join(fileDir, cssModuleName); - - await Promise.all([ - moduleStore.addModule(fullPathToModule, cssText), - moduleStore.addModuleDependencies(fullPathToModule, this.getDependencies()), - ]); - - this.callback( - null, - `${result.code}\n\nrequire("./${cssModuleName}");`, - result.sourceMap ?? undefined, - ); - } catch (err) { - this.callback(err as Error); - } - - return; - } - - this.callback(null, result.code, result.sourceMap ?? undefined); - }, - (err: Error) => this.callback(err), - ); - }, - (err: Error) => this.callback(err), - ); -}; - -export default transformLoader; diff --git a/packages/zero-next-plugin/src/plugins/errorPlugin.ts b/packages/zero-next-plugin/src/plugins/errorPlugin.ts deleted file mode 100644 index a583a69a40cdcc..00000000000000 --- a/packages/zero-next-plugin/src/plugins/errorPlugin.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Compiler } from 'webpack'; -import { WebpackError } from 'webpack'; - -import { isFSCache } from '../utils'; - -const cssRegex = /\.linaria\.(module|global)\.css/; - -export default class ErrorPlugin { - // eslint-disable-next-line class-methods-use-this - apply(compiler: Compiler) { - compiler.hooks.afterDone.tap('ErrorPlugin', (stats) => { - if (stats.hasErrors()) { - if (isFSCache(stats.compilation.compiler.options.cache)) { - const isLinariaRelated = stats.compilation.errors.some((error) => { - return cssRegex.test(error.message); - }); - - if (isLinariaRelated) { - stats.compilation.errors = stats.compilation.errors.filter( - (err) => !cssRegex.test(err.message), - ); - - const message = - '🔄 The Linaria cache seems to be out of sync with the webpack cache, please restart the server.\n For more details see: https://github.com/dlehmhus/next-with-linaria#good-to-know \n\n'; - - stats.compilation.errors.push(new WebpackError(message)); - } - } - } - }); - } -} diff --git a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/index.ts b/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/index.ts deleted file mode 100644 index 3104541b4a9967..00000000000000 --- a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/index.ts +++ /dev/null @@ -1,225 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -// Thanks https://github.com/sysgears/webpack-virtual-modules/blob/ea53626016db74de66b14401b7377cbc3fc31059/src/index.ts -// This is the webpack-virtual-modules package with the slight alteration that -// we can write modules before the compiler is available. -import path from 'path'; - -import type { Compiler } from 'webpack'; -import VirtualStats from './virtual-stats'; -import { - checkActivation, - createWebpackData, - getData, - getFileStorage, - getModulePath, - getReadDirBackend, - getStatStorage, - setData, -} from './vmUtils'; - -let inode = 45000000; - -export default class VirtualModulesPlugin { - private _staticModules: Record | null; - - private _compiler: Compiler | null = null; - - private _watcher: any = null; - - public constructor(modules?: Record) { - this._staticModules = modules || null; - } - - public writeModule(filePath: string, contents: string): void { - // next-with-linaria patch, if not initialized yet, add to static modules - if (!this._compiler) { - if (!this._staticModules) { - this._staticModules = {}; - } - this._staticModules[filePath] = contents; - return; - } - - checkActivation(this); - - const len = contents ? contents.length : 0; - const time = Date.now(); - const date = new Date(time); - - const stats = new VirtualStats({ - dev: 8675309, - nlink: 0, - uid: 1000, - gid: 1000, - rdev: 0, - blksize: 4096, - ino: (inode += 1), - mode: 33188, - size: len, - blocks: Math.floor(len / 4096), - atime: date, - mtime: date, - ctime: date, - birthtime: date, - }); - const modulePath = getModulePath(filePath, this._compiler); - - if (process.env.WVM_DEBUG) { - // eslint-disable-next-line no-console - console.log(this._compiler.name, 'Write virtual module:', modulePath, contents); - } - - // When using the WatchIgnorePlugin (https://github.com/webpack/webpack/blob/52184b897f40c75560b3630e43ca642fcac7e2cf/lib/WatchIgnorePlugin.js), - // the original watchFileSystem is stored in `wfs`. The following "unwraps" the ignoring - // wrappers, giving us access to the "real" watchFileSystem. - let finalWatchFileSystem = this._watcher && this._watcher.watchFileSystem; - - while (finalWatchFileSystem && finalWatchFileSystem.wfs) { - finalWatchFileSystem = finalWatchFileSystem.wfs; - } - - let finalInputFileSystem: any = this._compiler.inputFileSystem; - while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) { - finalInputFileSystem = finalInputFileSystem._inputFileSystem; - } - - finalInputFileSystem._writeVirtualFile(modulePath, stats, contents); - if ( - finalWatchFileSystem && - (finalWatchFileSystem.watcher.fileWatchers.size || - finalWatchFileSystem.watcher.fileWatchers.length) - ) { - const fileWatchers = - finalWatchFileSystem.watcher.fileWatchers instanceof Map - ? Array.from(finalWatchFileSystem.watcher.fileWatchers.values()) - : finalWatchFileSystem.watcher.fileWatchers; - for (let i = 0; i < fileWatchers.length; i += 1) { - let fileWatcher = fileWatchers[i]; - if ('watcher' in fileWatcher) { - fileWatcher = fileWatcher.watcher; - } - if (fileWatcher.path === modulePath) { - if (process.env.DEBUG) { - // eslint-disable-next-line no-console - console.log(this._compiler.name, 'Emit file change:', modulePath, time); - } - delete fileWatcher.directoryWatcher._cachedTimeInfoEntries; - fileWatcher.emit('change', time, null); - } - } - } - } - - public apply(compiler: Compiler) { - this._compiler = compiler; - - const afterEnvironmentHook = () => { - let finalInputFileSystem: any = compiler.inputFileSystem; - while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) { - finalInputFileSystem = finalInputFileSystem._inputFileSystem; - } - - if (!finalInputFileSystem._writeVirtualFile) { - const originalPurge = finalInputFileSystem.purge; - - finalInputFileSystem.purge = () => { - originalPurge.apply(finalInputFileSystem, []); - if (finalInputFileSystem._virtualFiles) { - Object.keys(finalInputFileSystem._virtualFiles).forEach((file) => { - const data = finalInputFileSystem._virtualFiles[file]; - finalInputFileSystem._writeVirtualFile(file, data.stats, data.contents); - }); - } - }; - - // @ts-ignore - finalInputFileSystem._writeVirtualFile = (file, stats, contents) => { - const statStorage = getStatStorage(finalInputFileSystem); - const fileStorage = getFileStorage(finalInputFileSystem); - const readDirStorage = getReadDirBackend(finalInputFileSystem); - finalInputFileSystem._virtualFiles = finalInputFileSystem._virtualFiles || {}; - finalInputFileSystem._virtualFiles[file] = { - stats, - contents, - }; - setData(statStorage, file, createWebpackData(stats)); - setData(fileStorage, file, createWebpackData(contents)); - const segments = file.split(/[\\/]/); - let count = segments.length - 1; - const minCount = segments[0] ? 1 : 0; - while (count > minCount) { - const dir = segments.slice(0, count).join(path.sep) || path.sep; - try { - finalInputFileSystem.readdirSync(dir); - } catch (e) { - const time = Date.now(); - const dirStats = new VirtualStats({ - dev: 8675309, - nlink: 0, - uid: 1000, - gid: 1000, - rdev: 0, - blksize: 4096, - ino: (inode += 1), - mode: 16877, - size: stats.size, - blocks: Math.floor(stats.size / 4096), - atime: time, - mtime: time, - ctime: time, - birthtime: time, - }); - - setData(readDirStorage, dir, createWebpackData([])); - setData(statStorage, dir, createWebpackData(dirStats)); - } - let dirData = getData(getReadDirBackend(finalInputFileSystem), dir); - // Webpack v4 returns an array, webpack v5 returns an object - dirData = dirData[1] || dirData.result; - const filename = segments[count]; - if (dirData.indexOf(filename) < 0) { - const files = dirData.concat([filename]).sort(); - setData(getReadDirBackend(finalInputFileSystem), dir, createWebpackData(files)); - } else { - break; - } - count -= 1; - } - }; - } - }; - const afterResolversHook = () => { - if (this._staticModules) { - const entries = Object.entries(this._staticModules); - for (let i = 0; i < entries.length; i += 1) { - const [filePath, contents] = entries[i]; - this.writeModule(filePath, contents); - } - this._staticModules = null; - } - }; - - // @ts-ignore - const watchRunHook = (watcher, callback) => { - this._watcher = watcher.compiler || watcher; - const virtualFiles = (compiler as any).inputFileSystem._virtualFiles; - const fts = compiler.fileTimestamps as any; - if (virtualFiles && fts && typeof fts.set === 'function') { - Object.keys(virtualFiles).forEach((file) => { - fts.set(file, +virtualFiles[file].stats.mtime); - }); - } - callback(); - }; - - if (compiler.hooks) { - compiler.hooks.afterEnvironment.tap('VirtualModulesPlugin', afterEnvironmentHook); - compiler.hooks.afterResolvers.tap('VirtualModulesPlugin', afterResolversHook); - compiler.hooks.watchRun.tapAsync('VirtualModulesPlugin', watchRunHook); - } else { - (compiler as any).plugin('after-environment', afterEnvironmentHook); - (compiler as any).plugin('after-resolvers', afterResolversHook); - (compiler as any).plugin('watch-run', watchRunHook); - } - } -} diff --git a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/virtual-stats.js b/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/virtual-stats.js deleted file mode 100644 index fbe85346c454f6..00000000000000 --- a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/virtual-stats.js +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-bitwise */ -/** - * Used to cache a stats object for the virtual file. - * Extracted from the `mock-fs` package. - * - * @author Tim Schaub http://tschaub.net/ - * @author `webpack-virtual-modules` Contributors - * @link https://github.com/tschaub/mock-fs/blob/master/lib/binding.js - * @link https://github.com/tschaub/mock-fs/blob/master/license.md - */ -import constants from 'constants'; - -export default class VirtualStats { - /** - * Create a new stats object. - * - * @param config Stats properties. - */ - constructor(config) { - Object.keys(config).forEach((key) => { - if (!Object.prototype.hasOwnProperty.call(config, key)) { - return; - } - this[key] = config[key]; - }); - } - - /** - * Check if mode indicates property. - */ - _checkModeProperty(property) { - return (this.mode & constants.S_IFMT) === property; - } - - isDirectory() { - return this._checkModeProperty(constants.S_IFDIR); - } - - isFile() { - return this._checkModeProperty(constants.S_IFREG); - } - - isBlockDevice() { - return this._checkModeProperty(constants.S_IFBLK); - } - - isCharacterDevice() { - return this._checkModeProperty(constants.S_IFCHR); - } - - isSymbolicLink() { - return this._checkModeProperty(constants.S_IFLNK); - } - - isFIFO() { - return this._checkModeProperty(constants.S_IFIFO); - } - - isSocket() { - return this._checkModeProperty(constants.S_IFSOCK); - } -} diff --git a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/vmUtils.js b/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/vmUtils.js deleted file mode 100644 index b0b70c7444621c..00000000000000 --- a/packages/zero-next-plugin/src/plugins/webpack-virtual-modules/vmUtils.js +++ /dev/null @@ -1,95 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -import * as path from 'node:path'; - -export function checkActivation(instance) { - if (!instance._compiler) { - throw new Error('You must use this plugin only after creating webpack instance!'); - } -} - -export function getModulePath(filePath, compiler) { - return path.isAbsolute(filePath) ? filePath : path.join(compiler.context, filePath); -} - -export function createWebpackData(result) { - return (backendOrStorage) => { - // In Webpack v5, this variable is a "Backend", and has the data stored in a field - // _data. In V4, the `_` prefix isn't present. - if (backendOrStorage._data) { - const curLevelIdx = backendOrStorage._currentLevel; - const curLevel = backendOrStorage._levels[curLevelIdx]; - return { - result, - level: curLevel, - }; - } - // Webpack 4 - return [null, result]; - }; -} - -export function getData(storage, key) { - // Webpack 5 - if (storage._data instanceof Map) { - return storage._data.get(key); - } - if (storage._data) { - return storage.data[key]; - } - if (storage.data instanceof Map) { - // Webpack v4 - return storage.data.get(key); - } - return storage.data[key]; -} - -export function setData(backendOrStorage, key, valueFactory) { - const value = valueFactory(backendOrStorage); - - // Webpack v5 - if (backendOrStorage._data instanceof Map) { - backendOrStorage._data.set(key, value); - } else if (backendOrStorage._data) { - backendOrStorage.data[key] = value; - } else if (backendOrStorage.data instanceof Map) { - // Webpack 4 - backendOrStorage.data.set(key, value); - } else { - backendOrStorage.data[key] = value; - } -} - -export function getStatStorage(fileSystem) { - if (fileSystem._statStorage) { - // Webpack v4 - return fileSystem._statStorage; - } - if (fileSystem._statBackend) { - // webpack v5 - return fileSystem._statBackend; - } - // Unknown version? - throw new Error("Couldn't find a stat storage"); -} - -export function getFileStorage(fileSystem) { - if (fileSystem._readFileStorage) { - // Webpack v4 - return fileSystem._readFileStorage; - } - if (fileSystem._readFileBackend) { - // Webpack v5 - return fileSystem._readFileBackend; - } - throw new Error("Couldn't find a readFileStorage"); -} - -export function getReadDirBackend(fileSystem) { - if (fileSystem._readdirBackend) { - return fileSystem._readdirBackend; - } - if (fileSystem._readdirStorage) { - return fileSystem._readdirStorage; - } - throw new Error("Couldn't find a readDirStorage from Webpack Internals"); -} diff --git a/packages/zero-next-plugin/src/utils.ts b/packages/zero-next-plugin/src/utils.ts deleted file mode 100644 index 2c3ca80b9add65..00000000000000 --- a/packages/zero-next-plugin/src/utils.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type * as Webpack from 'webpack'; - -type CssModuleType = { - auto: boolean | RegExp | ((resourcePath: string) => boolean); - exportGlobals: boolean; - exportLocalsConvention: - | 'asIs' - | 'camelCase' - | 'camelCaseOnly' - | 'dashes' - | 'dashesOnly' - | ((name: string) => string); - exportOnlyLocals: boolean; - getLocalIdent: ( - context: Webpack.LoaderContext, - localIdentName: string, - exportName: string, - options: object, - ) => string; - localIdentContext: string; - localIdentHashDigest: string; - localIdentHashFunction: string; - localIdentHashSalt: string; - localIdentName: string; - localIdentRegExp: string | RegExp; - mode: - | 'local' - | 'global' - | 'pure' - | 'icss' - | ((resourcePath: string) => 'local' | 'global' | 'pure' | 'icss'); - namedExport: boolean; -}; - -export function isCssModule( - rule: Webpack.RuleSetRule, -): rule is Webpack.RuleSetRule & { options: { modules: CssModuleType } } { - return ( - rule.options && - typeof rule.options === 'object' && - rule.options.modules && - typeof rule.options.modules.getLocalIdent === 'function' - ); -} - -export function isCssLoader(rule: Webpack.RuleSetRule): boolean { - return typeof rule.loader === 'string' && rule.loader.includes('css-loader'); -} - -export function isFSCache( - cache: Webpack.Configuration['cache'], -): cache is Webpack.FileCacheOptions { - return typeof cache === 'object' && cache.type === 'filesystem'; -} diff --git a/packages/zero-next-plugin/src/virtual-css-loader.js b/packages/zero-next-plugin/src/virtual-css-loader.js new file mode 100644 index 00000000000000..7ef1b6d716e01c --- /dev/null +++ b/packages/zero-next-plugin/src/virtual-css-loader.js @@ -0,0 +1,6 @@ +export const loader = function virtualFileLoader() { + const callback = this.async(); + const resourceQuery = this.resourceQuery.slice(1); + const { source } = JSON.parse(decodeURIComponent(resourceQuery)); + return callback(null, source); +}; diff --git a/packages/zero-next-plugin/tsconfig.build.json b/packages/zero-next-plugin/tsconfig.build.json index 8d011f4d868ce1..80b6a0a8461245 100644 --- a/packages/zero-next-plugin/tsconfig.build.json +++ b/packages/zero-next-plugin/tsconfig.build.json @@ -1,22 +1,6 @@ { - // This config is for emitting declarations (.d.ts) only - // Actual .ts source files are transpiled via babel - "extends": "./tsconfig", + "extends": "./tsconfig.json", "compilerOptions": { - "target": "ES2015", - "composite": true, - "declaration": true, - "noEmit": false, - "emitDeclarationOnly": true, - "outDir": "build", - "rootDir": "./src" - }, - "include": ["./src/**/*.ts", "./src/**/*.js"], - "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], - "references": [ - { "path": "../mui-base/tsconfig.build.json" }, - { "path": "../mui-system/tsconfig.build.json" }, - { "path": "../mui-material/tsconfig.build.json" }, - { "path": "../zero-tag-processor/tsconfig.build.json" } - ] + "composite": false + } } diff --git a/packages/zero-next-plugin/tsconfig.json b/packages/zero-next-plugin/tsconfig.json index f1b9f4b0310a39..0142f7d5340b37 100644 --- a/packages/zero-next-plugin/tsconfig.json +++ b/packages/zero-next-plugin/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig", - "include": ["src/**/*"], + "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["ES2022", "DOM"], - "target": "ES2015", - "types": ["mocha", "node", "chai"] - } + "resolveJsonModule": true, + "target": "ES2015" + }, + "include": ["src/**/*.ts"], + "exclude": ["./tsup.config.ts"], + "references": [ + { + "path": "../zero-unplugin" + } + ] } diff --git a/packages/zero-next-plugin/tsup.config.ts b/packages/zero-next-plugin/tsup.config.ts new file mode 100644 index 00000000000000..cc7e4562200b87 --- /dev/null +++ b/packages/zero-next-plugin/tsup.config.ts @@ -0,0 +1,13 @@ +import { Options, defineConfig } from 'tsup'; +import config from '../../tsup.config'; + +const configOptions = config as Options; + +const baseConfig: Options = { + ...configOptions, + tsconfig: './tsconfig.build.json', + cjsInterop: true, + entry: ['./src/index.ts', './src/virtual-css-loader.js'], +}; + +export default defineConfig(baseConfig); diff --git a/packages/zero-next-plugin/zero-virtual.css b/packages/zero-next-plugin/zero-virtual.css new file mode 100644 index 00000000000000..9ad1d681126fae --- /dev/null +++ b/packages/zero-next-plugin/zero-virtual.css @@ -0,0 +1 @@ +/** Placeholder file */ diff --git a/packages/zero-runtime/.eslintrc.json b/packages/zero-runtime/.eslintrc.json deleted file mode 100644 index 54a33fd127fb66..00000000000000 --- a/packages/zero-runtime/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@typescript-eslint/consistent-type-imports": "error" - } -} diff --git a/packages/zero-runtime/.gitignore b/packages/zero-runtime/.gitignore new file mode 100644 index 00000000000000..f43d90c8429d5e --- /dev/null +++ b/packages/zero-runtime/.gitignore @@ -0,0 +1,2 @@ +/processors/ +/utils/ diff --git a/packages/zero-runtime/README.md b/packages/zero-runtime/README.md deleted file mode 100644 index 6ffaf477384095..00000000000000 --- a/packages/zero-runtime/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @mui/zero-runtime - -Runtime package for `styled`. It'll be an equivalent to `@mui/system` later on. diff --git a/packages/zero-runtime/exports/generateAtomics.js b/packages/zero-runtime/exports/generateAtomics.js new file mode 100644 index 00000000000000..897eea3b6beaa4 --- /dev/null +++ b/packages/zero-runtime/exports/generateAtomics.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../processors/generateAtomics').GenerateAtomicsProcessor; diff --git a/packages/zero-runtime/exports/keyframes.js b/packages/zero-runtime/exports/keyframes.js new file mode 100644 index 00000000000000..6de596c2dc662b --- /dev/null +++ b/packages/zero-runtime/exports/keyframes.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../processors/keyframes').KeyframesProcessor; diff --git a/packages/zero-runtime/exports/styled.js b/packages/zero-runtime/exports/styled.js new file mode 100644 index 00000000000000..937d484a867010 --- /dev/null +++ b/packages/zero-runtime/exports/styled.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../processors/styled').StyledProcessor; diff --git a/packages/zero-runtime/exports/sx-plugin.js b/packages/zero-runtime/exports/sx-plugin.js new file mode 100644 index 00000000000000..dad557a6deab17 --- /dev/null +++ b/packages/zero-runtime/exports/sx-plugin.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../utils/pre-linaria-plugin').babelPlugin; diff --git a/packages/zero-runtime/exports/sx.js b/packages/zero-runtime/exports/sx.js new file mode 100644 index 00000000000000..a07d9d481a18aa --- /dev/null +++ b/packages/zero-runtime/exports/sx.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, '__esModule', { + value: true, +}); + +exports.default = require('../processors/sx').SxProcessor; diff --git a/packages/zero-runtime/package.json b/packages/zero-runtime/package.json index e3d5ecaf5a8089..dfccd8bd91bc05 100644 --- a/packages/zero-runtime/package.json +++ b/packages/zero-runtime/package.json @@ -1,54 +1,43 @@ { "name": "@mui/zero-runtime", - "version": "0.0.1-alpha.0", - "private": true, - "author": "MUI Team", - "description": "Linaria tag processors for custom styled implementation.", - "main": "./src/index.ts", - "keywords": [ - "zero runtime", - "css-in-js", - "mui" - ], - "repository": { - "type": "git", - "url": "https://github.com/mui/material-ui.git", - "directory": "packages/zero-tag-processor" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/mui/material-ui/issues" - }, - "homepage": "@TODO", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, + "version": "0.0.1-alpha.5", + "main": "build/index.js", + "module": "build/index.mjs", + "types": "build/index.d.ts", "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", - "build:modern": "node ../../scripts/build.mjs modern", - "build:node": "node ../../scripts/build.mjs node", - "build:stable": "node ../../scripts/build.mjs stable", - "build:copy-files": "node ../../scripts/copyFiles.mjs styles.css", - "build:types": "node ../../scripts/buildTypes.mjs", - "prebuild": "rimraf build tsconfig.build.tsbuildinfo", - "release": "pnpm build && pnpm publish", - "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-runtime/**/*.test.{js,ts,tsx}'", - "typescript": "tsc -p tsconfig.json", - "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" + "clean": "rimraf build types", + "watch": "tsup --watch --clean false", + "build": "tsup", + "typecheck": "tsc --noEmit -p ." }, "dependencies": { - "clsx": "^2.1.0", - "csstype": "^3.1.2" + "csstype": "^3.1.2", + "cssesc": "^3.0.0", + "clsx": "^2.0.0", + "@babel/core": "^7.23.2", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", + "@emotion/css": "^11.11.2", + "@emotion/styled": "^11.11.0", + "@linaria/tags": "^5.0.2", + "@linaria/utils": "^5.0.2", + "@mui/system": "^5.14.18", + "lodash.set": "^4.3.2", + "lodash.get": "^4.4.2", + "stylis": "^4.2.0" }, "devDependencies": { - "@mui/zero-runtime": "workspace:*", - "@types/chai": "^4.3.11", - "@types/mocha": "^10.0.6", - "@types/node": "^18.19.4", - "@types/react": "^18.2.46", - "chai": "^4.4.0", + "@types/babel__core": "^7.20.3", + "@types/babel__helper-module-imports": "^7.18.2", + "@types/babel__helper-plugin-utils": "^7.10.2", + "@types/cssesc": "^3.0.2", + "@types/lodash.get": "^4.4.7", + "@types/lodash.set": "^4.3.9", + "@types/node": "^18.18.5", + "@types/react": "^18.2.31", + "@types/stylis": "^4.2.0", "react": "^18.2.0" }, "peerDependencies": { @@ -56,18 +45,49 @@ }, "sideEffects": false, "publishConfig": { - "access": "public", - "directory": "build" - }, - "engines": { - "node": ">=12.0.0" + "access": "public" }, "linaria": { "tags": { - "styled": "@mui/zero-tag-processor/styled", - "default": "@mui/zero-tag-processor/styled", - "sx": "@mui/zero-tag-processor/sx", - "keyframes": "@mui/zero-tag-processor/keyframes" + "styled": "./exports/styled.js", + "default": "./exports/styled.js", + "sx": "./exports/sx.js", + "keyframes": "./exports/keyframes.js", + "generateAtomics": "./exports/generateAtomics.js" + } + }, + "files": [ + "build", + "exports", + "processors", + "utils", + "package.json", + "styles.css", + "theme" + ], + "exports": { + ".": { + "types": "./build/index.d.ts", + "import": "./build/index.mjs", + "require": "./build/index.js" + }, + "./package.json": "./package.json", + "./theme": { + "types": "./theme/index.d.ts", + "import": "./theme/index.mjs", + "require": "./theme/index.js", + "default": "./theme/index.js" + }, + "./styles.css": { + "default": "./styles.css" + }, + "./utils": { + "types": "./utils/index.d.ts", + "import": "./utils/index.mjs", + "require": "./utils/index.js" + }, + "./exports/sx-plugin": { + "default": "./exports/sx-plugin.js" } } } diff --git a/packages/zero-runtime/src/base.d.ts b/packages/zero-runtime/src/base.d.ts index c1d60b17f80f82..c417cdfdc61f3c 100644 --- a/packages/zero-runtime/src/base.d.ts +++ b/packages/zero-runtime/src/base.d.ts @@ -1,22 +1,24 @@ import type * as CSS from 'csstype'; -export type CSSProperties = CSS.PropertiesFallback; +export type CSSProperties = CSS.PropertiesFallback; export type CSSPropertiesMultiValue = { [K in keyof CSSProperties]: CSSProperties[K] | Array>; }; -export type CSSPropertiesWithCallback = { +export type CSSPropertiesWithCallback = { [K in keyof CSSProperties]: | CSSProperties[K] | Array> | ((props: Props) => CSSProperties[K]); }; -export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject }; +export type CSSPseudos = { + [K in CSS.Pseudos]?: CSSObject; +}; export type CSSPseudosNoCallback = { [K in CSS.Pseudos]?: CSSObjectNoCallback }; -export interface CSSOthersObject { +export interface CSSOthersObject { [selector: string]: CSSObject; } @@ -24,7 +26,7 @@ export interface CSSOthersObjectNoCallback { [selector: string]: CSSObjectNoCallback; } -export type CSSObject = +export type CSSObject = | CSSPropertiesWithCallback | CSSPseudos | CSSOthersObject; diff --git a/packages/zero-runtime/src/generateAtomics.d.ts b/packages/zero-runtime/src/generateAtomics.d.ts new file mode 100644 index 00000000000000..4af7eeec54f661 --- /dev/null +++ b/packages/zero-runtime/src/generateAtomics.d.ts @@ -0,0 +1,30 @@ +import type { CSSProperties } from './base'; +import type { ThemeArgs } from './theme'; + +// @TODO Implement proper types +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type GenerateAtomicsResult = (props: any) => { className: string }; + +type AtomicProperty = { + [Key in keyof CSSProperties]: ReadonlyArray; +}; + +type Atomics< + Conditions extends Record, + Properties extends AtomicProperty = AtomicProperty, + Shorthands extends Record> = Record< + string, + Array + >, +> = { + conditions: Conditions; + defaultCondition: keyof Conditions; + properties: Properties; + shorthands?: Shorthands; +}; + +export declare function generateAtomics>( + atomics: Atomics | ((themeConfig: ThemeArgs) => Atomics), +): GenerateAtomicsResult; + +export declare function atomics(config: unknown): string; diff --git a/packages/zero-runtime/src/generateAtomics.js b/packages/zero-runtime/src/generateAtomics.js new file mode 100644 index 00000000000000..2d8f67cedcf3a3 --- /dev/null +++ b/packages/zero-runtime/src/generateAtomics.js @@ -0,0 +1,64 @@ +import cx from 'clsx'; + +export function generateAtomics() { + throw new Error( + 'MUI: You were trying to call "generateAtomics" function directly without configuring your bundler. Make sure to install the bundler specific plugin and use it.', + ); +} + +/** + * @typedef {Object} RuntimeConfig + * @property {Object.>>} styles + * @property {Object.} shorthands + * @property {string[]} conditions + */ + +/** + * @param {RuntimeConfig} runtimeConfig + */ +export function atomics({ styles, shorthands, conditions }) { + function addStyles(cssProperty, values, classes) { + const styleClasses = styles[cssProperty]; + if (!styleClasses) { + return; + } + if (typeof values === 'string') { + classes.push(styleClasses[values].$$default); + } else if (Array.isArray(values)) { + values.forEach((value, index) => { + classes.push(styleClasses[value][conditions[index]]); + }); + } else { + Object.keys(values).forEach((condition) => { + const propertyClasses = styleClasses[values[condition]]; + if (!propertyClasses) { + return; + } + classes.push(propertyClasses[condition]); + }); + } + } + + function generateClass(props) { + const classes = []; + const runtimeStyles = Object.assign({}, props); + Object.keys(runtimeStyles).forEach((cssProperty) => { + const values = runtimeStyles[cssProperty]; + if (cssProperty in shorthands) { + const configShorthands = shorthands[cssProperty]; + if (!configShorthands) { + return; + } + configShorthands.forEach((shorthand) => { + addStyles(shorthand, values, classes); + }); + } else { + addStyles(cssProperty, values, classes); + } + }); + return { + className: cx(Array.from(new Set(classes))), + }; + } + return generateClass; +} diff --git a/packages/zero-runtime/src/index.ts b/packages/zero-runtime/src/index.ts index 8038196b22a7ee..7f2e376b6ce020 100644 --- a/packages/zero-runtime/src/index.ts +++ b/packages/zero-runtime/src/index.ts @@ -1,3 +1,4 @@ -export { default as styled } from './styled'; +export { default as styled, type StyledComponent } from './styled'; export { default as sx } from './sx'; export { default as keyframes } from './keyframes'; +export { generateAtomics, atomics } from './generateAtomics'; diff --git a/packages/zero-tag-processor/src/base-processor.ts b/packages/zero-runtime/src/processors/base-processor.ts similarity index 96% rename from packages/zero-tag-processor/src/base-processor.ts rename to packages/zero-runtime/src/processors/base-processor.ts index 7b3861c304be21..9e6c2248aef189 100644 --- a/packages/zero-tag-processor/src/base-processor.ts +++ b/packages/zero-runtime/src/processors/base-processor.ts @@ -24,7 +24,6 @@ export default abstract class BaseProcessor extends LinariaBaseProcessor { // Implementation taken from Linaria - https://github.com/callstack/linaria/blob/master/packages/react/src/processors/styled.ts#L362 protected getVariableContext(cssKey: string, source: string, hasUnit: boolean): IVariableContext { const getIndex = () => { - // eslint-disable-next-line no-plusplus return this.variableIdx++; }; diff --git a/packages/zero-runtime/src/processors/generateAtomics.ts b/packages/zero-runtime/src/processors/generateAtomics.ts new file mode 100644 index 00000000000000..4efd3228d93ac9 --- /dev/null +++ b/packages/zero-runtime/src/processors/generateAtomics.ts @@ -0,0 +1,105 @@ +import { Expression } from '@babel/types'; +import { + type Params, + type TailProcessorParams, + type ValueCache, + validateParams, +} from '@linaria/tags'; +import { ValueType } from '@linaria/utils'; +import type { ExpressionValue, Replacements, Rules } from '@linaria/utils'; + +import BaseProcessor from './base-processor'; +import type { IOptions } from './styled'; +import { + convertAtomicsToCss, + type Atomics, + type RuntimeConfig, +} from '../utils/convertAtomicsToCss'; +import { css, cache } from '../utils/emotion'; +import { valueToLiteral } from '../utils/valueToLiteral'; +import { CSSInterpolation } from '@emotion/css'; + +export class GenerateAtomicsProcessor extends BaseProcessor { + callParam: ExpressionValue; + runtimeConfig?: RuntimeConfig; + + constructor(params: Params, ...args: TailProcessorParams) { + super(params, ...args); + + validateParams(params, ['callee', ['call']], `Invalid use of ${this.tagSource.imported} tag.`); + const [, callParam] = params; + const [, callParamArgument] = callParam; + this.dependencies.push(callParamArgument); + this.callParam = callParamArgument; + } + + get asSelector(): string { + throw new Error('Method not implemented.'); + } + + get value(): Expression { + throw new Error('Method not implemented.'); + } + + doEvaltimeReplacement(): void { + this.replacer(this.astService.nullLiteral(), true); + } + + build(values: ValueCache): void { + const { themeArgs = {} } = this.options as IOptions; + const param = this.callParam; + if (param.kind !== ValueType.CONST) { + const value = + param.kind === ValueType.FUNCTION + ? (values.get(param.ex.name) as (config: unknown) => unknown)(themeArgs) + : values.get(param.ex.name); + const { classes, runtimeConfig } = convertAtomicsToCss( + value as Atomics, + this.className, + false, + this.options.displayName, + ); + this.runtimeConfig = runtimeConfig; + + classes.forEach(({ className, css: cssObject }) => { + const emotionClass = css(cssObject as CSSInterpolation); + const cssText = cache.registered[emotionClass]; + + const rules: Rules = { + [`.${className}`]: { + cssText, + className: this.className, + displayName: this.displayName, + start: this.location?.start ?? null, + }, + }; + const sourceMapReplacements: Replacements = [ + { + length: cssText.length, + original: { + start: { + column: this.location?.start.column ?? 0, + line: this.location?.start.line ?? 0, + }, + end: { + column: this.location?.end.column ?? 0, + line: this.location?.end.line ?? 0, + }, + }, + }, + ]; + this.artifacts.push(['css', [rules, sourceMapReplacements]]); + }); + } + } + + doRuntimeReplacement(): void { + if (!this.runtimeConfig) { + this.doEvaltimeReplacement(); + return; + } + const { astService: t } = this; + const importName = t.addNamedImport('atomics', process.env.PACKAGE_NAME as string); + this.replacer(t.callExpression(importName, [valueToLiteral(this.runtimeConfig)]), true); + } +} diff --git a/packages/zero-tag-processor/src/keyframes.ts b/packages/zero-runtime/src/processors/keyframes.ts similarity index 92% rename from packages/zero-tag-processor/src/keyframes.ts rename to packages/zero-runtime/src/processors/keyframes.ts index 01497497bfea9a..cb8401df388322 100644 --- a/packages/zero-tag-processor/src/keyframes.ts +++ b/packages/zero-runtime/src/processors/keyframes.ts @@ -12,11 +12,11 @@ import { ValueType } from '@linaria/utils'; import type { CSSInterpolation } from '@emotion/css'; import BaseProcessor from './base-processor'; import type { IOptions } from './styled'; -import { cache, keyframes } from './utils/emotion'; +import { cache, keyframes } from '../utils/emotion'; type Primitive = string | number | boolean | null | undefined; -export default class KeyframesProcessor extends BaseProcessor { +export class KeyframesProcessor extends BaseProcessor { callParam: CallParam | TemplateParam; constructor(params: Params, ...args: TailProcessorParams) { @@ -45,7 +45,7 @@ export default class KeyframesProcessor extends BaseProcessor { build(values: ValueCache) { if (this.artifacts.length > 0) { - throw new Error('Tag is already built'); + throw new Error(`MUI: "${this.tagSource.imported}" is already built`); } const [callType] = this.callParam; @@ -128,8 +128,10 @@ export default class KeyframesProcessor extends BaseProcessor { styleObj = values.get(callArg.ex.name) as CSSInterpolation; } else if (callArg.kind === ValueType.FUNCTION) { const { themeArgs } = this.options as IOptions; - const value = values.get(callArg.ex.name) as Function; - styleObj = value(themeArgs) as CSSInterpolation; + const value = values.get(callArg.ex.name) as ( + args: Record | undefined, + ) => CSSInterpolation; + styleObj = value(themeArgs); } if (styleObj) { this.generateArtifacts(styleObj); diff --git a/packages/zero-tag-processor/src/styled.ts b/packages/zero-runtime/src/processors/styled.ts similarity index 83% rename from packages/zero-tag-processor/src/styled.ts rename to packages/zero-runtime/src/processors/styled.ts index 6eff00835be51b..1437c5fa6af77f 100644 --- a/packages/zero-tag-processor/src/styled.ts +++ b/packages/zero-runtime/src/processors/styled.ts @@ -8,23 +8,24 @@ import type { WrappedNode, } from '@linaria/tags'; import { ValueType } from '@linaria/utils'; -import type { Rules, Replacements, ExpressionValue, LazyValue } from '@linaria/utils'; +import type { Rules, Replacements, ExpressionValue, LazyValue, ConstValue } from '@linaria/utils'; import { parseExpression } from '@babel/parser'; -import type { SourceLocation } from '@babel/types'; -import type { Theme } from '@mui/material/styles'; -import type { PluginCustomOptions } from './utils/cssFnValueToVariable'; -import { cssFnValueToVariable } from './utils/cssFnValueToVariable'; -import { processCssObject } from './utils/processCssObject'; -import { valueToLiteral } from './utils/valueToLiteral'; +import type { ObjectExpression, SourceLocation } from '@babel/types'; +import type { PluginCustomOptions } from '../utils/cssFnValueToVariable'; +import { cssFnValueToVariable } from '../utils/cssFnValueToVariable'; +import { processCssObject } from '../utils/processCssObject'; +import { valueToLiteral } from '../utils/valueToLiteral'; import BaseProcessor from './base-processor'; +import { Theme } from '../utils/generateCss'; type VariantData = { - props: Record; + props: (componentProps: unknown) => boolean | Record; style: object; + originalExpression?: Exclude; }; type VariantDataTransformed = { - props: Record; + props: VariantData['props']; className: string; }; @@ -38,6 +39,8 @@ type ComponentMeta = { skipSx?: boolean; }; +type DefaultProps = Record; + /** * Linaria tag processor responsible for converting complex `styled()()` calls * at build-time to simple `styled` calls supported by runtime. @@ -81,7 +84,7 @@ type ComponentMeta = { * 2. build * 3. doRuntimeReplacement */ -export default class StyledProcessor extends BaseProcessor { +export class StyledProcessor extends BaseProcessor { variableIdx = 0; component?: WrappedNode; @@ -111,7 +114,7 @@ export default class StyledProcessor extends BaseProcessor { originalLocation: SourceLocation | null = null; - defaultProps: Record = {}; + defaultProps: DefaultProps = {}; constructor(params: Params, ...args: TailProcessorParams) { super(params, ...args); @@ -124,7 +127,7 @@ export default class StyledProcessor extends BaseProcessor { ['callee', ['call', 'member'], ['call', 'template']], `Invalid use of ${this.tagSource.imported} tag.`, ); - const [call, memberOrCall, styleCall] = params; + const [callee, memberOrCall, styleCall] = params; const [callType, componentArg, componentMetaArg] = memberOrCall; const [, ...styleArgs] = styleCall; this.componentMetaArg = @@ -164,8 +167,8 @@ export default class StyledProcessor extends BaseProcessor { } } }); - if (call[0] === 'callee') { - this.originalLocation = call[1].loc ?? null; + if (callee[0] === 'callee') { + this.originalLocation = callee[1].loc ?? null; } } @@ -208,11 +211,15 @@ export default class StyledProcessor extends BaseProcessor { * 3. Variants declared in theme object */ build(values: ValueCache): void { + const themeImportIdentifier = this.astService.addDefaultImport( + `${process.env.PACKAGE_NAME}/theme`, + 'theme', + ); // all the variant definitions are collected here so that we can // apply variant styles after base styles for more specific targetting. const variantsAccumulator: VariantData[] = []; this.styleArgs.forEach((styleArg) => { - this.processStyle(values, styleArg, variantsAccumulator); + this.processStyle(values, styleArg, variantsAccumulator, themeImportIdentifier.name); }); this.processOverrides(values, variantsAccumulator); variantsAccumulator.forEach((variant) => { @@ -255,7 +262,7 @@ export default class StyledProcessor extends BaseProcessor { /** * This is the runtime phase where all of the css have been transformed and we finally want to replace the `styled` call with the code that we want in the final bundle. In this particular case, we replace the `styled` calls with * ```js - * const Component = styled('div', { + * const Component = styled('div')({ * displayName: 'Component', * name: 'MuiSlider', * slot: 'root', @@ -317,10 +324,12 @@ export default class StyledProcessor extends BaseProcessor { ); } + let componentMetaExpression: ObjectExpression | undefined; + if (this.componentMetaArg) { const parsedMeta = parseExpression(this.componentMetaArg.source); if (parsedMeta.type === 'ObjectExpression') { - argProperties.push(...parsedMeta.properties); + componentMetaExpression = parsedMeta as ObjectExpression; } } if (this.defaultProps && Object.keys(this.defaultProps).length > 0) { @@ -328,19 +337,26 @@ export default class StyledProcessor extends BaseProcessor { t.objectProperty(t.identifier('defaultProps'), valueToLiteral(this.defaultProps)), ); } - this.replacer( - t.callExpression(t.addNamedImport('styled', '@mui/zero-runtime'), [ - componentName, - t.objectExpression(argProperties), - ]), - true, + + const styledImportIdentifier = t.addNamedImport(this.tagSource.imported, this.tagSource.source); + const styledCall = t.callExpression( + styledImportIdentifier, + componentMetaExpression ? [componentName, componentMetaExpression] : [componentName], ); + const mainCall = t.callExpression(styledCall, [t.objectExpression(argProperties)]); + + this.replacer(mainCall, true); } /** * Generates css for object directly provided as arguments in the styled call. */ - processStyle(values: ValueCache, styleArg: ExpressionValue, variantsAccumulator?: VariantData[]) { + processStyle( + values: ValueCache, + styleArg: ExpressionValue, + variantsAccumulator?: VariantData[], + themeImportIdentifier?: string, + ) { if (styleArg.kind === ValueType.CONST) { if (typeof styleArg.value === 'string') { this.collectedStyles.push([this.getClassName(), styleArg.value, styleArg]); @@ -348,9 +364,10 @@ export default class StyledProcessor extends BaseProcessor { } else { const styleObjOrFn = values.get(styleArg.ex.name); const finalStyle = this.processCss( - styleObjOrFn as object | Function, + styleObjOrFn as object | (() => void), styleArg, variantsAccumulator, + themeImportIdentifier, ); const className = this.getClassName(); this.baseClasses.push(className); @@ -399,7 +416,7 @@ export default class StyledProcessor extends BaseProcessor { variantsAccumulator.push(...(componentData.variants as unknown as VariantData[])); } if ('defaultProps' in componentData && componentData.defaultProps) { - this.defaultProps = componentData.defaultProps; + this.defaultProps = componentData.defaultProps as DefaultProps; } } @@ -410,7 +427,8 @@ export default class StyledProcessor extends BaseProcessor { const { displayName } = this.options; const className = this.getClassName(displayName ? 'variant' : undefined); const styleObjOrFn = variant.style; - const finalStyle = this.processCss(styleObjOrFn, null); + const originalExpression = variant.originalExpression; + const finalStyle = this.processCss(styleObjOrFn, originalExpression ?? null); this.collectedStyles.push([className, finalStyle, null]); this.collectedVariants.push({ props: variant.props, @@ -419,9 +437,10 @@ export default class StyledProcessor extends BaseProcessor { } processCss( - styleObjOrFn: Function | object, + styleObjOrFn: ((args: Record) => void) | object, styleArg: ExpressionValue | null, variantsAccumulator?: VariantData[], + themeImportIdentifier?: string, ) { const { themeArgs = {} } = this.options as IOptions; const styleObj = typeof styleObjOrFn === 'function' ? styleObjOrFn(themeArgs) : styleObjOrFn; @@ -429,9 +448,14 @@ export default class StyledProcessor extends BaseProcessor { return ''; } if (styleObj.variants) { - variantsAccumulator?.push(...styleObj.variants); - delete styleObj.variants; + variantsAccumulator?.push( + ...styleObj.variants.map((variant: Omit) => ({ + ...variant, + originalExpression: styleArg, + })), + ); } + delete styleObj.variants; const res = cssFnValueToVariable({ styleObj, expressionValue: styleArg, @@ -439,6 +463,8 @@ export default class StyledProcessor extends BaseProcessor { this.getCustomVariableId(cssKey, source, hasUnit), filename: this.context.filename, options: this.options as IOptions, + includeThemeArg: typeof styleObjOrFn === 'function', + themeImportIdentifier, }); if (res.length) { this.collectedVariables.push(...res); diff --git a/packages/zero-tag-processor/src/sx.ts b/packages/zero-runtime/src/processors/sx.ts similarity index 95% rename from packages/zero-tag-processor/src/sx.ts rename to packages/zero-runtime/src/processors/sx.ts index 4e4433a4a36df2..cd1ac67fb1efd4 100644 --- a/packages/zero-tag-processor/src/sx.ts +++ b/packages/zero-runtime/src/processors/sx.ts @@ -3,10 +3,10 @@ import { BaseProcessor, buildSlug, toValidCSSIdentifier, validateParams } from ' import { ValueType, slugify } from '@linaria/utils'; import type { IVariableContext, ExpressionValue, Replacements, Rules } from '@linaria/utils'; import type { IOptions } from './styled'; -import { processCssObject } from './utils/processCssObject'; -import { cssFnValueToVariable } from './utils/cssFnValueToVariable'; +import { processCssObject } from '../utils/processCssObject'; +import { cssFnValueToVariable } from '../utils/cssFnValueToVariable'; -export default class SxProcessor extends BaseProcessor { +export class SxProcessor extends BaseProcessor { sxArguments: ExpressionValue[] = []; variableIdx: number = 0; @@ -139,13 +139,12 @@ export default class SxProcessor extends BaseProcessor { return typeof customSlugFn === 'function' ? customSlugFn(context) - : buildSlug(customSlugFn, context); + : buildSlug(customSlugFn, { ...context }); } // Implementation taken from Linaria - https://github.com/callstack/linaria/blob/master/packages/react/src/processors/styled.ts#L362 protected getVariableContext(cssKey: string, source: string, hasUnit: boolean): IVariableContext { const getIndex = () => { - // eslint-disable-next-line no-plusplus return this.variableIdx++; }; diff --git a/packages/zero-runtime/src/styled.d.ts b/packages/zero-runtime/src/styled.d.ts index 2d8dbfbfc70ec7..d67f84175fd11f 100644 --- a/packages/zero-runtime/src/styled.d.ts +++ b/packages/zero-runtime/src/styled.d.ts @@ -7,6 +7,7 @@ type Falsy = false | 0 | '' | null | undefined; type BaseDefaultProps = object; +// eslint-disable-next-line @typescript-eslint/no-explicit-any export type NoInfer = [T][T extends any ? 0 : never]; type FastOmit = { [K in keyof T as K extends U ? never : K]: T[K]; @@ -14,7 +15,7 @@ type FastOmit = { export type Substitute = FastOmit & B; export interface StyledVariants { - props: Partial; + props: Partial | ((props: Props) => boolean); style: CSSObject; } @@ -54,7 +55,10 @@ export interface StyledComponent string; } -export interface CreateStyledComponent { +export interface CreateStyledComponent< + Component extends React.ElementType, + OuterProps extends object, +> { /** * @typeparam Props: Additional props to add to the styled component */ @@ -70,7 +74,8 @@ export interface StyledOptions, ) => (string | Falsy) | Array; } diff --git a/packages/zero-runtime/src/styled.js b/packages/zero-runtime/src/styled.js deleted file mode 100644 index 093dd5aa7f4576..00000000000000 --- a/packages/zero-runtime/src/styled.js +++ /dev/null @@ -1,158 +0,0 @@ -import * as React from 'react'; -import clsx from 'clsx'; - -function getVariantClasses(componentProps, variants) { - const { ownerState = {} } = componentProps; - const variantClasses = variants - .filter(({ props: variantProps }) => - Object.entries(variantProps).every(([propKey, propValue]) => { - return ownerState[propKey] === propValue || componentProps[propKey] === propValue; - }), - ) - .map(({ className }) => className); - return variantClasses; -} - -/** - * @param {string} propKey - * @returns {boolean} - */ -function defaultShouldForwardProp(propKey) { - return propKey !== 'sx' && propKey !== 'as' && propKey !== 'ownerState'; -} - -/** - * @typedef {typeof defaultShouldForwardProp} ShouldForwardProp - */ - -/** - * @TODO - Filter props and only pass necessary props to children - * - * This is the runtime `styled` function that finally renders the component - * after transpilation through linaria. It makes sure to add the base classes, - * variant classes if they satisfy the prop value and also adds dynamic css - * variables at runtime, if any. - * @param {string | Function} tag - * @param {Object} options - * @param {string} options.displayName Set by linaria. Mostly is same as the variable name. For this code, ```const Comp = styled(...)(...)```, `displayName` will be `Comp`. - * @param {string[]} options.classes List of class names that reference the inline css object styles. - * @param {Object} options.vars Dynamically generated css variables inlined directly on the element for runtime styling. - * @param {Object[]} options.variants - * @param {Object} options.variants.props - * @param {string} options.variants.className Classname generated for this specific variant through styled processor. - * @param {string} options.name - * @param {string} options.slot - * @param {ShouldForwardProp} options.shouldForwardProp - * @param {Object} options.defaultProps Default props object copied over and inlined from theme object - */ -export default function styled(tag, options = {}) { - const { - displayName, - classes = [], - vars: cssVars = {}, - variants = [], - name, - slot, - defaultProps = {}, - shouldForwardProp = defaultShouldForwardProp, - } = options; - let componentName = 'Component'; - - if (name) { - if (slot) { - componentName = `${name}${slot}`; - } else { - componentName = name; - } - } else if (displayName) { - componentName = displayName; - } - - const StyledComponent = React.forwardRef(function StyledComponent( - // eslint-disable-next-line react/prop-types - { as, className, sx, style, ...props }, - ref, - ) { - // eslint-disable-next-line react/prop-types - const { ownerState, ...restProps } = props; - const Component = as ?? tag; - const varStyles = Object.entries(cssVars).reduce( - (acc, [cssVariable, [variableFunction, isUnitLess]]) => { - const value = variableFunction(props); - if (typeof value === 'undefined') { - return acc; - } - if (typeof value === 'string' || isUnitLess) { - acc[`--${cssVariable}`] = value; - } else { - acc[`--${cssVariable}`] = `${value}px`; - } - return acc; - }, - {}, - ); - // eslint-disable-next-line react/prop-types - const sxClass = typeof sx === 'string' ? sx : sx?.className; - // eslint-disable-next-line react/prop-types - const sxVars = sx && typeof sx !== 'string' ? sx.vars : undefined; - - if (sxVars) { - Object.entries(sxVars).forEach(([cssVariable, [value, isUnitLess]]) => { - if (typeof value === 'string' || isUnitLess) { - varStyles[`--${cssVariable}`] = value; - } else { - varStyles[`--${cssVariable}`] = `${value}px`; - } - }); - } - - const finalClassName = clsx(classes, sxClass, className, getVariantClasses(props, variants)); - const toPassProps = Object.keys(restProps) - .filter((item) => { - const res = shouldForwardProp(item); - if (res) { - return defaultShouldForwardProp(item); - } - return false; - }) - .reduce((acc, key) => { - acc[key] = restProps[key]; - return acc; - }, {}); - - // eslint-disable-next-line no-underscore-dangle - if (!Component.__isStyled || typeof Component === 'string') { - return ( - - ); - } - - return ( - - ); - }); - - StyledComponent.displayName = `Styled(${componentName})`; - StyledComponent.defaultProps = defaultProps; - // eslint-disable-next-line no-underscore-dangle - StyledComponent.__isStyled = true; - - return StyledComponent; -} diff --git a/packages/zero-runtime/src/styled.jsx b/packages/zero-runtime/src/styled.jsx new file mode 100644 index 00000000000000..d1cc1def3db5a6 --- /dev/null +++ b/packages/zero-runtime/src/styled.jsx @@ -0,0 +1,169 @@ +import * as React from 'react'; +import clsx from 'clsx'; + +function getVariantClasses(componentProps, variants) { + const { ownerState = {} } = componentProps; + const variantClasses = variants + .filter(({ props: variantProps }) => + typeof variantProps === 'function' + ? variantProps({ ...componentProps, ...componentProps.ownerState }) + : Object.entries(variantProps).every(([propKey, propValue]) => { + return ownerState[propKey] === propValue || componentProps[propKey] === propValue; + }), + ) + .map(({ className }) => className); + return variantClasses; +} + +/** + * @param {string} propKey + * @returns {boolean} + */ +function defaultShouldForwardProp(propKey) { + return propKey !== 'sx' && propKey !== 'as' && propKey !== 'ownerState'; +} + +/** + * @typedef {typeof defaultShouldForwardProp} ShouldForwardProp + */ + +/** + * This is the runtime `styled` function that finally renders the component + * after transpilation through linaria. It makes sure to add the base classes, + * variant classes if they satisfy the prop value and also adds dynamic css + * variables at runtime, if any. + * @param {string | Function} tag + * @param {Object} componentMeta + * @param {string} componentMeta.name + * @param {string} componentMeta.slot + * @param {ShouldForwardProp} componentMeta.shouldForwardProp + * @param {Object} componentMeta.defaultProps Default props object copied over and inlined from theme object + */ +export default function styled(tag, componentMeta = {}) { + const { + name, + slot, + defaultProps = {}, + shouldForwardProp = defaultShouldForwardProp, + } = componentMeta; + /** + * @TODO - Filter props and only pass necessary props to children + * + * This is the runtime `styled` function that finally renders the component + * after transpilation through linaria. It makes sure to add the base classes, + * variant classes if they satisfy the prop value and also adds dynamic css + * variables at runtime, if any. + * @param {string | Function} tag + * @param {Object} options + * @param {string} options.displayName Set by linaria. Mostly is same as the variable name. For this code, ```const Comp = styled(...)(...)```, `displayName` will be `Comp`. + * @param {string[]} options.classes List of class names that reference the inline css object styles. + * @param {Object} options.vars Dynamically generated css variables inlined directly on the element for runtime styling. + * @param {Object[]} options.variants + * @param {Object} options.variants.props + * @param {string} options.variants.className Classname generated for this specific variant through styled processor. + * @param {string} options.name + * @param {string} options.slot + * @param {ShouldForwardProp} options.shouldForwardProp + * @param {Object} options.defaultProps Default props object copied over and inlined from theme object + */ + function scopedStyledWithOptions(options = {}) { + const { displayName, classes = [], vars: cssVars = {}, variants = [] } = options; + let componentName = 'Component'; + + if (name) { + if (slot) { + componentName = `${name}${slot}`; + } else { + componentName = name; + } + } else if (displayName) { + componentName = displayName; + } + + const StyledComponent = React.forwardRef(function StyledComponent( + { as, className, sx, style, ...props }, + ref, + ) { + const { ownerState, ...restProps } = props; + const Component = as ?? tag; + const varStyles = Object.entries(cssVars).reduce( + (acc, [cssVariable, [variableFunction, isUnitLess]]) => { + const value = variableFunction(props); + if (typeof value === 'undefined') { + return acc; + } + if (typeof value === 'string' || isUnitLess) { + acc[`--${cssVariable}`] = value; + } else { + acc[`--${cssVariable}`] = `${value}px`; + } + return acc; + }, + {}, + ); + const sxClass = typeof sx === 'string' ? sx : sx?.className; + const sxVars = sx && typeof sx !== 'string' ? sx.vars : undefined; + + if (sxVars) { + Object.entries(sxVars).forEach(([cssVariable, [value, isUnitLess]]) => { + if (typeof value === 'string' || isUnitLess) { + varStyles[`--${cssVariable}`] = value; + } else { + varStyles[`--${cssVariable}`] = `${value}px`; + } + }); + } + + const finalClassName = clsx(classes, sxClass, className, getVariantClasses(props, variants)); + const toPassProps = Object.keys(restProps) + .filter((item) => { + const res = shouldForwardProp(item); + if (res) { + return defaultShouldForwardProp(item); + } + return false; + }) + .reduce((acc, key) => { + acc[key] = restProps[key]; + return acc; + }, {}); + + // eslint-disable-next-line no-underscore-dangle + if (!Component.__isStyled || typeof Component === 'string') { + return ( + + ); + } + + return ( + + ); + }); + + StyledComponent.displayName = `Styled(${componentName})`; + StyledComponent.defaultProps = defaultProps; + // eslint-disable-next-line no-underscore-dangle + StyledComponent.__isStyled = true; + + return StyledComponent; + } + + return scopedStyledWithOptions; +} diff --git a/packages/zero-runtime/src/styled.spec.tsx b/packages/zero-runtime/src/styled.spec.tsx deleted file mode 100644 index a3fa4f1c5d4379..00000000000000 --- a/packages/zero-runtime/src/styled.spec.tsx +++ /dev/null @@ -1,269 +0,0 @@ -/* eslint-disable material-ui/no-empty-box */ -import * as React from 'react'; -import { styled } from '@mui/zero-runtime'; -import { expectType } from '@mui/types'; -import Accordion from '@mui/material/Accordion'; - -declare module '@mui/zero-runtime/theme' { - interface ThemeArgs { - theme: { - palette: { - primary: Record; - }; - mixins: { - toolbar: Record; - }; - typography: { - body1: Record; - }; - }; - } -} - -const B = styled('a')<{ isRed?: boolean }>(({ theme }) => ({ - // @ts-expect-error isBlue is not a prop - color: (props) => (props.isBlue ? 'red' : 'blue'), - borderColor: (props) => (props.isRed ? 'red' : 'blue'), - backgroundColor: [theme.palette.primary.main, theme.palette.primary.darkMain], - '&:enabled': { - color: 'beige', - }, - '@layer utils': {}, - '@media (min-width:360px)': { - '.globalClass': { - color: [theme.palette.primary.main, theme.palette.primary.darkMain], - }, - }, - variants: [ - { - props: { - isRed: true, - }, - style: { - color: ({ isRed }) => (isRed ? 'red' : 'blue'), - }, - }, - ], -})); - -// @TODO - Fix for case with multiple variants or multiple prop keys -// in the same styled definition -// @ts-expect-error isBlue is not a prop -const B1 = styled('a')<{ isRed?: boolean }>(({ theme }) => ({ - color: (props) => (props.isRed ? 'red' : 'blue'), - variants: [ - { - props: { - isBlue: true, - }, - style: { - color: ({ isRed }) => (isRed ? 'red' : 'blue'), - }, - }, - ], -})); - -// @ts-expect-error Type argument should be a key:value object -const B2 = styled.a({ - color: 'red', -}); - -const bElement = ; - -// @ts-expect-error isBlue is not a prop -const bElement2 = ; - -const A = styled(B, { - overridesResolver(props) { - return false; - }, -})<{ isBlue?: boolean }>({ - color: 'red', - backgroundColor: (props) => (props.isBlue ? 'red' : 'blue'), -}); - -const Box = styled('div')(({ theme }) => ({ - color: theme.palette.primary.main, -})); - -function WorksWithNoTheme() { - ; -} - -const StyledToolbar = styled('div')(({ theme }) => ({ - ...theme.mixins.toolbar, -})); - -const StyledSpan = styled('span')(({ theme }) => ({ - ...theme.typography.body1, -})); - -interface PropsFooVariant { - variant: 'foo'; -} -interface PropsBarVariant { - variant: 'bar'; -} -function Component(props: PropsFooVariant | PropsBarVariant) { - return
; -} -const StyledComponent = styled(Component)(({ theme }) => ({})); -const rendered = ( - - - - -); - -/** - * Test styleOverrides callback types - */ -interface ButtonProps { - startIcon?: React.ReactNode; - endIcon?: React.ReactNode; - color?: 'primary'; - variant?: 'contained'; -} - -const ButtonRoot = styled('button', { - name: 'MuiButton', - slot: 'Root', - overridesResolver: (props, styles) => styles.root, -})<{ ownerState: ButtonProps }>({}); - -const ButtonIcon = styled('span', { - name: 'MuiButton', - slot: 'Icon', - overridesResolver: (props, styles) => styles.icon, -})<{ ownerState: ButtonProps }>({}); - -function Button({ - children, - startIcon, - endIcon, - color = 'primary', - variant = 'contained', - ...props -}: React.PropsWithChildren) { - const ownerState = { startIcon, endIcon, color, variant, ...props }; - return ( - - {startIcon && {startIcon}} - {children} - {endIcon && {endIcon}} - - ); -} - -function variantsAPI() { - const ObjectSyntax = styled('div')<{ foo?: string; bar?: number }>({ - variants: [ - { - props: { foo: 'a' }, - style: { color: 'blue' }, - }, - ], - }); - - const FunctionSyntax = styled('div')<{ foo?: string; bar?: number }>(() => ({ - variants: [ - { - props: { foo: 'a' }, - style: { color: 'blue' }, - }, - ], - })); - - const WrongUsage = styled('div')<{ foo?: string; bar?: number }>({ - color: [ - { - // @ts-expect-error the API is not valid for CSS properties - props: { foo: 'a' }, - style: { color: 'blue' }, - }, - ], - }); -} - -const InitialButton = styled('button')<{ isRed?: boolean }>({ - color: 'red', -}); -InitialButton.defaultProps = { - type: 'button', - // @ts-expect-error href is not present in button - href: '/about', -}; - -const InitialLink = styled.a<{ isActive?: boolean }>(({ theme }) => ({ - color: 'black', - variants: [ - { - props: { - isActive: true, - }, - style: { - color: 'blue', - }, - }, - ], -})); - -const WrapperComponent = styled(Component)({ - variants: [ - { - props: { - variant: 'bar', - }, - style: { - boxSizing: 'border-box', - }, - }, - ], -}); - -const LocalAccordion = styled(Accordion)({ - color: 'red', -}); - -function App() { - const elementRef = React.useRef(null); - const divRef = React.useRef(null); - return ( - - {/* @ts-expect-error ref expects HTMLButtonElement */} - - { - expectType, typeof e>(e); - }} - /> - ({ - color: 'red', - backgroundColor: [theme.palette.primary.main], - })} - onClick={(e) => { - expectType, typeof e>(e); - }} - /> - {/* @ts-expect-error href is not present in button */} - {}} /> - {/* @ts-expect-error isBlue is not specified in additional props */} - {}} /> - - - - Hello - - - ); -} diff --git a/packages/zero-runtime/src/styled.test.js b/packages/zero-runtime/src/styled.test.js deleted file mode 100644 index d583b9f405e1cf..00000000000000 --- a/packages/zero-runtime/src/styled.test.js +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from 'react'; -import { createRenderer } from '@mui-internal/test-utils'; -import { styled } from '@mui/zero-runtime'; -import { expect } from 'chai'; - -describe('styled', () => { - const { render } = createRenderer(); - it('should not set css variable where the value is undefined', () => { - const Component = styled('div', { - displayName: 'Component', - classes: 'component', - vars: { - 'var-1': [({ isBlue }) => (isBlue ? 'blue' : undefined), true], - 'var-2': [() => 'red', true], - }, - shouldForwardProp: (propKey) => propKey !== 'isBlue', - }); - const screen = render( - - Hello - , - ); - expect(screen.getByTestId('component')).attribute('style', '--var-2: red;'); - screen.rerender( - - Hello - , - ); - expect(screen.getByTestId('component')).attribute('style', '--var-2: red; --var-1: blue;'); - }); -}); diff --git a/packages/zero-runtime/src/theme.d.ts b/packages/zero-runtime/src/theme.ts similarity index 100% rename from packages/zero-runtime/src/theme.d.ts rename to packages/zero-runtime/src/theme.ts diff --git a/packages/zero-tag-processor/src/utils/checkStaticObjectOrArray.ts b/packages/zero-runtime/src/utils/checkStaticObjectOrArray.ts similarity index 100% rename from packages/zero-tag-processor/src/utils/checkStaticObjectOrArray.ts rename to packages/zero-runtime/src/utils/checkStaticObjectOrArray.ts diff --git a/packages/zero-runtime/src/utils/convertAtomicsToCss.ts b/packages/zero-runtime/src/utils/convertAtomicsToCss.ts new file mode 100644 index 00000000000000..c887d6a68973a5 --- /dev/null +++ b/packages/zero-runtime/src/utils/convertAtomicsToCss.ts @@ -0,0 +1,92 @@ +import cssesc from 'cssesc'; + +export type Atomics = { + conditions: Record; + defaultCondition: string; + properties: { + [key: string]: string[]; + }; + shorthands: Record; +}; + +export type RuntimeConfig = { + conditions: string[]; + styles: Record>>; + shorthands: Atomics['shorthands']; +}; + +function getClassName(...items: string[]) { + return cssesc(items.filter(Boolean).join('_')); +} + +export function convertAtomicsToCss( + { conditions = {}, defaultCondition, properties, shorthands = {} }: Atomics, + mainClassName: string, + isGlobal = false, + debug = false, + prefix = 'Mui', +) { + const runtimeConfig: RuntimeConfig = { + styles: {}, + shorthands, + conditions: Object.keys(conditions), + }; + let count = 1; + function getCount() { + const val = count; + count += 1; + return val; + } + + const classes: { + className: string; + css: object; + }[] = []; + + Object.entries(conditions).forEach(([conditionName, mediaQueryStr]) => { + Object.entries(properties).forEach(([cssPropertyName, propertyValues]) => { + propertyValues.forEach((propertyValue) => { + const className = + isGlobal || debug + ? getClassName( + prefix, + cssPropertyName, + conditionName ?? 'default', + propertyValue, + !isGlobal ? mainClassName : '', + ) + : `${mainClassName}${getCount()}`; + if (defaultCondition === conditionName || !mediaQueryStr) { + classes.push({ + className, + css: { + [cssPropertyName]: propertyValue, + }, + }); + } else { + classes.push({ + className, + css: { + [mediaQueryStr]: { + [cssPropertyName]: propertyValue, + }, + }, + }); + } + const classMap = runtimeConfig.styles[cssPropertyName] ?? {}; + const conditionClassMap = classMap[propertyValue] ?? {}; + conditionClassMap[conditionName] = className; + if (conditionName === defaultCondition) { + conditionClassMap['$$default'] = className; + } + classMap[propertyValue] = conditionClassMap; + runtimeConfig.styles[cssPropertyName] = classMap; + }); + }); + }); + + return { + classes, + runtimeConfig, + }; +} diff --git a/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts b/packages/zero-runtime/src/utils/cssFnValueToVariable.ts similarity index 54% rename from packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts rename to packages/zero-runtime/src/utils/cssFnValueToVariable.ts index ab5ecd6ee36f2f..cee4a9d1263d55 100644 --- a/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts +++ b/packages/zero-runtime/src/utils/cssFnValueToVariable.ts @@ -1,4 +1,4 @@ -import type { ExpressionValue } from '@linaria/utils'; +import type { ExpressionValue, FunctionValue } from '@linaria/utils'; import { transformSync, type Node } from '@babel/core'; import { parseExpression } from '@babel/parser'; import type { Expression } from '@linaria/tags'; @@ -7,7 +7,7 @@ import { isUnitLess } from './isUnitLess'; import { cssFunctionTransformerPlugin } from './cssFunctionTransformerPlugin'; interface StyleObj { - [key: string]: string | number | Function | StyleObj; + [key: string]: string | number | (() => void) | StyleObj; } export type PluginCustomOptions = { @@ -27,20 +27,51 @@ type CssFnValueToVariableParams = { getVariableName: (cssKey: string, source: string, hasUnit: boolean) => string; filename?: string | null; options: PluginCustomOptions; + includeThemeArg?: boolean; + themeImportIdentifier?: string; }; +// const expressionCache = new WeakMap(); + +// @TODO - Implement default theme argument for non-theme config as well. +function parseAndWrapExpression( + functionString: string, + expressionValue?: FunctionValue, + themeImportIdentifier?: string, +) { + if (!expressionValue) { + return parseExpression(functionString); + } + const expression = parseExpression(functionString); + if (expression.type === 'FunctionExpression' || expression.type === 'ArrowFunctionExpression') { + // let parsedParentExpression = expressionCache.get(expressionValue); + // if (!parsedParentExpression) { + // parsedParentExpression = parseExpression(expressionValue.source); + // if (!parsedParentExpression) { + // throw new Error("MUI: Could not parse styled function's source."); + // } + // } + expression.params.push( + t.assignmentPattern(t.identifier('theme'), t.identifier(themeImportIdentifier ?? 'theme')), + ); + } + return expression; +} + function transformThemeKeysInFn( styleKey: string, functionString: string, options: PluginCustomOptions, filename?: string, + expressionValue?: FunctionValue, + themeImportIdentifier?: string, ) { const { themeArgs: { theme } = {} } = options; // return the function as-is if sxConfig does not contain // this css key if (!theme) { - return parseExpression(functionString); + return parseAndWrapExpression(functionString, expressionValue, themeImportIdentifier); } const result = transformSync(functionString, { @@ -60,15 +91,23 @@ function transformThemeKeysInFn( }); const firstItem = result?.ast?.program.body[0]; if (!firstItem) { - return parseExpression(functionString); + return parseAndWrapExpression(functionString, expressionValue, themeImportIdentifier); } + const defaultThemeParam = t.assignmentPattern( + t.identifier('theme'), + t.identifier(themeImportIdentifier ?? 'theme'), + ); if (firstItem.type === 'ExpressionStatement') { - return firstItem.expression; + const { expression } = firstItem; + if (expression.type === 'ArrowFunctionExpression' || expression.type === 'FunctionExpression') { + expression.params.push(defaultThemeParam); + } + return expression; } if (firstItem.type === 'FunctionDeclaration') { - return t.functionExpression(null, firstItem.params, firstItem.body); + return t.functionExpression(null, [...firstItem.params, defaultThemeParam], firstItem.body); } - return parseExpression(functionString); + return parseAndWrapExpression(functionString, expressionValue, themeImportIdentifier); } function iterateAndReplaceFunctions( @@ -78,6 +117,8 @@ function iterateAndReplaceFunctions( options: PluginCustomOptions, acc: [string, Node, boolean][], filename?: string, + themeImportIdentifier?: string, + includeThemeArg = false, ) { const css = styleObj as StyleObj; Object.keys(css).forEach((key) => { @@ -85,7 +126,16 @@ function iterateAndReplaceFunctions( if (typeof value === 'object') { if (!Array.isArray(value)) { - iterateAndReplaceFunctions(value, expressionValue, getVariableName, options, acc, filename); + iterateAndReplaceFunctions( + value, + expressionValue, + getVariableName, + options, + acc, + filename, + themeImportIdentifier, + includeThemeArg, + ); } return; } @@ -96,7 +146,14 @@ function iterateAndReplaceFunctions( try { const fnString = value.toString(); - const expression = transformThemeKeysInFn(key, fnString, options, filename); + const expression = transformThemeKeysInFn( + key, + fnString, + options, + filename, + includeThemeArg && expressionValue ? (expressionValue as FunctionValue) : undefined, + themeImportIdentifier, + ); const unitLess = isUnitLess(key); const variableId = getVariableName(key, fnString, unitLess); acc.push([variableId, expression, unitLess]); @@ -104,11 +161,13 @@ function iterateAndReplaceFunctions( } catch (ex) { const err = expressionValue?.buildCodeFrameError( (ex as Error).message || 'Could not parse function expression.', - ); + ) as Error; if (!err) { throw ex; } - err.cause = ex; + if ('cause' in err) { + err.cause = ex; + } throw err; } }); @@ -123,6 +182,8 @@ export function cssFnValueToVariable({ getVariableName, filename, options, + themeImportIdentifier, + includeThemeArg = false, }: CssFnValueToVariableParams) { const acc: [string, Expression, boolean][] = []; iterateAndReplaceFunctions( @@ -132,6 +193,8 @@ export function cssFnValueToVariable({ options, acc, filename ?? undefined, + themeImportIdentifier, + includeThemeArg, ); return acc; } diff --git a/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts b/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts similarity index 79% rename from packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts rename to packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts index 4719701fe69966..b814384c1a6432 100644 --- a/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts +++ b/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts @@ -1,8 +1,8 @@ import { declare } from '@babel/helper-plugin-utils'; import defaultSxConfig from '@mui/system/styleFunctionSx/defaultSxConfig'; import get from 'lodash.get'; -import type { Theme } from '@mui/material/styles'; import type { PluginCustomOptions } from './cssFnValueToVariable'; +import { Theme } from './generateCss'; type BabelPluginOptions = { styleKey: string; @@ -29,8 +29,8 @@ const cssFunctionTransformerPlugin = declare((api, pluginOpt const typedTheme = theme as Theme & { vars?: Theme; }; - const config = typedTheme?.unstable_sxConfig ?? defaultSxConfig; - const cssPropOptions = config[styleKey]; + const config = (typedTheme?.unstable_sxConfig ?? defaultSxConfig) as Theme; + const cssPropOptions = config[styleKey] as Theme; const themeKey = cssPropOptions?.themeKey; const finalPrefix = cssVariablesPrefix ? `${cssVariablesPrefix}-` : ''; @@ -48,22 +48,21 @@ const cssFunctionTransformerPlugin = declare((api, pluginOpt !arrowFnExpression.isArrowFunctionExpression() && !arrowFnExpression.isFunctionExpression() ) { - return; } // @NOTE: Very quick and dirty way of checking usage of `theme` // variable inside the function. May give false positives in // some cases. Refine over time as bugs are reported. - arrowFnExpression.traverse({ - Identifier(path) { - const name = path.node.name; - const binding = path.scope.getBinding(name); - if (name === 'theme' && !binding) { - throw new Error( - 'You cannot use `theme` or other arguments inside runtime functions. Please use token shorthands (like `primary.main` for `theme.palette.primary.main`) if you want to access theme values.', - ); - } - }, - }); + // arrowFnExpression.traverse({ + // Identifier(path) { + // const name = path.node.name; + // const binding = path.scope.getBinding(name); + // if (name === 'theme' && !binding) { + // throw new Error( + // 'You cannot use `theme` or other arguments inside runtime functions. Please use token shorthands (like `primary.main` for `theme.palette.primary.main`) if you want to access theme values.', + // ); + // } + // }, + // }); }, }, // @TODO - Maybe add support for plain strings in template diff --git a/packages/zero-tag-processor/src/utils/emotion.ts b/packages/zero-runtime/src/utils/emotion.ts similarity index 100% rename from packages/zero-tag-processor/src/utils/emotion.ts rename to packages/zero-runtime/src/utils/emotion.ts diff --git a/packages/zero-runtime/src/utils/generateCss.ts b/packages/zero-runtime/src/utils/generateCss.ts new file mode 100644 index 00000000000000..8835e37ea4c0ce --- /dev/null +++ b/packages/zero-runtime/src/utils/generateCss.ts @@ -0,0 +1,158 @@ +import set from 'lodash.set'; +import type { PluginCustomOptions } from './cssFnValueToVariable'; +import { css, cache } from './emotion'; + +type Primitive = string | number | null | undefined; +type CssVarsObject = Record; + +type ExtendTheme = { + cssVarPrefix?: string; + colorSchemes: Record; + generateCssVars: (colorScheme?: string) => { + css: CssVarsObject; + }; + getColorSchemeSelector?: (colorScheme?: string) => string; +}; + +export type Theme = { + [key: 'unstable_sxConfig' | string]: string | number | Theme; +}; + +type CssGenerationOptions = { + injectInRoot?: boolean; + defaultThemeKey?: string; +}; + +type RelevantTokenKey = + | 'palette' + | 'shadows' + | 'shape' + | 'typography' + | 'zIndex' + | 'direction' + | 'transitions'; +const TOP_LEVEL_TOKEN_KEYS: RelevantTokenKey[] = [ + 'palette', + 'shadows', + 'shape', + 'typography', + 'zIndex', + 'direction', + 'transitions', +]; + +type Walkable = { + [Key in string | number]: Primitive | Walkable; +}; + +function iterateObject( + tokenObject: Primitive | T, + prefix: string[], + fn: (value: Primitive, path: string[]) => void, +) { + if ( + tokenObject === null || + typeof tokenObject === 'string' || + typeof tokenObject === 'number' || + typeof tokenObject === 'boolean' + ) { + fn(tokenObject, prefix); + } else if (Array.isArray(tokenObject)) { + tokenObject.forEach((item, index) => { + iterateObject(item, prefix.concat(`${index}`), fn); + }); + } else if (typeof tokenObject === 'object') { + Object.entries(tokenObject).forEach(([key, value]) => { + iterateObject(value, prefix.concat(key), fn); + }); + } +} + +function generateCssForTheme(theme: Theme, prefix = ['']) { + const cssVarsObject: CssVarsObject = {}; + TOP_LEVEL_TOKEN_KEYS.forEach((themeKey: RelevantTokenKey) => { + const nestedPrefix = prefix.concat(themeKey); + const tokenValue = theme[themeKey]; + iterateObject(tokenValue as Walkable, nestedPrefix, (value, path: string[]) => { + const cssVariableName = `--${path.filter(Boolean).join('-')}`; + cssVarsObject[cssVariableName] = + typeof value === 'string' ? value : value ? value.toString() : null; + }); + }); + return cssVarsObject; +} + +function generateCssFromExtendTheme(theme: ExtendTheme, injectInRoot = false) { + const { cssVarPrefix = 'mui' } = theme; + let cssStr = ''; + Object.keys(theme.colorSchemes).forEach((colorScheme) => { + let selector = + theme.getColorSchemeSelector?.(colorScheme) ?? + `[data-${cssVarPrefix}-color-scheme="${colorScheme}"]`; + if (injectInRoot && colorScheme === 'light') { + selector = `:root, ${selector}`; + } + const cssObject = theme.generateCssVars(colorScheme).css; + const cssClass = css({ + [selector]: cssObject, + }); + cssStr += cache.registered[cssClass]; + }); + return cssStr; +} + +export function generateCss( + options: PluginCustomOptions, + generationOptions: CssGenerationOptions = {}, +) { + const { injectInRoot = true, defaultThemeKey = 'theme' } = generationOptions; + const { cssVariablesPrefix = 'mui', themeArgs } = options; + if (!themeArgs) { + return ''; + } + let cssStr = ''; + Object.entries(themeArgs).forEach(([themeKey, theme]) => { + if ( + theme && + typeof theme === 'object' && + 'generateCssVars' in theme && + typeof theme.generateCssVars === 'function' + ) { + cssStr += generateCssFromExtendTheme(theme as ExtendTheme, injectInRoot); + return; + } + const cssVarsObject = generateCssForTheme(theme as Theme, [cssVariablesPrefix]); + const cssThemeObject: Record = {}; + if (themeKey === defaultThemeKey && injectInRoot) { + cssThemeObject[':root'] = cssVarsObject; + } else { + cssThemeObject[`.${themeKey}`] = cssVarsObject; + } + const cssClass = css(cssThemeObject); + cssStr += cache.registered[cssClass]; + }); + return cssStr; +} + +export function generateThemeTokens(theme: unknown, prefix = '') { + if (!theme || typeof theme !== 'object') { + return {}; + } + // is created using extendTheme + if ('vars' in theme && theme.vars) { + return { + vars: theme.vars, + }; + } else { + const tokens = {}; + iterateObject(theme as Walkable, [], (value, path) => { + if (!TOP_LEVEL_TOKEN_KEYS.includes(path[0] as RelevantTokenKey)) { + return; + } + const filteredPath = path.filter(Boolean); + const cssVariableName = `--${[prefix, ...filteredPath].filter(Boolean).join('-')}`; + set(tokens, filteredPath, `var(${cssVariableName}, ${value})`); + }); + return tokens; + } +} diff --git a/packages/zero-tag-processor/src/utils/index.ts b/packages/zero-runtime/src/utils/index.ts similarity index 51% rename from packages/zero-tag-processor/src/utils/index.ts rename to packages/zero-runtime/src/utils/index.ts index 1e01216b47da43..b2fa96784748fa 100644 --- a/packages/zero-tag-processor/src/utils/index.ts +++ b/packages/zero-runtime/src/utils/index.ts @@ -1 +1,3 @@ export type { PluginCustomOptions } from './cssFnValueToVariable'; +export * from './generateCss'; +export * from './preprocessor'; diff --git a/packages/zero-tag-processor/src/utils/isUnitLess.ts b/packages/zero-runtime/src/utils/isUnitLess.ts similarity index 94% rename from packages/zero-tag-processor/src/utils/isUnitLess.ts rename to packages/zero-runtime/src/utils/isUnitLess.ts index 34463093dc9104..d1fdc5bf6ffa2c 100644 --- a/packages/zero-tag-processor/src/utils/isUnitLess.ts +++ b/packages/zero-runtime/src/utils/isUnitLess.ts @@ -52,5 +52,5 @@ const unitlessKeys: { [key: string]: 1 } = { }; export function isUnitLess(cssKey: string) { - return unitlessKeys[cssKey] === 1; + return unitlessKeys[cssKey] === 1 || cssKey.startsWith('--'); } diff --git a/packages/zero-tag-processor/src/pre-linaria-plugin.ts b/packages/zero-runtime/src/utils/pre-linaria-plugin.ts similarity index 89% rename from packages/zero-tag-processor/src/pre-linaria-plugin.ts rename to packages/zero-runtime/src/utils/pre-linaria-plugin.ts index 955c840745bf40..d107175ef37f2f 100644 --- a/packages/zero-tag-processor/src/pre-linaria-plugin.ts +++ b/packages/zero-runtime/src/utils/pre-linaria-plugin.ts @@ -1,8 +1,8 @@ import { addNamed } from '@babel/helper-module-imports'; import { declare } from '@babel/helper-plugin-utils'; -import { sxObjectExtractor } from './utils/sxObjectExtractor'; +import { sxObjectExtractor } from './sxObjectExtractor'; -const babelPlugin = declare((api) => { +export const babelPlugin = declare((api) => { api.assertVersion(7); const { types: t } = api; return { @@ -35,7 +35,7 @@ const babelPlugin = declare((api) => { return; } sxObjectExtractor(expressionPath); - const sxIdentifier = addNamed(namePath, 'sx', '@mui/zero-runtime'); + const sxIdentifier = addNamed(namePath, 'sx', process.env.PACKAGE_NAME as string); expressionPath.replaceWith( t.callExpression(sxIdentifier, [expressionPath.node, t.identifier(tagName.node.name)]), ); @@ -61,11 +61,9 @@ const babelPlugin = declare((api) => { } const jsxElement = parentJsxCall.get('arguments')[0]; sxObjectExtractor(valuePath); - const sxIdentifier = addNamed(keyPath, 'sx', '@mui/zero-runtime'); + const sxIdentifier = addNamed(keyPath, 'sx', process.env.PACKAGE_NAME as string); valuePath.replaceWith(t.callExpression(sxIdentifier, [valuePath.node, jsxElement.node])); }, }, }; }); - -export default babelPlugin; diff --git a/packages/zero-tag-processor/src/preprocessor.ts b/packages/zero-runtime/src/utils/preprocessor.ts similarity index 91% rename from packages/zero-tag-processor/src/preprocessor.ts rename to packages/zero-runtime/src/utils/preprocessor.ts index 2f343ee18ec62f..a290743b7244f9 100644 --- a/packages/zero-tag-processor/src/preprocessor.ts +++ b/packages/zero-runtime/src/utils/preprocessor.ts @@ -4,7 +4,7 @@ import { serialize, compile, stringify, middleware } from 'stylis'; function globalSelector(element: Element) { switch (element.type) { case 'rule': - element.props = (element.props as string[]).map((value: any) => { + element.props = (element.props as string[]).map((value) => { if (value.match(/(:where|:is)\(/)) { value = value.replace(/\.[^:]+(:where|:is)/, '$1'); return value; diff --git a/packages/zero-tag-processor/src/utils/processCssObject.ts b/packages/zero-runtime/src/utils/processCssObject.ts similarity index 100% rename from packages/zero-tag-processor/src/utils/processCssObject.ts rename to packages/zero-runtime/src/utils/processCssObject.ts diff --git a/packages/zero-tag-processor/src/utils/sxObjectExtractor.ts b/packages/zero-runtime/src/utils/sxObjectExtractor.ts similarity index 98% rename from packages/zero-tag-processor/src/utils/sxObjectExtractor.ts rename to packages/zero-runtime/src/utils/sxObjectExtractor.ts index 48b7f1020897f8..cf2729cfb7dd38 100644 --- a/packages/zero-tag-processor/src/utils/sxObjectExtractor.ts +++ b/packages/zero-runtime/src/utils/sxObjectExtractor.ts @@ -69,7 +69,7 @@ function traverseObjectExpression( 'Arrow functions are not supported as values of sx object.', ); } else if (!value.isLiteral() && !isStaticObjectOrArrayExpression(value)) { - const identifiers = findIdentifiers([value], 'referenced'); + const identifiers = findIdentifiers([value], 'reference'); const themeIdentifiers: NodePath[] = []; const localIdentifiers: NodePath[] = []; identifiers.forEach((id) => { diff --git a/packages/zero-runtime/src/utils/valueToLiteral.ts b/packages/zero-runtime/src/utils/valueToLiteral.ts new file mode 100644 index 00000000000000..96c037b0c6b9bd --- /dev/null +++ b/packages/zero-runtime/src/utils/valueToLiteral.ts @@ -0,0 +1,124 @@ +import { types as t } from '@babel/core'; +import type { ExpressionValue, Serializable } from '@linaria/utils'; +import { isBoxedPrimitive } from '@linaria/utils'; +import { parseExpression } from '@babel/parser'; + +export function isSerializable(o: unknown): o is Serializable { + if (Array.isArray(o)) { + return o.every(isSerializable); + } + + if (o === null) return true; + + if (isBoxedPrimitive(o)) return true; + + if (typeof o === 'object') { + return Object.values(o).every(isSerializable); + } + + return ( + typeof o === 'function' || + typeof o === 'string' || + typeof o === 'number' || + typeof o === 'boolean' + ); +} + +export function parseAndGenerateFunction(fnString: string, expression?: ExpressionValue) { + try { + const exp = parseExpression(fnString); + // a function or an arrow function expression + return exp as t.FunctionExpression | t.ArrowFunctionExpression; + } catch (ex) { + try { + const exp = parseExpression(`{${fnString}}`); + if (exp.type !== 'ObjectExpression') { + throw new Error('MUI: The expression must be an object literal.'); + } + const propMethod = exp.properties[0] as t.ObjectMethod; + return t.arrowFunctionExpression(propMethod.params, propMethod.body); + } catch (ex) { + throw ( + expression?.buildCodeFrameError(`MUI: Could not parse the expression '${fnString}'.`) ?? + new Error(`MUI: Could not parse the given expression ${fnString}`) + ); + } + } +} + +/** + * Converts a javascript primitive to its Babel AST node representation. + */ +export function valueToLiteral(value: unknown, expression?: ExpressionValue): t.Expression { + if (value === undefined) { + return { + type: 'Identifier', + name: 'undefined', + }; + } + + if (typeof value === 'function') { + return parseAndGenerateFunction(value.toString(), expression); + } + + if (isSerializable(value)) { + if (value === null) { + return { + type: 'NullLiteral', + }; + } + + if (typeof value === 'string') { + return { + type: 'StringLiteral', + value, + }; + } + + if (typeof value === 'number') { + return { + type: 'NumericLiteral', + value, + }; + } + + if (typeof value === 'boolean') { + return { + type: 'BooleanLiteral', + value, + }; + } + + if (Array.isArray(value)) { + return { + type: 'ArrayExpression', + elements: value.map((v) => valueToLiteral(v, expression)), + }; + } + + return { + type: 'ObjectExpression', + properties: Object.entries(value).map(([key, v]) => ({ + type: 'ObjectProperty', + key: key.match(/^[a-zA-Z]\w*$/) + ? { + type: 'Identifier', + name: key, + } + : { + type: 'StringLiteral', + value: key, + }, + value: valueToLiteral(v, expression), + computed: false, + shorthand: false, + })), + }; + } + + throw ( + expression?.buildCodeFrameError( + `The expression evaluated to '${value}', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(${expression.source})'.`, + ) ?? new Error(`Could not convert value: "${value}" to literal.`) + ); +} diff --git a/packages/zero-runtime/styles.css b/packages/zero-runtime/styles.css index 2671046eb47bc4..d27283bddcbe05 100644 --- a/packages/zero-runtime/styles.css +++ b/packages/zero-runtime/styles.css @@ -1,3 +1,3 @@ /** - * Placeholder file that gets populated with theme styles + * Placeholder file for generated theme */ diff --git a/packages/zero-runtime/theme/index.d.ts b/packages/zero-runtime/theme/index.d.ts new file mode 100644 index 00000000000000..7da9b781121a8a --- /dev/null +++ b/packages/zero-runtime/theme/index.d.ts @@ -0,0 +1 @@ +export * from '../build/theme'; diff --git a/packages/zero-runtime/theme/index.js b/packages/zero-runtime/theme/index.js new file mode 100644 index 00000000000000..f053ebf7976e37 --- /dev/null +++ b/packages/zero-runtime/theme/index.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/packages/zero-runtime/theme/index.mjs b/packages/zero-runtime/theme/index.mjs new file mode 100644 index 00000000000000..ff8b4c56321a33 --- /dev/null +++ b/packages/zero-runtime/theme/index.mjs @@ -0,0 +1 @@ +export default {}; diff --git a/packages/zero-runtime/tsconfig.build.json b/packages/zero-runtime/tsconfig.build.json index 05dec83dca2af2..80b6a0a8461245 100644 --- a/packages/zero-runtime/tsconfig.build.json +++ b/packages/zero-runtime/tsconfig.build.json @@ -1,16 +1,6 @@ { - // This config is for emitting declarations (.d.ts) only - // Actual .ts source files are transpiled via babel "extends": "./tsconfig.json", "compilerOptions": { - "composite": true, - "declaration": true, - "noEmit": false, - "emitDeclarationOnly": true, - "outDir": "build", - "rootDir": "./src" - }, - "include": ["./src/**/*.ts*"], - "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], - "references": [] + "composite": false + } } diff --git a/packages/zero-runtime/tsconfig.json b/packages/zero-runtime/tsconfig.json index d9f8bd647b62bd..590dcab8d84bc5 100644 --- a/packages/zero-runtime/tsconfig.json +++ b/packages/zero-runtime/tsconfig.json @@ -1,7 +1,13 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], "compilerOptions": { - "types": ["mocha", "node", "chai", "react"] - } + "target": "ES2015", + "allowJs": true, + "lib": ["ES2017", "ES2021.String", "DOM"], + "composite": true, + "noEmit": true, + "resolveJsonModule": true + }, + "include": ["src/**/*.ts"], + "exclude": ["./tsup.config.ts"] } diff --git a/packages/zero-runtime/tsup.config.ts b/packages/zero-runtime/tsup.config.ts new file mode 100644 index 00000000000000..c87ce3ef6fa047 --- /dev/null +++ b/packages/zero-runtime/tsup.config.ts @@ -0,0 +1,32 @@ +import { Options, defineConfig } from 'tsup'; +import config from '../../tsup.config'; +import packageJson from './package.json'; + +const processors = ['styled', 'sx', 'keyframes', 'generateAtomics']; +const external = ['react', 'react-is', 'prop-types']; + +const baseConfig: Options = { + ...(config as Options), + tsconfig: './tsconfig.build.json', + external, + env: { + PACKAGE_NAME: packageJson.name, + }, +}; + +export default defineConfig([ + { + ...baseConfig, + entry: ['./src/index.ts', './src/theme.ts'], + }, + { + ...baseConfig, + entry: processors.map((fn) => `./src/processors/${fn}.ts`), + outDir: 'processors', + }, + { + ...baseConfig, + entry: ['./src/utils/index.ts', './src/utils/pre-linaria-plugin.ts'], + outDir: 'utils', + }, +]); diff --git a/packages/zero-tag-processor/.eslintrc.json b/packages/zero-tag-processor/.eslintrc.json deleted file mode 100644 index 794e023d7cced9..00000000000000 --- a/packages/zero-tag-processor/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@typescript-eslint/consistent-type-imports": "error", - "import/prefer-default-export": "off" - } -} diff --git a/packages/zero-tag-processor/README.md b/packages/zero-tag-processor/README.md deleted file mode 100644 index 4faff8f921fce0..00000000000000 --- a/packages/zero-tag-processor/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# @mui/zero-tag-processor - -`styled` processor for Linaria to support CSSObject syntax with theme support. Exploratory package not meant for production as of yet. - -## TODOs - -### `styled` call features - -- [x] Replacing usage of theme tokens (`primary.main`) inside the dynamic functions with equivalent css variables at build time. -- [x] Restricting usage of `theme` object inside above functions. -- [x] Generating theme classes with all the theme tokens. -- [x] Optional processing of shorthands. -- [ ] Copying over some of the logic from `@mui/system` to the package (mainly `styleFunctionSx` and it's dependencies.) -- [ ] Typescript typings for `styled` -- [ ] Tagged template support. This version only supports css objects and strings. You can interpolate theme and return tagged string. _We'll probably revisit at the end as right now we are focussed on style objects_. diff --git a/packages/zero-tag-processor/package.json b/packages/zero-tag-processor/package.json deleted file mode 100644 index 9d6e45816f95f8..00000000000000 --- a/packages/zero-tag-processor/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@mui/zero-tag-processor", - "version": "0.0.1-alpha.0", - "private": true, - "author": "MUI Team", - "description": "Linaria tag processors for custom styled implementation.", - "main": "./src/index.ts", - "keywords": [ - "zero runtime", - "css-in-js", - "mui" - ], - "repository": { - "type": "git", - "url": "https://github.com/mui/material-ui.git", - "directory": "packages/zero-tag-processor" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/mui/material-ui/issues" - }, - "homepage": "@TODO", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", - "build:modern": "node ../../scripts/build.mjs modern", - "build:node": "node ../../scripts/build.mjs node", - "build:stable": "node ../../scripts/build.mjs stable", - "build:copy-files": "node ../../scripts/copyFiles.mjs", - "build:types": "node ../../scripts/buildTypes.mjs", - "prebuild": "rimraf build tsconfig.build.tsbuildinfo", - "release": "pnpm build && pnpm publish", - "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-babel-plugin/**/*.test.{js,ts,tsx}'", - "typescript": "tsc -p tsconfig.json", - "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" - }, - "dependencies": { - "@babel/core": "^7.23.7", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/parser": "^7.23.6", - "@babel/types": "^7.23.6", - "@emotion/css": "^11.11.2", - "@linaria/tags": "^4.5.4", - "@linaria/utils": "^4.5.3", - "@mui/system": "workspace:^", - "lodash.get": "^4.4.2", - "stylis": "^4.2.0" - }, - "devDependencies": { - "@mui/material": "workspace:^", - "@types/babel__core": "^7.20.5", - "@types/babel__helper-module-imports": "^7.18.3", - "@types/babel__helper-plugin-utils": "^7.10.3", - "@types/chai": "^4.3.11", - "@types/lodash.get": "^4.4.9", - "@types/mocha": "^10.0.6", - "@types/node": "^18.19.4", - "@types/stylis": "^4.2.0" - }, - "sideEffects": false, - "publishConfig": { - "access": "public", - "directory": "build" - }, - "engines": { - "node": ">=12.0.0" - } -} diff --git a/packages/zero-tag-processor/src/generateCss.ts b/packages/zero-tag-processor/src/generateCss.ts deleted file mode 100644 index 091f12b538066a..00000000000000 --- a/packages/zero-tag-processor/src/generateCss.ts +++ /dev/null @@ -1,78 +0,0 @@ -import type { Theme } from '@mui/material/styles'; -import type { PluginCustomOptions } from './utils/cssFnValueToVariable'; -import { css, cache } from './utils/emotion'; - -type CssGenerationOptions = { - injectInRoot?: boolean; - defaultThemeKey?: string; -}; - -type RelevantTokenKey = keyof Pick< - Theme, - 'palette' | 'shadows' | 'shape' | 'typography' | 'zIndex' | 'direction' | 'transitions' ->; -const topLevelTokenKeys: RelevantTokenKey[] = [ - 'palette', - 'shadows', - 'shape', - 'typography', - 'zIndex', - 'direction', - 'transitions', -]; - -type CssVarsObject = Record; - -function iterateObject( - tokenObject: object | string | number | boolean, - cssVarsObject: CssVarsObject, - prefix: string[], -) { - if (Array.isArray(tokenObject)) { - tokenObject.forEach((item, index) => { - iterateObject(item, cssVarsObject, prefix.concat(`${index}`)); - }); - } else if (typeof tokenObject === 'object') { - Object.entries(tokenObject).forEach(([key, value]) => { - iterateObject(value, cssVarsObject, prefix.concat(key)); - }); - } else if (['string', 'number', 'boolean'].includes(typeof tokenObject)) { - const cssVariableName = `--${prefix.filter(Boolean).join('-')}`; - cssVarsObject[cssVariableName] = - typeof tokenObject === 'string' ? tokenObject : tokenObject.toString(); - } -} - -function generateCssForTheme(theme: Theme, prefix = ['']) { - const cssVarsObject: CssVarsObject = {}; - topLevelTokenKeys.forEach((themeKey: RelevantTokenKey) => { - const nestedPrefix = prefix.concat(themeKey); - const tokenValue = theme[themeKey]; - iterateObject(tokenValue, cssVarsObject, nestedPrefix); - }); - return cssVarsObject; -} - -export function generateCss( - options: PluginCustomOptions, - generationOptions: CssGenerationOptions = {}, -) { - const { injectInRoot = true, defaultThemeKey = 'theme' } = generationOptions; - const { cssVariablesPrefix = 'mui', themeArgs } = options; - if (!themeArgs) { - return ''; - } - let cssStr = ''; - Object.entries(themeArgs).forEach(([themeKey, theme]) => { - const cssVarsObject = generateCssForTheme(theme as Theme, [cssVariablesPrefix]); - const cssThemeObject: Record = {}; - if (themeKey === defaultThemeKey && injectInRoot) { - cssThemeObject[':root'] = cssVarsObject; - } else { - cssThemeObject[`.${themeKey}`] = cssVarsObject; - } - const cssClass = css(cssThemeObject); - cssStr += cache.registered[cssClass]; - }); - return cssStr; -} diff --git a/packages/zero-tag-processor/src/utils/valueToLiteral.ts b/packages/zero-tag-processor/src/utils/valueToLiteral.ts deleted file mode 100644 index b7fcc6154d6116..00000000000000 --- a/packages/zero-tag-processor/src/utils/valueToLiteral.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type { types as t } from '@babel/core'; -import { type ExpressionValue, isSerializable } from '@linaria/utils'; - -/** - * Converts a javascript primitive to its Babel AST node representation. - */ -export function valueToLiteral(value: unknown, expression?: ExpressionValue): t.Expression { - if (value === undefined) { - return { - type: 'Identifier', - name: 'undefined', - }; - } - - if (isSerializable(value)) { - if (value === null) { - return { - type: 'NullLiteral', - }; - } - - if (typeof value === 'string') { - return { - type: 'StringLiteral', - value, - }; - } - - if (typeof value === 'number') { - return { - type: 'NumericLiteral', - value, - }; - } - - if (typeof value === 'boolean') { - return { - type: 'BooleanLiteral', - value, - }; - } - - if (Array.isArray(value)) { - return { - type: 'ArrayExpression', - elements: value.map((v) => valueToLiteral(v, expression)), - }; - } - - return { - type: 'ObjectExpression', - properties: Object.entries(value).map(([key, v]) => ({ - type: 'ObjectProperty', - key: key.match(/^[a-zA-Z]\w*$/) - ? { - type: 'Identifier', - name: key, - } - : { - type: 'StringLiteral', - value: key, - }, - value: valueToLiteral(v, expression), - computed: false, - shorthand: false, - })), - }; - } - - throw ( - expression?.buildCodeFrameError( - `The expression evaluated to '${value}', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(${expression.source})'.`, - ) ?? new Error('Could not convert value to literal.') - ); -} diff --git a/packages/zero-tag-processor/tsconfig.build.json b/packages/zero-tag-processor/tsconfig.build.json deleted file mode 100644 index d97878065b93d9..00000000000000 --- a/packages/zero-tag-processor/tsconfig.build.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - // This config is for emitting declarations (.d.ts) only - // Actual .ts source files are transpiled via babel - "extends": "./tsconfig.json", - "compilerOptions": { - "target": "ES2015", - "composite": true, - "declaration": true, - "noEmit": false, - "emitDeclarationOnly": true, - "outDir": "build", - "rootDir": "./src" - }, - "include": ["./src/**/*.ts*"], - "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], - "references": [ - { "path": "../mui-system/tsconfig.build.json" }, - { "path": "../mui-material/tsconfig.build.json" } - ] -} diff --git a/packages/zero-tag-processor/tsconfig.json b/packages/zero-tag-processor/tsconfig.json deleted file mode 100644 index f436e1e32dc6e6..00000000000000 --- a/packages/zero-tag-processor/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "lib": ["ES2022", "DOM"], - "target": "ES2015", - "types": ["mocha", "node", "chai"] - } -} diff --git a/packages/zero-unplugin/package.json b/packages/zero-unplugin/package.json new file mode 100644 index 00000000000000..d12a5e1f4be999 --- /dev/null +++ b/packages/zero-unplugin/package.json @@ -0,0 +1,35 @@ +{ + "name": "@mui/zero-unplugin", + "version": "0.0.1-alpha.5", + "main": "build/index.js", + "module": "build/index.mjs", + "types": "build/index.d.ts", + "scripts": { + "clean": "rimraf build types", + "watch": "tsup --watch --tsconfig tsconfig.build.json", + "build": "tsup --tsconfig tsconfig.build.json", + "typecheck": "tsc --noEmit -p ." + }, + "dependencies": { + "@babel/core": "^7.23.2", + "@linaria/babel-preset": "^5.0.4", + "@linaria/logger": "^5.0.0", + "@linaria/utils": "^5.0.2", + "unplugin": "^1.5.1" + }, + "devDependencies": { + "@mui/zero-runtime": "workspace:^", + "@types/babel__core": "^7.20.3" + }, + "peerDependencies": { + "@mui/zero-runtime": "workspace:^" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "files": [ + "build", + "package.json" + ] +} diff --git a/packages/zero-unplugin/src/index.ts b/packages/zero-unplugin/src/index.ts new file mode 100644 index 00000000000000..581387ec1178ab --- /dev/null +++ b/packages/zero-unplugin/src/index.ts @@ -0,0 +1,311 @@ +import { + UnpluginFactoryOutput, + WebpackPluginInstance, + createUnplugin, + VitePlugin, + UnpluginOptions, +} from 'unplugin'; +import { transformAsync } from '@babel/core'; +import type { PluginOptions as LinariaPluginOptions, Preprocessor } from '@linaria/babel-preset'; +import { TransformCacheCollection, transform } from '@linaria/babel-preset'; +import { createPerfMeter, asyncResolveFallback, slugify } from '@linaria/utils'; +import { + generateCss, + preprocessor as basePreprocessor, + generateThemeTokens, +} from '@mui/zero-runtime/utils'; + +type NextMeta = { + type: 'next'; + dev: boolean; + isServer: boolean; + outputCss: boolean; + placeholderCssFile: string; +}; + +type ViteMeta = { + type: 'vite'; +}; + +type WebpackMeta = { + type: 'webpack'; +}; + +type Meta = NextMeta | ViteMeta | WebpackMeta; + +export type PluginOptions = { + theme: Theme; + cssVariablesPrefix?: string; + injectDefaultThemeInRoot?: boolean; + transformLibraries?: string[]; + preprocessor?: Preprocessor; + debug?: boolean; + sourceMap?: boolean; + meta?: Meta; + asyncResolve?: (what: string) => string | null; + transformSx?: boolean; +} & Partial; + +const extensions = ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts']; + +function hasCorectExtension(fileName: string) { + return extensions.some((ext) => fileName.endsWith(ext)); +} + +const VIRTUAL_CSS_FILE = `\0zero-runtime-styles.css`; +const VIRTUAL_THEME_FILE = `\0zero-runtime-theme.js`; + +function isZeroRuntimeThemeFile(fileName: string) { + return fileName === VIRTUAL_CSS_FILE || fileName === VIRTUAL_THEME_FILE; +} + +function isZeroRuntimeProcessableFile(fileName: string, transformLibraries: string[]) { + const isNodeModule = fileName.includes('node_modules'); + const isTransformableFile = + isNodeModule && transformLibraries.some((libName) => fileName.includes(libName)); + return ( + hasCorectExtension(fileName) && + (isTransformableFile || !isNodeModule) && + !fileName.includes('runtime/build') + ); +} + +/** + * Next.js initializes the plugin multiple times. So all the calls + * have to share the same Maps. + */ +const globalCssFileLookup = new Map(); +const globalCssLookup = new Map(); + +const pluginName = 'ZeroWebpackPlugin'; + +export const plugin = createUnplugin((options) => { + const { + theme, + meta, + cssVariablesPrefix = 'mui', + injectDefaultThemeInRoot = true, + transformLibraries = [], + preprocessor = basePreprocessor, + asyncResolve: asyncResolveOpt, + debug = false, + sourceMap = false, + transformSx = true, + ...rest + } = options; + const themeArgs = { theme }; + const isExtendTheme = !!(theme && typeof theme === 'object' && 'vars' in theme && theme.vars); + const varPrefix: string = + isExtendTheme && 'cssVarPrefix' in theme + ? (theme.cssVarPrefix as string) ?? cssVariablesPrefix + : cssVariablesPrefix; + const linariaOptions = { + themeArgs: { + theme, + }, + cssVariablesPrefix: varPrefix, + ...rest, + }; + const cache = new TransformCacheCollection(); + const { emitter, onDone } = createPerfMeter(debug); + const cssLookup = meta?.type === 'next' ? globalCssLookup : new Map(); + const cssFileLookup = meta?.type === 'next' ? globalCssFileLookup : new Map(); + const isNext = meta?.type === 'next'; + const outputCss = isNext && meta.outputCss; + + const themeTokenCss = generateCss( + { themeArgs, cssVariablesPrefix: varPrefix }, + { + injectInRoot: injectDefaultThemeInRoot, + }, + ); + + const babelTransformPlugin: UnpluginOptions = { + name: 'zero-plugin-transform-babel', + enforce: 'post', + transformInclude(id) { + return isZeroRuntimeProcessableFile(id, transformLibraries); + }, + async transform(code, id) { + const result = await transformAsync(code, { + filename: id, + babelrc: false, + configFile: false, + plugins: [[`${process.env.RUNTIME_PACKAGE_NAME}/exports/sx-plugin`]], + }); + if (!result) { + return null; + } + return { + code: result.code ?? code, + map: result.map, + }; + }, + }; + const linariaTransformPlugin: UnpluginOptions = { + name: 'zero-plugin-transform-linaria', + enforce: 'post', + buildEnd() { + onDone(process.cwd()); + }, + transformInclude(id) { + return isZeroRuntimeProcessableFile(id, transformLibraries); + }, + async transform(code, id) { + const asyncResolve: typeof asyncResolveFallback = async (what, importer, stack) => { + const result = asyncResolveOpt?.(what); + if (typeof result === 'string') { + return result; + } + return await asyncResolveFallback(what, importer, stack); + }; + const transformServices = { + options: { + filename: id, + root: process.cwd(), + preprocessor, + pluginOptions: linariaOptions, + }, + cache, + eventEmitter: emitter, + }; + + const result = await transform(transformServices, code, asyncResolve); + + if (!result.cssText) { + return null; + } + + let { cssText } = result; + if (isNext && !outputCss) { + return { + code: result.code, + map: result.sourceMap, + }; + } + const slug = slugify(cssText); + const cssFilename = `${slug}.zero.css`; + + if (sourceMap && result.cssSourceMapText) { + const map = Buffer.from(result.cssSourceMapText).toString('base64'); + cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`; + } + + // Virtual modules do not work consistently in Next.js (the build is done at least + // thrice) resulting in error in subsequent builds. So we use a placeholder CSS + // file with the actual CSS content as part of the query params. + if (isNext) { + const data = `${meta.placeholderCssFile}?${encodeURIComponent( + JSON.stringify({ + filename: cssFilename, + source: cssText, + }), + )}`; + return { + code: `import ${JSON.stringify(data)};\n${result.code}`, + map: result.sourceMap, + }; + } + const cssId = `./${cssFilename}`; + cssFileLookup.set(cssId, cssFilename); + cssLookup.set(cssFilename, cssText); + return { + code: `import ${JSON.stringify(`./${cssFilename}`)};\n${result.code}`, + map: result.sourceMap, + }; + }, + }; + + const plugins: Array = [ + { + name: 'zero-plugin-theme-tokens', + enforce: 'pre', + webpack(compiler) { + compiler.hooks.normalModuleFactory.tap(pluginName, (nmf) => { + nmf.hooks.createModule.tap( + pluginName, + // @ts-expect-error CreateData is typed as 'object'... + (createData: { matchResource?: string; settings: { sideEffects?: boolean } }) => { + if (createData.matchResource && createData.matchResource.endsWith('.zero.css')) { + createData.settings.sideEffects = true; + } + }, + ); + }); + }, + ...(isNext + ? { + transformInclude(id) { + return ( + // this file should exist in the package + id.endsWith('@mui/zero-runtime/styles.css') || + id.endsWith('/runtime/styles.css') || + id.endsWith('@mui/zero-runtime/theme') || + id.endsWith('/runtime/theme.js') + ); + }, + transform(_code, id) { + if (id.endsWith('styles.css')) { + return themeTokenCss; + } + if (id.endsWith('theme.js')) { + const tokens = generateThemeTokens(theme, varPrefix); + return `export default ${JSON.stringify(tokens)};`; + } + }, + } + : { + resolveId(source: string) { + if (source === '@mui/zero-runtime/styles.css') { + return VIRTUAL_CSS_FILE; + } + if (source === '@mui/zero-runtime/theme') { + return VIRTUAL_THEME_FILE; + } + return null; + }, + loadInclude(id) { + return isZeroRuntimeThemeFile(id); + }, + load(id) { + if (id === VIRTUAL_CSS_FILE) { + return themeTokenCss; + } + if (id === VIRTUAL_THEME_FILE) { + const tokens = generateThemeTokens(theme, varPrefix); + return `export default ${JSON.stringify(tokens)};`; + } + }, + }), + }, + ]; + + if (transformSx) { + plugins.push(babelTransformPlugin); + } + plugins.push(linariaTransformPlugin); + + // This is already handled separately for Next.js using `placeholderCssFile` + if (!isNext) { + plugins.push({ + name: 'zero-plugin-load-output-css', + enforce: 'pre', + resolveId(source: string) { + return cssFileLookup.get(source); + }, + loadInclude(id) { + return id.endsWith('.zero.css'); + }, + load(id) { + return cssLookup.get(id) ?? ''; + }, + }); + } + return plugins; +}); + +export const webpack = plugin.webpack as unknown as UnpluginFactoryOutput< + PluginOptions, + WebpackPluginInstance +>; +export const vite = plugin.vite as unknown as UnpluginFactoryOutput; diff --git a/packages/zero-unplugin/tsconfig.build.json b/packages/zero-unplugin/tsconfig.build.json new file mode 100644 index 00000000000000..80b6a0a8461245 --- /dev/null +++ b/packages/zero-unplugin/tsconfig.build.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "composite": false + } +} diff --git a/packages/zero-unplugin/tsconfig.json b/packages/zero-unplugin/tsconfig.json new file mode 100644 index 00000000000000..16edb79b6bbcfc --- /dev/null +++ b/packages/zero-unplugin/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "resolveJsonModule": true, + "target": "ES2022", + "paths": { + "@babel/core": ["./node_modules/@babel/core"] + } + }, + "include": ["src/**/*.ts"], + "exclude": ["./tsup.config.ts"] +} diff --git a/packages/zero-unplugin/tsup.config.ts b/packages/zero-unplugin/tsup.config.ts new file mode 100644 index 00000000000000..44c71e50b1ec5b --- /dev/null +++ b/packages/zero-unplugin/tsup.config.ts @@ -0,0 +1,13 @@ +import { Options, defineConfig } from 'tsup'; +import config from '../../tsup.config'; +import runtimePackageJson from '../zero-runtime/package.json'; + +const baseConfig: Options = { + ...(config as Options), + tsconfig: './tsconfig.build.json', + env: { + RUNTIME_PACKAGE_NAME: runtimePackageJson.name, + }, +}; + +export default defineConfig(baseConfig); diff --git a/packages/zero-vite-plugin/.eslintrc.json b/packages/zero-vite-plugin/.eslintrc.json deleted file mode 100644 index 54a33fd127fb66..00000000000000 --- a/packages/zero-vite-plugin/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@typescript-eslint/consistent-type-imports": "error" - } -} diff --git a/packages/zero-vite-plugin/README.md b/packages/zero-vite-plugin/README.md deleted file mode 100644 index cec32be4e491c7..00000000000000 --- a/packages/zero-vite-plugin/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @mui/zero-vite-plugin - -Vite plugin to support MUI's `styled` processor. diff --git a/packages/zero-vite-plugin/package.json b/packages/zero-vite-plugin/package.json index 3e31bb298bb507..74928875065608 100644 --- a/packages/zero-vite-plugin/package.json +++ b/packages/zero-vite-plugin/package.json @@ -1,65 +1,37 @@ { "name": "@mui/zero-vite-plugin", "version": "0.0.1-alpha.0", - "private": true, - "author": "MUI Team", - "description": "Vite plugin for MUI zero styled implementation.", - "main": "./src/index.ts", - "keywords": [ - "zero runtime", - "css-in-js", - "mui" - ], - "repository": { - "type": "git", - "url": "https://github.com/mui/material-ui.git", - "directory": "packages/zero-vite-plugin" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/mui/material-ui/issues" - }, - "homepage": "@TODO", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, + "main": "build/index.js", + "module": "build/index.mjs", + "types": "build/index.d.ts", "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", - "build:modern": "node ../../scripts/build.mjs modern", - "build:node": "node ../../scripts/build.mjs node", - "build:stable": "node ../../scripts/build.mjs stable", - "build:copy-files": "node ../../scripts/copyFiles.mjs", - "build:types": "node ../../scripts/buildTypes.mjs", - "prebuild": "rimraf build tsconfig.build.tsbuildinfo", - "release": "pnpm build && pnpm publish", - "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-babel-plugin/**/*.test.{js,ts,tsx}'", - "typescript": "tsc -p tsconfig.json", - "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" + "clean": "rimraf build", + "watch": "tsup --watch", + "build": "tsup", + "typecheck": "tsc --noEmit -p ." }, "dependencies": { - "@babel/core": "^7.23.7", - "@linaria/babel-preset": "^4.5.4", - "@linaria/logger": "^4.5.0", - "@linaria/utils": "^4.5.3", - "@mui/zero-tag-processor": "workspace:^" + "@babel/core": "^7.23.6", + "@babel/preset-typescript": "^7.23.3", + "@linaria/babel-preset": "^5.0.4", + "@linaria/logger": "^5.0.0", + "@linaria/utils": "^5.0.2", + "@mui/zero-runtime": "workspace:^" }, "devDependencies": { - "@types/babel__core": "^7.20.5", - "@types/chai": "^4.3.11", - "chai": "^4.4.0", - "vite": "^4.5.1" + "@types/babel__core": "^7.20.3", + "@types/debug": "^4.1.12", + "vite": "^5.0.0" }, "peerDependencies": { - "vite": "^4.0.0" + "vite": "^4.0.0 || ^5.0.0" }, "sideEffects": false, "publishConfig": { - "access": "public", - "directory": "build" + "access": "public" }, - "engines": { - "node": ">=12.0.0" - } + "files": [ + "build", + "package.json" + ] } diff --git a/packages/zero-vite-plugin/src/index.ts b/packages/zero-vite-plugin/src/index.ts index 0d67c89d6b9592..33d3b8d07f0e02 100644 --- a/packages/zero-vite-plugin/src/index.ts +++ b/packages/zero-vite-plugin/src/index.ts @@ -1,8 +1,10 @@ -import type { Plugin, PluginOption } from 'vite'; -import { generateCss } from '@mui/zero-tag-processor/generateCss'; -import { preprocessor } from '@mui/zero-tag-processor/preprocessor'; +import type { Plugin } from 'vite'; +import { + generateCss, + preprocessor as basePreprocessor, + generateThemeTokens, +} from '@mui/zero-runtime/utils'; import { transformAsync } from '@babel/core'; -import type { PluginCustomOptions } from '@mui/zero-tag-processor/utils'; import baseZeroVitePlugin, { type VitePluginOptions } from './zero-vite-plugin'; export interface ZeroVitePluginOptions extends VitePluginOptions { @@ -21,81 +23,116 @@ export interface ZeroVitePluginOptions extends VitePluginOptions { injectDefaultThemeInRoot?: boolean; } -type WrapperOptions = VitePluginOptions & PluginCustomOptions; +const VIRTUAL_CSS_FILE = `\0zero-runtime-styles.css`; +const VIRTUAL_THEME_FILE = `\0zero-runtime-theme.js`; -const wrapperPlugin = (options: WrapperOptions): Plugin => { - return baseZeroVitePlugin({ - preprocessor, - ...options, - }); -}; +const extensions = ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts']; + +function hasCorectExtension(fileName: string) { + return extensions.some((ext) => fileName.endsWith(ext)); +} + +function isZeroRuntimeProcessableFile(fileName: string, transformLibraries: string[]) { + const isNodeModule = fileName.includes('node_modules'); + const isTransformableFile = + isNodeModule && transformLibraries.some((libName) => fileName.includes(libName)); + return ( + hasCorectExtension(fileName) && + (isTransformableFile || !isNodeModule) && + !fileName.includes('runtime/dist') + ); +} -export function zeroVitePlugin(options: ZeroVitePluginOptions): PluginOption { +export function zeroVitePlugin(options: ZeroVitePluginOptions) { const { cssVariablesPrefix = 'mui', injectDefaultThemeInRoot = true, theme, babelOptions = {}, + preprocessor = basePreprocessor, + transformLibraries = [], ...rest } = options ?? {}; + const isExtendTheme = !!(theme && typeof theme === 'object' && 'vars' in theme && theme.vars); + const varPrefix: string = + isExtendTheme && 'cssVarPrefix' in theme + ? (theme.cssVarPrefix as string) ?? cssVariablesPrefix + : cssVariablesPrefix; - function injectMUITokensPlugin(): PluginOption { + function injectMUITokensPlugin(): Plugin { return { name: 'vite-mui-theme-injection-plugin', + enforce: 'pre', + resolveId(source) { + if (source === '@mui/zero-runtime/styles.css') { + return VIRTUAL_CSS_FILE; + } + if (source === '@mui/zero-runtime/theme') { + return VIRTUAL_THEME_FILE; + } + return null; + }, load(id) { - if (id.endsWith('@mui/zero-runtime/styles.css')) { - return { - code: generateCss( - { - cssVariablesPrefix, - themeArgs: { - theme, - }, - }, - { - defaultThemeKey: 'theme', - injectInRoot: injectDefaultThemeInRoot, + if (id === VIRTUAL_CSS_FILE) { + return generateCss( + { + cssVariablesPrefix: varPrefix, + themeArgs: { + theme, }, - ), - map: null, - }; + }, + { + defaultThemeKey: 'theme', + injectInRoot: injectDefaultThemeInRoot, + }, + ); + } + if (id === VIRTUAL_THEME_FILE) { + const tokens = generateThemeTokens(theme, varPrefix); + return `export default ${JSON.stringify(tokens)};`; } return null; }, }; } - const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs', '.cts', '.cjs', '.mtsx']; - function intermediateBabelPlugin(): PluginOption { + function intermediateBabelPlugin(): Plugin { return { name: 'vite-mui-zero-intermediate-plugin', + enforce: 'post', async transform(code, id) { const [filename] = id.split('?'); - if (!extensions.some((ext) => filename.endsWith(ext))) { + if (!isZeroRuntimeProcessableFile(id, transformLibraries)) { + return null; + } + try { + const result = await transformAsync(code, { + filename, + babelrc: false, + configFile: false, + plugins: [['@mui/zero-runtime/exports/sx-plugin']], + }); + return { + code: result?.code ?? code, + map: result?.map, + }; + } catch (ex) { + console.error(ex); return null; } - const result = await transformAsync(code, { - filename, - babelrc: false, - configFile: false, - plugins: [['@mui/zero-tag-processor/pre-linaria-plugin']], - }); - return { - code: result?.code ?? code, - map: result?.map, - }; }, }; } - const zeroPlugin = wrapperPlugin({ - cssVariablesPrefix, + const zeroPlugin = baseZeroVitePlugin({ + cssVariablesPrefix: varPrefix, themeArgs: { theme, }, + preprocessor, babelOptions: { ...babelOptions, - plugins: ['@babel/plugin-syntax-jsx'], + plugins: ['@babel/plugin-syntax-typescript', ...(babelOptions.plugins ?? [])], }, ...rest, }); diff --git a/packages/zero-vite-plugin/src/zero-vite-plugin.ts b/packages/zero-vite-plugin/src/zero-vite-plugin.ts index 94325e08e0e8a4..5e63f2df8e7b63 100644 --- a/packages/zero-vite-plugin/src/zero-vite-plugin.ts +++ b/packages/zero-vite-plugin/src/zero-vite-plugin.ts @@ -12,9 +12,10 @@ import { optimizeDeps, createFilter } from 'vite'; import { transform, slugify, TransformCacheCollection } from '@linaria/babel-preset'; import type { PluginOptions, Preprocessor } from '@linaria/babel-preset'; -import { createCustomDebug } from '@linaria/logger'; +import { linariaLogger } from '@linaria/logger'; import type { IPerfMeterOptions } from '@linaria/utils'; import { createPerfMeter, getFileIdx, syncResolve } from '@linaria/utils'; +import { type PluginCustomOptions } from '@mui/zero-runtime/utils'; export type VitePluginOptions = { debug?: IPerfMeterOptions | false | null | undefined; @@ -23,7 +24,8 @@ export type VitePluginOptions = { preprocessor?: Preprocessor; sourceMap?: boolean; transformLibraries?: string[]; -} & Partial; +} & Partial & + PluginCustomOptions; export default function zeroVitePlugin({ debug, @@ -57,10 +59,6 @@ export default function zeroVitePlugin({ configureServer(_server) { devServer = _server; }, - load(url: string) { - const [id] = url.split('?', 1); - return cssLookup[id]; - }, resolveId(importeeUrl: string) { const [id] = importeeUrl.split('?', 1); if (cssLookup[id]) { @@ -68,6 +66,10 @@ export default function zeroVitePlugin({ } return cssFileLookup[id]; }, + load(url: string) { + const [id] = url.split('?', 1); + return cssLookup[id]; + }, handleHotUpdate(ctx) { // it's module, so just transform it if (ctx.modules.length) { @@ -84,8 +86,8 @@ export default function zeroVitePlugin({ ); const deps = affected.flatMap((target) => target.dependencies); - // eslint-disable-next-line no-restricted-syntax - for (const depId of deps) { + for (let i = 0; i < deps.length; i += 1) { + const depId = deps[i]; cache.invalidateForFile(depId); } @@ -101,6 +103,7 @@ export default function zeroVitePlugin({ if (id in cssLookup) { return null; } + let shouldReturn = url.includes('node_modules'); if (shouldReturn) { @@ -117,8 +120,8 @@ export default function zeroVitePlugin({ return null; } - const log = createCustomDebug('rollup', getFileIdx(id)); - log('Vite transform', id); + const log = linariaLogger.extend('vite'); + log('Vite transform', getFileIdx(id)); const asyncResolve = async (what: string, importer: string, stack: string[]) => { const resolved = await this.resolve(what, importer); @@ -152,71 +155,92 @@ export default function zeroVitePlugin({ throw new Error(`Could not resolve ${what}`); }; - const result = await transform( - code, - { - filename: id, - preprocessor, - pluginOptions: rest, - }, - asyncResolve, - {}, - cache, - emitter, + const presets = new Set( + Array.isArray(rest.babelOptions?.presets) ? rest.babelOptions?.presets : [], ); + presets.add('@babel/preset-typescript'); + + try { + const result = await transform( + { + options: { + filename: id, + root: process.cwd(), + preprocessor, + pluginOptions: { + ...rest, + babelOptions: { + ...rest.babelOptions, + // presets: Array.from(presets), + }, + }, + }, + cache, + eventEmitter: emitter, + }, + code, + asyncResolve, + ); + + let { cssText, dependencies } = result; + + if (!cssText) { + return null; + } - let { cssText, dependencies } = result; - - if (!cssText) { - return null; - } - dependencies ??= []; + dependencies ??= []; - const slug = slugify(cssText); - const cssFilename = path - .normalize(`${id.replace(/\.[jt]sx?$/, '')}_${slug}.css`) - .replace(/\\/g, path.posix.sep); + const slug = slugify(cssText); + const cssFilename = path + .normalize(`${id.replace(/\.[jt]sx?$/, '')}_${slug}.css`) + .replace(/\\/g, path.posix.sep); - const cssRelativePath = path - .relative(config.root, cssFilename) - .replace(/\\/g, path.posix.sep); + const cssRelativePath = path + .relative(config.root, cssFilename) + .replace(/\\/g, path.posix.sep); - const cssId = `/${cssRelativePath}`; + const cssId = `/${cssRelativePath}`; - if (sourceMap && result.cssSourceMapText) { - const map = Buffer.from(result.cssSourceMapText).toString('base64'); - cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`; - } + if (sourceMap && result.cssSourceMapText) { + const map = Buffer.from(result.cssSourceMapText).toString('base64'); + cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`; + } - cssLookup[cssFilename] = cssText; - cssFileLookup[cssId] = cssFilename; + cssLookup[cssFilename] = cssText; + cssFileLookup[cssId] = cssFilename; - result.code += `\nimport ${JSON.stringify(cssFilename)};\n`; - if (devServer?.moduleGraph) { - const module = devServer.moduleGraph.getModuleById(cssId); + result.code += `\nimport ${JSON.stringify(cssFilename)};\n`; + if (devServer?.moduleGraph) { + const module = devServer.moduleGraph.getModuleById(cssId); - if (module) { - devServer.moduleGraph.invalidateModule(module); - module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now(); + if (module) { + devServer.moduleGraph.invalidateModule(module); + module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now(); + } } - } - for (let i = 0, end = dependencies.length; i < end; i += 1) { - // eslint-disable-next-line no-await-in-loop - const depModule = await this.resolve(dependencies[i], url, { - isEntry: false, - }); - if (depModule) { - dependencies[i] = depModule.id; + for (let i = 0, end = dependencies.length; i < end; i += 1) { + // eslint-disable-next-line no-await-in-loop + const depModule = await this.resolve(dependencies[i], url, { + isEntry: false, + }); + if (depModule) { + dependencies[i] = depModule.id; + } } + const target = targets.find((t) => t.id === id); + if (!target) { + targets.push({ id, dependencies }); + } else { + target.dependencies = dependencies; + } + return { code: result.code, map: result.sourceMap }; + } catch (ex) { + const err = new Error(`MUI: Error while transforming file '${id}'`); + err.message = (ex as Error).message; + err.stack = (ex as Error).stack; + throw err; } - const target = targets.find((t) => t.id === id); - if (!target) { - targets.push({ id, dependencies }); - } else { - target.dependencies = dependencies; - } - return { code: result.code, map: result.sourceMap }; }, }; } diff --git a/packages/zero-vite-plugin/tsconfig.build.json b/packages/zero-vite-plugin/tsconfig.build.json index 93ac2a470ef729..80b6a0a8461245 100644 --- a/packages/zero-vite-plugin/tsconfig.build.json +++ b/packages/zero-vite-plugin/tsconfig.build.json @@ -1,22 +1,6 @@ { - // This config is for emitting declarations (.d.ts) only - // Actual .ts source files are transpiled via babel "extends": "./tsconfig.json", "compilerOptions": { - "target": "ES2015", - "composite": true, - "declaration": true, - "noEmit": false, - "emitDeclarationOnly": true, - "outDir": "build", - "rootDir": "./src" - }, - "include": ["./src/**/*.ts*"], - "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], - "references": [ - { "path": "../mui-base/tsconfig.build.json" }, - { "path": "../mui-system/tsconfig.build.json" }, - { "path": "../mui-material/tsconfig.build.json" }, - { "path": "../zero-tag-processor/tsconfig.build.json" } - ] + "composite": false + } } diff --git a/packages/zero-vite-plugin/tsconfig.json b/packages/zero-vite-plugin/tsconfig.json index f436e1e32dc6e6..819ce7d6a1f66a 100644 --- a/packages/zero-vite-plugin/tsconfig.json +++ b/packages/zero-vite-plugin/tsconfig.json @@ -2,8 +2,9 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "lib": ["ES2022", "DOM"], - "target": "ES2015", - "types": ["mocha", "node", "chai"] + "target": "ES2022", + "paths": { + "@babel/core": ["./node_modules/@babel/core"] + } } } diff --git a/packages/zero-vite-plugin/tsup.config.ts b/packages/zero-vite-plugin/tsup.config.ts new file mode 100644 index 00000000000000..f6b8c530b9be1f --- /dev/null +++ b/packages/zero-vite-plugin/tsup.config.ts @@ -0,0 +1,17 @@ +import { Options, defineConfig } from 'tsup'; +import config from '../../tsup.config'; + +const external = ['@mui/zero-runtime/utils']; + +const baseConfig: Options = { + ...(config as Options), + tsconfig: './tsconfig.build.json', + external, +}; + +export default defineConfig([ + { + ...baseConfig, + entry: ['./src/index.ts'], + }, +]); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59f42994c16575..535794078c6af0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -319,7 +319,10 @@ importers: version: 1.10.0 terser-webpack-plugin: specifier: ^5.3.10 - version: 5.3.10(webpack@5.89.0) + version: 5.3.10(esbuild@0.19.11)(webpack@5.89.0) + tsup: + specifier: ^8.0.1 + version: 8.0.1(postcss@8.4.33)(typescript@5.3.3) tsx: specifier: ^4.7.0 version: 4.7.0 @@ -331,7 +334,7 @@ importers: version: link:packages/typescript-to-proptypes webpack: specifier: ^5.89.0 - version: 5.89.0(webpack-cli@5.1.4) + version: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-bundle-analyzer: specifier: ^4.10.1 version: 4.10.1 @@ -342,42 +345,33 @@ importers: specifier: ^17.7.2 version: 17.7.2 - apps/local-library: + apps/local-ui-lib: dependencies: '@mui/zero-runtime': - specifier: workspace:* - version: link:../../packages/zero-runtime/build + specifier: workspace:^ + version: link:../../packages/zero-runtime apps/zero-runtime-next-app: dependencies: - '@mui/base': - specifier: workspace:* - version: link:../../packages/mui-base/build - '@mui/material': - specifier: workspace:* - version: link:../../packages/mui-material/build - '@mui/utils': - specifier: workspace:* - version: link:../../packages/mui-utils/build '@mui/zero-runtime': - specifier: workspace:* - version: link:../../packages/zero-runtime/build + specifier: workspace:^ + version: link:../../packages/zero-runtime next: - specifier: 13.5.6 - version: 13.5.6(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.0.1 + version: 14.0.1(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) react: - specifier: 18.2.0 + specifier: ^18 version: 18.2.0 react-dom: - specifier: 18.2.0 + specifier: ^18 version: 18.2.0(react@18.2.0) devDependencies: + '@mui/material': + specifier: ^5.15.2 + version: link:../../packages/mui-material/build '@mui/zero-next-plugin': - specifier: workspace:* + specifier: workspace:^ version: link:../../packages/zero-next-plugin - '@mui/zero-tag-processor': - specifier: workspace:* - version: link:../../packages/zero-tag-processor/build '@types/node': specifier: ^18.19.4 version: 18.19.4 @@ -387,76 +381,12 @@ importers: '@types/react-dom': specifier: 18.2.7 version: 18.2.7 + eslint: + specifier: ^8.52.0 + version: 8.56.0 typescript: - specifier: 5.3.3 - version: 5.3.3 - - apps/zero-runtime-vite-app: - dependencies: - '@mui/zero-runtime': - specifier: workspace:* - version: link:../../packages/zero-runtime/build - '@mui/zero-tag-processor': - specifier: workspace:* - version: link:../../packages/zero-tag-processor/build - react: - specifier: ^18.2.0 - version: 18.2.0 - react-dom: - specifier: ^18.2.0 - version: 18.2.0(react@18.2.0) - devDependencies: - '@babel/preset-env': - specifier: ^7.23.7 - version: 7.23.7(@babel/core@7.23.7) - '@babel/preset-react': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.7) - '@babel/preset-typescript': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.7) - '@mui/material': - specifier: workspace:* - version: link:../../packages/mui-material/build - '@mui/utils': - specifier: workspace:* - version: link:../../packages/mui-utils/build - '@mui/zero-jest': - specifier: workspace:* - version: link:../../packages/zero-jest - '@mui/zero-vite-plugin': - specifier: workspace:* - version: link:../../packages/zero-vite-plugin/build - '@testing-library/jest-dom': - specifier: ^6.2.0 - version: 6.2.0(jest@29.7.0)(vitest@0.34.6) - '@testing-library/react': - specifier: ^14.1.2 - version: 14.1.2(react-dom@18.2.0)(react@18.2.0) - '@vitejs/plugin-react': - specifier: ^4.2.1 - version: 4.2.1(vite@4.5.1) - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - jest-environment-jsdom: - specifier: ^29.7.0 - version: 29.7.0 - jsdom: - specifier: ^22.1.0 - version: 22.1.0 - local-ui-lib: - specifier: workspace:* - version: link:../local-library - typescript: - specifier: 5.3.3 + specifier: ^5.3.3 version: 5.3.3 - vite: - specifier: 4.5.1 - version: 4.5.1(@types/node@18.19.4) - vitest: - specifier: ^0.34.6 - version: 0.34.6(jsdom@22.1.0) benchmark: dependencies: @@ -537,7 +467,7 @@ importers: version: 0.16.1(@emotion/react@11.11.3)(react@18.2.0) webpack: specifier: ^5.89.0 - version: 5.89.0(webpack-cli@5.1.4) + version: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) docs: dependencies: @@ -1403,7 +1333,7 @@ importers: version: 4.17.21 next: specifier: ^13.4.19 - version: 13.5.6(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) + version: 13.4.19(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) react: specifier: ^18.2.0 version: 18.2.0 @@ -2280,95 +2210,17 @@ importers: packages/waterfall: {} - packages/zero-jest: - dependencies: - '@linaria/babel-preset': - specifier: ^4.5.4 - version: 4.5.4 - '@linaria/utils': - specifier: ^4.5.3 - version: 4.5.3 - '@mui/zero-tag-processor': - specifier: workspace:^ - version: link:../zero-tag-processor/build - babel-jest: - specifier: ^29.7.0 - version: 29.7.0(@babel/core@7.23.7) - style-inject: - specifier: ^0.3.0 - version: 0.3.0 - devDependencies: - '@jest/transform': - specifier: ^29.7.0 - version: 29.7.0 - packages/zero-next-plugin: dependencies: - '@babel/core': - specifier: ^7.23.7 - version: 7.23.7 - '@babel/plugin-syntax-jsx': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.7) - '@babel/preset-typescript': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.7) - '@linaria/babel-preset': - specifier: ^4.5.4 - version: 4.5.4 - '@mui/zero-tag-processor': + '@mui/zero-unplugin': specifier: workspace:^ - version: link:../zero-tag-processor/build - file-system-cache: - specifier: 2.4.4 - version: 2.4.4 + version: link:../zero-unplugin devDependencies: - '@types/babel__core': - specifier: ^7.20.5 - version: 7.20.5 - '@types/chai': - specifier: ^4.3.11 - version: 4.3.11 - chai: - specifier: ^4.4.0 - version: 4.4.0 next: - specifier: ^13.4.19 - version: 13.5.6(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) + specifier: ^14.0.1 + version: 14.0.1(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) packages/zero-runtime: - dependencies: - clsx: - specifier: ^2.1.0 - version: 2.1.0 - csstype: - specifier: ^3.1.2 - version: 3.1.2 - devDependencies: - '@mui/zero-runtime': - specifier: workspace:* - version: link:build - '@types/chai': - specifier: ^4.3.11 - version: 4.3.11 - '@types/mocha': - specifier: ^10.0.6 - version: 10.0.6 - '@types/node': - specifier: ^18.19.4 - version: 18.19.4 - '@types/react': - specifier: ^18.2.46 - version: 18.2.46 - chai: - specifier: ^4.4.0 - version: 4.4.0 - react: - specifier: ^18.2.0 - version: 18.2.0 - publishDirectory: build - - packages/zero-tag-processor: dependencies: '@babel/core': specifier: ^7.23.7 @@ -2380,7 +2232,7 @@ importers: specifier: ^7.22.5 version: 7.22.5 '@babel/parser': - specifier: ^7.23.6 + specifier: ^7.23.0 version: 7.23.6 '@babel/types': specifier: ^7.23.6 @@ -2388,82 +2240,123 @@ importers: '@emotion/css': specifier: ^11.11.2 version: 11.11.2 + '@emotion/styled': + specifier: ^11.11.0 + version: 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) '@linaria/tags': - specifier: ^4.5.4 - version: 4.5.4 + specifier: ^5.0.2 + version: 5.0.2 '@linaria/utils': - specifier: ^4.5.3 - version: 4.5.3 + specifier: ^5.0.2 + version: 5.0.2 '@mui/system': - specifier: workspace:^ + specifier: ^5.14.18 version: link:../mui-system/build + clsx: + specifier: ^2.0.0 + version: 2.1.0 + cssesc: + specifier: ^3.0.0 + version: 3.0.0 + csstype: + specifier: ^3.1.2 + version: 3.1.2 lodash.get: specifier: ^4.4.2 version: 4.4.2 + lodash.set: + specifier: ^4.3.2 + version: 4.3.2 stylis: specifier: ^4.2.0 version: 4.2.0 devDependencies: - '@mui/material': - specifier: workspace:^ - version: link:../mui-material/build '@types/babel__core': - specifier: ^7.20.5 + specifier: ^7.20.3 version: 7.20.5 '@types/babel__helper-module-imports': - specifier: ^7.18.3 + specifier: ^7.18.2 version: 7.18.3 '@types/babel__helper-plugin-utils': - specifier: ^7.10.3 + specifier: ^7.10.2 version: 7.10.3 - '@types/chai': - specifier: ^4.3.11 - version: 4.3.11 + '@types/cssesc': + specifier: ^3.0.2 + version: 3.0.2 '@types/lodash.get': - specifier: ^4.4.9 + specifier: ^4.4.7 version: 4.4.9 - '@types/mocha': - specifier: ^10.0.6 - version: 10.0.6 + '@types/lodash.set': + specifier: ^4.3.9 + version: 4.3.9 '@types/node': specifier: ^18.19.4 version: 18.19.4 + '@types/react': + specifier: ^18.2.46 + version: 18.2.46 '@types/stylis': specifier: ^4.2.0 version: 4.2.0 - publishDirectory: build + react: + specifier: ^18.2.0 + version: 18.2.0 + + packages/zero-unplugin: + dependencies: + '@babel/core': + specifier: ^7.23.7 + version: 7.23.7 + '@linaria/babel-preset': + specifier: ^5.0.4 + version: 5.0.4 + '@linaria/logger': + specifier: ^5.0.0 + version: 5.0.0 + '@linaria/utils': + specifier: ^5.0.2 + version: 5.0.2 + unplugin: + specifier: ^1.5.1 + version: 1.6.0 + devDependencies: + '@mui/zero-runtime': + specifier: workspace:^ + version: link:../zero-runtime + '@types/babel__core': + specifier: ^7.20.3 + version: 7.20.5 packages/zero-vite-plugin: dependencies: '@babel/core': specifier: ^7.23.7 version: 7.23.7 + '@babel/preset-typescript': + specifier: ^7.23.3 + version: 7.23.3(@babel/core@7.23.7) '@linaria/babel-preset': - specifier: ^4.5.4 - version: 4.5.4 + specifier: ^5.0.4 + version: 5.0.4 '@linaria/logger': - specifier: ^4.5.0 - version: 4.5.0 + specifier: ^5.0.0 + version: 5.0.0 '@linaria/utils': - specifier: ^4.5.3 - version: 4.5.3 - '@mui/zero-tag-processor': + specifier: ^5.0.2 + version: 5.0.2 + '@mui/zero-runtime': specifier: workspace:^ - version: link:../zero-tag-processor/build + version: link:../zero-runtime devDependencies: '@types/babel__core': - specifier: ^7.20.5 + specifier: ^7.20.3 version: 7.20.5 - '@types/chai': - specifier: ^4.3.11 - version: 4.3.11 - chai: - specifier: ^4.4.0 - version: 4.4.0 + '@types/debug': + specifier: ^4.1.12 + version: 4.1.12 vite: - specifier: ^4.5.1 - version: 4.5.1(@types/node@18.19.4) - publishDirectory: build + specifier: ^5.0.0 + version: 5.0.10(@types/node@18.19.4) test: devDependencies: @@ -2577,7 +2470,7 @@ importers: version: 1.6.28 webpack: specifier: ^5.89.0 - version: 5.89.0(webpack-cli@5.1.4) + version: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) yargs: specifier: ^17.7.2 version: 17.7.2 @@ -2589,10 +2482,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /@adobe/css-tools@4.3.2: - resolution: {integrity: sha512-DA5a1C0gD/pLOvhv33YMrbf2FK3oUzwNl9oOJqE4XVjuEtt6XIakRcsd7eLiOSPkp1kTRQGICTA8cKra/vFbjw==} - dev: true - /@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1)(search-insights@2.7.0): resolution: {integrity: sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw==} dependencies: @@ -3108,18 +2997,6 @@ packages: '@babel/plugin-syntax-export-default-from': 7.23.3(@babel/core@7.23.7) dev: false - /@babel/plugin-proposal-export-namespace-from@7.18.9(@babel/core@7.23.7): - resolution: {integrity: sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==} - engines: {node: '>=6.9.0'} - deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead. - peerDependencies: - '@babel/core': ^7.23.7 - dependencies: - '@babel/core': 7.23.7 - '@babel/helper-plugin-utils': 7.22.5 - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.23.7) - dev: false - /@babel/plugin-proposal-nullish-coalescing-operator@7.18.6(@babel/core@7.23.7): resolution: {integrity: sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==} engines: {node: '>=6.9.0'} @@ -3225,14 +3102,6 @@ packages: '@babel/core': 7.23.7 '@babel/helper-plugin-utils': 7.22.5 - /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.23.7): - resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} - peerDependencies: - '@babel/core': ^7.23.7 - dependencies: - '@babel/core': 7.23.7 - '@babel/helper-plugin-utils': 7.22.5 - /@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.23.7): resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} peerDependencies: @@ -3843,6 +3712,7 @@ packages: dependencies: '@babel/core': 7.23.7 '@babel/helper-plugin-utils': 7.22.5 + dev: false /@babel/plugin-transform-react-jsx-source@7.23.3(@babel/core@7.23.7): resolution: {integrity: sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g==} @@ -3852,6 +3722,7 @@ packages: dependencies: '@babel/core': 7.23.7 '@babel/helper-plugin-utils': 7.22.5 + dev: false /@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.7): resolution: {integrity: sha512-oKckg2eZFa8771O/5vi7XeTvmM6+O9cxZu+kanTU7tD4sin5nO/G8jGJhq8Hvt2Z0kUoEDRayuZLaUlYl8QuGA==} @@ -4222,6 +4093,7 @@ packages: /@bcoe/v8-coverage@0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + dev: false /@chakra-ui/anatomy@2.2.2: resolution: {integrity: sha512-MV6D4VLRIHr4PkW4zMyqfrNS1mPlCTiCXwvYGtDFQYr+xHFfonhAuf9WjsSc0nyp2m0OdkSLnzmVKkZFLo25Tg==} @@ -4563,16 +4435,6 @@ packages: cpu: [ppc64] os: [aix] requiresBuild: true - dev: true - optional: true - - /@esbuild/android-arm64@0.18.20: - resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.19.11: @@ -4581,16 +4443,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true - optional: true - - /@esbuild/android-arm@0.18.20: - resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.19.11: @@ -4599,16 +4451,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true - optional: true - - /@esbuild/android-x64@0.18.20: - resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.19.11: @@ -4617,16 +4459,6 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-arm64@0.18.20: - resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.19.11: @@ -4635,16 +4467,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64@0.18.20: - resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.19.11: @@ -4653,16 +4475,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-arm64@0.18.20: - resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.19.11: @@ -4671,16 +4483,6 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-x64@0.18.20: - resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.19.11: @@ -4689,16 +4491,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64@0.18.20: - resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.19.11: @@ -4707,16 +4499,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm@0.18.20: - resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.19.11: @@ -4725,16 +4507,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ia32@0.18.20: - resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.19.11: @@ -4743,16 +4515,6 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-loong64@0.18.20: - resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.19.11: @@ -4761,16 +4523,6 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-mips64el@0.18.20: - resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.19.11: @@ -4779,16 +4531,6 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ppc64@0.18.20: - resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.19.11: @@ -4797,16 +4539,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-riscv64@0.18.20: - resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.19.11: @@ -4815,16 +4547,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x@0.18.20: - resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.19.11: @@ -4833,16 +4555,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-x64@0.18.20: - resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.19.11: @@ -4851,16 +4563,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64@0.18.20: - resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.19.11: @@ -4869,16 +4571,6 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-x64@0.18.20: - resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.19.11: @@ -4887,16 +4579,6 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true - optional: true - - /@esbuild/sunos-x64@0.18.20: - resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.19.11: @@ -4905,16 +4587,6 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64@0.18.20: - resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.19.11: @@ -4923,16 +4595,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-ia32@0.18.20: - resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.19.11: @@ -4941,16 +4603,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-x64@0.18.20: - resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.19.11: @@ -4959,7 +4611,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): @@ -5022,21 +4673,17 @@ packages: lodash.uniq: 4.5.0 dev: false - /@floating-ui/core@1.5.3(react@18.2.0): + /@floating-ui/core@1.5.3: resolution: {integrity: sha512-O0WKDOo0yhJuugCx6trZQj5jVJ9yR0ystG2JaNAemYUWce+pmM6WUEFIibnWyEJKdrDxhm75NoSRME35FNaM/Q==} dependencies: - '@floating-ui/utils': 0.2.0(react@18.2.0) - transitivePeerDependencies: - - react + '@floating-ui/utils': 0.2.1 dev: false - /@floating-ui/dom@1.5.4(react@18.2.0): + /@floating-ui/dom@1.5.4: resolution: {integrity: sha512-jByEsHIY+eEdCjnTVu+E3ephzTOzkQ8hgUfGwos+bg7NlH33Zc5uO+QHz1mrQUOgIKKDD1RtS201P9NvAfq3XQ==} dependencies: - '@floating-ui/core': 1.5.3(react@18.2.0) - '@floating-ui/utils': 0.2.0(react@18.2.0) - transitivePeerDependencies: - - react + '@floating-ui/core': 1.5.3 + '@floating-ui/utils': 0.2.1 dev: false /@floating-ui/react-dom@2.0.5(react-dom@18.2.0)(react@18.2.0): @@ -5045,17 +4692,13 @@ packages: react: '>=16.8.0' react-dom: '>=16.8.0' dependencies: - '@floating-ui/dom': 1.5.4(react@18.2.0) + '@floating-ui/dom': 1.5.4 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /@floating-ui/utils@0.2.0(react@18.2.0): - resolution: {integrity: sha512-T4jNeM6dMzXONGkSjk7+O+eFQTVbw7KHi5OYuvFaBer3Wcrmpwi6fHKcT/FdSf7boWC7H9eXTyYTFZOQdJ1AMA==} - peerDependencies: - react: '>=16.8.0' - dependencies: - react: 18.2.0 + /@floating-ui/utils@0.2.1: + resolution: {integrity: sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==} dev: false /@fortawesome/fontawesome-common-types@6.5.1: @@ -5194,66 +4837,12 @@ packages: get-package-type: 0.1.0 js-yaml: 3.14.1 resolve-from: 5.0.0 + dev: true /@istanbuljs/schema@0.1.3: resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} engines: {node: '>=8'} - /@jest/console@29.7.0: - resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - chalk: 4.1.2 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - slash: 3.0.0 - dev: true - - /@jest/core@29.7.0(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - ci-info: 3.8.0 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - jest-watcher: 29.7.0 - micromatch: 4.0.5 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - ts-node - dev: true - /@jest/create-cache-key-function@29.7.0: resolution: {integrity: sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -5269,23 +4858,7 @@ packages: '@jest/types': 29.6.3 '@types/node': 18.19.4 jest-mock: 29.7.0 - - /@jest/expect-utils@29.7.0: - resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - jest-get-type: 29.6.3 - dev: true - - /@jest/expect@29.7.0: - resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - expect: 29.7.0 - jest-snapshot: 29.7.0 - transitivePeerDependencies: - - supports-color - dev: true + dev: false /@jest/fake-timers@29.7.0: resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} @@ -5297,55 +4870,7 @@ packages: jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 - - /@jest/globals@29.7.0: - resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 - '@jest/types': 29.6.3 - jest-mock: 29.7.0 - transitivePeerDependencies: - - supports-color - dev: true - - /@jest/reporters@29.7.0: - resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@jest/console': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.20 - '@types/node': 18.19.4 - chalk: 4.1.2 - collect-v8-coverage: 1.0.2 - exit: 0.1.2 - glob: 7.2.3 - graceful-fs: 4.2.11 - istanbul-lib-coverage: 3.2.0 - istanbul-lib-instrument: 6.0.1 - istanbul-lib-report: 3.0.0 - istanbul-lib-source-maps: 4.0.1 - istanbul-reports: 3.1.5 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - jest-worker: 29.7.0 - slash: 3.0.0 - string-length: 4.0.2 - strip-ansi: 6.0.1 - v8-to-istanbul: 9.0.1 - transitivePeerDependencies: - - supports-color - dev: true + dev: false /@jest/schemas@29.6.3: resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} @@ -5353,57 +4878,6 @@ packages: dependencies: '@sinclair/typebox': 0.27.8 - /@jest/source-map@29.6.3: - resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jridgewell/trace-mapping': 0.3.20 - callsites: 3.1.0 - graceful-fs: 4.2.11 - dev: true - - /@jest/test-result@29.7.0: - resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/console': 29.7.0 - '@jest/types': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.4 - collect-v8-coverage: 1.0.2 - dev: true - - /@jest/test-sequencer@29.7.0: - resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/test-result': 29.7.0 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - slash: 3.0.0 - dev: true - - /@jest/transform@29.7.0: - resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@babel/core': 7.23.7 - '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.20 - babel-plugin-istanbul: 6.1.1 - chalk: 4.1.2 - convert-source-map: 2.0.0 - fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-regex-util: 29.6.3 - jest-util: 29.7.0 - micromatch: 4.0.5 - pirates: 4.0.6 - slash: 3.0.0 - write-file-atomic: 4.0.2 - transitivePeerDependencies: - - supports-color - /@jest/types@26.6.2: resolution: {integrity: sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==} engines: {node: '>= 10.14.2'} @@ -5425,6 +4899,7 @@ packages: '@types/node': 18.19.4 '@types/yargs': 17.0.32 chalk: 4.1.2 + dev: false /@jridgewell/gen-mapping@0.1.1: resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} @@ -5541,9 +5016,9 @@ packages: - supports-color dev: true - /@linaria/babel-preset@4.5.4: - resolution: {integrity: sha512-AbOTqCb7XbQGAUNQkt8YxysXsek3qTEfXwj46bYLyFu/ADZ+ypmAUcmNJRJSjI0qAoS+ZFuK2dEpuwFVYeiveQ==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/babel-preset@5.0.4: + resolution: {integrity: sha512-OMhlD6gc/+6DFLkadoavlxCtTIElo/UdDMeQH6I/CAL3hgfmHyIXJPrGObTa7jvQKddUaKvFIHGAVB7pz6J8Qg==} + engines: {node: '>=16.0.0'} dependencies: '@babel/core': 7.23.7 '@babel/generator': 7.23.6 @@ -5551,32 +5026,34 @@ packages: '@babel/template': 7.22.15 '@babel/traverse': 7.23.7 '@babel/types': 7.23.6 - '@linaria/core': 4.5.4 - '@linaria/logger': 4.5.0 - '@linaria/shaker': 4.5.3 - '@linaria/tags': 4.5.4 - '@linaria/utils': 4.5.3 + '@linaria/core': 5.0.2 + '@linaria/logger': 5.0.0 + '@linaria/shaker': 5.0.3 + '@linaria/tags': 5.0.2 + '@linaria/utils': 5.0.2 cosmiconfig: 8.2.0 + happy-dom: 10.8.0 source-map: 0.7.4 stylis: 3.5.4 + ts-invariant: 0.10.3 transitivePeerDependencies: - supports-color dev: false - /@linaria/core@4.5.4: - resolution: {integrity: sha512-vMs/5iU0stxjfbBCxobIgY+wSQx4G8ukNwrhjPVD+6bF9QrTwi5rl0mKaCMxaGMjnfsLRiiM3i+hnWLIEYLdSg==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/core@5.0.2: + resolution: {integrity: sha512-l5jQq7w9kDvonfr/0MBF47Dagx9Y9f/o5Q8j3zv7GepwG/yHQdbjKr0tq07rx2fSDDX7Nbqlxk6k9Ymir/NGpg==} + engines: {node: '>=16.0.0'} dependencies: - '@linaria/logger': 4.5.0 - '@linaria/tags': 4.5.4 - '@linaria/utils': 4.5.3 + '@linaria/logger': 5.0.0 + '@linaria/tags': 5.0.2 + '@linaria/utils': 5.0.2 transitivePeerDependencies: - supports-color dev: false - /@linaria/logger@4.5.0: - resolution: {integrity: sha512-XdQLk242Cpcsc9a3Cz1ktOE5ysTo2TpxdeFQEPwMm8Z/+F/S6ZxBDdHYJL09srXWz3hkJr3oS2FPuMZNH1HIxw==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/logger@5.0.0: + resolution: {integrity: sha512-PZd5H0I4F84U0kXSE+vD75ltIGDxEA6gMDNWS2aDZFitmdlQM5rIXqvKFrp5NsHa7a3AH+I2Hxm0dg60WZF7vg==} + engines: {node: '>=16.0.0'} dependencies: debug: 4.3.4(supports-color@8.1.1) picocolors: 1.0.0 @@ -5584,9 +5061,9 @@ packages: - supports-color dev: false - /@linaria/shaker@4.5.3: - resolution: {integrity: sha512-UeNw8HtY43pm+D0B+kq8BrW9GsRxm11zT7Lq3Qry8sX2mapvFqXaQ7VpTFHWEdkcbv7JOxBAMial2fu+ce/zqA==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/shaker@5.0.3: + resolution: {integrity: sha512-2a3pzYs09Iz88e+VG4OAQVRSIjxkbj7S4ju81ZTJVbZIWSR1kGsbX5OtJkRrh/AbKRrrUMW0DBS4PPgd0fks4A==} + engines: {node: '>=16.0.0'} dependencies: '@babel/core': 7.23.7 '@babel/generator': 7.23.6 @@ -5594,38 +5071,36 @@ packages: '@babel/plugin-transform-runtime': 7.23.7(@babel/core@7.23.7) '@babel/plugin-transform-template-literals': 7.23.3(@babel/core@7.23.7) '@babel/preset-env': 7.23.7(@babel/core@7.23.7) - '@linaria/logger': 4.5.0 - '@linaria/utils': 4.5.3 + '@linaria/logger': 5.0.0 + '@linaria/utils': 5.0.2 babel-plugin-transform-react-remove-prop-types: 0.4.24 ts-invariant: 0.10.3 transitivePeerDependencies: - supports-color dev: false - /@linaria/tags@4.5.4: - resolution: {integrity: sha512-HPxLB6HlJWLi6o8+8lTLegOmDnbMbuzEE+zzunaPZEGSoIIYx8HAv5VbY/sG/zNyxDElk6laiAwEVWN8h5/zxg==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/tags@5.0.2: + resolution: {integrity: sha512-opcORl2sA6WkBjTNLHTgpet97dNKnwPRX/QGGZMykBsvGH3AsnEg/bT31cKBMBhL+YBGQsCdBmolxvCkWPOXQw==} + engines: {node: '>=16.0.0'} dependencies: '@babel/generator': 7.23.6 - '@linaria/logger': 4.5.0 - '@linaria/utils': 4.5.3 + '@linaria/logger': 5.0.0 + '@linaria/utils': 5.0.2 transitivePeerDependencies: - supports-color dev: false - /@linaria/utils@4.5.3: - resolution: {integrity: sha512-tSpxA3Zn0DKJ2n/YBnYAgiDY+MNvkmzAHrD8R9PKrpGaZ+wz1jQEmE1vGn1cqh8dJyWK0NzPAA8sf1cqa+RmAg==} - engines: {node: ^12.16.0 || >=13.7.0} + /@linaria/utils@5.0.2: + resolution: {integrity: sha512-ZL8Yz4IIr9A8a5+o5LRnEpgdzIkyj4yKJrhw5Zv8wwvL+d/MHUK0q+l/KvxBmuYdcF+YYVHZ9eeBHTQBSL7r/w==} + engines: {node: '>=16.0.0'} dependencies: '@babel/core': 7.23.7 '@babel/generator': 7.23.6 - '@babel/plugin-proposal-export-namespace-from': 7.18.9(@babel/core@7.23.7) - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.23.7) '@babel/plugin-transform-modules-commonjs': 7.23.3(@babel/core@7.23.7) '@babel/template': 7.22.15 '@babel/traverse': 7.23.7 '@babel/types': 7.23.6 - '@linaria/logger': 4.5.0 + '@linaria/logger': 5.0.0 babel-merge: 3.0.0(@babel/core@7.23.7) find-up: 5.0.0 minimatch: 9.0.3 @@ -5668,8 +5143,8 @@ packages: react-test-renderer: 18.2.0(react@18.2.0) semver: 5.7.2 - /@mui/base@5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-l4asGID5tmyerx9emJfXOKLyXzaBtdXNIFE3M+IrSZaFtGFvaQKHhc3+nxxSxPf1+G44psjczM0ekRQCdXx9HA==} + /@mui/base@5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-dc38W4W3K42atE9nSaOeoJ7/x9wGIfawdwC/UmMxMLlZ1iSsITQ8dQJaTATCbn98YvYPINK/EH541YA5enQIPQ==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^18.2.46 @@ -5681,8 +5156,8 @@ packages: dependencies: '@babel/runtime': 7.23.7 '@floating-ui/react-dom': 2.0.5(react-dom@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.46) - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/types': 7.2.12(@types/react@18.2.46) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@popperjs/core': 2.11.8 '@types/react': 18.2.46 clsx: 2.1.0 @@ -5691,12 +5166,12 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /@mui/core-downloads-tracker@5.14.16: - resolution: {integrity: sha512-97isBjzH2v1K7oB4UH2f4NOkBShOynY6dhnoR2XlUk/g6bb7ZBv2I3D1hvvqPtpEigKu93e7f/jAYr5d9LOc5w==} + /@mui/core-downloads-tracker@5.15.3: + resolution: {integrity: sha512-sWeihiVyxdJjpLkp8SHkTy9kt2M/o11M60G1MzwljGL2BXdM3Ktzqv5QaQHdi00y7Y1ulvtI3GOSxP2xU8mQJw==} dev: false - /@mui/material@5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-W4zZ4vnxgGk6/HqBwgsDHKU7x2l2NhX+r8gAwfg58Rhu3ikfY7NkIS6y8Gl3NkATc4GG1FNaGjjpQKfJx3U6Jw==} + /@mui/material@5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-DODBBMouyq1B5f3YkEWL9vO8pGCxuEGqtfpltF6peMJzz/78tJFyLQsDas9MNLC/8AdFu2BQdkK7wox5UBPTAA==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.5.0 @@ -5715,11 +5190,11 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) - '@mui/core-downloads-tracker': 5.14.16 - '@mui/system': 5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.46) - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/core-downloads-tracker': 5.15.3 + '@mui/system': 5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react@18.2.0) + '@mui/types': 7.2.12(@types/react@18.2.46) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@types/react': 18.2.46 '@types/react-transition-group': 4.4.10 clsx: 2.1.0 @@ -5731,8 +5206,8 @@ packages: react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) dev: false - /@mui/private-theming@5.14.16(@types/react@18.2.46)(react@18.2.0): - resolution: {integrity: sha512-FNlL0pTSEBh8nXsVWreCHDSHk+jG8cBx1sxRbT8JVtL+PYbYPi802zfV4B00Kkf0LNRVRvAVQwojMWSR/MYGng==} + /@mui/private-theming@5.15.3(@types/react@18.2.46)(react@18.2.0): + resolution: {integrity: sha512-Q79MhVMmywC1l5bMsMZq5PsIudr1MNPJnx9/EqdMP0vpz5iNvFpnLmxsD7d8/hqTWgFAljI+LH3jX8MxlZH9Gw==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^18.2.46 @@ -5742,14 +5217,14 @@ packages: optional: true dependencies: '@babel/runtime': 7.23.7 - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@types/react': 18.2.46 prop-types: 15.8.1 react: 18.2.0 dev: false - /@mui/styled-engine@5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(react@18.2.0): - resolution: {integrity: sha512-FfvYvTG/Zd+KXMMImbcMYEeQAbONGuX5Vx3gBmmtB6KyA7Mvm9Pma1ly3R0gc44yeoFd+2wBjn1feS8h42HW5w==} + /@mui/styled-engine@5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(react@18.2.0): + resolution: {integrity: sha512-+d5XZCTeemOO/vBfWGEeHgTm8fjU1Psdgm+xAw+uegycO2EnoA/EfGSaG5UwZ6g3b66y48Mkxi35AggShMr88w==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.4.1 @@ -5770,8 +5245,8 @@ packages: react: 18.2.0 dev: false - /@mui/system@5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react@18.2.0): - resolution: {integrity: sha512-uKnPfsDqDs8bbN54TviAuoGWOmFiQLwNZ3Wvj+OBkJCzwA6QnLb/sSeCB7Pk3ilH4h4jQ0BHtbR+Xpjy9wlOuA==} + /@mui/system@5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react@18.2.0): + resolution: {integrity: sha512-ewVU4eRgo4VfNMGpO61cKlfWmH7l9s6rA8EknRzuMX3DbSLfmtW2WJJg6qPwragvpPIir0Pp/AdWVSDhyNy5Tw==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.5.0 @@ -5789,10 +5264,10 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/private-theming': 5.14.16(@types/react@18.2.46)(react@18.2.0) - '@mui/styled-engine': 5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.46) - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/private-theming': 5.15.3(@types/react@18.2.46)(react@18.2.0) + '@mui/styled-engine': 5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(react@18.2.0) + '@mui/types': 7.2.12(@types/react@18.2.46) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@types/react': 18.2.46 clsx: 2.1.0 csstype: 3.1.2 @@ -5800,8 +5275,8 @@ packages: react: 18.2.0 dev: false - /@mui/types@7.2.8(@types/react@18.2.46): - resolution: {integrity: sha512-9u0ji+xspl96WPqvrYJF/iO+1tQ1L5GTaDOeG3vCR893yy7VcWwRNiVMmPdPNpMDqx0WV1wtEW9OMwK9acWJzQ==} + /@mui/types@7.2.12(@types/react@18.2.46): + resolution: {integrity: sha512-3kaHiNm9khCAo0pVe0RenketDSFoZGAlVZ4zDjB/QNZV0XiCj+sh1zkX0VVhQPgYJDlBEzAag+MHJ1tU3vf0Zw==} peerDependencies: '@types/react': ^18.2.46 peerDependenciesMeta: @@ -5811,8 +5286,8 @@ packages: '@types/react': 18.2.46 dev: false - /@mui/utils@5.14.16(@types/react@18.2.46)(react@18.2.0): - resolution: {integrity: sha512-3xV31GposHkwRbQzwJJuooWpK2ybWdEdeUPtRjv/6vjomyi97F3+68l+QVj9tPTvmfSbr2sx5c/NuvDulrdRmA==} + /@mui/utils@5.15.3(@types/react@18.2.46)(react@18.2.0): + resolution: {integrity: sha512-mT3LiSt9tZWCdx1pl7q4Q5tNo6gdZbvJel286ZHGuj6LQQXjWNAh8qiF9d+LogvNUI+D7eLkTnj605d1zoazfg==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^18.2.46 @@ -5848,7 +5323,7 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build '@react-spring/rafz': 9.7.3 @@ -5873,7 +5348,7 @@ packages: react: ^17.0.0 || ^18.0.0 dependencies: '@babel/runtime': 7.23.7 - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/icons-material': link:packages/mui-icons-material/build '@mui/material': link:packages/mui-material/build '@mui/x-data-grid-premium': 6.18.6(@mui/material@packages+mui-material+build)(@mui/system@packages+mui-system+build)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) @@ -5899,7 +5374,7 @@ packages: '@babel/runtime': 7.23.7 '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@mui/x-data-grid': 6.18.6(@mui/material@packages+mui-material+build)(@mui/system@packages+mui-system+build)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/x-data-grid-pro': 6.18.6(@mui/material@packages+mui-material+build)(@mui/system@packages+mui-system+build)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/x-license-pro': 6.10.2(@types/react@18.2.46)(react@18.2.0) @@ -5926,7 +5401,7 @@ packages: '@babel/runtime': 7.23.7 '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@mui/x-data-grid': 6.18.6(@mui/material@packages+mui-material+build)(@mui/system@packages+mui-system+build)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/x-license-pro': 6.10.2(@types/react@18.2.46)(react@18.2.0) '@types/format-util': 1.0.4 @@ -5951,7 +5426,7 @@ packages: '@babel/runtime': 7.23.7 '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) clsx: 2.1.0 prop-types: 15.8.1 react: 18.2.0 @@ -6001,10 +5476,10 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@mui/x-date-pickers': 6.18.6(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@mui/material@packages+mui-material+build)(@mui/system@packages+mui-system+build)(@types/react@18.2.46)(date-fns-jalali@2.21.3-1)(date-fns@2.30.0)(react-dom@18.2.0)(react@18.2.0) '@mui/x-license-pro': 6.10.2(@types/react@18.2.46)(react@18.2.0) clsx: 2.1.0 @@ -6058,10 +5533,10 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@types/react-transition-group': 4.4.10 clsx: 2.1.0 date-fns: 2.30.0 @@ -6081,7 +5556,7 @@ packages: react: ^17.0.0 || ^18.0.0 dependencies: '@babel/runtime': 7.23.7 - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) react: 18.2.0 transitivePeerDependencies: - '@types/react' @@ -6101,10 +5576,10 @@ packages: '@babel/runtime': 7.23.7 '@emotion/react': 11.11.3(@types/react@18.2.46)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.46)(react@18.2.0) - '@mui/base': 5.0.0-beta.22(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/base': 5.0.0-beta.30(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) '@mui/material': link:packages/mui-material/build '@mui/system': link:packages/mui-system/build - '@mui/utils': 5.14.16(@types/react@18.2.46)(react@18.2.0) + '@mui/utils': 5.15.3(@types/react@18.2.46)(react@18.2.0) '@types/react-transition-group': 4.4.10 clsx: 2.1.0 prop-types: 15.8.1 @@ -6118,8 +5593,8 @@ packages: /@next/env@13.4.19: resolution: {integrity: sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==} - /@next/env@13.5.6: - resolution: {integrity: sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==} + /@next/env@14.0.1: + resolution: {integrity: sha512-Ms8ZswqY65/YfcjrlcIwMPD7Rg/dVjdLapMcSHG26W6O67EJDF435ShW4H4LXi1xKO1oRc97tLXUpx8jpLe86A==} /@next/eslint-plugin-next@14.0.4: resolution: {integrity: sha512-U3qMNHmEZoVmHA0j/57nRfi3AscXNvkOnxDmle/69Jz/G0o/gWjXTDdlgILZdrxQ0Lw/jv2mPW8PGy0EGIHXhQ==} @@ -6135,8 +5610,8 @@ packages: requiresBuild: true optional: true - /@next/swc-darwin-arm64@13.5.6: - resolution: {integrity: sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA==} + /@next/swc-darwin-arm64@14.0.1: + resolution: {integrity: sha512-JyxnGCS4qT67hdOKQ0CkgFTp+PXub5W1wsGvIq98TNbF3YEIN7iDekYhYsZzc8Ov0pWEsghQt+tANdidITCLaw==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -6151,8 +5626,8 @@ packages: requiresBuild: true optional: true - /@next/swc-darwin-x64@13.5.6: - resolution: {integrity: sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA==} + /@next/swc-darwin-x64@14.0.1: + resolution: {integrity: sha512-625Z7bb5AyIzswF9hvfZWa+HTwFZw+Jn3lOBNZB87lUS0iuCYDHqk3ujuHCkiyPtSC0xFBtYDLcrZ11mF/ap3w==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -6167,8 +5642,8 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-arm64-gnu@13.5.6: - resolution: {integrity: sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg==} + /@next/swc-linux-arm64-gnu@14.0.1: + resolution: {integrity: sha512-iVpn3KG3DprFXzVHM09kvb//4CNNXBQ9NB/pTm8LO+vnnnaObnzFdS5KM+w1okwa32xH0g8EvZIhoB3fI3mS1g==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -6183,8 +5658,8 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-arm64-musl@13.5.6: - resolution: {integrity: sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q==} + /@next/swc-linux-arm64-musl@14.0.1: + resolution: {integrity: sha512-mVsGyMxTLWZXyD5sen6kGOTYVOO67lZjLApIj/JsTEEohDDt1im2nkspzfV5MvhfS7diDw6Rp/xvAQaWZTv1Ww==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -6199,8 +5674,8 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-x64-gnu@13.5.6: - resolution: {integrity: sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw==} + /@next/swc-linux-x64-gnu@14.0.1: + resolution: {integrity: sha512-wMqf90uDWN001NqCM/auRl3+qVVeKfjJdT9XW+RMIOf+rhUzadmYJu++tp2y+hUbb6GTRhT+VjQzcgg/QTD9NQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -6215,8 +5690,8 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-x64-musl@13.5.6: - resolution: {integrity: sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ==} + /@next/swc-linux-x64-musl@14.0.1: + resolution: {integrity: sha512-ol1X1e24w4j4QwdeNjfX0f+Nza25n+ymY0T2frTyalVczUmzkVD7QGgPTZMHfR1aLrO69hBs0G3QBYaj22J5GQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -6231,8 +5706,8 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-arm64-msvc@13.5.6: - resolution: {integrity: sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg==} + /@next/swc-win32-arm64-msvc@14.0.1: + resolution: {integrity: sha512-WEmTEeWs6yRUEnUlahTgvZteh5RJc4sEjCQIodJlZZ5/VJwVP8p2L7l6VhzQhT4h7KvLx/Ed4UViBdne6zpIsw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -6247,8 +5722,8 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-ia32-msvc@13.5.6: - resolution: {integrity: sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg==} + /@next/swc-win32-ia32-msvc@14.0.1: + resolution: {integrity: sha512-oFpHphN4ygAgZUKjzga7SoH2VGbEJXZa/KL8bHCAwCjDWle6R1SpiGOdUdA8EJ9YsG1TYWpzY6FTbUA+iAJeww==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -6263,8 +5738,8 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-x64-msvc@13.5.6: - resolution: {integrity: sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ==} + /@next/swc-win32-x64-msvc@14.0.1: + resolution: {integrity: sha512-FFp3nOJ/5qSpeWT0BZQ+YE1pSMk4IMpkME/1DwKBwhg4mJLB9L+6EXuJi4JEwaJdl5iN+UUlmUD3IsR1kx5fAg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -7403,8 +6878,112 @@ packages: rollup: 3.29.4 dev: true - /@sideway/address@4.1.4: - resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} + /@rollup/rollup-android-arm-eabi@4.9.2: + resolution: {integrity: sha512-RKzxFxBHq9ysZ83fn8Iduv3A283K7zPPYuhL/z9CQuyFrjwpErJx0h4aeb/bnJ+q29GRLgJpY66ceQ/Wcsn3wA==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.9.2: + resolution: {integrity: sha512-yZ+MUbnwf3SHNWQKJyWh88ii2HbuHCFQnAYTeeO1Nb8SyEiWASEi5dQUygt3ClHWtA9My9RQAYkjvrsZ0WK8Xg==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.9.2: + resolution: {integrity: sha512-vqJ/pAUh95FLc/G/3+xPqlSBgilPnauVf2EXOQCZzhZJCXDXt/5A8mH/OzU6iWhb3CNk5hPJrh8pqJUPldN5zw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.9.2: + resolution: {integrity: sha512-otPHsN5LlvedOprd3SdfrRNhOahhVBwJpepVKUN58L0RnC29vOAej1vMEaVU6DadnpjivVsNTM5eNt0CcwTahw==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.9.2: + resolution: {integrity: sha512-ewG5yJSp+zYKBYQLbd1CUA7b1lSfIdo9zJShNTyc2ZP1rcPrqyZcNlsHgs7v1zhgfdS+kW0p5frc0aVqhZCiYQ==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.9.2: + resolution: {integrity: sha512-pL6QtV26W52aCWTG1IuFV3FMPL1m4wbsRG+qijIvgFO/VBsiXJjDPE/uiMdHBAO6YcpV4KvpKtd0v3WFbaxBtg==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.9.2: + resolution: {integrity: sha512-On+cc5EpOaTwPSNetHXBuqylDW+765G/oqB9xGmWU3npEhCh8xu0xqHGUA+4xwZLqBbIZNcBlKSIYfkBm6ko7g==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.9.2: + resolution: {integrity: sha512-Wnx/IVMSZ31D/cO9HSsU46FjrPWHqtdF8+0eyZ1zIB5a6hXaZXghUKpRrC4D5DcRTZOjml2oBhXoqfGYyXKipw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.9.2: + resolution: {integrity: sha512-ym5x1cj4mUAMBummxxRkI4pG5Vht1QMsJexwGP8547TZ0sox9fCLDHw9KCH9c1FO5d9GopvkaJsBIOkTKxksdw==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.9.2: + resolution: {integrity: sha512-m0hYELHGXdYx64D6IDDg/1vOJEaiV8f1G/iO+tejvRCJNSwK4jJ15e38JQy5Q6dGkn1M/9KcyEOwqmlZ2kqaZg==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.9.2: + resolution: {integrity: sha512-x1CWburlbN5JjG+juenuNa4KdedBdXLjZMp56nHFSHTOsb/MI2DYiGzLtRGHNMyydPGffGId+VgjOMrcltOksA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.9.2: + resolution: {integrity: sha512-VVzCB5yXR1QlfsH1Xw1zdzQ4Pxuzv+CPr5qpElpKhVxlxD3CRdfubAG9mJROl6/dmj5gVYDDWk8sC+j9BI9/kQ==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.9.2: + resolution: {integrity: sha512-SYRedJi+mweatroB+6TTnJYLts0L0bosg531xnQWtklOI6dezEagx4Q0qDyvRdK+qgdA3YZpjjGuPFtxBmddBA==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@sideway/address@4.1.4: + resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} dependencies: '@hapi/hoek': 9.3.0 dev: false @@ -7719,36 +7298,6 @@ packages: lz-string: 1.5.0 pretty-format: 27.5.1 - /@testing-library/jest-dom@6.2.0(jest@29.7.0)(vitest@0.34.6): - resolution: {integrity: sha512-+BVQlJ9cmEn5RDMUS8c2+TU6giLvzaHZ8sU/x0Jj7fk+6/46wPdwlgOPcpxS17CjcanBi/3VmGMqVr2rmbUmNw==} - engines: {node: '>=14', npm: '>=6', yarn: '>=1'} - peerDependencies: - '@jest/globals': '>= 28' - '@types/jest': '>= 28' - jest: '>= 28' - vitest: '>= 0.32' - peerDependenciesMeta: - '@jest/globals': - optional: true - '@types/jest': - optional: true - jest: - optional: true - vitest: - optional: true - dependencies: - '@adobe/css-tools': 4.3.2 - '@babel/runtime': 7.23.7 - aria-query: 5.3.0 - chalk: 3.0.0 - css.escape: 1.5.1 - dom-accessibility-api: 0.6.3 - jest: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - lodash: 4.17.21 - redent: 3.0.0 - vitest: 0.34.6(jsdom@22.1.0) - dev: true - /@testing-library/react@14.1.2(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-z4p7DVBTPjKM5qDZ0t5ZjzkpSNb+fZy1u6bzO7kk8oeGagpPCAtgh4cx1syrfp7a+QWkM021jGqjJaxJJnXAZg==} engines: {node: '>=14'} @@ -7904,11 +7453,13 @@ packages: '@types/babel__generator': 7.6.4 '@types/babel__template': 7.4.1 '@types/babel__traverse': 7.20.5 + dev: true /@types/babel__generator@7.6.4: resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==} dependencies: '@babel/types': 7.23.6 + dev: true /@types/babel__helper-module-imports@7.18.3: resolution: {integrity: sha512-2pyr9Vlriessj2KI85SEF7qma8vA3vzquQMw3wn6kL5lsfjH/YxJ1Noytk4/FJElpYybUbyaC37CVfEgfyme9A==} @@ -7928,11 +7479,13 @@ packages: dependencies: '@babel/parser': 7.23.6 '@babel/types': 7.23.6 + dev: true /@types/babel__traverse@7.20.5: resolution: {integrity: sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==} dependencies: '@babel/types': 7.23.6 + dev: true /@types/body-parser@1.19.2: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} @@ -7956,12 +7509,6 @@ packages: '@types/chai': 4.3.11 dev: true - /@types/chai-subset@1.3.4: - resolution: {integrity: sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==} - dependencies: - '@types/chai': 4.3.11 - dev: true - /@types/chai@4.3.11: resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} dev: true @@ -7990,6 +7537,10 @@ packages: resolution: {integrity: sha512-DZyHAz716ZUctpqkUU2COwUoZ4gI6mZK2Q1oIz/fvNS6XHVpKSJgDnE7vRxZUBn9vjJHDVelCVW0dkshKOLFsA==} dev: true + /@types/cssesc@3.0.2: + resolution: {integrity: sha512-Qii6nTRktvtI380EloxH/V7MwgrYxkPgBI+NklUjQuhzgAd1AqT3QDJd+eD+0doRADgfwvtagLRo7JFa7aMHXg==} + dev: true + /@types/d3-array@3.0.5: resolution: {integrity: sha512-Qk7fpJ6qFp+26VeQ47WY0mkwXaiq8+76RJcncDEfMc2ocRzXLO67bLFRNI4OX1aGBoPzsM5Y2T+/m1pldOgD+A==} dev: false @@ -8032,6 +7583,12 @@ packages: resolution: {integrity: sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==} dev: false + /@types/debug@4.1.12: + resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + dependencies: + '@types/ms': 0.7.34 + dev: true + /@types/doctrine@0.0.9: resolution: {integrity: sha512-eOIHzCUSH7SMfonMG1LsC2f8vxBFtho6NGBznK41R84YzPuvSBzrhEps33IsQiOW9+VL6NQ9DbjQJznk/S4uRA==} dev: true @@ -8079,13 +7636,6 @@ packages: /@types/format-util@1.0.4: resolution: {integrity: sha512-xrCYOdHh5zA3LUrn6CvspYwlzSWxPso11Lx32WnAG6KvLCRecKZ/Rh21PLXUkzUFsQmrGcx/traJAFjR6dVS5Q==} - /@types/fs-extra@11.0.1: - resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==} - dependencies: - '@types/jsonfile': 6.1.1 - '@types/node': 18.19.4 - dev: false - /@types/fs-extra@11.0.4: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: @@ -8093,11 +7643,6 @@ packages: '@types/node': 18.19.4 dev: true - /@types/graceful-fs@4.1.7: - resolution: {integrity: sha512-MhzcwU8aUygZroVwL2jeYk6JisJrPl/oov/gsgGCue9mkgl9wjGbzReYQClxiUgFDnib9FuHqTndccKeZKxTRw==} - dependencies: - '@types/node': 18.19.4 - /@types/hoist-non-react-statics@3.3.5: resolution: {integrity: sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==} dependencies: @@ -8123,16 +7668,19 @@ packages: /@types/istanbul-lib-coverage@2.0.4: resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} + dev: false /@types/istanbul-lib-report@3.0.1: resolution: {integrity: sha512-gPQuzaPR5h/djlAv2apEG1HVOyj1IUs7GpfMZixU0/0KXT3pm64ylHuMUI1/Akh+sq/iikxg6Z2j+fcMDXaaTQ==} dependencies: '@types/istanbul-lib-coverage': 2.0.4 + dev: false /@types/istanbul-reports@3.0.2: resolution: {integrity: sha512-kv43F9eb3Lhj+lr/Hn6OcLCs/sSM8bt+fIaP11rCYngfV6NVjzWXJ17owQtDQTL9tQ8WSLUrGsSJ6rJz0F1w1A==} dependencies: '@types/istanbul-lib-report': 3.0.1 + dev: false /@types/jscodeshift@0.11.5: resolution: {integrity: sha512-7JV0qdblTeWFigevmwFUgROXX395F+MQx6v0YqPn8Bx0B4Sng6alEejz9PENzgLYpG+zL0O4tGdBzc4gKZH8XA==} @@ -8141,14 +7689,6 @@ packages: recast: 0.20.5 dev: true - /@types/jsdom@20.0.1: - resolution: {integrity: sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==} - dependencies: - '@types/node': 18.19.4 - '@types/tough-cookie': 4.0.4 - parse5: 7.1.2 - dev: true - /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} @@ -8164,6 +7704,7 @@ packages: resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==} dependencies: '@types/node': 18.19.4 + dev: true /@types/jsonwebtoken@8.5.9: resolution: {integrity: sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==} @@ -8189,6 +7730,12 @@ packages: '@types/lodash': 4.14.202 dev: false + /@types/lodash.set@4.3.9: + resolution: {integrity: sha512-KOxyNkZpbaggVmqbpr82N2tDVTx05/3/j0f50Es1prxrWB0XYf9p3QNxqcbWb7P1Q9wlvsUSlCFnwlPCIJ46PQ==} + dependencies: + '@types/lodash': 4.14.202 + dev: true + /@types/lodash@4.14.202: resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} @@ -8233,6 +7780,10 @@ packages: resolution: {integrity: sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==} dev: true + /@types/ms@0.7.34: + resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} + dev: true + /@types/node@18.19.4: resolution: {integrity: sha512-xNzlUhzoHotIsnFoXmJB+yWmBvFZgKCI9TtPIEdYIMM1KWfwuY8zh7wvc1u1OAXlC7dlf6mZVx/s+Y5KfFz19A==} dependencies: @@ -8264,12 +7815,6 @@ packages: resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} dev: false - /@types/ramda@0.29.3: - resolution: {integrity: sha512-Yh/RHkjN0ru6LVhSQtTkCRo6HXkfL9trot/2elzM/yXLJmbLm2v6kJc8yftTnwv1zvUob6TEtqI2cYjdqG3U0Q==} - dependencies: - types-ramda: 0.29.6 - dev: false - /@types/range-parser@1.2.4: resolution: {integrity: sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==} dev: false @@ -8384,6 +7929,7 @@ packages: /@types/stack-utils@2.0.2: resolution: {integrity: sha512-g7CK9nHdwjK2n0ymT2CW698FuWJRIx+RP6embAzZ2Qi8/ilIrA1Imt2LVSeHUzKvpoi7BhmmQcXz95eS0f2JXw==} + dev: false /@types/styled-system@5.1.15: resolution: {integrity: sha512-1uls4wipZn8FtYFZ7upRVFDoEeOXTQTs2zuyOZPn02T6rjIxtvj2P2lG5qsxXHhKuKsu3thveCZrtaeLE/ibLg==} @@ -8394,10 +7940,6 @@ packages: /@types/stylis@4.2.0: resolution: {integrity: sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw==} - /@types/tough-cookie@4.0.4: - resolution: {integrity: sha512-95Sfz4nvMAb0Nl9DTxN3j64adfwfbBPEYq14VN7zT5J5O2M9V6iZMIIQU1U+pJyl9agHYHNCqhCXgyEtIRRa5A==} - dev: true - /@types/tsscmp@1.0.0: resolution: {integrity: sha512-rj18XR6c4Ohds86Lq8MI1NMRrXes4eLo4H06e5bJyKucE1rXGsfBBbFGD2oDC+DSufQCpnU3TTW7QAiwLx+7Yw==} dev: false @@ -8577,60 +8119,6 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@vitejs/plugin-react@4.2.1(vite@4.5.1): - resolution: {integrity: sha512-oojO9IDc4nCUUi8qIR11KoQm0XFFLIwsRBwHRR4d/88IWghn1y6ckz/bJ8GHDCsYEJee8mDzqtJxh15/cisJNQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.2.0 || ^5.0.0 - dependencies: - '@babel/core': 7.23.7 - '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.23.7) - '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.7) - '@types/babel__core': 7.20.5 - react-refresh: 0.14.0 - vite: 4.5.1(@types/node@18.19.4) - transitivePeerDependencies: - - supports-color - dev: true - - /@vitest/expect@0.34.6: - resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} - dependencies: - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - chai: 4.4.0 - dev: true - - /@vitest/runner@0.34.6: - resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} - dependencies: - '@vitest/utils': 0.34.6 - p-limit: 4.0.0 - pathe: 1.1.1 - dev: true - - /@vitest/snapshot@0.34.6: - resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} - dependencies: - magic-string: 0.30.5 - pathe: 1.1.1 - pretty-format: 29.7.0 - dev: true - - /@vitest/spy@0.34.6: - resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} - dependencies: - tinyspy: 2.2.0 - dev: true - - /@vitest/utils@0.34.6: - resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} - dependencies: - diff-sequences: 29.6.3 - loupe: 2.3.7 - pretty-format: 29.7.0 - dev: true - /@webassemblyjs/ast@1.11.6: resolution: {integrity: sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==} dependencies: @@ -8729,7 +8217,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.1)(webpack@5.89.0) /@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.89.0): @@ -8739,7 +8227,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.1)(webpack@5.89.0) /@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack@5.89.0): @@ -8753,7 +8241,7 @@ packages: webpack-dev-server: optional: true dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.1)(webpack@5.89.0) /@xtuc/ieee754@1.2.0: @@ -8796,6 +8284,7 @@ packages: /abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} deprecated: Use your platform's native atob() and btoa() methods instead + dev: false /abbrev@2.0.0: resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} @@ -8816,26 +8305,19 @@ packages: mime-types: 2.1.35 negotiator: 0.6.3 - /acorn-globals@7.0.1: - resolution: {integrity: sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==} - dependencies: - acorn: 8.10.0 - acorn-walk: 8.2.0 - dev: true - - /acorn-import-assertions@1.9.0(acorn@8.10.0): + /acorn-import-assertions@1.9.0(acorn@8.11.3): resolution: {integrity: sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==} peerDependencies: acorn: ^8 dependencies: - acorn: 8.10.0 + acorn: 8.11.3 - /acorn-jsx@5.3.2(acorn@8.10.0): + /acorn-jsx@5.3.2(acorn@8.11.3): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.10.0 + acorn: 8.11.3 dev: true /acorn-walk@8.2.0: @@ -8848,8 +8330,8 @@ packages: hasBin: true dev: true - /acorn@8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} + /acorn@8.11.3: + resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} hasBin: true @@ -9488,23 +8970,6 @@ packages: '@babel/core': 7.23.7 dev: false - /babel-jest@29.7.0(@babel/core@7.23.7): - resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.23.7 - dependencies: - '@babel/core': 7.23.7 - '@jest/transform': 29.7.0 - '@types/babel__core': 7.20.5 - babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.6.3(@babel/core@7.23.7) - chalk: 4.1.2 - graceful-fs: 4.2.11 - slash: 3.0.0 - transitivePeerDependencies: - - supports-color - /babel-loader@9.1.3(@babel/core@7.23.7)(webpack@5.89.0): resolution: {integrity: sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==} engines: {node: '>= 14.15.0'} @@ -9515,7 +8980,7 @@ packages: '@babel/core': 7.23.7 find-cache-dir: 4.0.0 schema-utils: 4.0.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) dev: true /babel-merge@3.0.0(@babel/core@7.23.7): @@ -9540,15 +9005,7 @@ packages: test-exclude: 6.0.0 transitivePeerDependencies: - supports-color - - /babel-plugin-jest-hoist@29.6.3: - resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@babel/template': 7.22.15 - '@babel/types': 7.23.6 - '@types/babel__core': 7.20.5 - '@types/babel__traverse': 7.20.5 + dev: true /babel-plugin-macros@3.1.0: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} @@ -9645,25 +9102,6 @@ packages: /babel-plugin-transform-react-remove-prop-types@0.4.24: resolution: {integrity: sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==} - /babel-preset-current-node-syntax@1.0.1(@babel/core@7.23.7): - resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} - peerDependencies: - '@babel/core': ^7.23.7 - dependencies: - '@babel/core': 7.23.7 - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.7) - '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.7) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.7) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.7) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.7) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.7) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.7) - /babel-preset-fbjs@3.4.0(@babel/core@7.23.7): resolution: {integrity: sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow==} peerDependencies: @@ -9699,16 +9137,6 @@ packages: babel-plugin-syntax-trailing-function-commas: 7.0.0-beta.0 dev: false - /babel-preset-jest@29.6.3(@babel/core@7.23.7): - resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.23.7 - dependencies: - '@babel/core': 7.23.7 - babel-plugin-jest-hoist: 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.7) - /bail@1.0.5: resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} dev: false @@ -9902,6 +9330,7 @@ packages: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} dependencies: node-int64: 0.4.0 + dev: false /buffer-crc32@0.2.13: resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} @@ -9965,6 +9394,16 @@ packages: semver: 7.5.4 dev: true + /bundle-require@4.0.2(esbuild@0.19.11): + resolution: {integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.19.11 + load-tsconfig: 0.2.5 + dev: true + /busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -10245,11 +9684,6 @@ packages: resolution: {integrity: sha512-kqTg3WWywappJPqtgrdvbA380VoXO2eu9VCV895JgbyHsaErXdyHK9LOZ911OvAk6L0obK7kDk9CGs8+oBawVA==} dev: false - /char-regex@1.0.2: - resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} - engines: {node: '>=10'} - dev: true - /character-entities-legacy@1.1.4: resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} dev: false @@ -10354,10 +9788,6 @@ packages: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} - /cjs-module-lexer@1.2.3: - resolution: {integrity: sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==} - dev: true - /class-utils@0.3.6: resolution: {integrity: sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==} engines: {node: '>=0.10.0'} @@ -10512,15 +9942,6 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dev: true - /co@4.6.0: - resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} - engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} - dev: true - - /collect-v8-coverage@1.0.2: - resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} - dev: true - /collection-visit@1.0.0: resolution: {integrity: sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw==} engines: {node: '>=0.10.0'} @@ -10681,7 +10102,7 @@ packages: dependencies: schema-utils: 4.0.0 serialize-javascript: 6.0.1 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) dev: true /compression@1.7.4: @@ -10990,25 +10411,6 @@ packages: buffer: 5.7.1 dev: true - /create-jest@29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - dev: true - /cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -11120,13 +10522,12 @@ packages: /css.escape@1.5.1: resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} - dev: true + dev: false /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} hasBin: true - dev: true /cssjanus@1.3.2: resolution: {integrity: sha512-5pM/C1MIfoqhXa7k9PqSnrjj1SSZDakfyB1DZhdYyJoDUH+evGbsUg6/bpQapTJeSnYaj0rdzPUMeM33CvB0vw==} @@ -11144,26 +10545,12 @@ packages: css-tree: 2.2.1 dev: true - /cssom@0.3.8: - resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} - dev: true - - /cssom@0.5.0: - resolution: {integrity: sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==} - dev: true - - /cssstyle@2.3.0: - resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==} - engines: {node: '>=8'} - dependencies: - cssom: 0.3.8 - dev: true - /cssstyle@3.0.0: resolution: {integrity: sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==} engines: {node: '>=14'} dependencies: rrweb-cssom: 0.6.0 + dev: false /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} @@ -11310,15 +10697,6 @@ packages: engines: {node: '>=8'} dev: true - /data-urls@3.0.2: - resolution: {integrity: sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==} - engines: {node: '>=12'} - dependencies: - abab: 2.0.6 - whatwg-mimetype: 3.0.0 - whatwg-url: 11.0.0 - dev: true - /data-urls@4.0.0: resolution: {integrity: sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==} engines: {node: '>=14'} @@ -11326,6 +10704,7 @@ packages: abab: 2.0.6 whatwg-mimetype: 3.0.0 whatwg-url: 12.0.1 + dev: false /date-fns-jalali@2.21.3-1: resolution: {integrity: sha512-Sgw1IdgCgyWDKCpq6uwAu24vPMOtvmcXXXuETr1jQO/aVj4h23XAltcP7hLbo+osqoiJnPmiydbI/q1W7TYAjA==} @@ -11414,6 +10793,7 @@ packages: /decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + dev: false /decode-uri-component@0.2.2: resolution: {integrity: sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==} @@ -11430,17 +10810,6 @@ packages: resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} dev: true - /dedent@1.5.1(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==} - peerDependencies: - babel-plugin-macros: ^3.1.0 - peerDependenciesMeta: - babel-plugin-macros: - optional: true - dependencies: - babel-plugin-macros: 3.1.0 - dev: true - /deep-eql@4.1.3: resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} engines: {node: '>=6'} @@ -11486,6 +10855,7 @@ packages: /deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} + dev: false /default-require-extensions@3.0.0: resolution: {integrity: sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==} @@ -11605,11 +10975,6 @@ packages: engines: {node: '>=8'} dev: true - /detect-newline@3.1.0: - resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} - engines: {node: '>=8'} - dev: true - /di@0.0.1: resolution: {integrity: sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==} dev: true @@ -11663,6 +11028,7 @@ packages: /dom-accessibility-api@0.6.3: resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + dev: false /dom-converter@0.2.0: resolution: {integrity: sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==} @@ -11705,7 +11071,7 @@ packages: dependencies: domelementtype: 2.3.0 domhandler: 5.0.3 - entities: 4.4.0 + entities: 4.5.0 /domelementtype@2.3.0: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} @@ -11716,6 +11082,7 @@ packages: deprecated: Use your platform's native DOMException instead dependencies: webidl-conversions: 7.0.0 + dev: false /domhandler@4.3.1: resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} @@ -11808,11 +11175,6 @@ packages: /electron-to-chromium@1.4.613: resolution: {integrity: sha512-r4x5+FowKG6q+/Wj0W9nidx7QO31BJwmR2uEo+Qh3YLGQ8SbBAFuDFpTxzly/I2gsbrFwBuIjrMp423L3O5U3w==} - /emittery@0.13.1: - resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} - engines: {node: '>=12'} - dev: true - /emoji-regex@10.3.0: resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} dev: false @@ -11906,8 +11268,8 @@ packages: engines: {node: '>=0.12'} dev: true - /entities@4.4.0: - resolution: {integrity: sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==} + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} /env-paths@2.2.1: @@ -12116,36 +11478,6 @@ packages: es6-promise: 4.2.8 dev: true - /esbuild@0.18.20: - resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.18.20 - '@esbuild/android-arm64': 0.18.20 - '@esbuild/android-x64': 0.18.20 - '@esbuild/darwin-arm64': 0.18.20 - '@esbuild/darwin-x64': 0.18.20 - '@esbuild/freebsd-arm64': 0.18.20 - '@esbuild/freebsd-x64': 0.18.20 - '@esbuild/linux-arm': 0.18.20 - '@esbuild/linux-arm64': 0.18.20 - '@esbuild/linux-ia32': 0.18.20 - '@esbuild/linux-loong64': 0.18.20 - '@esbuild/linux-mips64el': 0.18.20 - '@esbuild/linux-ppc64': 0.18.20 - '@esbuild/linux-riscv64': 0.18.20 - '@esbuild/linux-s390x': 0.18.20 - '@esbuild/linux-x64': 0.18.20 - '@esbuild/netbsd-x64': 0.18.20 - '@esbuild/openbsd-x64': 0.18.20 - '@esbuild/sunos-x64': 0.18.20 - '@esbuild/win32-arm64': 0.18.20 - '@esbuild/win32-ia32': 0.18.20 - '@esbuild/win32-x64': 0.18.20 - dev: true - /esbuild@0.19.11: resolution: {integrity: sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==} engines: {node: '>=12'} @@ -12175,7 +11507,6 @@ packages: '@esbuild/win32-arm64': 0.19.11 '@esbuild/win32-ia32': 0.19.11 '@esbuild/win32-x64': 0.19.11 - dev: true /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -12191,6 +11522,7 @@ packages: /escape-string-regexp@2.0.0: resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} engines: {node: '>=8'} + dev: false /escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} @@ -12201,18 +11533,6 @@ packages: engines: {node: '>=12'} dev: true - /escodegen@2.1.0: - resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} - engines: {node: '>=6.0'} - hasBin: true - dependencies: - esprima: 4.0.1 - estraverse: 5.3.0 - esutils: 2.0.3 - optionalDependencies: - source-map: 0.6.1 - dev: true - /eslint-config-airbnb-base@15.0.0(eslint-plugin-import@2.29.1)(eslint@8.56.0): resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==} engines: {node: ^10.12.0 || >=12.0.0} @@ -12301,7 +11621,7 @@ packages: lodash: 4.17.21 resolve: 2.0.0-next.5 semver: 5.7.2 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) transitivePeerDependencies: - supports-color dev: true @@ -12554,8 +11874,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.10.0 - acorn-jsx: 5.3.2(acorn@8.10.0) + acorn: 8.11.3 + acorn-jsx: 5.3.2(acorn@8.11.3) eslint-visitor-keys: 3.4.3 dev: true @@ -12707,11 +12027,6 @@ packages: signal-exit: 3.0.7 strip-final-newline: 2.0.0 - /exit@0.1.2: - resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} - engines: {node: '>= 0.8.0'} - dev: true - /expand-brackets@2.1.4: resolution: {integrity: sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA==} engines: {node: '>=0.10.0'} @@ -12739,17 +12054,6 @@ packages: homedir-polyfill: 1.0.3 dev: true - /expect@29.7.0: - resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/expect-utils': 29.7.0 - jest-get-type: 29.6.3 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - dev: true - /exponential-backoff@3.1.1: resolution: {integrity: sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==} dev: true @@ -12900,6 +12204,7 @@ packages: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} dependencies: bser: 2.1.1 + dev: false /feed@4.2.2: resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==} @@ -12934,15 +12239,6 @@ packages: flat-cache: 3.2.0 dev: true - /file-system-cache@2.4.4: - resolution: {integrity: sha512-vCYhn8pb5nlC3Gs2FFCOkmf4NEg2Ym3ulJwkmS9o6p9oRShGj6CwTMFvpgZihBlsh373NaM0XgAgDHXQIlS4LQ==} - dependencies: - '@types/fs-extra': 11.0.1 - '@types/ramda': 0.29.3 - fs-extra: 11.1.1 - ramda: 0.29.0 - dev: false - /filelist@1.0.4: resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} dependencies: @@ -13204,15 +12500,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /fs-extra@11.1.1: - resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} - engines: {node: '>=14.14'} - dependencies: - graceful-fs: 4.2.11 - jsonfile: 6.1.0 - universalify: 2.0.0 - dev: false - /fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} @@ -13357,6 +12644,7 @@ packages: /get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} engines: {node: '>=8.0.0'} + dev: true /get-pkg-repo@4.2.1: resolution: {integrity: sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA==} @@ -13765,6 +13053,17 @@ packages: uglify-js: 3.17.0 dev: true + /happy-dom@10.8.0: + resolution: {integrity: sha512-ux5UfhNA9ANGf4keV7FCd9GqeQr3Bz1u9qnoPtTL0NcO1MEOeUXIUwNTB9r84Z7Q8/bsgkwi6K114zjYvnCmag==} + dependencies: + css.escape: 1.5.1 + entities: 4.5.0 + iconv-lite: 0.6.3 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + dev: false + /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} @@ -13958,6 +13257,7 @@ packages: engines: {node: '>=12'} dependencies: whatwg-encoding: 2.0.0 + dev: false /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} @@ -14008,7 +13308,7 @@ packages: lodash: 4.17.21 pretty-error: 4.0.0 tapable: 2.2.1 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) dev: true /htmlparser2@6.1.0: @@ -14026,7 +13326,7 @@ packages: domelementtype: 2.3.0 domhandler: 5.0.3 domutils: 3.0.1 - entities: 4.4.0 + entities: 4.5.0 /http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} @@ -14504,11 +13804,6 @@ packages: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - /is-generator-fn@2.1.0: - resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} - engines: {node: '>=6'} - dev: true - /is-generator-function@1.0.10: resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} engines: {node: '>= 0.4'} @@ -14614,6 +13909,7 @@ packages: /is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + dev: false /is-reference@1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} @@ -14796,18 +14092,6 @@ packages: semver: 6.3.1 transitivePeerDependencies: - supports-color - - /istanbul-lib-instrument@6.0.1: - resolution: {integrity: sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==} - engines: {node: '>=10'} - dependencies: - '@babel/core': 7.23.7 - '@babel/parser': 7.23.6 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color dev: true /istanbul-lib-processinfo@2.0.3: @@ -14910,112 +14194,6 @@ packages: minimatch: 3.1.2 dev: true - /jest-changed-files@29.7.0: - resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - execa: 5.1.1 - jest-util: 29.7.0 - p-limit: 3.1.0 - dev: true - - /jest-circus@29.7.0(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - chalk: 4.1.2 - co: 4.6.0 - dedent: 1.5.1(babel-plugin-macros@3.1.0) - is-generator-fn: 2.1.0 - jest-each: 29.7.0 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - p-limit: 3.1.0 - pretty-format: 29.7.0 - pure-rand: 6.0.4 - slash: 3.0.0 - stack-utils: 2.0.6 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - dev: true - - /jest-cli@29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - exit: 0.1.2 - import-local: 3.1.0 - jest-config: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - dev: true - - /jest-config@29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@types/node': ^18.19.4 - ts-node: '>=9.0.0' - peerDependenciesMeta: - '@types/node': - optional: true - ts-node: - optional: true - dependencies: - '@babel/core': 7.23.7 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - babel-jest: 29.7.0(@babel/core@7.23.7) - chalk: 4.1.2 - ci-info: 3.8.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0(babel-plugin-macros@3.1.0) - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.5 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - dev: true - /jest-diff@29.7.0: resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -15026,47 +14204,6 @@ packages: pretty-format: 29.7.0 dev: true - /jest-docblock@29.7.0: - resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - detect-newline: 3.1.0 - dev: true - - /jest-each@29.7.0: - resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - jest-get-type: 29.6.3 - jest-util: 29.7.0 - pretty-format: 29.7.0 - dev: true - - /jest-environment-jsdom@29.7.0: - resolution: {integrity: sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - dependencies: - '@jest/environment': 29.7.0 - '@jest/fake-timers': 29.7.0 - '@jest/types': 29.6.3 - '@types/jsdom': 20.0.1 - '@types/node': 18.19.4 - jest-mock: 29.7.0 - jest-util: 29.7.0 - jsdom: 20.0.3 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - /jest-environment-node@29.7.0: resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -15077,47 +14214,12 @@ packages: '@types/node': 18.19.4 jest-mock: 29.7.0 jest-util: 29.7.0 + dev: false /jest-get-type@29.6.3: resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - /jest-haste-map@29.7.0: - resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.6.3 - '@types/graceful-fs': 4.1.7 - '@types/node': 18.19.4 - anymatch: 3.1.2 - fb-watchman: 2.0.2 - graceful-fs: 4.2.11 - jest-regex-util: 29.6.3 - jest-util: 29.7.0 - jest-worker: 29.7.0 - micromatch: 4.0.5 - walker: 1.0.8 - optionalDependencies: - fsevents: 2.3.3 - - /jest-leak-detector@29.7.0: - resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - dev: true - - /jest-matcher-utils@29.7.0: - resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - chalk: 4.1.2 - jest-diff: 29.7.0 - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - dev: true - /jest-message-util@29.7.0: resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -15131,6 +14233,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 stack-utils: 2.0.6 + dev: false /jest-mock@29.7.0: resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} @@ -15139,134 +14242,7 @@ packages: '@jest/types': 29.6.3 '@types/node': 18.19.4 jest-util: 29.7.0 - - /jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): - resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} - engines: {node: '>=6'} - peerDependencies: - jest-resolve: '*' - peerDependenciesMeta: - jest-resolve: - optional: true - dependencies: - jest-resolve: 29.7.0 - dev: true - - /jest-regex-util@29.6.3: - resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - /jest-resolve-dependencies@29.7.0: - resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - jest-regex-util: 29.6.3 - jest-snapshot: 29.7.0 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-resolve@29.7.0: - resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - chalk: 4.1.2 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-pnp-resolver: 1.2.3(jest-resolve@29.7.0) - jest-util: 29.7.0 - jest-validate: 29.7.0 - resolve: 1.22.4 - resolve.exports: 2.0.2 - slash: 3.0.0 - dev: true - - /jest-runner@29.7.0: - resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/console': 29.7.0 - '@jest/environment': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - chalk: 4.1.2 - emittery: 0.13.1 - graceful-fs: 4.2.11 - jest-docblock: 29.7.0 - jest-environment-node: 29.7.0 - jest-haste-map: 29.7.0 - jest-leak-detector: 29.7.0 - jest-message-util: 29.7.0 - jest-resolve: 29.7.0 - jest-runtime: 29.7.0 - jest-util: 29.7.0 - jest-watcher: 29.7.0 - jest-worker: 29.7.0 - p-limit: 3.1.0 - source-map-support: 0.5.13 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-runtime@29.7.0: - resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/environment': 29.7.0 - '@jest/fake-timers': 29.7.0 - '@jest/globals': 29.7.0 - '@jest/source-map': 29.6.3 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - chalk: 4.1.2 - cjs-module-lexer: 1.2.3 - collect-v8-coverage: 1.0.2 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-mock: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - slash: 3.0.0 - strip-bom: 4.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-snapshot@29.7.0: - resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@babel/core': 7.23.7 - '@babel/generator': 7.23.6 - '@babel/plugin-syntax-jsx': 7.23.3(@babel/core@7.23.7) - '@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.7) - '@babel/types': 7.23.6 - '@jest/expect-utils': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.7) - chalk: 4.1.2 - expect: 29.7.0 - graceful-fs: 4.2.11 - jest-diff: 29.7.0 - jest-get-type: 29.6.3 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - natural-compare: 1.4.0 - pretty-format: 29.7.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - dev: true + dev: false /jest-util@29.7.0: resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} @@ -15278,6 +14254,7 @@ packages: ci-info: 3.8.0 graceful-fs: 4.2.11 picomatch: 2.3.1 + dev: false /jest-validate@29.7.0: resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} @@ -15289,20 +14266,7 @@ packages: jest-get-type: 29.6.3 leven: 3.1.0 pretty-format: 29.7.0 - - /jest-watcher@29.7.0: - resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 18.19.4 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - emittery: 0.13.1 - jest-util: 29.7.0 - string-length: 4.0.2 - dev: true + dev: false /jest-worker@26.6.2: resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} @@ -15329,27 +14293,7 @@ packages: jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - - /jest@29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0): - resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0) - '@jest/types': 29.6.3 - import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@18.19.4)(babel-plugin-macros@3.1.0) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - dev: true + dev: false /jiti@1.19.1: resolution: {integrity: sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==} @@ -15371,6 +14315,11 @@ packages: '@sideway/pinpoint': 2.0.0 dev: false + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: true + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -15475,47 +14424,6 @@ packages: - supports-color dev: false - /jsdom@20.0.3: - resolution: {integrity: sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==} - engines: {node: '>=14'} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - dependencies: - abab: 2.0.6 - acorn: 8.10.0 - acorn-globals: 7.0.1 - cssom: 0.5.0 - cssstyle: 2.3.0 - data-urls: 3.0.2 - decimal.js: 10.4.3 - domexception: 4.0.0 - escodegen: 2.1.0 - form-data: 4.0.0 - html-encoding-sniffer: 3.0.0 - http-proxy-agent: 5.0.0 - https-proxy-agent: 5.0.1 - is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.7 - parse5: 7.1.2 - saxes: 6.0.0 - symbol-tree: 3.2.4 - tough-cookie: 4.1.2 - w3c-xmlserializer: 4.0.0 - webidl-conversions: 7.0.0 - whatwg-encoding: 2.0.0 - whatwg-mimetype: 3.0.0 - whatwg-url: 11.0.0 - ws: 8.13.0 - xml-name-validator: 4.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - /jsdom@22.1.0: resolution: {integrity: sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==} engines: {node: '>=16'} @@ -15552,6 +14460,7 @@ packages: - bufferutil - supports-color - utf-8-validate + dev: false /jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} @@ -15891,7 +14800,7 @@ packages: dependencies: glob: 7.2.3 minimatch: 3.1.2 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-merge: 4.2.2 dev: true @@ -15967,6 +14876,7 @@ packages: /kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} + dev: false /known-css-properties@0.29.0: resolution: {integrity: sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==} @@ -16083,6 +14993,7 @@ packages: /leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} engines: {node: '>=6'} + dev: false /levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} @@ -16180,6 +15091,11 @@ packages: type-fest: 0.6.0 dev: true + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -16193,11 +15109,6 @@ packages: json5: 2.2.3 dev: true - /local-pkg@0.4.3: - resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} - engines: {node: '>=14'} - dev: true - /locate-path@2.0.0: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} @@ -16334,10 +15245,18 @@ packages: /lodash.mergewith@4.6.2: resolution: {integrity: sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==} + /lodash.set@4.3.2: + resolution: {integrity: sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg==} + dev: false + /lodash.snakecase@4.1.1: resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==} dev: true + /lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + dev: true + /lodash.throttle@4.1.1: resolution: {integrity: sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==} dev: false @@ -16530,6 +15449,7 @@ packages: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} dependencies: tmpl: 1.0.5 + dev: false /map-cache@0.2.2: resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==} @@ -16625,7 +15545,7 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: '@babel/runtime': 7.23.7 - '@mui/material': 5.14.16(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) + '@mui/material': 5.15.3(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0) classnames: 2.3.2 prop-types: 15.8.1 react: 18.2.0 @@ -17212,15 +16132,6 @@ packages: engines: {node: '>=10'} hasBin: true - /mlly@1.4.2: - resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} - dependencies: - acorn: 8.10.0 - pathe: 1.1.1 - pkg-types: 1.0.3 - ufo: 1.3.1 - dev: true - /mocha@10.2.0: resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} engines: {node: '>= 14.0.0'} @@ -17419,9 +16330,9 @@ packages: - '@babel/core' - babel-plugin-macros - /next@13.5.6(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw==} - engines: {node: '>=16.14.0'} + /next@14.0.1(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-s4YaLpE4b0gmb3ggtmpmV+wt+lPRuGtANzojMQ2+gmBpgX9w5fTbjsy6dXByBuENsdCX5pukZH/GxdFgO62+pA==} + engines: {node: '>=18.17.0'} hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 @@ -17434,7 +16345,7 @@ packages: sass: optional: true dependencies: - '@next/env': 13.5.6 + '@next/env': 14.0.1 '@swc/helpers': 0.5.2 busboy: 1.6.0 caniuse-lite: 1.0.30001570 @@ -17444,15 +16355,15 @@ packages: styled-jsx: 5.1.1(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react@18.2.0) watchpack: 2.4.0 optionalDependencies: - '@next/swc-darwin-arm64': 13.5.6 - '@next/swc-darwin-x64': 13.5.6 - '@next/swc-linux-arm64-gnu': 13.5.6 - '@next/swc-linux-arm64-musl': 13.5.6 - '@next/swc-linux-x64-gnu': 13.5.6 - '@next/swc-linux-x64-musl': 13.5.6 - '@next/swc-win32-arm64-msvc': 13.5.6 - '@next/swc-win32-ia32-msvc': 13.5.6 - '@next/swc-win32-x64-msvc': 13.5.6 + '@next/swc-darwin-arm64': 14.0.1 + '@next/swc-darwin-x64': 14.0.1 + '@next/swc-linux-arm64-gnu': 14.0.1 + '@next/swc-linux-arm64-musl': 14.0.1 + '@next/swc-linux-x64-gnu': 14.0.1 + '@next/swc-linux-x64-musl': 14.0.1 + '@next/swc-win32-arm64-msvc': 14.0.1 + '@next/swc-win32-ia32-msvc': 14.0.1 + '@next/swc-win32-x64-msvc': 14.0.1 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -17578,6 +16489,7 @@ packages: /node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} + dev: false /node-machine-id@1.1.12: resolution: {integrity: sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==} @@ -17821,6 +16733,7 @@ packages: /nwsapi@2.2.7: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} + dev: false /nx@17.2.8: resolution: {integrity: sha512-rM5zXbuXLEuqQqcjVjClyvHwRJwt+NVImR2A6KFNG40Z60HP6X12wAxxeLHF5kXXTDRU0PFhf/yACibrpbPrAw==} @@ -18447,7 +17360,7 @@ packages: /parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} dependencies: - entities: 4.4.0 + entities: 4.5.0 /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} @@ -18530,10 +17443,6 @@ packages: engines: {node: '>=12'} dev: true - /pathe@1.1.1: - resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} - dev: true - /pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} @@ -18619,14 +17528,6 @@ packages: find-up: 6.3.0 dev: true - /pkg-types@1.0.3: - resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} - dependencies: - jsonc-parser: 3.2.0 - mlly: 1.4.2 - pathe: 1.1.1 - dev: true - /pkg-up@3.1.0: resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} engines: {node: '>=8'} @@ -18933,6 +17834,7 @@ packages: dependencies: kleur: 3.0.3 sisteransi: 1.0.5 + dev: false /promzard@1.0.0: resolution: {integrity: sha512-KQVDEubSUHGSt5xLakaToDFrSoZhStB8dXLzk2xvwR67gJktrHFvpR63oZgHyK19WKbHFLXJqCPXdVR3aBP8Ig==} @@ -18983,6 +17885,7 @@ packages: /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: false /pump@2.0.1: resolution: {integrity: sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==} @@ -19017,10 +17920,6 @@ packages: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} - /pure-rand@6.0.4: - resolution: {integrity: sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==} - dev: true - /q@1.5.1: resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==} engines: {node: '>=0.6.0', teleport: '>=0.2.0'} @@ -19055,6 +17954,7 @@ packages: /querystringify@2.2.0: resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + dev: false /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -19091,10 +17991,6 @@ packages: resolution: {integrity: sha512-y/M9weqWAH4iopRd7EHDEQQvpFPHj1AA3oHozE9tfITHUtTR7Z9PSlIRRG2l1GuW7sefC1cXFfIcF+cgnShdBA==} dev: true - /ramda@0.29.0: - resolution: {integrity: sha512-BBea6L67bYLtdbOqfp8f58fPMqEwx0doL+pAi8TZyp2YWz8R9G8z9x75CZI8W+ftqhFHCpEX2cRnUUXK130iKA==} - dev: false - /randexp@0.4.6: resolution: {integrity: sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==} engines: {node: '>=0.12'} @@ -19132,7 +18028,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) dev: true /rc@1.2.8: @@ -19414,6 +18310,7 @@ packages: /react-refresh@0.14.0: resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} engines: {node: '>=0.10.0'} + dev: false /react-router-dom@6.21.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-QCNrtjtDPwHDO+AO21MJd7yIcr41UetYt5jzaB9Y1UYaPTCnVuJq6S748g1dE11OQlCFIQg+RtAA1SEZIyiBeA==} @@ -20063,11 +18960,6 @@ packages: deprecated: https://github.com/lydell/resolve-url#deprecated dev: false - /resolve.exports@2.0.2: - resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} - engines: {node: '>=10'} - dev: true - /resolve@1.22.4: resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==} hasBin: true @@ -20239,8 +19131,30 @@ packages: fsevents: 2.3.3 dev: true + /rollup@4.9.2: + resolution: {integrity: sha512-66RB8OtFKUTozmVEh3qyNfH+b+z2RXBVloqO2KCC/pjFaGaHtxP9fVfOQKPSGXg2mElmjmxjW/fZ7iKrEpMH5Q==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.9.2 + '@rollup/rollup-android-arm64': 4.9.2 + '@rollup/rollup-darwin-arm64': 4.9.2 + '@rollup/rollup-darwin-x64': 4.9.2 + '@rollup/rollup-linux-arm-gnueabihf': 4.9.2 + '@rollup/rollup-linux-arm64-gnu': 4.9.2 + '@rollup/rollup-linux-arm64-musl': 4.9.2 + '@rollup/rollup-linux-riscv64-gnu': 4.9.2 + '@rollup/rollup-linux-x64-gnu': 4.9.2 + '@rollup/rollup-linux-x64-musl': 4.9.2 + '@rollup/rollup-win32-arm64-msvc': 4.9.2 + '@rollup/rollup-win32-ia32-msvc': 4.9.2 + '@rollup/rollup-win32-x64-msvc': 4.9.2 + fsevents: 2.3.3 + dev: true + /rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} + dev: false /rst-selector-parser@2.2.3: resolution: {integrity: sha512-nDG1rZeP6oFTLN6yNDV/uiAvs1+FS/KlrEwh7+y7dpuApDBy6bI2HTBcc0/V8lv9OTqfyD34eF7au2pm8aBbhA==} @@ -20320,6 +19234,7 @@ packages: engines: {node: '>=v12.22.7'} dependencies: xmlchars: 2.2.0 + dev: false /scheduler@0.21.0: resolution: {integrity: sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==} @@ -20572,10 +19487,6 @@ packages: get-intrinsic: 1.2.1 object-inspect: 1.12.3 - /siginfo@2.0.0: - resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} - dev: true - /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -20647,6 +19558,7 @@ packages: /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + dev: false /slash@2.0.0: resolution: {integrity: sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==} @@ -20726,8 +19638,8 @@ packages: resolution: {integrity: sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==} dev: true - /socket.io-parser@4.2.4: - resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} + /socket.io-parser@4.2.1: + resolution: {integrity: sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==} engines: {node: '>=10.0.0'} dependencies: '@socket.io/component-emitter': 3.1.0 @@ -20745,7 +19657,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) engine.io: 6.2.1 socket.io-adapter: 2.4.0 - socket.io-parser: 4.2.4 + socket.io-parser: 4.2.1 transitivePeerDependencies: - bufferutil - supports-color @@ -20804,13 +19716,6 @@ packages: urix: 0.1.0 dev: false - /source-map-support@0.5.13: - resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} - dependencies: - buffer-from: 1.1.2 - source-map: 0.6.1 - dev: true - /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} dependencies: @@ -20835,6 +19740,13 @@ packages: engines: {node: '>= 8'} dev: false + /source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + dependencies: + whatwg-url: 7.1.0 + dev: true + /sourcemap-codec@1.4.8: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} deprecated: Please use @jridgewell/sourcemap-codec instead @@ -20930,10 +19842,7 @@ packages: engines: {node: '>=10'} dependencies: escape-string-regexp: 2.0.0 - - /stackback@0.0.2: - resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - dev: true + dev: false /stackframe@1.3.4: resolution: {integrity: sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==} @@ -20962,10 +19871,6 @@ packages: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} engines: {node: '>= 0.8'} - /std-env@3.4.3: - resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} - dev: true - /stop-iteration-iterator@1.0.0: resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} engines: {node: '>= 0.4'} @@ -21013,14 +19918,6 @@ packages: resolution: {integrity: sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==} dev: false - /string-length@4.0.2: - resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} - engines: {node: '>=10'} - dependencies: - char-regex: 1.0.2 - strip-ansi: 6.0.1 - dev: true - /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -21146,12 +20043,6 @@ packages: engines: {node: '>=14.16'} dev: true - /strip-literal@1.3.0: - resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} - dependencies: - acorn: 8.10.0 - dev: true - /strnum@1.0.5: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} dev: false @@ -21166,10 +20057,6 @@ packages: through: 2.3.8 dev: true - /style-inject@0.3.0: - resolution: {integrity: sha512-IezA2qp+vcdlhJaVm5SOdPPTUu0FCEqfNSli2vRuSIBbu5Nq5UvygTk/VzeCqfLz2Atj3dVII5QBKGZRZ0edzw==} - dev: false - /style-search@0.1.0: resolution: {integrity: sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==} dev: true @@ -21423,6 +20310,7 @@ packages: /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + dev: false /table@6.8.1: resolution: {integrity: sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==} @@ -21546,7 +20434,7 @@ packages: rimraf: 2.6.3 dev: false - /terser-webpack-plugin@5.3.10(webpack@5.89.0): + /terser-webpack-plugin@5.3.10(esbuild@0.19.11)(webpack@5.89.0): resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -21563,11 +20451,12 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.20 + esbuild: 0.19.11 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.26.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) /terser@5.26.0: resolution: {integrity: sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==} @@ -21575,7 +20464,7 @@ packages: hasBin: true dependencies: '@jridgewell/source-map': 0.3.5 - acorn: 8.10.0 + acorn: 8.11.3 commander: 2.20.3 source-map-support: 0.5.21 @@ -21667,20 +20556,6 @@ packages: resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} dev: false - /tinybench@2.5.1: - resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} - dev: true - - /tinypool@0.7.0: - resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} - engines: {node: '>=14.0.0'} - dev: true - - /tinyspy@2.2.0: - resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} - engines: {node: '>=14.0.0'} - dev: true - /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -21696,6 +20571,7 @@ packages: /tmpl@1.0.5: resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} + dev: false /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} @@ -21748,13 +20624,13 @@ packages: punycode: 2.3.0 universalify: 0.2.0 url-parse: 1.5.10 + dev: false /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - /tr46@3.0.0: - resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} - engines: {node: '>=12'} + /tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} dependencies: punycode: 2.3.0 dev: true @@ -21764,6 +20640,7 @@ packages: engines: {node: '>=14'} dependencies: punycode: 2.3.0 + dev: false /traverse@0.3.9: resolution: {integrity: sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==} @@ -21807,10 +20684,6 @@ packages: tslib: 2.6.1 dev: false - /ts-toolbelt@9.6.0: - resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} - dev: false - /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} dependencies: @@ -21844,6 +20717,46 @@ packages: engines: {node: '>=0.6.x'} dev: false + /tsup@8.0.1(postcss@8.4.33)(typescript@5.3.3): + resolution: {integrity: sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 4.0.2(esbuild@0.19.11) + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4(supports-color@8.1.1) + esbuild: 0.19.11 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss: 8.4.33 + postcss-load-config: 4.0.1(postcss@8.4.33) + resolve-from: 5.0.0 + rollup: 4.9.2 + source-map: 0.8.0-beta.0 + sucrase: 3.34.0 + tree-kill: 1.2.2 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + /tsx@4.7.0: resolution: {integrity: sha512-I+t79RYPlEYlHn9a+KzwrvEwhJg35h/1zHsLC2JXvhC2mdynMv6Zxzvhv5EMV6VF5qJlLlkSnMVvdZV3PSIGcg==} engines: {node: '>=18.0.0'} @@ -21990,12 +20903,6 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: true - /types-ramda@0.29.6: - resolution: {integrity: sha512-VJoOk1uYNh9ZguGd3eZvqkdhD4hTGtnjRBUx5Zc0U9ftmnCgiWcSj/lsahzKunbiwRje1MxxNkEy1UdcXRCpYw==} - dependencies: - ts-toolbelt: 9.6.0 - dev: false - /typescript@5.3.3: resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} @@ -22009,10 +20916,6 @@ packages: resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==} dev: true - /ufo@1.3.1: - resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} - dev: true - /uglify-js@3.17.0: resolution: {integrity: sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==} engines: {node: '>=0.8.0'} @@ -22128,6 +21031,7 @@ packages: /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} engines: {node: '>= 4.0.0'} + dev: false /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} @@ -22137,6 +21041,15 @@ packages: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} + /unplugin@1.6.0: + resolution: {integrity: sha512-BfJEpWBu3aE/AyHx8VaNE/WgouoQxgH9baAiH82JjX8cqVyi3uJQstqwD5J+SZxIK326SZIhsSZlALXVBCknTQ==} + dependencies: + acorn: 8.11.3 + chokidar: 3.5.3 + webpack-sources: 3.2.3 + webpack-virtual-modules: 0.6.1 + dev: false + /unset-value@1.0.0: resolution: {integrity: sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==} engines: {node: '>=0.10.0'} @@ -22197,6 +21110,7 @@ packages: dependencies: querystringify: 2.2.0 requires-port: 1.0.0 + dev: false /url-template@2.0.8: resolution: {integrity: sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==} @@ -22279,6 +21193,7 @@ packages: '@jridgewell/trace-mapping': 0.3.20 '@types/istanbul-lib-coverage': 2.0.4 convert-source-map: 1.8.0 + dev: false /v8flags@3.2.0: resolution: {integrity: sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==} @@ -22346,31 +21261,9 @@ packages: d3-timer: 3.0.1 dev: false - /vite-node@0.34.6(@types/node@18.19.4): - resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} - engines: {node: '>=v14.18.0'} - hasBin: true - dependencies: - cac: 6.7.14 - debug: 4.3.4(supports-color@8.1.1) - mlly: 1.4.2 - pathe: 1.1.1 - picocolors: 1.0.0 - vite: 4.5.1(@types/node@18.19.4) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: true - - /vite@4.5.1(@types/node@18.19.4): - resolution: {integrity: sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==} - engines: {node: ^14.18.0 || >=16.0.0} + /vite@5.0.10(@types/node@18.19.4): + resolution: {integrity: sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@types/node': ^18.19.4 @@ -22397,79 +21290,13 @@ packages: optional: true dependencies: '@types/node': 18.19.4 - esbuild: 0.18.20 + esbuild: 0.19.11 postcss: 8.4.33 - rollup: 3.29.4 + rollup: 4.9.2 optionalDependencies: fsevents: 2.3.3 dev: true - /vitest@0.34.6(jsdom@22.1.0): - resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} - engines: {node: '>=v14.18.0'} - hasBin: true - peerDependencies: - '@edge-runtime/vm': '*' - '@vitest/browser': '*' - '@vitest/ui': '*' - happy-dom: '*' - jsdom: '*' - playwright: '*' - safaridriver: '*' - webdriverio: '*' - peerDependenciesMeta: - '@edge-runtime/vm': - optional: true - '@vitest/browser': - optional: true - '@vitest/ui': - optional: true - happy-dom: - optional: true - jsdom: - optional: true - playwright: - optional: true - safaridriver: - optional: true - webdriverio: - optional: true - dependencies: - '@types/chai': 4.3.11 - '@types/chai-subset': 1.3.4 - '@types/node': 18.19.4 - '@vitest/expect': 0.34.6 - '@vitest/runner': 0.34.6 - '@vitest/snapshot': 0.34.6 - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - acorn: 8.10.0 - acorn-walk: 8.2.0 - cac: 6.7.14 - chai: 4.4.0 - debug: 4.3.4(supports-color@8.1.1) - jsdom: 22.1.0 - local-pkg: 0.4.3 - magic-string: 0.30.5 - pathe: 1.1.1 - picocolors: 1.0.0 - std-env: 3.4.3 - strip-literal: 1.3.0 - tinybench: 2.5.1 - tinypool: 0.7.0 - vite: 4.5.1(@types/node@18.19.4) - vite-node: 0.34.6(@types/node@18.19.4) - why-is-node-running: 2.2.2 - transitivePeerDependencies: - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: true - /vlq@0.2.3: resolution: {integrity: sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==} dev: true @@ -22488,11 +21315,13 @@ packages: engines: {node: '>=14'} dependencies: xml-name-validator: 4.0.0 + dev: false /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} dependencies: makeerror: 1.0.12 + dev: false /warning@4.0.3: resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==} @@ -22519,9 +21348,14 @@ packages: /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + /webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + dev: true + /webidl-conversions@7.0.0: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} + dev: false /webpack-bundle-analyzer@4.10.1: resolution: {integrity: sha512-s3P7pgexgT/HTUSYgxJyn28A+99mmLq4HsJepMPzu0R8ImJc52QNqaFYW1Z2z2uIb1/J3eYgaAWVpaC+v/1aAQ==} @@ -22529,7 +21363,7 @@ packages: hasBin: true dependencies: '@discoveryjs/json-ext': 0.5.7 - acorn: 8.10.0 + acorn: 8.11.3 acorn-walk: 8.2.0 commander: 7.2.0 debounce: 1.2.1 @@ -22574,7 +21408,7 @@ packages: import-local: 3.1.0 interpret: 3.1.1 rechoir: 0.8.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4) webpack-bundle-analyzer: 4.10.1 webpack-merge: 5.9.0 @@ -22595,7 +21429,11 @@ packages: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} - /webpack@5.89.0(webpack-cli@5.1.4): + /webpack-virtual-modules@0.6.1: + resolution: {integrity: sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg==} + dev: false + + /webpack@5.89.0(esbuild@0.19.11)(webpack-cli@5.1.4): resolution: {integrity: sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==} engines: {node: '>=10.13.0'} hasBin: true @@ -22610,8 +21448,8 @@ packages: '@webassemblyjs/ast': 1.11.6 '@webassemblyjs/wasm-edit': 1.11.6 '@webassemblyjs/wasm-parser': 1.11.6 - acorn: 8.10.0 - acorn-import-assertions: 1.9.0(acorn@8.10.0) + acorn: 8.11.3 + acorn-import-assertions: 1.9.0(acorn@8.11.3) browserslist: 4.22.2 chrome-trace-event: 1.0.3 enhanced-resolve: 5.15.0 @@ -22626,7 +21464,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(webpack@5.89.0) + terser-webpack-plugin: 5.3.10(esbuild@0.19.11)(webpack@5.89.0) watchpack: 2.4.0 webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.1)(webpack@5.89.0) webpack-sources: 3.2.3 @@ -22640,6 +21478,7 @@ packages: engines: {node: '>=12'} dependencies: iconv-lite: 0.6.3 + dev: false /whatwg-fetch@3.6.20: resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==} @@ -22648,14 +21487,7 @@ packages: /whatwg-mimetype@3.0.0: resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} engines: {node: '>=12'} - - /whatwg-url@11.0.0: - resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} - engines: {node: '>=12'} - dependencies: - tr46: 3.0.0 - webidl-conversions: 7.0.0 - dev: true + dev: false /whatwg-url@12.0.1: resolution: {integrity: sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==} @@ -22663,6 +21495,7 @@ packages: dependencies: tr46: 4.1.1 webidl-conversions: 7.0.0 + dev: false /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} @@ -22670,6 +21503,14 @@ packages: tr46: 0.0.3 webidl-conversions: 3.0.1 + /whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + dev: true + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -22740,15 +21581,6 @@ packages: isexe: 3.1.1 dev: true - /why-is-node-running@2.2.2: - resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} - engines: {node: '>=8'} - hasBin: true - dependencies: - siginfo: 2.0.0 - stackback: 0.0.2 - dev: true - /wide-align@1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: @@ -22815,13 +21647,6 @@ packages: typedarray-to-buffer: 3.1.5 dev: true - /write-file-atomic@4.0.2: - resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} - engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} - dependencies: - imurmurhash: 0.1.4 - signal-exit: 3.0.7 - /write-file-atomic@5.0.1: resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -22888,6 +21713,7 @@ packages: optional: true utf-8-validate: optional: true + dev: false /ws@8.2.3: resolution: {integrity: sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==} @@ -22916,6 +21742,7 @@ packages: /xml-name-validator@4.0.0: resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} engines: {node: '>=12'} + dev: false /xml2js@0.5.0: resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==} @@ -22932,6 +21759,7 @@ packages: /xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + dev: false /xtend@2.1.2: resolution: {integrity: sha512-vMNKzr2rHP9Dp/e1NQFnLQlwlhp9L/LfvnsVdHxN1f+uggyVI3i08uD14GPvCToPkdsRfyPqIyYGmIk58V98ZQ==} diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 00000000000000..9891894d481fd0 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + outDir: 'build', + splitting: true, + sourcemap: true, + clean: true, + format: ['cjs', 'esm'], + treeshake: true, + cjsInterop: true, + dts: true, + silent: true, +}); From 1ea2d79c1cd368740c07a3f901c910d55726c639 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Wed, 27 Dec 2023 17:39:12 +0530 Subject: [PATCH 02/11] Fix: remove parallel flag from build command --- package.json | 4 ++-- packages/zero-next-plugin/tsconfig.json | 7 +------ packages/zero-runtime/package.json | 2 +- pnpm-lock.yaml | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 5db8b32b8666a5..9f1960372e63a4 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "proptypes": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./scripts/generateProptypes.ts", "deduplicate": "pnpm dedupe", "benchmark:browser": "pnpm --filter benchmark browser", - "build": "lerna run --parallel --scope \"@mui/*\" build", - "build:zero": "lerna run --parallel --scope \"@mui/zero-*\" build", + "build": "lerna run --scope \"@mui/*\" build", + "build:zero": "lerna run --scope \"@mui/zero-*\" build", "build:codesandbox": "NODE_OPTIONS=\"–max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" build", "release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private --force-publish=@mui/core-downloads-tracker", "release:build": "lerna run --concurrency 8 --scope \"@mui/*\" build --skip-nx-cache", diff --git a/packages/zero-next-plugin/tsconfig.json b/packages/zero-next-plugin/tsconfig.json index 0142f7d5340b37..ad4f42a8683509 100644 --- a/packages/zero-next-plugin/tsconfig.json +++ b/packages/zero-next-plugin/tsconfig.json @@ -5,10 +5,5 @@ "target": "ES2015" }, "include": ["src/**/*.ts"], - "exclude": ["./tsup.config.ts"], - "references": [ - { - "path": "../zero-unplugin" - } - ] + "exclude": ["./tsup.config.ts"] } diff --git a/packages/zero-runtime/package.json b/packages/zero-runtime/package.json index dfccd8bd91bc05..ef7e882cc7931e 100644 --- a/packages/zero-runtime/package.json +++ b/packages/zero-runtime/package.json @@ -23,7 +23,7 @@ "@emotion/styled": "^11.11.0", "@linaria/tags": "^5.0.2", "@linaria/utils": "^5.0.2", - "@mui/system": "^5.14.18", + "@mui/system": "workspace:^", "lodash.set": "^4.3.2", "lodash.get": "^4.4.2", "stylis": "^4.2.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 535794078c6af0..9ec70b49d23b53 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2250,7 +2250,7 @@ importers: specifier: ^5.0.2 version: 5.0.2 '@mui/system': - specifier: ^5.14.18 + specifier: workspace:^ version: link:../mui-system/build clsx: specifier: ^2.0.0 From 76e2f8d859ce5242e2f76fc24661405973752185 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Thu, 28 Dec 2023 15:10:37 +0530 Subject: [PATCH 03/11] fix: error related to $RefreshSig$ fixed and updated new paths for theme token generation. Also added Slider example to next app --- apps/zero-runtime-next-app/next.config.js | 6 ++ apps/zero-runtime-next-app/package.json | 5 +- .../src/app/slider/page.tsx | 98 +++++++++++++++++ .../src/components/Slider/ZeroSlider.tsx | 54 +++++----- packages/zero-runtime/src/styled.d.ts | 1 + packages/zero-unplugin/src/index.ts | 102 +++++++++++------- .../zero-vite-plugin/src/zero-vite-plugin.ts | 18 ++++ pnpm-lock.yaml | 15 ++- 8 files changed, 232 insertions(+), 67 deletions(-) create mode 100644 apps/zero-runtime-next-app/src/app/slider/page.tsx diff --git a/apps/zero-runtime-next-app/next.config.js b/apps/zero-runtime-next-app/next.config.js index 40b2a8c1201522..65c44b5897ded3 100644 --- a/apps/zero-runtime-next-app/next.config.js +++ b/apps/zero-runtime-next-app/next.config.js @@ -5,6 +5,12 @@ const { experimental_extendTheme: extendTheme } = require('@mui/material/styles' const theme = extendTheme(); +theme.applyDarkStyles = function applyDarkStyles(obj) { + return { + ':where([data-mui-color-scheme="dark"]) &': obj, + }; +}; + /** * @typedef {import('@mui/zero-next-plugin').ZeroPluginConfig} ZeroPluginConfig */ diff --git a/apps/zero-runtime-next-app/package.json b/apps/zero-runtime-next-app/package.json index d92369cb161cb1..11d16f91d54f9a 100644 --- a/apps/zero-runtime-next-app/package.json +++ b/apps/zero-runtime-next-app/package.json @@ -10,12 +10,15 @@ }, "dependencies": { "@mui/zero-runtime": "workspace:^", + "@mui/utils": "workspace:^", + "@mui/base": "workspace:^", + "@mui/material": "workspace:^", + "@mui/system": "workspace:^", "react": "^18", "react-dom": "^18", "next": "14.0.1" }, "devDependencies": { - "@mui/material": "^5.15.2", "@mui/zero-next-plugin": "workspace:^", "@types/node": "^20.5.7", "@types/react": "^18.2.45", diff --git a/apps/zero-runtime-next-app/src/app/slider/page.tsx b/apps/zero-runtime-next-app/src/app/slider/page.tsx new file mode 100644 index 00000000000000..92d5bd33fe5f61 --- /dev/null +++ b/apps/zero-runtime-next-app/src/app/slider/page.tsx @@ -0,0 +1,98 @@ +'use client'; +import * as React from 'react'; +import { styled } from '@mui/zero-runtime'; +import Slider from '@/components/Slider/ZeroSlider'; + +const HalfWidth = styled.div(({ theme }) => ({ + marginLeft: 20, + width: '50%', + maxHeight: 100, + padding: 20, + border: `1px solid ${theme.vars.palette.primary.main}`, +})); + +export default function SliderPage() { + const [value, setValue] = React.useState(50); + const [isColorPrimary, setIsColorPrimary] = React.useState(true); + const [size, setSize] = React.useState('medium'); + const [showMarks, setShowMarks] = React.useState(true); + const [isTrackInverted, setIsTrackInverted] = React.useState(false); + const [disabled, setDisabled] = React.useState(false); + const [isHorizontal, setIsHorizontal] = React.useState(true); + + return ( +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + setValue(val as number)} + /> + +
+ ); +} diff --git a/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx b/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx index dad698ba13fb6f..259488ddaf4fd4 100644 --- a/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx +++ b/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx @@ -1,5 +1,4 @@ -'use-client'; - +/* eslint-disable */ import * as React from 'react'; import clsx from 'clsx'; import { unstable_composeClasses as composeClasses } from '@mui/utils'; @@ -14,7 +13,8 @@ import { styled } from '@mui/zero-runtime'; import { capitalize } from '@mui/material/utils'; import SliderValueLabel from '@mui/material/Slider/SliderValueLabel'; import { useSlider, valueToPercent } from '@mui/base/useSlider'; -import { alpha, lighten, darken } from '../utils/colorManipulator'; +import { alpha, lighten, darken } from '@mui/system/colorManipulator'; +import type { Theme } from '@mui/material/styles'; const shouldSpreadAdditionalProps = (Slot?: React.ElementType) => { return !Slot || !isHostComponent(Slot); @@ -57,7 +57,7 @@ const SliderRoot = styled('span', { [`&.${sliderClasses.disabled}`]: { pointerEvents: 'none', cursor: 'default', - color: theme.palette.grey[400], + color: (theme.vars || theme).palette.grey[400], }, [`&.${sliderClasses.dragging}`]: { [`& .${sliderClasses.thumb}, & .${sliderClasses.track}`]: { @@ -66,11 +66,11 @@ const SliderRoot = styled('span', { }, variants: [ { - props: { - color: 'primary', + props({ color }) { + return color === 'primary'; }, style: { - color: theme.palette.primary.main, + color: (theme.vars || theme).palette.primary.main, }, }, { @@ -78,7 +78,7 @@ const SliderRoot = styled('span', { color: 'secondary', }, style: { - color: theme.palette.secondary.main, + color: (theme.vars || theme).palette.secondary.main, }, }, { @@ -203,10 +203,18 @@ const SliderTrack = styled('span', { slot: 'Track', overridesResolver: (props, styles) => styles.track, })(({ theme }) => { - const lightPrimaryColor = lighten(theme.palette.primary.main, 0.62); - const lightSecondaryColor = lighten(theme.palette.secondary.main, 0.62); - const darkPrimaryColor = darken(theme.palette.primary.main, 0.5); - const darkSecondaryColor = darken(theme.palette.secondary.main, 0.5); + const lightPrimaryColor = theme.vars + ? theme.vars.palette.Slider.primaryTrack + : lighten(theme.palette.primary.main, 0.62); + const lightSecondaryColor = theme.vars + ? theme.vars.palette.Slider.secondaryTrack + : lighten(theme.palette.secondary.main, 0.62); + const darkPrimaryColor = theme.vars + ? theme.vars.palette.Slider.primaryTrack + : darken(theme.palette.primary.main, 0.5); + const darkSecondaryColor = theme.vars + ? theme.vars.palette.Slider.secondaryTrack + : darken(theme.palette.secondary.main, 0.5); return { display: 'block', @@ -327,7 +335,7 @@ const SliderThumb = styled('span', { transition: theme.transitions.create(['box-shadow', 'left', 'bottom'], { duration: theme.transitions.duration.shortest, }), - '&::before': { + '&:before': { position: 'absolute', content: '""', borderRadius: 'inherit', @@ -368,7 +376,7 @@ const SliderThumb = styled('span', { style: { '--slider-thumb-shadow-color': theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / 0.16)` - : alpha(theme.palette.primary.main, 0.16), + : alpha((theme as Theme).palette.primary.main, 0.16), }, }, { @@ -378,7 +386,7 @@ const SliderThumb = styled('span', { style: { '--slider-thumb-shadow-color': theme.vars ? `rgba(${theme.vars.palette.secondary.mainChannel} / 0.16)` - : alpha(theme.palette.secondary.main, 0.16), + : alpha((theme as Theme).palette.secondary.main, 0.16), }, }, { @@ -388,7 +396,7 @@ const SliderThumb = styled('span', { style: { width: 12, height: 12, - '&::before': { + '&:before': { boxShadow: 'none', }, }, @@ -454,7 +462,7 @@ const StyledSliderValueLabel = styled(SliderValueLabel, { top: '-10px', transformOrigin: 'bottom center', transform: 'translateY(-100%) scale(0)', - '&::before': { + '&:before': { position: 'absolute', content: '""', width: 8, @@ -478,7 +486,7 @@ const StyledSliderValueLabel = styled(SliderValueLabel, { right: '30px', transform: 'translateY(-50%) scale(0)', transformOrigin: 'right center', - '&::before': { + '&:before': { position: 'absolute', content: '""', width: 8, @@ -510,6 +518,7 @@ export { StyledSliderValueLabel as SliderValueLabel }; const SliderMark = styled('span', { name: 'MuiSlider', slot: 'Mark', + shouldForwardProp: (prop) => prop !== 'markActive', // @TODO - Support this in `styled` implementation // shouldForwardProp: (prop) => slotShouldForwardProp(prop) && prop !== 'markActive', overridesResolver: (props, styles) => { @@ -664,18 +673,13 @@ const Slider = React.forwardRef(function Slider(pr marks: marksProp = false, max = 100, min = 0, - name, - onChange, - onChangeCommitted, orientation = 'horizontal', size = 'medium', step = 1, scale = Identity, slotProps, slots, - tabIndex, track = 'normal', - value: valueProp, valueLabelDisplay = 'off', valueLabelFormat = Identity, ...other @@ -794,7 +798,7 @@ const Slider = React.forwardRef(function Slider(pr externalSlotProps: thumbSlotProps, ownerState: { ...ownerState, - // @ts-expect-error @TODO Fix type + // @ts-expect-error ...thumbSlotProps?.ownerState, }, className: classes.thumb, @@ -805,7 +809,7 @@ const Slider = React.forwardRef(function Slider(pr externalSlotProps: valueLabelSlotProps, ownerState: { ...ownerState, - // @ts-expect-error @TODO + // @ts-expect-error ...valueLabelSlotProps?.ownerState, }, className: classes.valueLabel, diff --git a/packages/zero-runtime/src/styled.d.ts b/packages/zero-runtime/src/styled.d.ts index d67f84175fd11f..7109a5aa980081 100644 --- a/packages/zero-runtime/src/styled.d.ts +++ b/packages/zero-runtime/src/styled.d.ts @@ -73,6 +73,7 @@ export interface StyledOptions boolean; overridesResolver?: ( // eslint-disable-next-line @typescript-eslint/no-explicit-any props: any | Props, diff --git a/packages/zero-unplugin/src/index.ts b/packages/zero-unplugin/src/index.ts index 581387ec1178ab..e1087b305199d3 100644 --- a/packages/zero-unplugin/src/index.ts +++ b/packages/zero-unplugin/src/index.ts @@ -79,6 +79,14 @@ const globalCssLookup = new Map(); const pluginName = 'ZeroWebpackPlugin'; +function innerNoop() { + return null; +} + +function outerNoop() { + return innerNoop; +} + export const plugin = createUnplugin((options) => { const { theme, @@ -91,6 +99,7 @@ export const plugin = createUnplugin((options) => { debug = false, sourceMap = false, transformSx = true, + overrideContext, ...rest } = options; const themeArgs = { theme }; @@ -104,6 +113,15 @@ export const plugin = createUnplugin((options) => { theme, }, cssVariablesPrefix: varPrefix, + overrideContext(context: Record, filename: string) { + if (overrideContext) { + return overrideContext(context, filename); + } + if (!context.$RefreshSig$) { + context.$RefreshSig$ = outerNoop; + } + return context; + }, ...rest, }; const cache = new TransformCacheCollection(); @@ -157,7 +175,7 @@ export const plugin = createUnplugin((options) => { if (typeof result === 'string') { return result; } - return await asyncResolveFallback(what, importer, stack); + return asyncResolveFallback(what, importer, stack); }; const transformServices = { options: { @@ -170,49 +188,55 @@ export const plugin = createUnplugin((options) => { eventEmitter: emitter, }; - const result = await transform(transformServices, code, asyncResolve); + try { + const result = await transform(transformServices, code, asyncResolve); - if (!result.cssText) { - return null; - } + if (!result.cssText) { + return null; + } - let { cssText } = result; - if (isNext && !outputCss) { - return { - code: result.code, - map: result.sourceMap, - }; - } - const slug = slugify(cssText); - const cssFilename = `${slug}.zero.css`; + let { cssText } = result; + if (isNext && !outputCss) { + return { + code: result.code, + map: result.sourceMap, + }; + } + const slug = slugify(cssText); + const cssFilename = `${slug}.zero.css`; - if (sourceMap && result.cssSourceMapText) { - const map = Buffer.from(result.cssSourceMapText).toString('base64'); - cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`; - } + if (sourceMap && result.cssSourceMapText) { + const map = Buffer.from(result.cssSourceMapText).toString('base64'); + cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`; + } - // Virtual modules do not work consistently in Next.js (the build is done at least - // thrice) resulting in error in subsequent builds. So we use a placeholder CSS - // file with the actual CSS content as part of the query params. - if (isNext) { - const data = `${meta.placeholderCssFile}?${encodeURIComponent( - JSON.stringify({ - filename: cssFilename, - source: cssText, - }), - )}`; + // Virtual modules do not work consistently in Next.js (the build is done at least + // thrice) resulting in error in subsequent builds. So we use a placeholder CSS + // file with the actual CSS content as part of the query params. + if (isNext) { + const data = `${meta.placeholderCssFile}?${encodeURIComponent( + JSON.stringify({ + filename: cssFilename, + source: cssText, + }), + )}`; + return { + code: `import ${JSON.stringify(data)};\n${result.code}`, + map: result.sourceMap, + }; + } + const cssId = `./${cssFilename}`; + cssFileLookup.set(cssId, cssFilename); + cssLookup.set(cssFilename, cssText); return { - code: `import ${JSON.stringify(data)};\n${result.code}`, + code: `import ${JSON.stringify(`./${cssFilename}`)};\n${result.code}`, map: result.sourceMap, }; + } catch (e) { + const error = new Error((e as Error).message); + error.stack = (e as Error).stack; + throw error; } - const cssId = `./${cssFilename}`; - cssFileLookup.set(cssId, cssFilename); - cssLookup.set(cssFilename, cssText); - return { - code: `import ${JSON.stringify(`./${cssFilename}`)};\n${result.code}`, - map: result.sourceMap, - }; }, }; @@ -239,9 +263,9 @@ export const plugin = createUnplugin((options) => { return ( // this file should exist in the package id.endsWith('@mui/zero-runtime/styles.css') || - id.endsWith('/runtime/styles.css') || + id.endsWith('/zero-runtime/styles.css') || id.endsWith('@mui/zero-runtime/theme') || - id.endsWith('/runtime/theme.js') + id.endsWith('/zero-runtime/theme.js') ); }, transform(_code, id) { @@ -252,6 +276,7 @@ export const plugin = createUnplugin((options) => { const tokens = generateThemeTokens(theme, varPrefix); return `export default ${JSON.stringify(tokens)};`; } + return null; }, } : { @@ -275,6 +300,7 @@ export const plugin = createUnplugin((options) => { const tokens = generateThemeTokens(theme, varPrefix); return `export default ${JSON.stringify(tokens)};`; } + return null; }, }), }, diff --git a/packages/zero-vite-plugin/src/zero-vite-plugin.ts b/packages/zero-vite-plugin/src/zero-vite-plugin.ts index 5e63f2df8e7b63..9e8ed55be525b8 100644 --- a/packages/zero-vite-plugin/src/zero-vite-plugin.ts +++ b/packages/zero-vite-plugin/src/zero-vite-plugin.ts @@ -27,6 +27,14 @@ export type VitePluginOptions = { } & Partial & PluginCustomOptions; +function innerNoop() { + return null; +} + +function outerNoop() { + return innerNoop; +} + export default function zeroVitePlugin({ debug, include, @@ -34,6 +42,7 @@ export default function zeroVitePlugin({ sourceMap, preprocessor, transformLibraries = [], + overrideContext, ...rest }: VitePluginOptions = {}): Plugin { const filter = createFilter(include, exclude); @@ -173,6 +182,15 @@ export default function zeroVitePlugin({ ...rest.babelOptions, // presets: Array.from(presets), }, + overrideContext(context: Record, filename: string) { + if (overrideContext) { + return overrideContext(context, filename); + } + if (!context.$RefreshSig$) { + context.$RefreshSig$ = outerNoop; + } + return context; + }, }, }, cache, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ec70b49d23b53..8a45e36443cfc2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -353,6 +353,18 @@ importers: apps/zero-runtime-next-app: dependencies: + '@mui/base': + specifier: workspace:^ + version: link:../../packages/mui-base/build + '@mui/material': + specifier: workspace:^ + version: link:../../packages/mui-material/build + '@mui/system': + specifier: workspace:^ + version: link:../../packages/mui-system/build + '@mui/utils': + specifier: workspace:^ + version: link:../../packages/mui-utils/build '@mui/zero-runtime': specifier: workspace:^ version: link:../../packages/zero-runtime @@ -366,9 +378,6 @@ importers: specifier: ^18 version: 18.2.0(react@18.2.0) devDependencies: - '@mui/material': - specifier: ^5.15.2 - version: link:../../packages/mui-material/build '@mui/zero-next-plugin': specifier: workspace:^ version: link:../../packages/zero-next-plugin From 75963d9e3514d6fce26a2f65577822b1727e3b26 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Fri, 29 Dec 2023 14:44:38 +0530 Subject: [PATCH 04/11] Make zero packages private --- packages/zero-next-plugin/package.json | 1 + packages/zero-runtime/package.json | 1 + packages/zero-unplugin/package.json | 1 + packages/zero-vite-plugin/package.json | 1 + 4 files changed, 4 insertions(+) diff --git a/packages/zero-next-plugin/package.json b/packages/zero-next-plugin/package.json index d62a6d72650ba1..9d7e175d5f13ae 100644 --- a/packages/zero-next-plugin/package.json +++ b/packages/zero-next-plugin/package.json @@ -4,6 +4,7 @@ "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", + "private": true, "scripts": { "clean": "rimraf build types", "watch": "tsup --watch --tsconfig tsconfig.build.json", diff --git a/packages/zero-runtime/package.json b/packages/zero-runtime/package.json index ef7e882cc7931e..3e397bacb24865 100644 --- a/packages/zero-runtime/package.json +++ b/packages/zero-runtime/package.json @@ -4,6 +4,7 @@ "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", + "private": true, "scripts": { "clean": "rimraf build types", "watch": "tsup --watch --clean false", diff --git a/packages/zero-unplugin/package.json b/packages/zero-unplugin/package.json index d12a5e1f4be999..592e4d89127b6a 100644 --- a/packages/zero-unplugin/package.json +++ b/packages/zero-unplugin/package.json @@ -4,6 +4,7 @@ "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", + "private": true, "scripts": { "clean": "rimraf build types", "watch": "tsup --watch --tsconfig tsconfig.build.json", diff --git a/packages/zero-vite-plugin/package.json b/packages/zero-vite-plugin/package.json index 74928875065608..6697c8267798ba 100644 --- a/packages/zero-vite-plugin/package.json +++ b/packages/zero-vite-plugin/package.json @@ -4,6 +4,7 @@ "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", + "private": true, "scripts": { "clean": "rimraf build", "watch": "tsup --watch", From 5127fbfe86fbdf18a0b80af58876ff6ff63a4057 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Tue, 2 Jan 2024 17:01:30 +0530 Subject: [PATCH 05/11] Fix: Use babel-plugin-transform-react-remove-prop-types directly in the library --- packages/zero-unplugin/package.json | 1 + packages/zero-unplugin/src/index.ts | 40 +++++++++++-------- packages/zero-vite-plugin/package.json | 3 +- .../zero-vite-plugin/src/zero-vite-plugin.ts | 6 ++- pnpm-lock.yaml | 6 +++ 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/packages/zero-unplugin/package.json b/packages/zero-unplugin/package.json index 592e4d89127b6a..d14cd762cce77a 100644 --- a/packages/zero-unplugin/package.json +++ b/packages/zero-unplugin/package.json @@ -16,6 +16,7 @@ "@linaria/babel-preset": "^5.0.4", "@linaria/logger": "^5.0.0", "@linaria/utils": "^5.0.2", + "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "unplugin": "^1.5.1" }, "devDependencies": { diff --git a/packages/zero-unplugin/src/index.ts b/packages/zero-unplugin/src/index.ts index e1087b305199d3..dd768f67c3cda6 100644 --- a/packages/zero-unplugin/src/index.ts +++ b/packages/zero-unplugin/src/index.ts @@ -108,22 +108,6 @@ export const plugin = createUnplugin((options) => { isExtendTheme && 'cssVarPrefix' in theme ? (theme.cssVarPrefix as string) ?? cssVariablesPrefix : cssVariablesPrefix; - const linariaOptions = { - themeArgs: { - theme, - }, - cssVariablesPrefix: varPrefix, - overrideContext(context: Record, filename: string) { - if (overrideContext) { - return overrideContext(context, filename); - } - if (!context.$RefreshSig$) { - context.$RefreshSig$ = outerNoop; - } - return context; - }, - ...rest, - }; const cache = new TransformCacheCollection(); const { emitter, onDone } = createPerfMeter(debug); const cssLookup = meta?.type === 'next' ? globalCssLookup : new Map(); @@ -182,7 +166,29 @@ export const plugin = createUnplugin((options) => { filename: id, root: process.cwd(), preprocessor, - pluginOptions: linariaOptions, + pluginOptions: { + themeArgs: { + theme, + }, + cssVariablesPrefix: varPrefix, + overrideContext(context: Record, filename: string) { + if (overrideContext) { + return overrideContext(context, filename); + } + if (!context.$RefreshSig$) { + context.$RefreshSig$ = outerNoop; + } + return context; + }, + ...rest, + babelOptions: { + ...rest.babelOptions, + plugins: [ + ['babel-plugin-transform-react-remove-prop-types', { mode: 'remove' }], + ...(rest.babelOptions?.plugins ?? []), + ], + }, + }, }, cache, eventEmitter: emitter, diff --git a/packages/zero-vite-plugin/package.json b/packages/zero-vite-plugin/package.json index 6697c8267798ba..c2ca7807cc7125 100644 --- a/packages/zero-vite-plugin/package.json +++ b/packages/zero-vite-plugin/package.json @@ -17,7 +17,8 @@ "@linaria/babel-preset": "^5.0.4", "@linaria/logger": "^5.0.0", "@linaria/utils": "^5.0.2", - "@mui/zero-runtime": "workspace:^" + "@mui/zero-runtime": "workspace:^", + "babel-plugin-transform-react-remove-prop-types": "^0.4.24" }, "devDependencies": { "@types/babel__core": "^7.20.3", diff --git a/packages/zero-vite-plugin/src/zero-vite-plugin.ts b/packages/zero-vite-plugin/src/zero-vite-plugin.ts index 9e8ed55be525b8..2ad4c2be667373 100644 --- a/packages/zero-vite-plugin/src/zero-vite-plugin.ts +++ b/packages/zero-vite-plugin/src/zero-vite-plugin.ts @@ -180,7 +180,11 @@ export default function zeroVitePlugin({ ...rest, babelOptions: { ...rest.babelOptions, - // presets: Array.from(presets), + plugins: [ + ['babel-plugin-transform-react-remove-prop-types', { mode: 'remove' }], + ...(rest.babelOptions?.plugins ?? []), + ], + presets: Array.from(presets), }, overrideContext(context: Record, filename: string) { if (overrideContext) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a45e36443cfc2..94438aeef93f9a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2325,6 +2325,9 @@ importers: '@linaria/utils': specifier: ^5.0.2 version: 5.0.2 + babel-plugin-transform-react-remove-prop-types: + specifier: ^0.4.24 + version: 0.4.24 unplugin: specifier: ^1.5.1 version: 1.6.0 @@ -2356,6 +2359,9 @@ importers: '@mui/zero-runtime': specifier: workspace:^ version: link:../zero-runtime + babel-plugin-transform-react-remove-prop-types: + specifier: ^0.4.24 + version: 0.4.24 devDependencies: '@types/babel__core': specifier: ^7.20.3 From 1697be2fc333fa0c5cf97ad0b9c2d5350e527880 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Wed, 3 Jan 2024 14:15:36 +0530 Subject: [PATCH 06/11] Eslint fixes --- apps/zero-runtime-next-app/.eslintrc | 6 ---- .../src/components/Box.jsx | 4 ++- packages/zero-next-plugin/.eslintrc | 5 ++++ packages/zero-runtime/.eslintignore | 4 +++ packages/zero-runtime/.eslintrc | 5 ++++ .../zero-runtime/src/generateAtomics.d.ts | 1 - packages/zero-runtime/src/generateAtomics.js | 2 +- .../src/processors/base-processor.ts | 4 ++- .../src/processors/generateAtomics.ts | 5 +++- packages/zero-runtime/src/processors/sx.ts | 27 +++--------------- packages/zero-runtime/src/styled.d.ts | 2 -- .../src/utils/convertAtomicsToCss.ts | 2 +- .../src/utils/cssFunctionTransformerPlugin.ts | 28 ------------------- .../zero-runtime/src/utils/generateCss.ts | 22 +++++++-------- .../zero-runtime/src/utils/valueToLiteral.ts | 10 +++++-- 15 files changed, 48 insertions(+), 79 deletions(-) delete mode 100644 apps/zero-runtime-next-app/.eslintrc create mode 100644 packages/zero-next-plugin/.eslintrc create mode 100644 packages/zero-runtime/.eslintignore create mode 100644 packages/zero-runtime/.eslintrc diff --git a/apps/zero-runtime-next-app/.eslintrc b/apps/zero-runtime-next-app/.eslintrc deleted file mode 100644 index facef445d20386..00000000000000 --- a/apps/zero-runtime-next-app/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": ["next"], - "rules": { - "@next/next/no-html-link-for-pages": "off" - } -} diff --git a/apps/zero-runtime-next-app/src/components/Box.jsx b/apps/zero-runtime-next-app/src/components/Box.jsx index f5dcc83a94a67c..4a65b224fb34fa 100644 --- a/apps/zero-runtime-next-app/src/components/Box.jsx +++ b/apps/zero-runtime-next-app/src/components/Box.jsx @@ -1,4 +1,4 @@ -import { generateAtomics, styled } from '@mui/zero-runtime'; +import { generateAtomics } from '@mui/zero-runtime'; const atomics = generateAtomics(({ theme }) => ({ conditions: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => { @@ -50,6 +50,7 @@ const atomics = generateAtomics(({ theme }) => ({ }, })); +// eslint-disable-next-line react/prop-types export function Box({ children, as = 'div', className = '', style = undefined, ...rest }) { const Component = as; const atomicsResult = atomics(rest); @@ -59,6 +60,7 @@ export function Box({ children, as = 'div', className = '', style = undefined, . ...style, }; return ( + // eslint-disable-next-line react/react-in-jsx-scope, react/jsx-filename-extension {children} diff --git a/packages/zero-next-plugin/.eslintrc b/packages/zero-next-plugin/.eslintrc new file mode 100644 index 00000000000000..5abd34a395bc37 --- /dev/null +++ b/packages/zero-next-plugin/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "import/prefer-default-export": "off" + } +} diff --git a/packages/zero-runtime/.eslintignore b/packages/zero-runtime/.eslintignore new file mode 100644 index 00000000000000..5e7cacd6e3c1c3 --- /dev/null +++ b/packages/zero-runtime/.eslintignore @@ -0,0 +1,4 @@ +/build/ +/processors/ +/theme/ +/utils/ diff --git a/packages/zero-runtime/.eslintrc b/packages/zero-runtime/.eslintrc new file mode 100644 index 00000000000000..5abd34a395bc37 --- /dev/null +++ b/packages/zero-runtime/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "import/prefer-default-export": "off" + } +} diff --git a/packages/zero-runtime/src/generateAtomics.d.ts b/packages/zero-runtime/src/generateAtomics.d.ts index 4af7eeec54f661..5fea8626759d99 100644 --- a/packages/zero-runtime/src/generateAtomics.d.ts +++ b/packages/zero-runtime/src/generateAtomics.d.ts @@ -2,7 +2,6 @@ import type { CSSProperties } from './base'; import type { ThemeArgs } from './theme'; // @TODO Implement proper types -// eslint-disable-next-line @typescript-eslint/no-explicit-any type GenerateAtomicsResult = (props: any) => { className: string }; type AtomicProperty = { diff --git a/packages/zero-runtime/src/generateAtomics.js b/packages/zero-runtime/src/generateAtomics.js index 2d8f67cedcf3a3..f9b1820217270e 100644 --- a/packages/zero-runtime/src/generateAtomics.js +++ b/packages/zero-runtime/src/generateAtomics.js @@ -41,7 +41,7 @@ export function atomics({ styles, shorthands, conditions }) { function generateClass(props) { const classes = []; - const runtimeStyles = Object.assign({}, props); + const runtimeStyles = { ...props }; Object.keys(runtimeStyles).forEach((cssProperty) => { const values = runtimeStyles[cssProperty]; if (cssProperty in shorthands) { diff --git a/packages/zero-runtime/src/processors/base-processor.ts b/packages/zero-runtime/src/processors/base-processor.ts index 9e6c2248aef189..bfbfe5df641ab5 100644 --- a/packages/zero-runtime/src/processors/base-processor.ts +++ b/packages/zero-runtime/src/processors/base-processor.ts @@ -24,7 +24,9 @@ export default abstract class BaseProcessor extends LinariaBaseProcessor { // Implementation taken from Linaria - https://github.com/callstack/linaria/blob/master/packages/react/src/processors/styled.ts#L362 protected getVariableContext(cssKey: string, source: string, hasUnit: boolean): IVariableContext { const getIndex = () => { - return this.variableIdx++; + const id = this.variableIdx; + this.variableIdx += 1; + return id; }; return { diff --git a/packages/zero-runtime/src/processors/generateAtomics.ts b/packages/zero-runtime/src/processors/generateAtomics.ts index 4efd3228d93ac9..bd8ed5c9e60ac9 100644 --- a/packages/zero-runtime/src/processors/generateAtomics.ts +++ b/packages/zero-runtime/src/processors/generateAtomics.ts @@ -8,6 +8,7 @@ import { import { ValueType } from '@linaria/utils'; import type { ExpressionValue, Replacements, Rules } from '@linaria/utils'; +import { CSSInterpolation } from '@emotion/css'; import BaseProcessor from './base-processor'; import type { IOptions } from './styled'; import { @@ -17,10 +18,10 @@ import { } from '../utils/convertAtomicsToCss'; import { css, cache } from '../utils/emotion'; import { valueToLiteral } from '../utils/valueToLiteral'; -import { CSSInterpolation } from '@emotion/css'; export class GenerateAtomicsProcessor extends BaseProcessor { callParam: ExpressionValue; + runtimeConfig?: RuntimeConfig; constructor(params: Params, ...args: TailProcessorParams) { @@ -33,10 +34,12 @@ export class GenerateAtomicsProcessor extends BaseProcessor { this.callParam = callParamArgument; } + // eslint-disable-next-line class-methods-use-this get asSelector(): string { throw new Error('Method not implemented.'); } + // eslint-disable-next-line class-methods-use-this get value(): Expression { throw new Error('Method not implemented.'); } diff --git a/packages/zero-runtime/src/processors/sx.ts b/packages/zero-runtime/src/processors/sx.ts index cd1ac67fb1efd4..b6c699f04303a2 100644 --- a/packages/zero-runtime/src/processors/sx.ts +++ b/packages/zero-runtime/src/processors/sx.ts @@ -1,10 +1,11 @@ import type { Expression, Params, TailProcessorParams, ValueCache } from '@linaria/tags'; -import { BaseProcessor, buildSlug, toValidCSSIdentifier, validateParams } from '@linaria/tags'; -import { ValueType, slugify } from '@linaria/utils'; -import type { IVariableContext, ExpressionValue, Replacements, Rules } from '@linaria/utils'; +import { buildSlug, toValidCSSIdentifier, validateParams } from '@linaria/tags'; +import { ValueType } from '@linaria/utils'; +import type { ExpressionValue, Replacements, Rules } from '@linaria/utils'; import type { IOptions } from './styled'; import { processCssObject } from '../utils/processCssObject'; import { cssFnValueToVariable } from '../utils/cssFnValueToVariable'; +import BaseProcessor from './base-processor'; export class SxProcessor extends BaseProcessor { sxArguments: ExpressionValue[] = []; @@ -142,26 +143,6 @@ export class SxProcessor extends BaseProcessor { : buildSlug(customSlugFn, { ...context }); } - // Implementation taken from Linaria - https://github.com/callstack/linaria/blob/master/packages/react/src/processors/styled.ts#L362 - protected getVariableContext(cssKey: string, source: string, hasUnit: boolean): IVariableContext { - const getIndex = () => { - return this.variableIdx++; - }; - - return { - componentName: this.displayName, - componentSlug: this.slug, - get index() { - return getIndex(); - }, - precedingCss: cssKey, - processor: this.constructor.name, - source: '', - unit: '', - valueSlug: slugify(`${source}${hasUnit}`), - }; - } - private processCss(styleObjOrFn: unknown, expressionValue: ExpressionValue) { const { themeArgs } = this.options as IOptions; const styleObj = typeof styleObjOrFn === 'function' ? styleObjOrFn(themeArgs) : styleObjOrFn; diff --git a/packages/zero-runtime/src/styled.d.ts b/packages/zero-runtime/src/styled.d.ts index 7109a5aa980081..f9f2bbd05fccfb 100644 --- a/packages/zero-runtime/src/styled.d.ts +++ b/packages/zero-runtime/src/styled.d.ts @@ -7,7 +7,6 @@ type Falsy = false | 0 | '' | null | undefined; type BaseDefaultProps = object; -// eslint-disable-next-line @typescript-eslint/no-explicit-any export type NoInfer = [T][T extends any ? 0 : never]; type FastOmit = { [K in keyof T as K extends U ? never : K]: T[K]; @@ -75,7 +74,6 @@ export interface StyledOptions boolean; overridesResolver?: ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any props: any | Props, styles: Record, ) => (string | Falsy) | Array; diff --git a/packages/zero-runtime/src/utils/convertAtomicsToCss.ts b/packages/zero-runtime/src/utils/convertAtomicsToCss.ts index c887d6a68973a5..1afdf7c64c4a7b 100644 --- a/packages/zero-runtime/src/utils/convertAtomicsToCss.ts +++ b/packages/zero-runtime/src/utils/convertAtomicsToCss.ts @@ -77,7 +77,7 @@ export function convertAtomicsToCss( const conditionClassMap = classMap[propertyValue] ?? {}; conditionClassMap[conditionName] = className; if (conditionName === defaultCondition) { - conditionClassMap['$$default'] = className; + conditionClassMap.$$default = className; } classMap[propertyValue] = conditionClassMap; runtimeConfig.styles[cssPropertyName] = classMap; diff --git a/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts b/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts index b814384c1a6432..785e8c00fc520c 100644 --- a/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts +++ b/packages/zero-runtime/src/utils/cssFunctionTransformerPlugin.ts @@ -37,34 +37,6 @@ const cssFunctionTransformerPlugin = declare((api, pluginOpt return { name: '@mui/zero-internal/cssFunctionTransformerPlugin', visitor: { - Program: { - exit(programPath) { - const expression = programPath.get('body')[0]; - if (!expression.isExpressionStatement()) { - return; - } - const arrowFnExpression = expression.get('expression'); - if ( - !arrowFnExpression.isArrowFunctionExpression() && - !arrowFnExpression.isFunctionExpression() - ) { - } - // @NOTE: Very quick and dirty way of checking usage of `theme` - // variable inside the function. May give false positives in - // some cases. Refine over time as bugs are reported. - // arrowFnExpression.traverse({ - // Identifier(path) { - // const name = path.node.name; - // const binding = path.scope.getBinding(name); - // if (name === 'theme' && !binding) { - // throw new Error( - // 'You cannot use `theme` or other arguments inside runtime functions. Please use token shorthands (like `primary.main` for `theme.palette.primary.main`) if you want to access theme values.', - // ); - // } - // }, - // }); - }, - }, // @TODO - Maybe add support for plain strings in template // literals as well. StringLiteral(path) { diff --git a/packages/zero-runtime/src/utils/generateCss.ts b/packages/zero-runtime/src/utils/generateCss.ts index 8835e37ea4c0ce..69b4661ae2508f 100644 --- a/packages/zero-runtime/src/utils/generateCss.ts +++ b/packages/zero-runtime/src/utils/generateCss.ts @@ -76,6 +76,7 @@ function generateCssForTheme(theme: Theme, prefix = ['']) { iterateObject(tokenValue as Walkable, nestedPrefix, (value, path: string[]) => { const cssVariableName = `--${path.filter(Boolean).join('-')}`; cssVarsObject[cssVariableName] = + // eslint-disable-next-line no-nested-ternary typeof value === 'string' ? value : value ? value.toString() : null; }); }); @@ -143,16 +144,15 @@ export function generateThemeTokens(theme: unknown, prefix = '') { return { vars: theme.vars, }; - } else { - const tokens = {}; - iterateObject(theme as Walkable, [], (value, path) => { - if (!TOP_LEVEL_TOKEN_KEYS.includes(path[0] as RelevantTokenKey)) { - return; - } - const filteredPath = path.filter(Boolean); - const cssVariableName = `--${[prefix, ...filteredPath].filter(Boolean).join('-')}`; - set(tokens, filteredPath, `var(${cssVariableName}, ${value})`); - }); - return tokens; } + const tokens = {}; + iterateObject(theme as Walkable, [], (value, path) => { + if (!TOP_LEVEL_TOKEN_KEYS.includes(path[0] as RelevantTokenKey)) { + return; + } + const filteredPath = path.filter(Boolean); + const cssVariableName = `--${[prefix, ...filteredPath].filter(Boolean).join('-')}`; + set(tokens, filteredPath, `var(${cssVariableName}, ${value})`); + }); + return tokens; } diff --git a/packages/zero-runtime/src/utils/valueToLiteral.ts b/packages/zero-runtime/src/utils/valueToLiteral.ts index 96c037b0c6b9bd..5f4a23ff46eafa 100644 --- a/packages/zero-runtime/src/utils/valueToLiteral.ts +++ b/packages/zero-runtime/src/utils/valueToLiteral.ts @@ -8,9 +8,13 @@ export function isSerializable(o: unknown): o is Serializable { return o.every(isSerializable); } - if (o === null) return true; + if (o === null) { + return true; + } - if (isBoxedPrimitive(o)) return true; + if (isBoxedPrimitive(o)) { + return true; + } if (typeof o === 'object') { return Object.values(o).every(isSerializable); @@ -37,7 +41,7 @@ export function parseAndGenerateFunction(fnString: string, expression?: Expressi } const propMethod = exp.properties[0] as t.ObjectMethod; return t.arrowFunctionExpression(propMethod.params, propMethod.body); - } catch (ex) { + } catch (ex2) { throw ( expression?.buildCodeFrameError(`MUI: Could not parse the expression '${fnString}'.`) ?? new Error(`MUI: Could not parse the given expression ${fnString}`) From f7d500fa2a6b4817552fc265729640235ee78379 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Wed, 3 Jan 2024 16:49:42 +0530 Subject: [PATCH 07/11] Fix: do not transform sx prop if it is on non zero-runtime styled component --- apps/zero-runtime-next-app/.eslintrc | 6 ++++ .../src/app/box/page.tsx | 14 +++++--- packages/zero-runtime/src/processors/sx.ts | 32 +++++++++---------- packages/zero-runtime/src/sx.js | 7 ++-- 4 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 apps/zero-runtime-next-app/.eslintrc diff --git a/apps/zero-runtime-next-app/.eslintrc b/apps/zero-runtime-next-app/.eslintrc new file mode 100644 index 00000000000000..c4927f68f7791e --- /dev/null +++ b/apps/zero-runtime-next-app/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": ["plugin:react/jsx-runtime"], + "rules": { + "import/prefer-default-export": "off" + } +} diff --git a/apps/zero-runtime-next-app/src/app/box/page.tsx b/apps/zero-runtime-next-app/src/app/box/page.tsx index 631b81bd3471db..6bd98764a28fb0 100644 --- a/apps/zero-runtime-next-app/src/app/box/page.tsx +++ b/apps/zero-runtime-next-app/src/app/box/page.tsx @@ -1,6 +1,8 @@ +/* eslint-disable material-ui/no-empty-box */ + import { styled } from '@mui/zero-runtime'; +import * as React from 'react'; import { Box as MuiBox } from '../../components/Box'; -import { Fragment } from 'react'; const Box = styled(MuiBox)(({ theme }) => ({ border: `1px dashed ${(theme.vars ?? theme).palette.primary.main}`, @@ -15,8 +17,8 @@ export default function DemoBox() { return (
{[...Array(500)].map((_, i) => ( - - Flex with column for "sm" breakpoint + + Flex with column for "sm" breakpoint - 1 + + 1 + 2 3 @@ -47,7 +51,7 @@ export default function DemoBox() { 2 3 - + ))}
); diff --git a/packages/zero-runtime/src/processors/sx.ts b/packages/zero-runtime/src/processors/sx.ts index b6c699f04303a2..9873c076a4dd88 100644 --- a/packages/zero-runtime/src/processors/sx.ts +++ b/packages/zero-runtime/src/processors/sx.ts @@ -1,5 +1,5 @@ import type { Expression, Params, TailProcessorParams, ValueCache } from '@linaria/tags'; -import { buildSlug, toValidCSSIdentifier, validateParams } from '@linaria/tags'; +import { validateParams } from '@linaria/tags'; import { ValueType } from '@linaria/utils'; import type { ExpressionValue, Replacements, Rules } from '@linaria/utils'; import type { IOptions } from './styled'; @@ -14,6 +14,8 @@ export class SxProcessor extends BaseProcessor { collectedVariables: [string, Expression, boolean][] = []; + elementClassName = ''; + constructor(params: Params, ...args: TailProcessorParams) { super(params, ...args); validateParams(params, ['callee', 'call'], 'Invalid usage of sx call.'); @@ -28,14 +30,17 @@ export class SxProcessor extends BaseProcessor { build(values: ValueCache) { const [sxStyle, elementClassExpression] = this.sxArguments; - let elementClassName = ''; if (elementClassExpression.kind === ValueType.LAZY) { const elementClassValue = values.get(elementClassExpression.ex.name); if (typeof elementClassValue === 'string') { - elementClassName = elementClassValue; + this.elementClassName = elementClassValue; } } + if (!this.elementClassName) { + return; + } + let cssText: string = ''; if (sxStyle.kind === ValueType.CONST) { if (sxStyle.ex.type === 'StringLiteral') { @@ -45,7 +50,9 @@ export class SxProcessor extends BaseProcessor { const styleObjOrFn = values.get(sxStyle.ex.name); cssText = this.processCss(styleObjOrFn, sxStyle); } - const selector = elementClassName ? `.${elementClassName}${this.asSelector}` : this.asSelector; + const selector = this.elementClassName + ? `.${this.elementClassName}${this.asSelector}` + : this.asSelector; if (!cssText) { return; @@ -83,6 +90,10 @@ export class SxProcessor extends BaseProcessor { doRuntimeReplacement() { const t = this.astService; + // do not replace if sx prop is not on zero-runtime styled component + if (!this.elementClassName) { + return; + } if (this.collectedVariables.length) { const varProperties: ReturnType[] = this.collectedVariables.map( ([variableId, expression, isUnitLess]) => { @@ -130,19 +141,6 @@ export class SxProcessor extends BaseProcessor { return this.astService.stringLiteral(this.className); } - // Implementation taken from Linaria - https://github.com/callstack/linaria/blob/master/packages/react/src/processors/styled.ts#L284 - protected getCustomVariableId(cssKey: string, source: string, hasUnit: boolean) { - const context = this.getVariableContext(cssKey, source, hasUnit); - const customSlugFn = this.options.variableNameSlug; - if (!customSlugFn) { - return toValidCSSIdentifier(`${this.slug}-${context.index}`); - } - - return typeof customSlugFn === 'function' - ? customSlugFn(context) - : buildSlug(customSlugFn, { ...context }); - } - private processCss(styleObjOrFn: unknown, expressionValue: ExpressionValue) { const { themeArgs } = this.options as IOptions; const styleObj = typeof styleObjOrFn === 'function' ? styleObjOrFn(themeArgs) : styleObjOrFn; diff --git a/packages/zero-runtime/src/sx.js b/packages/zero-runtime/src/sx.js index e0a97713fdb3d6..4d9091f558229c 100644 --- a/packages/zero-runtime/src/sx.js +++ b/packages/zero-runtime/src/sx.js @@ -1,6 +1,3 @@ -export default function sx() { - // @TODO - Add link to the documentation when we have it. - throw new Error( - 'MUI: You were trying to call sx function directly without configuring your bundler. Make sure to install the bundler specific plugin and use it.', - ); +export default function sx(styleObj) { + return styleObj; } From ea14c99ee41822b6443cfbcf1383099afa6acc05 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Thu, 4 Jan 2024 14:23:27 +0530 Subject: [PATCH 08/11] Use local ui lib in nextjs demo --- .eslintignore | 6 ++++++ apps/local-ui-lib/.eslintrc | 6 ++++++ apps/zero-runtime-next-app/.eslintrc | 4 +++- apps/zero-runtime-next-app/next.config.js | 2 +- apps/zero-runtime-next-app/package.json | 1 + apps/zero-runtime-next-app/src/app/page.tsx | 2 +- apps/zero-runtime-next-app/src/app/slider/page.tsx | 2 ++ apps/zero-runtime-next-app/src/components/Box.jsx | 2 +- .../src/components/Slider/ZeroSlider.tsx | 1 - package.json | 3 ++- packages/zero-runtime/.eslintrc | 1 + packages/zero-runtime/exports/generateAtomics.js | 1 + packages/zero-runtime/src/styled.jsx | 5 +++++ packages/zero-unplugin/src/index.ts | 2 -- pnpm-lock.yaml | 3 +++ webpackBaseConfig.js | 2 +- 16 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 apps/local-ui-lib/.eslintrc diff --git a/.eslintignore b/.eslintignore index c81c6b721feb25..0cbac93daeefb5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,6 +18,12 @@ /packages/mui-icons-material/src/*.js /packages/mui-icons-material/templateSvgIcon.js /packages/mui-utils/macros/__fixtures__/ +/packages/zero-runtime/utils/ +/packages/zero-runtime/processors/ +/packages/zero-runtime/exports/ +/packages/zero-runtime/theme/ +/packages/zero-next-plugin/loader.js +/pkgs/ # Ignore fixtures /packages/typescript-to-proptypes/test/*/* /test/bundling/fixtures/**/*.fixture.js diff --git a/apps/local-ui-lib/.eslintrc b/apps/local-ui-lib/.eslintrc new file mode 100644 index 00000000000000..9a6f8e3481197e --- /dev/null +++ b/apps/local-ui-lib/.eslintrc @@ -0,0 +1,6 @@ +{ + "rules": { + "import/prefer-default-export": "off", + "import/no-unresolved": "off" + } +} diff --git a/apps/zero-runtime-next-app/.eslintrc b/apps/zero-runtime-next-app/.eslintrc index c4927f68f7791e..327cf67d7ce21a 100644 --- a/apps/zero-runtime-next-app/.eslintrc +++ b/apps/zero-runtime-next-app/.eslintrc @@ -1,6 +1,8 @@ { "extends": ["plugin:react/jsx-runtime"], "rules": { - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "import/extensions": "off", + "import/no-unresolved": "off" } } diff --git a/apps/zero-runtime-next-app/next.config.js b/apps/zero-runtime-next-app/next.config.js index 65c44b5897ded3..e22437e5b24ac8 100644 --- a/apps/zero-runtime-next-app/next.config.js +++ b/apps/zero-runtime-next-app/next.config.js @@ -1,5 +1,5 @@ -/* eslint-disable */ /* eslint-env node */ +// eslint-ignore-next-line import/no-unresolved const { withZeroPlugin } = require('@mui/zero-next-plugin'); const { experimental_extendTheme: extendTheme } = require('@mui/material/styles'); diff --git a/apps/zero-runtime-next-app/package.json b/apps/zero-runtime-next-app/package.json index 11d16f91d54f9a..29c1a14e99c8fd 100644 --- a/apps/zero-runtime-next-app/package.json +++ b/apps/zero-runtime-next-app/package.json @@ -14,6 +14,7 @@ "@mui/base": "workspace:^", "@mui/material": "workspace:^", "@mui/system": "workspace:^", + "local-ui-lib": "workspace:^", "react": "^18", "react-dom": "^18", "next": "14.0.1" diff --git a/apps/zero-runtime-next-app/src/app/page.tsx b/apps/zero-runtime-next-app/src/app/page.tsx index 325e49b09124ac..59edcbe6c33e14 100644 --- a/apps/zero-runtime-next-app/src/app/page.tsx +++ b/apps/zero-runtime-next-app/src/app/page.tsx @@ -1,6 +1,6 @@ import Image from 'next/image'; -import styles from './page.module.css'; import { styled } from '@mui/zero-runtime'; +import styles from './page.module.css'; const Main = styled.main({ display: 'flex', diff --git a/apps/zero-runtime-next-app/src/app/slider/page.tsx b/apps/zero-runtime-next-app/src/app/slider/page.tsx index 92d5bd33fe5f61..1c2a9b735bf559 100644 --- a/apps/zero-runtime-next-app/src/app/slider/page.tsx +++ b/apps/zero-runtime-next-app/src/app/slider/page.tsx @@ -1,6 +1,7 @@ 'use client'; import * as React from 'react'; import { styled } from '@mui/zero-runtime'; +import { Button } from 'local-ui-lib'; import Slider from '@/components/Slider/ZeroSlider'; const HalfWidth = styled.div(({ theme }) => ({ @@ -74,6 +75,7 @@ export default function SliderPage() {
+ {children}
diff --git a/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx b/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx index 259488ddaf4fd4..fe6f4e8108a037 100644 --- a/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx +++ b/apps/zero-runtime-next-app/src/components/Slider/ZeroSlider.tsx @@ -1,4 +1,3 @@ -/* eslint-disable */ import * as React from 'react'; import clsx from 'clsx'; import { unstable_composeClasses as composeClasses } from '@mui/utils'; diff --git a/package.json b/package.json index 9f1960372e63a4..c1671146ba40be 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "deduplicate": "pnpm dedupe", "benchmark:browser": "pnpm --filter benchmark browser", "build": "lerna run --scope \"@mui/*\" build", - "build:zero": "lerna run --scope \"@mui/zero-*\" build", + "build:zero": "pnpm --filter \"@mui/zero-*\" build", + "clean:zero": "pnpm --filter \"@mui/zero-*\" clean", "build:codesandbox": "NODE_OPTIONS=\"–max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" build", "release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private --force-publish=@mui/core-downloads-tracker", "release:build": "lerna run --concurrency 8 --scope \"@mui/*\" build --skip-nx-cache", diff --git a/packages/zero-runtime/.eslintrc b/packages/zero-runtime/.eslintrc index 5abd34a395bc37..2d10f64a22f97b 100644 --- a/packages/zero-runtime/.eslintrc +++ b/packages/zero-runtime/.eslintrc @@ -1,4 +1,5 @@ { + "ignorePatterns": ["**/exports/*.js", "**/theme/*.*"], "rules": { "import/prefer-default-export": "off" } diff --git a/packages/zero-runtime/exports/generateAtomics.js b/packages/zero-runtime/exports/generateAtomics.js index 897eea3b6beaa4..8364eb9c7870e6 100644 --- a/packages/zero-runtime/exports/generateAtomics.js +++ b/packages/zero-runtime/exports/generateAtomics.js @@ -1,3 +1,4 @@ +// eslint-ignore Object.defineProperty(exports, '__esModule', { value: true, }); diff --git a/packages/zero-runtime/src/styled.jsx b/packages/zero-runtime/src/styled.jsx index d1cc1def3db5a6..c91633690ee652 100644 --- a/packages/zero-runtime/src/styled.jsx +++ b/packages/zero-runtime/src/styled.jsx @@ -81,9 +81,11 @@ export default function styled(tag, componentMeta = {}) { } const StyledComponent = React.forwardRef(function StyledComponent( + // eslint-disable-next-line react/prop-types { as, className, sx, style, ...props }, ref, ) { + // eslint-disable-next-line react/prop-types const { ownerState, ...restProps } = props; const Component = as ?? tag; const varStyles = Object.entries(cssVars).reduce( @@ -101,7 +103,9 @@ export default function styled(tag, componentMeta = {}) { }, {}, ); + // eslint-disable-next-line react/prop-types const sxClass = typeof sx === 'string' ? sx : sx?.className; + // eslint-disable-next-line react/prop-types const sxVars = sx && typeof sx !== 'string' ? sx.vars : undefined; if (sxVars) { @@ -131,6 +135,7 @@ export default function styled(tag, componentMeta = {}) { // eslint-disable-next-line no-underscore-dangle if (!Component.__isStyled || typeof Component === 'string') { return ( + // eslint-disable-next-line react/jsx-filename-extension ; -export const vite = plugin.vite as unknown as UnpluginFactoryOutput; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94438aeef93f9a..6ca884596cb698 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -368,6 +368,9 @@ importers: '@mui/zero-runtime': specifier: workspace:^ version: link:../../packages/zero-runtime + local-ui-lib: + specifier: workspace:^ + version: link:../local-ui-lib next: specifier: 14.0.1 version: 14.0.1(@babel/core@7.23.7)(babel-plugin-macros@3.1.0)(react-dom@18.2.0)(react@18.2.0) diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index 4feb6aa97b14e2..e07c085c4cc830 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -24,7 +24,7 @@ module.exports = { '@mui/material-next': path.resolve(__dirname, './packages/mui-material-next/src'), '@mui/material-nextjs': path.resolve(__dirname, './packages/mui-material-nextjs/src'), '@mui/joy': path.resolve(__dirname, './packages/mui-joy/src'), - '@mui/zero-runtime': path.resolve(__dirname, './packages/zero-runtime/src'), + '@mui/zero-runtime': path.resolve(__dirname, './packages/zero-runtime'), 'typescript-to-proptypes': path.resolve(__dirname, './packages/typescript-to-proptypes/src'), docs: path.resolve(__dirname, './docs'), }, From a04c048d9cf6315b13517937c77cd55ed605610e Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Fri, 5 Jan 2024 14:50:41 +0530 Subject: [PATCH 09/11] Linting fix --- apps/zero-runtime-next-app/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/zero-runtime-next-app/README.md b/apps/zero-runtime-next-app/README.md index 39fc5a02d2dafb..de47d5fc1fa6a3 100644 --- a/apps/zero-runtime-next-app/README.md +++ b/apps/zero-runtime-next-app/README.md @@ -1,3 +1,5 @@ +# Demo Next.js app for Zero Runtime + This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started From fbb069a02d50b7d92f2261597e9593c6228fdca7 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Fri, 5 Jan 2024 16:55:04 +0530 Subject: [PATCH 10/11] Use nx to run commands instead of lerna This helps running the commands in correct order as per dependencies --- .eslintignore | 1 - package.json | 2 +- packages/zero-next-plugin/package.json | 2 +- packages/zero-runtime/package.json | 2 +- packages/zero-unplugin/package.json | 2 +- packages/zero-vite-plugin/package.json | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.eslintignore b/.eslintignore index 0cbac93daeefb5..298ccbdd2f0041 100644 --- a/.eslintignore +++ b/.eslintignore @@ -23,7 +23,6 @@ /packages/zero-runtime/exports/ /packages/zero-runtime/theme/ /packages/zero-next-plugin/loader.js -/pkgs/ # Ignore fixtures /packages/typescript-to-proptypes/test/*/* /test/bundling/fixtures/**/*.fixture.js diff --git a/package.json b/package.json index c1671146ba40be..f7187f65bb29aa 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "deduplicate": "pnpm dedupe", "benchmark:browser": "pnpm --filter benchmark browser", "build": "lerna run --scope \"@mui/*\" build", - "build:zero": "pnpm --filter \"@mui/zero-*\" build", + "build:zero": "lerna run --scope \"@mui/zero-*\" build", "clean:zero": "pnpm --filter \"@mui/zero-*\" clean", "build:codesandbox": "NODE_OPTIONS=\"–max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" build", "release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private --force-publish=@mui/core-downloads-tracker", diff --git a/packages/zero-next-plugin/package.json b/packages/zero-next-plugin/package.json index 9d7e175d5f13ae..b296febe2c59ea 100644 --- a/packages/zero-next-plugin/package.json +++ b/packages/zero-next-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@mui/zero-next-plugin", - "version": "0.0.1-alpha.5", + "version": "0.0.1", "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", diff --git a/packages/zero-runtime/package.json b/packages/zero-runtime/package.json index 3e397bacb24865..a8c5fedbdf3cd9 100644 --- a/packages/zero-runtime/package.json +++ b/packages/zero-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@mui/zero-runtime", - "version": "0.0.1-alpha.5", + "version": "0.0.1", "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", diff --git a/packages/zero-unplugin/package.json b/packages/zero-unplugin/package.json index d14cd762cce77a..424ca872e8a83e 100644 --- a/packages/zero-unplugin/package.json +++ b/packages/zero-unplugin/package.json @@ -1,6 +1,6 @@ { "name": "@mui/zero-unplugin", - "version": "0.0.1-alpha.5", + "version": "0.0.1", "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", diff --git a/packages/zero-vite-plugin/package.json b/packages/zero-vite-plugin/package.json index c2ca7807cc7125..a5101e087ac018 100644 --- a/packages/zero-vite-plugin/package.json +++ b/packages/zero-vite-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@mui/zero-vite-plugin", - "version": "0.0.1-alpha.0", + "version": "0.0.1", "main": "build/index.js", "module": "build/index.mjs", "types": "build/index.d.ts", From fc7fc610ef62177fb7d20d6731853f31414afc65 Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Mon, 8 Jan 2024 13:32:59 +0530 Subject: [PATCH 11/11] Add paths to tsconfig in next demo app --- apps/zero-runtime-next-app/tsconfig.json | 16 +++++++++++++++- packages/zero-runtime/tsconfig.json | 2 +- webpackBaseConfig.js | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/zero-runtime-next-app/tsconfig.json b/apps/zero-runtime-next-app/tsconfig.json index e59724b283f9cb..d11ca0046190ee 100644 --- a/apps/zero-runtime-next-app/tsconfig.json +++ b/apps/zero-runtime-next-app/tsconfig.json @@ -23,5 +23,19 @@ } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "exclude": ["node_modules"], + "references": [ + { + "path": "../../packages/mui-system/tsconfig.build.json" + }, + { + "path": "../../packages/mui-base/tsconfig.build.json" + }, + { + "path": "../../packages/mui-material/tsconfig.build.json" + }, + { + "path": "../../packages/zero-runtime/tsconfig.json" + } + ] } diff --git a/packages/zero-runtime/tsconfig.json b/packages/zero-runtime/tsconfig.json index 590dcab8d84bc5..863e932e7ce5cc 100644 --- a/packages/zero-runtime/tsconfig.json +++ b/packages/zero-runtime/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "lib": ["ES2017", "ES2021.String", "DOM"], "composite": true, - "noEmit": true, + "noEmit": false, "resolveJsonModule": true }, "include": ["src/**/*.ts"], diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index e07c085c4cc830..4feb6aa97b14e2 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -24,7 +24,7 @@ module.exports = { '@mui/material-next': path.resolve(__dirname, './packages/mui-material-next/src'), '@mui/material-nextjs': path.resolve(__dirname, './packages/mui-material-nextjs/src'), '@mui/joy': path.resolve(__dirname, './packages/mui-joy/src'), - '@mui/zero-runtime': path.resolve(__dirname, './packages/zero-runtime'), + '@mui/zero-runtime': path.resolve(__dirname, './packages/zero-runtime/src'), 'typescript-to-proptypes': path.resolve(__dirname, './packages/typescript-to-proptypes/src'), docs: path.resolve(__dirname, './docs'), },