Repository: react-tools/react-charts Branch: beta Commit: fc02dbd328c2 Files: 160 Total size: 1.8 MB Directory structure: gitextract_mus8ytg7/ ├── .babelrc.js ├── .eslintrc ├── .github/ │ ├── FUNDING.yml │ └── workflows/ │ └── publish.yml ├── .gitignore ├── LICENSE ├── README.md ├── docs/ │ ├── .gitignore │ ├── README.md │ ├── jsconfig.json │ ├── next.config.js │ ├── package.json │ ├── postcss.config.js │ ├── public/ │ │ └── robots.txt │ ├── src/ │ │ ├── components/ │ │ │ ├── ArrowRight.js │ │ │ ├── Banner.js │ │ │ ├── BytesForm.js │ │ │ ├── CarbonAds.js │ │ │ ├── CodeBlock.js │ │ │ ├── Container.js │ │ │ ├── DocsPageFooter.js │ │ │ ├── ExternalLink.js │ │ │ ├── Footer.js │ │ │ ├── Highlight.js │ │ │ ├── Highlight2.js │ │ │ ├── LayoutDocs.js │ │ │ ├── LazyImage.js │ │ │ ├── Logo.js │ │ │ ├── MDXComponents.js │ │ │ ├── Markdown.js │ │ │ ├── Nav.js │ │ │ ├── ProgressiveImage.js │ │ │ ├── Search.js │ │ │ ├── Seo.js │ │ │ ├── Sidebar.js │ │ │ ├── SidebarCategory.js │ │ │ ├── SidebarHeading.js │ │ │ ├── SidebarMobile.js │ │ │ ├── SidebarNavLink.js │ │ │ ├── SidebarPost.js │ │ │ ├── Sticky.js │ │ │ ├── TWButton.js │ │ │ ├── Toc.js │ │ │ ├── Toc.module.css │ │ │ ├── TocNotion.js │ │ │ ├── blog/ │ │ │ │ ├── ExternalLink.js │ │ │ │ ├── Heading.js │ │ │ │ ├── Image.js │ │ │ │ ├── dynamic.js │ │ │ │ └── intersection-observer/ │ │ │ │ ├── index.js │ │ │ │ ├── intersection-observer.js │ │ │ │ ├── manager.js │ │ │ │ └── utils.js │ │ │ ├── blog-markdown.module.css │ │ │ ├── clients/ │ │ │ │ ├── Client.js │ │ │ │ ├── ClientsMarquee.js │ │ │ │ └── Filters.js │ │ │ ├── forwardRefWithAs.js │ │ │ ├── markdown.module.css │ │ │ ├── useBytesSubmit.js │ │ │ ├── useClipboard.js │ │ │ ├── useIsMobile.js │ │ │ ├── useOverScroll.js │ │ │ ├── useSearch.js │ │ │ ├── useTocHighlight.js │ │ │ └── utils/ │ │ │ └── throttle.js │ │ ├── manifests/ │ │ │ ├── getManifest.js │ │ │ └── manifest.json │ │ ├── pages/ │ │ │ ├── _app.js │ │ │ ├── _document.js │ │ │ ├── docs/ │ │ │ │ ├── api.md │ │ │ │ ├── getting-started.md │ │ │ │ ├── installation.md │ │ │ │ ├── overview.md │ │ │ │ └── quick-start.md │ │ │ ├── examples/ │ │ │ │ ├── simple.md │ │ │ │ └── stress-test.md │ │ │ └── index.js │ │ ├── siteConfig.js │ │ ├── styles/ │ │ │ ├── blog.module.css │ │ │ ├── index.css │ │ │ ├── post.module.css │ │ │ └── shared.module.css │ │ └── users.js │ └── tailwind.config.js ├── examples/ │ └── simple/ │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .prettierrc │ ├── .rescriptsrc.js │ ├── README.md │ ├── package.json │ ├── public/ │ │ ├── index.html │ │ └── manifest.json │ ├── report.20200723.110041.33247.0.001.json │ ├── report.20200813.175012.49872.0.001.json │ ├── report.20200818.145051.85738.0.001.json │ ├── src/ │ │ ├── ResizableBox.js │ │ ├── components/ │ │ │ ├── Area.tsx │ │ │ ├── Band.tsx │ │ │ ├── Bar.tsx │ │ │ ├── BarHorizontal.tsx │ │ │ ├── BarHorizontalStacked.tsx │ │ │ ├── BarStacked.tsx │ │ │ ├── Bubble.tsx │ │ │ ├── CustomStyles.tsx │ │ │ ├── DarkMode.tsx │ │ │ ├── DynamicContainer.tsx │ │ │ ├── InteractionMode.tsx │ │ │ ├── Line.tsx │ │ │ ├── MultipleAxes.tsx │ │ │ ├── SparkChart.tsx │ │ │ ├── Steam.tsx │ │ │ ├── StressTest.tsx │ │ │ └── SyncedCursors.tsx │ │ ├── index.tsx │ │ ├── react-app-env.d.ts │ │ ├── styles.css │ │ ├── useDemoConfig.tsx │ │ └── useLagRadar.js │ └── tsconfig.json ├── media/ │ └── logo.sketch ├── package.json ├── prettier.config.js ├── rollup.config.js ├── src/ │ ├── components/ │ │ ├── AxisLinear.tsx │ │ ├── AxisLinear.useMeasure.ts │ │ ├── Chart.tsx │ │ ├── Cursors.tsx │ │ ├── Tooltip.tsx │ │ ├── TooltipRenderer.tsx │ │ └── Voronoi.tsx │ ├── hooks/ │ │ ├── useAnchor.tsx │ │ ├── useChanged.ts │ │ ├── useGetLatest.ts │ │ ├── useIsScrolling.ts │ │ ├── useIsomorphicLayoutEffect.ts │ │ ├── useLatestWhen.ts │ │ ├── usePortalElement.ts │ │ ├── usePrevious.ts │ │ ├── useRect.ts │ │ └── useSpring.ts │ ├── index.ts │ ├── seriesTypes/ │ │ ├── Bar.tsx │ │ └── Line.tsx │ ├── types.ts │ └── utils/ │ ├── Utils.ts │ ├── buildAxis.linear.ts │ ├── chartContext.tsx │ ├── curveMonotone.ts │ └── spring.ts ├── test/ │ └── placeholder.test.tsx ├── tsconfig.json ├── tsconfig.types.json ├── typedoc.json └── typedocs/ ├── assets/ │ ├── css/ │ │ └── main.css │ └── js/ │ ├── main.js │ └── search.js ├── index.html └── modules.html ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc.js ================================================ const { NODE_ENV, BABEL_ENV } = process.env const cjs = NODE_ENV === 'test' || BABEL_ENV === 'commonjs' const loose = true module.exports = { presets: [ [ '@babel/env', { loose, modules: false, exclude: ['@babel/plugin-transform-regenerator'], }, ], '@babel/preset-typescript', '@babel/react', ], plugins: [ [ 'const-enum', { transform: 'constObject', }, ], 'babel-plugin-transform-async-to-promises', cjs && ['@babel/transform-modules-commonjs', { loose }], [ '@babel/transform-runtime', { useESModules: !cjs, version: require('./package.json').dependencies[ '@babel/runtime' ].replace(/^[^0-9]*/, ''), }, ], ].filter(Boolean), } ================================================ FILE: .eslintrc ================================================ { "parser": "@typescript-eslint/parser", "parserOptions": { "jsx": true, "useJSXTextNode": true }, "extends": [ // "plugin:@typescript-eslint/recommended", "prettier" ], "plugins": ["@typescript-eslint", "react-hooks"], "rules": { "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-explicit-any": "off", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn" } } ================================================ FILE: .github/FUNDING.yml ================================================ github: tannerlinsley ================================================ FILE: .github/workflows/publish.yml ================================================ name: react-charts tests on: push: branches: - 'main' - 'beta' pull_request: jobs: test: name: 'Node ${{ matrix.node }}' runs-on: ubuntu-latest strategy: matrix: node: [12, 14, 16] steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} - name: Install dependencies uses: bahmutov/npm-install@v1 - run: yarn test:ci publish-module: name: 'Publish Module to NPM' # needs: test # publish only when merged in master on original repo, not on PR if: github.repository == 'tanstack/react-charts' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: 14 registry-url: https://registry.npmjs.org/ - name: Install dependencies uses: bahmutov/npm-install@v1 - run: yarn build - run: npx semantic-release@17 env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} GH_TOKEN: ${{secrets.GH_TOKEN}} ================================================ FILE: .gitignore ================================================ # See https://help.github.com/ignore-files/ for more about ignoring files. # dependencies node_modules # builds types build dist lib es artifacts .rpt2_cache coverage *.tgz # misc .DS_Store .env .env.local .env.development.local .env.test.local .env.production.local .next npm-debug.log* yarn-debug.log* yarn-error.log* .history size-plugin.json stats-hydration.json stats-react.json stats.html .vscode/settings.json stats-react.json ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2021 Tanner Linsley 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. ================================================ FILE: README.md ================================================ ![React Charts Header](https://github.com/TanStack/react-charts/raw/main/media/repo-dark.png) # ⚠️ No Longer Maintained ⚠️ This project is no longer actively maintained. No further updates, bug fixes, or support will be provided. ---- Simple, immersive and interactive charts for React #TanStack

Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Table](https://github.com/tannerlinsley/react-table), [React Query](https://github.com/tannerlinsley/react-query), [React Form](https://github.com/tannerlinsley/react-form) ## Visit [react-charts.tanstack.com](https://react-charts.tanstack.com) for docs, guides, API and more! ## Quick Features - Line Charts - Bar Charts - Column Charts - Bubble Charts - Area Charts - Axis Stacking - Inverted Axes - Hyper Responsive - Invisibly Powered by D3 - Declarative - Mutliple Axes ### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/) # Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Tanner Linsley

💻 🤔 💡 🚧 👀
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! ================================================ FILE: docs/.gitignore ================================================ .next .now .env .env.* node_modules *.log .DS_Store .vercel ================================================ FILE: docs/README.md ================================================ # React Charts Docs This is source code to react-charts.tanstack.com. It is forked from the [Formik](https://formik.org) docs and is built with: - Next.js - MDX - Tailwind - Algolia - Notion ## Running locally ```sh yarn install ``` At the moment, you need to signup for Notion, and [follow these instructions](https://github.com/ijjk/notion-blog#getting-blog-index-and-token) to get a token and create a blog in order to develop locally. Not ideal, but hopefully will fix soon. With tokens and page index in hand, rename `.sample.env` and `.sample.env.build` to just `.env` and `.env.build`. In each one, add respective parameters: ```diff -NOTION_TOKEN=XXXX +NOTION_TOKEN= -BLOG_INDEX_ID=XXXXX +BLOG_INDEX_ID= ``` Now it will work. Run `yarn dev` to get going. If you get stuck or need help, [send a DM to Jared](https://twitter.com/jaredpalmer) on Twitter. ================================================ FILE: docs/jsconfig.json ================================================ { "compilerOptions": { "baseUrl": "./src" } } ================================================ FILE: docs/next.config.js ================================================ const path = require('path') const dotenvLoad = require('dotenv-load') const optimizedImages = require('next-optimized-images') dotenvLoad() const remarkPlugins = [ require('remark-slug'), [ require('remark-autolink-headings'), { behavior: 'append', linkProperties: { class: ['anchor'], title: 'Direct link to heading', }, }, ], require('remark-emoji'), require('remark-footnotes'), require('remark-images'), [ require('remark-github'), { repository: 'https://github.com/tannerlinsley/react-charts' }, ], require('remark-unwrap-images'), [ require('remark-toc'), { skip: 'Reference', maxDepth: 6, }, ], ] module.exports = optimizedImages({ pageExtensions: ['jsx', 'js', 'mdx', 'md'], env: { GA_TRACKING_ID: process.env.GA_TRACKING_ID || '', SENTRY_RELEASE: process.env.VERCEL_GITHUB_COMMIT_SHA || '', }, experimental: { plugins: true, modern: true, rewrites() { return [ { source: '/feed.xml', destination: '/_next/static/feed.xml', }, { source: '/docs{/}?', destination: '/docs/overview', }, { source: '/docs/tag/:tag{/}?', destination: '/docs/tag/:tag/overview', }, ] }, }, webpack: (config, { dev, isServer, ...options }) => { config.module.rules.push({ test: /.mdx?$/, // load both .md and .mdx files use: [ options.defaultLoaders.babel, { loader: '@mdx-js/loader', options: { remarkPlugins, }, }, path.join(__dirname, './src/lib/docs/md-loader'), ], }) // only compile build-rss in production server build if (dev || !isServer) { return config } // we're in build mode so enable shared caching for Notion data process.env.USE_CACHE = 'true' const originalEntry = config.entry config.entry = async () => { const entries = { ...(await originalEntry()), } // entries['./scripts/build-rss.js'] = './src/lib/build-rss.js' return entries } return config }, optimizeImages: { /* config for next-optimized-images */ mozjpeg: { quality: 70, }, optipng: { optimizationLevel: 3, }, optimizeImagesInDev: true, }, }) ================================================ FILE: docs/package.json ================================================ { "name": "fdocs3", "version": "1.0.0", "main": "index.js", "author": "Jared Palmer ", "license": "MIT", "scripts": { "dev": "next", "build": "next build", "start": "next start", "index-docs": "node ./.next/serverless/scripts/index-docs.js" }, "dependencies": { "@babel/preset-typescript": "^7.10.4", "@docsearch/react": "1.0.0-alpha.14", "@mdx-js/loader": "^1.5.1", "@mdx-js/mdx": "^1.5.1", "@mdx-js/react": "^1.5.1", "@mdx-js/tag": "^0.20.3", "@next/mdx": "^9.4.0", "@next/plugin-google-analytics": "^9.4.4", "@reactions/component": "^2.0.2", "@visx/responsive": "^1.10.1", "@zeit/fetch": "^6.0.0", "@zeit/react-jsx-parser": "^2.0.0", "async-sema": "^3.1.0", "body-scroll-lock": "^3.0.1", "classnames": "^2.2.6", "copy-to-clipboard": "^3.3.1", "date-fns": "^2.12.0", "docsearch.js": "^2.6.3", "framer-motion": "^1.11.1", "gray-matter": "^4.0.2", "imagemin-mozjpeg": "^9.0.0", "imagemin-optipng": "^8.0.0", "intersection-observer": "^0.10.0", "isomorphic-unfetch": "^3.0.0", "next": "^9.4.4", "next-images": "^1.4.0", "next-optimized-images": "^2.6.1", "node-fetch": "^2.6.0", "prismjs": "^1.20.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-icons": "^3.9.0", "react-live": "^2.2.2", "rehype-format": "^3.0.1", "rehype-stringify": "^7.0.0", "remark": "^12.0.0", "remark-autolink-headings": "^6.0.0", "remark-emoji": "^2.1.0", "remark-footnotes": "^1.0.0", "remark-github": "^9.0.0", "remark-images": "^2.0.0", "remark-slug": "^6.0.0", "remark-toc": "^7.0.0", "remark-unwrap-images": "^2.0.0", "scroll-into-view-if-needed": "^2.2.24", "semver-regex": "^3.1.1", "unist-util-visit": "^2.0.2" }, "devDependencies": { "@babel/cli": "^7.10.4", "@babel/core": "^7.10.4", "@babel/plugin-transform-typescript": "^7.10.4", "@babel/preset-react": "^7.10.4", "@tailwindcss/ui": "^0.3.0", "algoliasearch": "3.35.1", "babel-preset-react-app": "^9.1.2", "dotenv-load": "^2.0.0", "github-slugger": "^1.3.0", "md5": "^2.2.1", "mdast-util-to-string": "^1.1.0", "postcss-preset-env": "^6.7.0", "remark-parse": "^8.0.2", "tailwindcss": "^1.4.6", "unified": "^9.0.0", "webp-loader": "^0.6.0" }, "engines": { "node": ">=12.x" } } ================================================ FILE: docs/postcss.config.js ================================================ module.exports = { plugins: ['tailwindcss', 'postcss-preset-env'], }; ================================================ FILE: docs/public/robots.txt ================================================ User-agent: * Disallow: ================================================ FILE: docs/src/components/ArrowRight.js ================================================ import * as React from 'react'; export function ArrowRight({ fill = '#718096', width = 6, height = 10 }) { return ; } ================================================ FILE: docs/src/components/Banner.js ================================================ export function Banner() { return null; // return ( //
//
// formium //
// Hassle-free form storage for static sites → //
//
//
// ); } ================================================ FILE: docs/src/components/BytesForm.js ================================================ import React from 'react' import useBytesSubmit from './useBytesSubmit' export default function BytesForm() { const { state, handleSubmit, error } = useBytesSubmit() if (state === 'submitted') { return (

Success! Please, check your email to confirm your subscription.

) } return (
Bytes

No spam. Unsubscribe at any time.

{error &&

{error}

}
) } ================================================ FILE: docs/src/components/CarbonAds.js ================================================ import React from 'react' function buildScript(src, attrs = {}) { if (typeof document !== 'undefined') { const script = document.createElement('script') script.async = true script.defer = true Object.keys(attrs).forEach(attr => script.setAttribute(attr, attrs[attr])) script.src = src return script } } export default function CarbonAds() { const ref = React.useRef() React.useEffect(() => { const script = buildScript( '//cdn.carbonads.com/carbon.js?serve=CESITK7L&placement=react-chartstanstackcom', { type: 'text/javascript', id: '_carbonads_js', } ) ref.current.appendChild(script) }, []) React.useEffect(() => { const interval = setInterval(() => { ;[...ref.current.children].forEach(child => { if (child.id.startsWith('carbonads_')) { ref.current.removeChild(child) } }) }, 100) return () => { clearInterval(interval) } }) return
} ================================================ FILE: docs/src/components/CodeBlock.js ================================================ import React, { useState } from 'react'; import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live'; import { mdx } from '@mdx-js/react'; import { TWButton } from './TWButton'; import { useClipboard } from './useClipboard'; import Component from '@reactions/component'; export const liveEditorStyle = { fontSize: 14, overflowX: 'auto', color: '#f8f8f2', fontFamily: 'SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace', height: '100%', background: '#161e2e' }; export const liveErrorStyle = { fontFamily: 'SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace', fontSize: 12, padding: '1em', overflowX: 'auto', color: 'white', backgroundColor: 'red' }; const LiveCodePreview = props =>
; const EditableNotice = props => { return
Editable Example
; }; const CodeBlock = ({ className, live = false, noInline = false, collapsed = false, isManual, render, children, ...props }) => { const initialCode = React.useRef(children.trim()); const [editorCode, setEditorCode] = useState(children.trim()); const language = className && className.replace(/language-/, ''); const [hasCopied, onCopy] = useClipboard(editorCode); const [isCollapsed, setCollapse] = React.useState(collapsed); const liveProviderProps = { theme: { plain: {}, styles: [] }, language, code: editorCode, transformCode: code => `<>${code}`, scope: { mdx, Component }, noInline, ...props }; const handleCodeChange = newCode => setEditorCode(newCode ? newCode.trim() : ''); if (language === 'jsx' && live === true) { return
{isCollapsed ?
: <>
{hasCopied ? 'Copied' : 'Copy'} setEditorCode(initialCode.current)}> Reset
}
; } if (render) { return
; } return
{hasCopied ? 'Copied' : 'Copy'}
; }; CodeBlock.defaultProps = { mountStylesheet: false }; export default CodeBlock; ================================================ FILE: docs/src/components/Container.js ================================================ import * as React from 'react'; import cn from 'classnames'; export const Container = props => { return
; }; Container.displayName = 'Container'; ================================================ FILE: docs/src/components/DocsPageFooter.js ================================================ import * as React from 'react' import NextLink from 'next/link' import { removeFromLast } from '../lib/docs/utils' import { siteConfig } from 'siteConfig' import { FiThumbsDown, FiThumbsUp } from 'react-icons/fi' import { TWButton } from './TWButton' function areEqual(prevProps, props) { return prevProps.route?.path === props.route?.path } export const DocsPageFooter = React.memo(({ route, prevRoute, nextRoute }) => { const editUrl = `${siteConfig.editUrl}${route?.editUrl || route?.path}` return ( <>
{prevRoute && prevRoute.path ? ( ← Prev {prevRoute.title} ) : (
)} {nextRoute && nextRoute.path && ( Next → {nextRoute.title} )}
Was this page helpful?
}>Yes }>No
) }, areEqual) DocsPageFooter.displayName = 'DocsPageFooter' ================================================ FILE: docs/src/components/ExternalLink.js ================================================ import * as React from 'react'; export function ExternalLink(props) { return ; } ================================================ FILE: docs/src/components/Footer.js ================================================ import * as React from 'react' import Link from 'next/link' import CarbonAds from './CarbonAds' import BytesForm from './BytesForm' export const Footer = props => { return (

Subscribe to Bytes

The best JavaScript newsletter! Delivered every Monday to over 76,000 devs.

© 2020 Tanner Linsley. All rights reserved.

) } Footer.displayName = 'Footer' ================================================ FILE: docs/src/components/Highlight.js ================================================ import * as React from 'react'; import Highlight, { defaultProps } from 'prism-react-renderer'; import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live'; // Original: https://raw.githubusercontent.com/PrismJS/prism-themes/master/themes/prism-ghcolors.css /*:: import type { PrismTheme } from '../src/types' */ const theme /*: PrismTheme */ = { plain: { color: '#293742', borderRadius: 12, fontFamily: `SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace`, fontSize: 14, lineHeight: '1.5' }, styles: [{ types: ['comment', 'prolog', 'doctype', 'cdata'], style: { color: '#A7B6C2', fontStyle: 'italic' } }, { types: ['namespace'], style: { opacity: 0.7 } }, { types: ['string', 'attr-value'], style: { color: '#DB2C6F' } }, { types: ['punctuation', 'operator'], style: { color: '#394B59' } }, { types: ['entity', 'url', 'symbol', 'number', 'boolean', 'variable', 'constant', 'property', 'regex', 'inserted'], style: { color: '#36acaa' } }, { types: ['atrule', 'keyword', 'attr-name', 'selector'], style: { color: '#00B3A4' } }, { types: ['function', 'deleted', 'tag'], style: { color: '#DB2C6F' } }, { types: ['function-variable'], style: { color: '#634DBF' } }, { types: ['tag', 'selector', 'keyword'], style: { color: '#1a56db' } }] }; const Code = ({ children, codeString, className = 'language-js', ...props }) => { const language = className.replace(/language-/, ''); const [key, setKey] = React.useState(`${Math.random() * 7}`); if (props['live']) { return
Live JSX Editor
Live Preview
; } else { return {({ className, style, tokens, getLineProps, getTokenProps }) =>
            {tokens.map((line, i) => 
{tokens.length > 1 ? : }{' '} {line.map((token, key) => )}
)}
}
; } }; export default Code; ================================================ FILE: docs/src/components/Highlight2.js ================================================ import * as React from 'react'; import Highlight, { defaultProps } from 'prism-react-renderer'; // Original: https://raw.githubusercontent.com/PrismJS/prism-themes/master/themes/prism-ghcolors.css /*:: import type { PrismTheme } from '../src/types' */ const theme /*: PrismTheme */ = { plain: { color: '#293742', borderRadius: 12, fontFamily: `SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace`, fontSize: 14, lineHeight: '1.5' }, styles: [{ types: ['comment', 'prolog', 'doctype', 'cdata'], style: { color: '#A7B6C2', fontStyle: 'italic' } }, { types: ['namespace'], style: { opacity: 0.7 } }, { types: ['string', 'attr-value'], style: { color: '#DB2C6F' } }, { types: ['punctuation', 'operator'], style: { color: '#394B59' } }, { types: ['entity', 'url', 'symbol', 'number', 'boolean', 'variable', 'constant', 'property', 'regex', 'inserted'], style: { color: '#36acaa' } }, { types: ['atrule', 'keyword', 'attr-name', 'selector'], style: { color: '#00B3A4' } }, { types: ['function', 'deleted', 'tag'], style: { color: '#DB2C6F' } }, { types: ['function-variable'], style: { color: '#634DBF' } }, { types: ['tag', 'selector', 'keyword'], style: { color: '#1a56db' } }] }; const Code = ({ children, codeString, className = 'language-js', ...props }) => { const language = className.replace(/language-/, ''); return {({ className, style, tokens, getLineProps, getTokenProps }) =>
          {tokens.map((line, i) => 
{tokens.length > 1 ? : }{' '} {line.map((token, key) => )}
)}
}
; }; export default Code; ================================================ FILE: docs/src/components/LayoutDocs.js ================================================ import * as React from 'react' import { MDXProvider } from '@mdx-js/react' import { Nav } from 'components/Nav' import { Sidebar } from 'components/Sidebar' import { SidebarCategory } from 'components/SidebarCategory' import { SidebarHeading } from 'components/SidebarHeading' import { SidebarMobile } from 'components/SidebarMobile' import { SidebarPost } from 'components/SidebarPost' import { Sticky } from 'components/Sticky' import { useIsMobile } from 'components/useIsMobile' import { findRouteByPath } from 'lib/docs/findRouteByPath' import { removeFromLast } from 'lib/docs/utils' import { getRouteContext } from 'lib/get-route-context' import { useRouter } from 'next/router' import { Toc } from './Toc' import s from './markdown.module.css' import { Footer } from './Footer' import { DocsPageFooter } from './DocsPageFooter' import { Seo } from './Seo' import MDXComponents from './MDXComponents' import Head from 'next/head' import { getManifest } from 'manifests/getManifest' import BytesForm from './BytesForm' const getSlugAndTag = path => { const parts = path.split('/') if (parts[2] === '1.5.8' || parts[2] === '2.1.4') { return { tag: parts[2], slug: `/docs/${parts.slice(2).join('/')}`, } } return { slug: path, } } const addTagToSlug = (slug, tag) => { return tag ? `/docs/${tag}/${slug.replace('/docs/', '')}` : slug } export const LayoutDocs = props => { const router = useRouter() const { slug, tag } = getSlugAndTag(router.asPath) const { routes } = getManifest(tag) const _route = findRouteByPath(removeFromLast(slug, '#'), routes) // @ts-ignore const isMobile = useIsMobile() const { route, prevRoute, nextRoute } = getRouteContext(_route, routes) const title = route && `${route.title}` return ( <> {tag && ( )}
{isMobile ? ( <>