Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] All the docs actual content #390

Draft
wants to merge 90 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
4ab2422
First working version of pigment-css/react@v1
Dec 26, 2024
841238d
Implement styled runtime
Feb 3, 2025
8275455
Implement runtime and add tests
Feb 6, 2025
2dc2085
Propagate className from prop to the target component
Feb 7, 2025
074a182
Allow react components in tagged template
Feb 7, 2025
f30fca7
Handle pre-transformed tagged-template literal by swc
Feb 8, 2025
04d8b61
Make the package exports work with node10 resolution
Feb 27, 2025
8e9c8ec
Throw error instead of warning when transform fails
Feb 27, 2025
fdf6245
Consolidate exports to single ts file
Feb 27, 2025
4261fc9
Update nx build outputs
Mar 6, 2025
5e57953
Fix argument processing for constant string css
Mar 6, 2025
5359d8c
v1/plugins
Jan 14, 2025
2e7dda6
Post transform callback for vite
Jan 21, 2025
b76ab4a
Fix typechecking config
Feb 3, 2025
334d2bb
feat: Add a way to filter files by names
Feb 4, 2025
3352e2b
Export bundle config type
Feb 4, 2025
351eb62
Add a way to have private values in the theme object
Feb 7, 2025
6fec8a4
Add a separate option for runtimePackages
Feb 7, 2025
7856e81
Suppress warnings in webpack
Feb 8, 2025
77d96dd
Fix types
Feb 8, 2025
64df9a2
Suppress related warnings in nextjs/webpack
Feb 8, 2025
03a1980
Rearrange exports
Feb 27, 2025
81fa5d4
Fix path resolution for webpack
Mar 5, 2025
482e094
Transform theme shorthands within the theme values to css variables
Mar 6, 2025
c35876b
Generate the theme css value once
Mar 11, 2025
559134b
Make plugin argument optional
Mar 11, 2025
34e8f69
Restructure package output
Mar 12, 2025
72bb50e
Add plugin package to csb
Mar 12, 2025
68e0400
Fix feature and wywFeature key swap
Mar 13, 2025
2c342e5
Handle path on Windows
Mar 19, 2025
c824c17
Bump next.js version
Mar 23, 2025
7a4985f
feat: revamped docs site
Feb 8, 2025
7176a9c
Refactor theme and use lightning css
Feb 8, 2025
d36637d
CI fixes
Feb 8, 2025
22002c9
Docs layout setup
Feb 27, 2025
bca25f9
Working mdx page. Syntax highlight is not working
Mar 5, 2025
bea2b50
Add basic doc to help with review
Mar 5, 2025
0370162
Allow shorthand css vars to be written in theme values as well
Mar 5, 2025
4c6b41d
Reconfigure app to use mdx from within the app
Mar 5, 2025
68fb966
Add reset styles
Mar 5, 2025
36c0634
Add releases page
Mar 6, 2025
8b6b31d
Add heading id and links
Mar 6, 2025
d3df23e
Fix code copy
Mar 6, 2025
2d8e50f
Add in-page quick-nav
Mar 6, 2025
d404ad9
Fix lint
Mar 6, 2025
cb303ff
Remove redundatn class
Mar 6, 2025
e74ce67
Fix lint errors
Mar 6, 2025
d56b9a4
Add alert component. Also add pure css system theme
Mar 7, 2025
d6f2bc4
Final theme implementation
Mar 8, 2025
5219f2a
Fix ci
Mar 8, 2025
092edb5
Use .pigment.tsx as next.js route pages directly
Mar 10, 2025
671c02d
Add in-built support for light,dark and system modes
Mar 11, 2025
82f1103
Use in-built theme support from Pigment
Mar 11, 2025
2866302
Fix lint
Mar 11, 2025
b7f3e27
Fix lint
Mar 11, 2025
f7c2d84
Add redirect
Mar 11, 2025
32f3416
Add netlify cache plugin
Mar 11, 2025
8cfd1ac
Empty about page
Mar 12, 2025
38519d3
Don't render draft items only in production deployment
Mar 12, 2025
5d0c492
Import static assets
Mar 12, 2025
c9de547
Remove usage of @pigment-css/theme package in docs
Mar 13, 2025
1d776cb
Update icons in Alert component
Mar 14, 2025
4d94975
Add theme selector menu
Mar 14, 2025
d680213
Remove unused css
Mar 14, 2025
94d0495
Theme selector icons
Mar 17, 2025
4e10f81
Update nav items
Mar 19, 2025
d7356c4
Filter static params generation to be only for files that exist in the
Mar 20, 2025
4f9858e
Remove some of the nav items
Mar 20, 2025
92f4d4c
Bump next.js version and fix logo loading
Mar 20, 2025
1b98a99
Add Edit on Github link and fix rtl
Mar 21, 2025
a94042d
Add id attribute to content
Mar 24, 2025
ff5a601
[examples] Add an example app for Next.js
Mar 11, 2025
ff4dde0
[examples] Add an example app for Vite
Mar 11, 2025
b4b5327
[examples] Add an example app for Webpack
Mar 12, 2025
d375bf3
Add example directories to codesandbox ci
Mar 13, 2025
57bf2f3
Update pnpm config to prefer workspace package first
Mar 13, 2025
0c0e32e
Fix cross-env command
Mar 14, 2025
a2da6cb
Fix lint
Mar 14, 2025
6194941
[examples] Next.js pages router
Mar 23, 2025
41279a3
[docs] About page
Mar 12, 2025
55a8ccd
Add README for docs itself
Mar 12, 2025
2d8dcfd
Add content for quick-start and integrations pages
Mar 13, 2025
b2e3c0a
Add styling and composition docs
Mar 14, 2025
f55570a
Fix lint errors
Mar 14, 2025
dd2194e
Modifications
Mar 20, 2025
324f5fb
Add plugin configuration doc
Mar 20, 2025
428cf04
Add theming doc
Mar 20, 2025
fd324a5
Move Composition page to Guides category
Mar 21, 2025
43ddc7b
Add variants page
Mar 21, 2025
3c74123
[docs] Add how-it-works page
Mar 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"packages": [
"packages/pigment-css-core",
"packages/pigment-css-nextjs-plugin",
"packages/pigment-css-plugin",
"packages/pigment-css-react",
"packages/pigment-css-react-new",
"packages/pigment-css-theme",
"packages/pigment-css-unplugin",
"packages/pigment-css-utils",
Expand All @@ -14,7 +16,9 @@
"sandboxes": [
"/examples/pigment-css-nextjs-ts",
"/examples/pigment-css-remix-ts",
"/examples/pigment-css-vite-ts"
"/examples/pigment-css-vite-ts",
"/v1-examples/pigment-css-v1-nextjs",
"/v1-examples/pigment-css-v1-vite"
],
"silent": true
}
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
/packages/pigment-css-react/tests/**/fixtures
/packages/pigment-css-core/exports/
/packages/pigment-css-core/tests/**/fixtures
/packages/pigment-css-react-new/exports/
/packages/pigment-css-react-new/tests/**/fixtures
/packages/pigment-css-nextjs-plugin/loader.js
/packages/pigment-css-plugin/exports/
# Ignore fixtures
/packages-internal/scripts/typescript-to-proptypes/test/*/*
/test/bundling/fixtures/**/*.fixture.js
Expand All @@ -35,3 +38,5 @@ pnpm-lock.yaml
# If we want to format these files we'd need to do it in crowdin
docs/**/*-pt.md
docs/**/*-zh.md
/tmpapps
/v1-examples
11 changes: 4 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ module.exports = {
// Airbnb use warn https://github.com/airbnb/javascript/blob/63098cbb6c05376dbefc9a91351f5727540c1ce1/packages/eslint-config-airbnb-base/rules/style.js#L97
// but eslint recommands error
'func-names': 'error',
'no-restricted-imports': [
'error',
{
patterns: ['@mui/*/*/*'],
},
],
'no-continue': 'off',
'no-constant-condition': 'error',
// Use the proptype inheritance chain
Expand All @@ -83,6 +77,8 @@ module.exports = {
],
'no-use-before-define': 'off',

'react/react-in-jsx-scope': 'off',

// disabled type-aware linting due to performance considerations
'@typescript-eslint/dot-notation': 'off',
'dot-notation': 'error',
Expand Down Expand Up @@ -201,6 +197,7 @@ module.exports = {

'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'lines-around-directive': 'off',
'react/prop-types': 'off',
},
overrides: [
{
Expand Down Expand Up @@ -281,7 +278,7 @@ module.exports = {
},
// Next.js entry points pages
{
files: ['docs/pages/**/*.js'],
files: ['docs/apps/**/*{.tsx,.ts,.js}'],
rules: {
'react/prop-types': 'off',
},
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
enable-pre-post-scripts = true
link-workspace-packages = true
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"language": "markdown",
"scheme": "file"
}
]
],
"typescript.tsdk": "node_modules/typescript/lib"
}
8 changes: 4 additions & 4 deletions apps/pigment-css-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"local-ui-lib": "workspace:^",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "15.1.3"
"next": "15.1.6"
},
"devDependencies": {
"@pigment-css/nextjs-plugin": "workspace:^",
"@types/node": "^18.19.63",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"@types/node": "^20",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint": "^8.57.0",
"typescript": "^5.4.4"
},
Expand Down
6 changes: 3 additions & 3 deletions apps/pigment-css-vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"@pigment-css/vite-plugin": "workspace:^",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"@vitejs/plugin-react": "^4.3.4",
"postcss": "^8.4.47",
"postcss-combine-media-query": "^1.0.1",
"vite": "5.4.10",
"vite-plugin-pages": "^0.32.3"
"vite": "6.2.1",
"vite-plugin-pages": "^0.32.5"
},
"nx": {
"targets": {
Expand Down
7 changes: 4 additions & 3 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REPO_ROOT=https://github.com/mui/pigment-css
DEFAULT_BRANCH=master

APP_NAME=Pigment CSS
GITHUB=https://github.com/mui/pigment-css
NPM=https://www.npmjs.com/package/@pigment-css/core
WEBSITE=https://pigment-css.com
18 changes: 0 additions & 18 deletions docs/.eslintrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
export
17 changes: 14 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Pigment CSS Docs app
# Pigment CSS Docs

This is the Pigment CSS docs application bootstrapped with Next.js 15. It uses App Router and
Pigment CSS for styling.
This is a Next.js based app that uses the app router and exports a static build that is hosted on Netlify.

Check failure on line 3 in docs/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.CorrectReferenceAllCases] Use 'App Router' instead of 'app router' Raw Output: {"message": "[MUI.CorrectReferenceAllCases] Use 'App Router' instead of 'app router'", "location": {"path": "docs/README.md", "range": {"start": {"line": 3, "column": 43}}}, "severity": "ERROR"}

It uses Pigment CSS itself for all the styling. The Pigment CSS config in the `next.config.ts` file includes an `include` filter to only transform files ending in `pigment.ts` or `pigment.tsx`. So any `styled` or `css` call should be done in a file ending with the same extension. Rest of the files won't go through Pigment CSS's transform making it comparatively faster than trying to transform all the files, even if they don't contain anything related to Pigment CSS.

`pigment.tsx` has also been added to the `pageExtensions` option in the Next.js config so that we can write our layout/page files directly and that'll be part of Next.js routes.

Check warning on line 7 in docs/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'our'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "docs/README.md", "range": {"start": {"line": 7, "column": 109}}}, "severity": "WARNING"}

