init project
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled

This commit is contained in:
how2ice
2025-12-12 14:26:25 +09:00
commit 005cf56baf
43188 changed files with 1079531 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -0,0 +1,39 @@
# Material UI x Pigment CSS - Vite example
## How to use
Download the example [or clone the repo](https://github.com/mui/material-ui):
<!-- #target-branch-reference -->
```bash
curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/material-ui-pigment-css-vite-ts
cd material-ui-pigment-css-vite-ts
```
Install it and run:
```bash
npm install
npm run dev
```
or:
<!-- #target-branch-reference -->
[![Edit on StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/mui/material-ui/tree/master/examples/material-ui-pigment-css-vite-ts)
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/github/mui/material-ui/tree/master/examples/material-ui-pigment-css-vite-ts)
## The idea behind the example
This example uses [Vite](https://github.com/vitejs/vite).
It includes `@mui/material` and [Pigment CSS](https://github.com/mui/pigment-css) as the style engine.
## What's next?
<!-- #host-reference -->
You now have a working example project.
You can head back to the documentation and continue by browsing the [templates](https://mui.com/material-ui/getting-started/templates/) section.

View File

@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<!-- Fonts to support Material Design -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
/>
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@@ -0,0 +1,30 @@
{
"name": "material-ui-pigment-css-vite",
"version": "7.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@mui/material": "latest",
"@mui/material-pigment-css": "latest",
"@pigment-css/react": "latest",
"react": "latest",
"react-dom": "latest",
"react-is": "latest",
"prop-types": "latest",
"hoist-non-react-statics": "latest"
},
"devDependencies": {
"@pigment-css/vite-plugin": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",
"@vitejs/plugin-react": "latest",
"typescript": "latest",
"vite": "latest"
}
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,121 @@
import DefaultPropsProvider from '@mui/material/DefaultPropsProvider';
import CssBaseline from '@mui/material/CssBaseline';
import Container from '@mui/material-pigment-css/Container';
import Grid from '@mui/material-pigment-css/Grid';
import Stack from '@mui/material-pigment-css/Stack';
import Typography from '@mui/material/Typography';
import Chip from '@mui/material/Chip';
import { styled } from '@mui/material-pigment-css';
const Title = styled('div')(({ theme }) => ({
color: theme.vars.palette.text.primary,
font: theme.vars.font.body1,
fontSize: '1.125rem',
lineHeight: 1.7,
}));
export default function Home() {
return (
<main sx={{ minHeight: '100lvh', display: 'grid', placeItems: 'center' }}>
<DefaultPropsProvider
value={{
MuiChip: {
label: 'Available in v6',
},
}}
>
<CssBaseline />
<Container>
<Grid container spacing={{ xs: 2, sm: 3, md: 4 }}>
<Grid size={{ xs: 12, md: 6 }} sx={{ pl: 4.5 }}>
<Chip
sx={(theme) => ({
mb: 2,
fontWeight: 600,
bgcolor: `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)`,
color: 'primary.dark',
})}
/>
<Typography
variant="h1"
sx={{
fontWeight: 500,
fontSize: 'clamp(3rem, 2.354rem + 2.7562vw, 5rem)',
textWrap: 'balance',
letterSpacing: '-0.025em',
}}
>
<span
sx={(theme) => ({
display: 'block',
background: `linear-gradient(145deg, ${
(theme.vars || theme).palette.primary.light
} 5%, ${(theme.vars || theme).palette.primary.dark} 90%)`,
// `Webkit` has to come later
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
})}
>
Material UI
</span>
Pigment CSS
</Typography>
</Grid>
<Grid size={{ xs: 12, md: 6 }}>
<Stack
component="ul"
spacing={3}
sx={{
m: 0,
pl: 3,
color: 'text.secondary',
'& li': {
pl: 2,
fontSize: '1.125rem',
fontWeight: 500,
'&::marker': {
color: 'text.primary',
},
},
}}
>
<li
sx={{
'&::marker': { content: '"⚡️"' },
}}
>
<Title>Build-time CSS Extraction</Title>
<Typography>
Pigment CSS looks through Material UI components used in the project and
extracts the styles into plain CSS.
</Typography>
</li>
<li
sx={{
'&::marker': { content: '"🚀"' },
}}
>
<Title>React Server Components</Title>
<Typography>
Material UI provides a set of layout components that integrates with Pigment CSS
to support React Server Components.
</Typography>
</li>
<li
sx={{
'&::marker': { content: '"📦"' },
}}
>
<Title>Emotionless</Title>
<Typography>
Replacing Emotion with Pigment CSS eliminates ~15kB from the final bundle.
</Typography>
</li>
</Stack>
</Grid>
</Grid>
</Container>
</DefaultPropsProvider>
</main>
);
}

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import '@mui/material-pigment-css/styles.css';
import App from './App.tsx';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);

View File

@@ -0,0 +1,19 @@
import { Theme, SxProps } from '@mui/material/styles';
import {} from '@mui/material/themeCssVarsAugmentation';
declare module '@mui/material-pigment-css' {
interface ThemeArgs {
theme: Theme;
}
}
declare global {
namespace React {
interface HTMLAttributes {
sx?: SxProps<Theme>;
}
interface SVGProps {
sx?: SxProps<Theme>;
}
}
}

View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -0,0 +1,27 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}

View File

@@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
},
"include": ["vite.config.ts"]
}

View File

@@ -0,0 +1,20 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { pigment } from '@pigment-css/vite-plugin';
import { createTheme } from '@mui/material/styles';
const pigmentConfig = {
theme: createTheme({
cssVariables: true,
colorSchemes: { light: true, dark: true },
}),
transformLibraries: ['@mui/material'],
};
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), pigment(pigmentConfig)],
optimizeDeps: {
include: ['prop-types', 'react-is', 'hoist-non-react-statics'],
},
});