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

feat: v1 docs #378

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d255233
Add runtime path replacement config
Dec 26, 2024
f049617
feat: Create utils package to share logic across runtime and bundler …
Dec 5, 2024
3ae7a3b
feat: create UI library independent core package
Dec 9, 2024
e815a34
keyframe new api
Dec 16, 2024
f9199ce
remove unused packages
Dec 25, 2024
3e6244a
Handle runtime path replacement logic
Dec 26, 2024
8b43da4
Add test for useLayer feature
Dec 26, 2024
d4dcda9
Use className if provided
Dec 27, 2024
516b661
Fix tests
Dec 27, 2024
5ffac93
Add to codesandbox
Dec 28, 2024
7719a57
add variables to generated js
Dec 28, 2024
01ab20c
Remove LICENSE
Dec 28, 2024
f98c654
remove unrelated files
Dec 28, 2024
80745a6
Variants for css call
Dec 29, 2024
d130e55
eslint fix
Jan 14, 2025
2365f75
Replace absolute paths in sourcemap to relative paths
Jan 14, 2025
26c97dc
sync pnpm changes
Jan 21, 2025
0919b1d
Add a workaround to use t() function in template literals
Feb 1, 2025
6b83625
Add defaultVariants to the output
Feb 1, 2025
d727ea8
Add defaultVariants support in runtime
Feb 1, 2025
39702bd
Fix typescript issue
Feb 1, 2025
ea8f952
Fix test
Feb 1, 2025
aa46a39
Export type definitions required for React package
Feb 3, 2025
ffa937f
Revert theme changes for node
Feb 8, 2025
0dde96a
First working version of pigment-css/react@v1
Dec 26, 2024
8eb34db
Implement styled runtime
Feb 3, 2025
ee532cf
Implement runtime and add tests
Feb 6, 2025
40d8b62
Propagate className from prop to the target component
Feb 7, 2025
35f443e
Allow react components in tagged template
Feb 7, 2025
155b9ef
Handle pre-transformed tagged-template literal by swc
Feb 8, 2025
5dcba4b
v1/plugins
Jan 14, 2025
cc81aa8
Post transform callback for vite
Jan 21, 2025
8de977f
Fix typechecking config
Feb 3, 2025
4e3e6bb
feat: Add a way to filter files by names
Feb 4, 2025
d59c43c
Export bundle config type
Feb 4, 2025
3ae3644
Add a way to have private values in the theme object
Feb 7, 2025
7fc8df0
Add a separate option for runtimePackages
Feb 7, 2025
0cd6daa
Suppress warnings in webpack
Feb 8, 2025
6935a25
Fix types
Feb 8, 2025
161951d
feat: revamped docs site
Feb 8, 2025
f65f109
Refactor theme and use lightning css
Feb 8, 2025
d23ea15
CI fixes
Feb 8, 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
2 changes: 2 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"installCommand": "install:codesandbox",
"node": "18",
"packages": [
"packages/pigment-css-core",
"packages/pigment-css-nextjs-plugin",
"packages/pigment-css-react",
"packages/pigment-css-react-new",
"packages/pigment-css-theme",
"packages/pigment-css-unplugin",
"packages/pigment-css-utils",
Expand Down
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
/packages/pigment-css-react/exports/
/packages/pigment-css-react/theme/
/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 @@ -33,3 +38,4 @@ 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
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
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
5 changes: 2 additions & 3 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
REPO_ROOT=https://github.com/mui/pigment-css
DEFAULT_BRANCH=master

SOURCE_CODE_REPO=https://github.com/mui/pigment-css
SOURCE_GITHUB_BRANCH=master
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
4 changes: 0 additions & 4 deletions docs/README.md

This file was deleted.

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.

67 changes: 30 additions & 37 deletions docs/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
import * as url from 'url';
import * as path from 'path';
import type { NextConfig } from 'next';
// @ts-ignore
// eslint-disable-next-line no-restricted-imports
import nextMdx from '@next/mdx';
import withPigment, { type PigmentCSSConfig } from '@pigment-css/plugin/nextjs';
import remarkGfm from 'remark-gfm';
import remarkTypography from 'remark-typography';
import rehypeExtractToc from '@stefanprobst/rehype-extract-toc';
// @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 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 withMdx = nextMdx({
options: {
remarkPlugins: [remarkGfm, remarkTypography],
rehypePlugins: [rehypeExtractToc],
},
});

const isProd = process.env.NODE_ENV === 'production';