Check warning on line 7 in docs/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'we'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "docs/README.md", "range": {"start": {"line": 7, "column": 96}}}, "severity": "WARNING"}

All the navigation items in the left sidebar of the docs is part of [src/nav.ts](./src/nav.ts) file. This also decides the pages that'll be generated during build.

## Adding a new page

To add a new mdx page, identify the correct category (directory) in the [content](./src/content/) directory and create a new mdx file. Make sure to add an appropriate navigation item in [src/nav.ts](./src/nav.ts) at the desired place. The sidebar should be updated now with the new item. Navigate to the new page.

Any navigation item or parent category can be marked as `draft` by setting `draft: true`. This makes sure that the marked nav items and the corresponding pages are only rendered during development and won't be part of the final production build.
12 changes: 0 additions & 12 deletions docs/data/getting-started/overview/overview.mdx

This file was deleted.

36 changes: 0 additions & 36 deletions docs/data/pages.ts

This file was deleted.

14 changes: 14 additions & 0 deletions docs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')];

export default eslintConfig;
10 changes: 0 additions & 10 deletions docs/globals.d.ts

This file was deleted.

68 changes: 32 additions & 36 deletions docs/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
import * as url from 'url';
import * as path from 'path';
import * as path from 'node:path';
import type { NextConfig } from 'next';
// @ts-ignore
// eslint-disable-next-line no-restricted-imports
import withPigment, { type PigmentCSSConfig } from '@pigment-css/plugin/nextjs';
// @ts-expect-error This file doesn't have TS definitions.
import withDocsInfra from '@mui/monorepo/docs/nextConfigDocsInfra.js';
import { withPigment, extendTheme } from '@pigment-css/nextjs-plugin';

import { theme as baseTheme } from './src/theme';
import theme, { THEME_DARK } from './src/theme';

import rootPackage from '../package.json';

const currentDirectory = url.fileURLToPath(new URL('.', import.meta.url));
const DATA_DIR = path.join(currentDirectory, 'data');
const isProd = process.env.NODE_ENV === 'production';
const CONTENT_DIR = path.join(__dirname, 'src', 'content');

const nextConfig: NextConfig = {
pageExtensions: ['tsx', 'pigment.tsx'],
trailingSlash: false,
env: {
DATA_DIR,
CURRENT_VERSION: rootPackage.version,
},
distDir: 'export',
output: process.env.NODE_ENV === 'production' ? 'export' : undefined,
eslint: {
ignoreDuringBuilds: true,
},
devIndicators: {
buildActivity: true,
buildActivityPosition: 'bottom-right',
appIsrStatus: false,
LIB_VERSION: rootPackage.version,
CONTENT_DIR,
CHANGELOG_FILE: path.join(__dirname, '../CHANGELOG.md'),
},
...(isProd && { distDir: 'export', output: 'export' }),
experimental: {
esmExternals: true,
workerThreads: false,
turbo: undefined,
useLightningcss: true,
},
};

const theme = extendTheme({
colorSchemes: {
light: baseTheme,
const pigmentConfig: PigmentCSSConfig = {
theme: {
colorSchemes: {
light: theme,
dark: THEME_DARK,
},
defaultScheme: 'light',
getSelector(mode) {
if (mode === 'light') {
return ':root, [data-theme="light"]';
}
return `[data-theme="${mode}"]`;
},
},
});
transformSx: false,
displayName: !isProd,
sourceMap: !isProd,
include: /\.pigment\.tsx?$/,
};

export default withPigment(withDocsInfra(nextConfig), {
theme,
displayName: true,
sourceMap: process.env.NODE_ENV !== 'production',
babelOptions: {
plugins: [
'@babel/plugin-proposal-explicit-resource-management',
'@babel/plugin-transform-unicode-property-regex',
],
},
});
export default withPigment(withDocsInfra(nextConfig), pigmentConfig);
Loading
Loading