const nextConfig: NextConfig = {
trailingSlash: false,
pageExtensions: ['mdx', 'tsx'],
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,
APP_NAME: 'Pigment CSS',
GITHUB: 'https://github.com/mui/pigment-css',
NPM: 'https://www.npmjs.com/package/@pigment-css/core',
},
...(isProd && { distDir: 'export', output: 'export' }),
experimental: {
esmExternals: true,
workerThreads: false,
turbo: undefined,
useLightningcss: true,
},
};

const theme = extendTheme({
colorSchemes: {
light: baseTheme,
},
});

export default withPigment(withDocsInfra(nextConfig), {
const pigmentConfig: PigmentCSSConfig = {
theme,
displayName: true,
sourceMap: process.env.NODE_ENV !== 'production',
babelOptions: {
plugins: [
'@babel/plugin-proposal-explicit-resource-management',
'@babel/plugin-transform-unicode-property-regex',
],
},
});
transformSx: false,
displayName: !isProd,
sourceMap: !isProd,
include: /\.pigment\.tsx?$/,
};

export default withPigment(withMdx(withDocsInfra(nextConfig)), pigmentConfig);
54 changes: 25 additions & 29 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
{
"name": "docs",
"version": "0.1.0",
"version": "0.0.0",
"private": true,
"scripts": {
"clean": "rm -rf .next export",
"dev": "next dev",
"build": "cross-env NODE_ENV=production next build",
"preview": "serve ./export",
"lint": "next lint",
"typescript": "tsc --noEmit -p ."
"build": "next build",
"start": "pnpm dlx serve export",
"lint": "next lint"
},
"dependencies": {
"@base_ui/react": "^1.0.0-alpha.3",
"@mdx-js/mdx": "^3.1.0",
"@pigment-css/react": "workspace:*",
"@stefanprobst/rehype-extract-toc": "^2.2.0",
"@base-ui-components/react": "^1.0.0-alpha.6",
"@pigment-css/theme": "workspace:*",
"@pigment-css/react-new": "workspace:*",
"clsx": "^2.1.1",
"next": "15.0.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"rehype-pretty-code": "0.14.0",
"rehype-slug": "^6.0.0",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^4.0.0",
"remark-mdx-frontmatter": "^5.0.0",
"shiki": "^1.22.2",
"to-vfile": "^8.0.0",
"vfile-matter": "^5.0.0"
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "15.1.6",
"scroll-into-view-if-needed": "^3.1.0"
},
"devDependencies": {
"@babel/plugin-proposal-explicit-resource-management": "^7.25.9",
"@babel/plugin-transform-unicode-property-regex": "^7.25.9",
"@mui/monorepo": "github:mui/material-ui#ae455647016fe5dee968b017aa191e176bc113dd",
"@pigment-css/nextjs-plugin": "workspace:*",
"@mdx-js/loader": "^3.1.0",
"@next/mdx": "^15.1.6",
"@pigment-css/plugin": "workspace:*",
"@stefanprobst/rehype-extract-toc": "^2.2.1",
"@mui/monorepo": "github:mui/material-ui#v6.4.2",
"remark-gfm": "^4.0.0",
"remark-typography": "^0.6.21",
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint-config-next": "15.0.2",
"serve": "14.2.4",
"tailwindcss": "^3.4.14"
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint": "^9",
"eslint-config-next": "15.1.6",
"@eslint/eslintrc": "^3"
},
"nx": {
"targets": {
Expand Down
24 changes: 24 additions & 0 deletions docs/public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/_next/*.js
Cache-Control: public, max-age=31536000, immutable

/static/*.ico
Content-Type: image/x-icon

/performance/*
X-Robots-Tag: noindex

/experiments/*
X-Robots-Tag: noindex

/*
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
# Block usage in iframes.
X-Frame-Options: SAMEORIGIN
# Force the browser to trust the Content-Type header
# https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
# TODO: progressively reduce the CSP scopes
# Start with a wildcard, using https://github.com/mui/toolpad/blob/f4c4eb046b352e4fc00729c3bed605e671b040c4/packages/toolpad-studio/src/server/index.ts#L241
Content-Security-Policy: default-src * data: mediastream: blob: filesystem: about: ws: wss: 'unsafe-eval' 'wasm-unsafe-eval' 'unsafe-inline'; script-src * data: blob: 'unsafe-inline' 'unsafe-eval'; script-src-elem * data: blob: 'unsafe-inline'; connect-src * data: blob: 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; media-src * data: blob: 'unsafe-inline'; frame-src * data: blob: ; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline'; frame-ancestors *;
4 changes: 4 additions & 0 deletions docs/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Algolia-Crawler-Verif: 98C49CAFF7AEED76

User-agent: *
Allow: /
Binary file added docs/public/static/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/static/favicon-dev.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/public/static/favicon-dev.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/static/favicon.ico
Binary file not shown.
Loading