Repository: doczjs/docz Branch: main Commit: e0a53cb64fa8 Files: 672 Total size: 844.2 KB Directory structure: gitextract_540tlwt0/ ├── .all-contributorsrc ├── .circleci/ │ └── config.yml ├── .commitlintrc.json ├── .editorconfig ├── .eslintignore ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── ---bug-report.md │ │ ├── ---feature-request.md │ │ └── ---support-question.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── stale.yml ├── .gitignore ├── .huskyrc ├── .prettierignore ├── .prettierrc ├── .vscode/ │ ├── launch.json │ └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── MIGRATION_GUIDE.md ├── README.md ├── core/ │ ├── docz/ │ │ ├── .babelrc │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── bin/ │ │ │ └── index.js │ │ ├── package.json │ │ ├── rollup.config.js │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ ├── Link.tsx │ │ │ │ ├── Playground.tsx │ │ │ │ └── Props.tsx │ │ │ ├── hooks/ │ │ │ │ ├── index.ts │ │ │ │ ├── useComponentProps.ts │ │ │ │ ├── useComponents.tsx │ │ │ │ ├── useConfig.ts │ │ │ │ ├── useCurrentDoc.tsx │ │ │ │ ├── useDataServer.ts │ │ │ │ ├── useDocs.ts │ │ │ │ ├── useMenus.ts │ │ │ │ ├── usePrevious.ts │ │ │ │ └── useWindowSize.ts │ │ │ ├── index.ts │ │ │ ├── state.tsx │ │ │ ├── theme.tsx │ │ │ ├── types.d.ts │ │ │ └── utils/ │ │ │ ├── createState.tsx │ │ │ ├── helpers.ts │ │ │ └── humanize-prop.ts │ │ └── tsconfig.json │ ├── docz-core/ │ │ ├── .babelrc │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── __fixtures__/ │ │ │ ├── Alert/ │ │ │ │ ├── Alert.mdx │ │ │ │ └── Alert.tsx │ │ │ ├── Label.jsx │ │ │ └── Label.tsx │ │ ├── __tests__/ │ │ │ ├── config.test.ts │ │ │ ├── entries.test.ts │ │ │ ├── props.test.ts │ │ │ └── states.test.ts │ │ ├── bin/ │ │ │ └── index.js │ │ ├── nodemon.json │ │ ├── package.json │ │ ├── rollup.config.js │ │ ├── src/ │ │ │ ├── bundler/ │ │ │ │ ├── build.ts │ │ │ │ ├── index.ts │ │ │ │ ├── machine/ │ │ │ │ │ ├── actions.ts │ │ │ │ │ ├── context.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── services/ │ │ │ │ │ ├── create-resources.ts │ │ │ │ │ ├── ensure-dirs.ts │ │ │ │ │ ├── exec-dev-command.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── install-deps.ts │ │ │ │ │ └── watch-files.ts │ │ │ │ └── server.ts │ │ │ ├── cli.ts │ │ │ ├── commands/ │ │ │ │ ├── build.ts │ │ │ │ ├── dev.ts │ │ │ │ ├── index.ts │ │ │ │ ├── init.ts │ │ │ │ └── serve.ts │ │ │ ├── config/ │ │ │ │ ├── argv.ts │ │ │ │ ├── docz.ts │ │ │ │ ├── env.ts │ │ │ │ └── paths.ts │ │ │ ├── index.ts │ │ │ ├── lib/ │ │ │ │ ├── Bundler.ts │ │ │ │ ├── DataServer.ts │ │ │ │ ├── Entries.ts │ │ │ │ ├── Entry.ts │ │ │ │ └── Plugin.ts │ │ │ ├── states/ │ │ │ │ ├── config.ts │ │ │ │ ├── entries.ts │ │ │ │ ├── index.ts │ │ │ │ └── props.ts │ │ │ ├── test-utils/ │ │ │ │ ├── data-bank.ts │ │ │ │ └── index.ts │ │ │ ├── types.d.ts │ │ │ └── utils/ │ │ │ ├── docgen/ │ │ │ │ ├── docz-docgen-resolver.ts │ │ │ │ ├── externalProptypesHandler.ts │ │ │ │ ├── index.ts │ │ │ │ ├── javascript.ts │ │ │ │ └── typescript.ts │ │ │ ├── open-browser.ts │ │ │ ├── openChrome.applescript │ │ │ ├── p-reduce.ts │ │ │ ├── repo-info.ts │ │ │ ├── spawn.ts │ │ │ └── template.ts │ │ ├── templates/ │ │ │ ├── 404.tpl.js │ │ │ ├── gatsby-config.tpl.js │ │ │ ├── gatsby-node.tpl.js │ │ │ ├── imports.tpl.js │ │ │ ├── index.tpl.html │ │ │ ├── index.tpl.js │ │ │ └── root.tpl.js │ │ └── tsconfig.json │ ├── docz-rollup/ │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── index.js │ │ └── plugins/ │ │ ├── clean.js │ │ ├── copy.js │ │ └── size.js │ ├── docz-utils/ │ │ ├── .babelrc │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── __tests__/ │ │ │ └── jsx.test.ts │ │ ├── package.json │ │ ├── rollup.config.js │ │ ├── src/ │ │ │ ├── ast.ts │ │ │ ├── exports.ts │ │ │ ├── format.ts │ │ │ ├── fs.ts │ │ │ ├── imports.ts │ │ │ ├── index.ts │ │ │ ├── jsx.ts │ │ │ ├── mdast.ts │ │ │ └── types.d.ts │ │ └── tsconfig.json │ ├── gatsby-theme-docz/ │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── gatsby-browser.js │ │ ├── gatsby-config.js │ │ ├── gatsby-node.js │ │ ├── gatsby-ssr.js │ │ ├── index.js │ │ ├── lib/ │ │ │ ├── createPagesStatefully.js │ │ │ ├── onCreateBabelConfig.js │ │ │ ├── onCreateDevServer.js │ │ │ ├── onCreateWebpackConfig.js │ │ │ ├── onPostBuild.js │ │ │ ├── onPreBuild.js │ │ │ ├── sourceNodes.js │ │ │ └── utils/ │ │ │ └── parseConfig.js │ │ ├── package.json │ │ └── src/ │ │ ├── base/ │ │ │ ├── Layout.js │ │ │ └── Seo.js │ │ ├── components/ │ │ │ ├── Code/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Header/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Headings/ │ │ │ │ └── index.js │ │ │ ├── Icons/ │ │ │ │ └── index.js │ │ │ ├── Layout/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Logo/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── MainContainer/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── NavGroup/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── NavLink/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── NavSearch/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Playground/ │ │ │ │ ├── Wrapper.js │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Pre/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Props/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ ├── Sidebar/ │ │ │ │ ├── index.js │ │ │ │ └── styles.js │ │ │ └── index.js │ │ ├── hooks/ │ │ │ └── useDbQuery.js │ │ ├── index.css │ │ ├── index.js │ │ ├── theme/ │ │ │ ├── breakpoints.js │ │ │ ├── colors.js │ │ │ ├── global.js │ │ │ ├── index.js │ │ │ ├── modes.js │ │ │ ├── prism/ │ │ │ │ ├── dark.js │ │ │ │ ├── index.js │ │ │ │ └── light.js │ │ │ └── styles.js │ │ ├── utils/ │ │ │ ├── mixins.js │ │ │ └── theme.js │ │ └── wrapper.js │ ├── rehype-docz/ │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── jest.config.js │ │ ├── package.json │ │ ├── rollup.config.js │ │ ├── src/ │ │ │ ├── __snapshots__/ │ │ │ │ └── index.test.ts.snap │ │ │ ├── index.test.ts │ │ │ ├── index.ts │ │ │ └── types.d.ts │ │ └── tsconfig.json │ └── remark-docz/ │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .lintstagedrc │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── rollup.config.js │ ├── src/ │ │ ├── __snapshots__/ │ │ │ └── index.test.ts.snap │ │ ├── index.test.ts │ │ ├── index.ts │ │ └── types.d.ts │ └── tsconfig.json ├── dev-env/ │ └── basic/ │ ├── .eslintrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── doczrc.js │ ├── package.json │ └── src/ │ ├── components/ │ │ ├── Alert.jsx │ │ └── Alert.mdx │ └── index.mdx ├── examples/ │ ├── .eslintrc │ ├── basic/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── create-react-app/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── index.css │ │ ├── index.js │ │ ├── index.mdx │ │ └── serviceWorker.js │ ├── create-react-app-ts/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ ├── src/ │ │ │ ├── App.css │ │ │ ├── App.test.tsx │ │ │ ├── App.tsx │ │ │ ├── components/ │ │ │ │ ├── Alert.jsx │ │ │ │ └── Alert.mdx │ │ │ ├── index.css │ │ │ ├── index.mdx │ │ │ ├── index.tsx │ │ │ ├── react-app-env.d.ts │ │ │ ├── serviceWorker.ts │ │ │ └── setupTests.ts │ │ └── tsconfig.json │ ├── custom-base-path/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── custom-config-location/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── doczrc.js │ │ └── index.mdx │ ├── flow/ │ │ ├── .babelrc │ │ ├── .flowconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── gatsby-node.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ ├── Button.jsx │ │ │ └── Button.mdx │ │ └── index.mdx │ ├── gatsby/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ ├── Button.jsx │ │ │ └── Button.mdx │ │ └── pages/ │ │ ├── 404.js │ │ └── index.mdx │ ├── images/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── index.jsx │ │ └── index.mdx │ ├── less/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.less │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── logo-in-sidebar/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── components/ │ │ │ ├── Header/ │ │ │ │ └── index.js │ │ │ └── Sidebar/ │ │ │ └── index.js │ │ └── index.mdx │ ├── material-ui/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── home.mdx │ │ └── package.json │ ├── monorepo/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── lerna.json │ │ ├── package.json │ │ └── packages/ │ │ └── basic/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── monorepo-package/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── lerna.json │ │ ├── package.json │ │ └── packages/ │ │ └── basic/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── monorepo-separate-docs/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── lerna.json │ │ ├── package.json │ │ └── packages/ │ │ ├── alert/ │ │ │ ├── README.md │ │ │ ├── example/ │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── alert-ts/ │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── example/ │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.tsx │ │ │ └── tsconfig.json │ │ └── docs/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ └── Alert.mdx │ │ │ └── index.mdx │ │ └── tsconfig.json │ ├── now/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── now.json │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ ├── Button.jsx │ │ │ └── Button.mdx │ │ └── index.mdx │ ├── react-native/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-node.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── react-router/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── wrapper.js │ │ └── index.mdx │ ├── sass/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ └── Alert.scss │ │ └── index.mdx │ ├── shadowed-playground/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── components/ │ │ │ └── Playground/ │ │ │ └── index.js │ │ └── index.mdx │ ├── styled-components/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ ├── Button.jsx │ │ │ └── Button.mdx │ │ └── index.mdx │ ├── stylus/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ └── Alert.styl │ │ └── index.mdx │ ├── typescript/ │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ ├── Alert.mdx │ │ │ │ ├── Alert.tsx │ │ │ │ ├── Button.mdx │ │ │ │ └── Button.tsx │ │ │ └── index.mdx │ │ └── tsconfig.json │ ├── webpack-alias/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-node.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── with-algolia-search/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── gatsby-config.js │ │ ├── package.json │ │ └── src/ │ │ ├── docs/ │ │ │ ├── customizing/ │ │ │ │ ├── add-favicon-and-metadata.mdx │ │ │ │ ├── component-shadowing.mdx │ │ │ │ ├── creating-your-themes.mdx │ │ │ │ ├── customizing-webpack-config.mdx │ │ │ │ ├── gatsby-theme.mdx │ │ │ │ └── powered-by-gatsby.mdx │ │ │ ├── general/ │ │ │ │ ├── built-in-components.mdx │ │ │ │ ├── deploying-your-docs.mdx │ │ │ │ ├── document-settings.mdx │ │ │ │ ├── getting-started.mdx │ │ │ │ ├── introduction.mdx │ │ │ │ ├── usage-in-monorepo.mdx │ │ │ │ ├── usage-with-css-preprocessors.mdx │ │ │ │ ├── usage-with-typescript.mdx │ │ │ │ └── writing-mdx.mdx │ │ │ └── references/ │ │ │ ├── components-api.mdx │ │ │ ├── creating-plugins.mdx │ │ │ ├── mdx-plugins.mdx │ │ │ ├── migration-guide.mdx │ │ │ └── project-configuration.mdx │ │ └── gatsby-theme-docz/ │ │ ├── components/ │ │ │ └── Header/ │ │ │ ├── Search/ │ │ │ │ ├── Input.js │ │ │ │ ├── hitComps.js │ │ │ │ ├── index.js │ │ │ │ └── primitives.js │ │ │ └── index.js │ │ └── wrapper.js │ ├── with-custom-404-page/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── index.mdx │ │ └── pages/ │ │ └── 404.js │ ├── with-custom-docz-theme/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── gatsby-theme-docz-pink/ │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── gatsby-theme-docz/ │ │ │ └── wrapper.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── with-custom-links/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── gatsby-theme-docz/ │ │ │ └── components/ │ │ │ └── index.js │ │ └── index.mdx │ ├── with-decorators/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-node.js │ │ ├── jsconfig.json │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── index.js │ │ └── index.mdx │ ├── with-env-variables/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-config.js │ │ ├── gatsby-node.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ └── index.mdx │ ├── with-favicon-and-metadata/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── wrapper.js │ │ └── index.mdx │ ├── with-gatsby-remark-vscode/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ └── Alert.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── components/ │ │ │ └── index.js │ │ └── index.mdx │ ├── with-styled-components-and-scoping/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ └── src/ │ │ ├── components/ │ │ │ ├── Alert.jsx │ │ │ ├── Alert.mdx │ │ │ ├── Button.jsx │ │ │ └── Button.mdx │ │ ├── gatsby-theme-docz/ │ │ │ └── components/ │ │ │ └── Playground/ │ │ │ └── IframeWrapper.js │ │ └── index.mdx │ ├── with-themes-dir/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── package.json │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ ├── Alert.jsx │ │ │ │ └── Alert.mdx │ │ │ └── index.mdx │ │ └── theme/ │ │ └── gatsby-theme-docz/ │ │ └── components/ │ │ └── Logo/ │ │ ├── index.js │ │ └── styles.js │ ├── with-typescript-decorators/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── doczrc.js │ │ ├── gatsby-node.js │ │ ├── package.json │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ ├── Alert.mdx │ │ │ │ ├── Alert.tsx │ │ │ │ ├── Button.mdx │ │ │ │ └── Button.tsx │ │ │ ├── index.mdx │ │ │ └── index.ts │ │ └── tsconfig.json │ └── wrapped-playground/ │ ├── .gitignore │ ├── README.md │ ├── doczrc.js │ ├── package.json │ └── src/ │ ├── Playground.jsx │ ├── components/ │ │ ├── Alert.jsx │ │ └── Alert.mdx │ └── index.mdx ├── lerna.json ├── other-packages/ │ ├── babel-plugin-export-metadata/ │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── jest.config.js │ │ ├── package.json │ │ ├── src/ │ │ │ └── index.js │ │ └── tests/ │ │ ├── __snapshots__/ │ │ │ └── index.test.js.snap │ │ ├── fixtures/ │ │ │ ├── assets/ │ │ │ │ └── a.js │ │ │ ├── export-default/ │ │ │ │ ├── with-arr-expression.js │ │ │ │ ├── with-call-expression.js │ │ │ │ ├── with-class-declaration.js │ │ │ │ ├── with-func-declaration.js │ │ │ │ ├── with-identifier.js │ │ │ │ └── with-obj-expression.js │ │ │ ├── export-named/ │ │ │ │ └── index.js │ │ │ └── re-export/ │ │ │ ├── re-export-default.js │ │ │ ├── re-export-multi.js │ │ │ ├── re-export-rename1.js │ │ │ ├── re-export-rename2.js │ │ │ ├── re-export-rename3.js │ │ │ └── re-export.js │ │ └── index.test.js │ ├── e2e-tests/ │ │ ├── .testcaferc.json │ │ ├── CHANGELOG.md │ │ ├── __tests__/ │ │ │ └── test.ts │ │ ├── helpers.js │ │ ├── index.js │ │ ├── package.json │ │ ├── testing-library.js │ │ └── verdaccio.yaml │ ├── eslint-config-docz-js/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── index.js │ │ └── package.json │ ├── eslint-config-docz-ts/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── index.js │ │ └── package.json │ ├── load-cfg/ │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .lintstagedrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── rollup.config.js │ │ ├── src/ │ │ │ ├── index.ts │ │ │ └── types.d.ts │ │ └── tsconfig.json │ └── react-docgen-actual-name-handler/ │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .lintstagedrc │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── src/ │ │ ├── index.ts │ │ └── types.d.ts │ └── tsconfig.json ├── package.json └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .all-contributorsrc ================================================ { "projectName": "docz", "projectOwner": "pedronauck", "repoType": "github", "repoHost": "https://github.com", "badgeTemplate": "", "files": ["README.md", "CONTRIBUTING.md"], "imageSize": 60, "commit": true, "contributors": [ { "login": "pedronauck", "name": "Pedro Nauck", "avatar_url": "https://avatars3.githubusercontent.com/u/2029172?v=4", "profile": "https://github.com/pedronauck", "contributions": ["code", "doc", "bug", "review"] } ] } ================================================ FILE: .circleci/config.yml ================================================ # Javascript Node CircleCI 2.0 configuration file # # Check https://circleci.com/docs/2.0/language-javascript/ for more details # version: 2 jobs: build: docker: - image: circleci/node:latest # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/mongo:3.4.4 working_directory: ~/repo steps: - checkout # Download and cache dependencies - restore_cache: keys: - v6-dependencies-{{ checksum "package.json" }} # fallback to using the latest cache if no exact match is found - v6-dependencies- - run: yarn install - save_cache: paths: - node_modules key: v5-dependencies-{{ checksum "package.json" }} - run: yarn bs # build, lint and test - run: yarn packages - run: sudo apt-get install -y lsof # - run: cd other-packages/e2e-tests && node index.js || true - store_test_results: path: /tmp/test-result ================================================ FILE: .commitlintrc.json ================================================ { "extends": [ "@commitlint/config-conventional", "@commitlint/config-lerna-scopes" ] } ================================================ FILE: .editorconfig ================================================ root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true ================================================ FILE: .eslintignore ================================================ dist node_modules ================================================ FILE: .github/FUNDING.yml ================================================ # These are supported funding model platforms github: pedronauck patreon: pedronauck open_collective: pedronauck ================================================ FILE: .github/ISSUE_TEMPLATE/---bug-report.md ================================================ --- name: "\U0001F41B Bug report" about: "Something is broken? \U0001F528" --- ## Bug Report **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Please try to build a small repo with a repro of your problem and provide a link to it. Doing that allows more people to quickly help you. If you can't provide a repo then provide clear steps describing how to reproduce the issue. 1. create-docz-app my-docz-app && cd my-docz-app 2. Change src/index.mdx to ```mdx ### Some mdx content ``` 4. Run npm run docz dev 5. See error in browser ```shell FOR BUGS: Insert debug trace ``` **Expected behavior** A clear and concise description of what you expected to happen.. **Environment** - docz version: [e.g. 2.0.0-rc.x or 1.3.2] - OS: [e.g. OSX 10.13.4, Windows 10] - Node/npm version: [e.g. Node 8/npm 5] **Additional context/Screenshots** Add any other context about the problem here. If applicable, add screenshots to help explain. ================================================ FILE: .github/ISSUE_TEMPLATE/---feature-request.md ================================================ --- name: "\U0001F680 Feature Request" about: "I have a suggestion (and may want to implement it \U0001F642)!" --- 👆👆👆 CLICK ON PREVIEW, PLEASE! 👆👆👆 --- ## Awesome, do you have an idea? 😍 Please, if you have any **feature request, improvement or idea** to give us, check it [our official roadmap](http://feedback.docz.site/roadmap) to see if this is already being planned or not! ### 👉   [Go to Roadmap](http://feedback.docz.site/roadmap) If your feature request isn't there, post it here on Github, we will discuss a lot about it and then maybe became official on our roadmap 🤟 ================================================ FILE: .github/ISSUE_TEMPLATE/---support-question.md ================================================ --- name: "\U0001F917 Support Question" about: "I have a question \U0001F4AC" --- ## Question **Description** *Give more information about your doubt* * Twitter: If it's just a quick question you can ping me on Twitter: https://twitter.com/pedronauck ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ ### Description Add here a description about your Pull Request ### Review - [ ] Check the copy - [ ] ... - [ ] ... ### Pre-merge checklist - [ ] ... - [ ] ... ### Screenshots | Before | After | | ------ | ----- | | Image | Image | ================================================ FILE: .github/stale.yml ================================================ # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - pinned - security # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false ================================================ FILE: .gitignore ================================================ logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pids *.pid *.seed *.pid.lock lib-cov coverage .nyc_output .grunt bower_components .lock-wscript build/Release node_modules/ jspm_packages/ typings/ .npm .npmrc .eslintcache .node_repl_history *.tgz .yarn-integrity .env es core/docz-utils/lib stats.html build dist .rpt2_cache .cache .docz .idea storage .e2e-tests-cache examples/**/yarn.lock ================================================ FILE: .huskyrc ================================================ { "hooks": { "pre-commit": "lerna run precommit --parallel", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } ================================================ FILE: .prettierignore ================================================ **/*.mdx MIGRATION_GUIDE.md ================================================ FILE: .prettierrc ================================================ { "requirePragma": false, "printWidth": 80, "tabWidth": 2, "useTabs": false, "semi": false, "singleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "jsxBracketSameLine": false } ================================================ FILE: .vscode/launch.json ================================================ { "version": "0.2.0", "configurations": [ { "name": "Docz dev", "type": "node", "request": "launch", "protocol": "inspector", "program": "${workspaceRoot}/node_modules/docz/bin/index.js", "cwd": "${workspaceFolder}/examples/basic", "args": ["dev"], "runtimeArgs": ["--debug"], "stopOnEntry": false, "sourceMaps": false }, { "name": "Docz build", "type": "node", "request": "launch", "protocol": "inspector", "program": "${workspaceRoot}/node_modules/docz/bin/index.js", "cwd": "${workspaceFolder}/examples/basic", "args": ["build"], "stopOnEntry": false, "sourceMaps": false }, { "name": "Gatsby develop", "type": "node", "request": "launch", "protocol": "inspector", "program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby", "cwd": "${workspaceFolder}/examples/gatsby", "args": ["develop"], "stopOnEntry": false, "runtimeArgs": ["--nolazy"], "sourceMaps": false }, { "name": "Gatsby build", "type": "node", "request": "launch", "protocol": "inspector", "program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby", "cwd": "${workspaceFolder}/examples/gatsby", "args": ["build"], "stopOnEntry": false, "runtimeArgs": ["--nolazy"], "sourceMaps": false } ] } ================================================ FILE: .vscode/settings.json ================================================ { "typescript.tsdk": "node_modules/typescript/lib", "javascript.format.enable": false, "eslint.validate": [ "javascript", "javascriptreact", "typescript", "typescriptreact" ], "editor.codeActionsOnSave": { "source.fixAll.eslint": true } } ================================================ FILE: CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **babel-plugin-export-metadata:** fix `hasOwnProperty` method call ([#1581](https://github.com/doczjs/docz/issues/1581)) ([9067ffb](https://github.com/doczjs/docz/commit/9067ffb)) * **dev-env/basic:** building and running development ([#1646](https://github.com/doczjs/docz/issues/1646)) ([7baaaf2](https://github.com/doczjs/docz/commit/7baaaf2)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * **docz-utils:** fix closing tag detection in `removeTags` ([#1696](https://github.com/doczjs/docz/issues/1696)) ([bfcd923](https://github.com/doczjs/docz/commit/bfcd923)) * **examples:** import alert component by correct lib name. ([#1605](https://github.com/doczjs/docz/issues/1605)) ([fadb6dd](https://github.com/doczjs/docz/commit/fadb6dd)) * **gatsby-theme-docz:** wrong imports ([ed169cf](https://github.com/doczjs/docz/commit/ed169cf)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) ### Features * add gatsby https flag to use in dev mode ([#1569](https://github.com/doczjs/docz/issues/1569)) ([9d91503](https://github.com/doczjs/docz/commit/9d91503)) * **docz-core:** add modifyEntry plugin supported ([#1621](https://github.com/doczjs/docz/issues/1621)) ([317987e](https://github.com/doczjs/docz/commit/317987e)) * **gatsby-theme-docz:** configure SEO information from md/mdx files ([#1477](https://github.com/doczjs/docz/issues/1477)) ([24bb600](https://github.com/doczjs/docz/commit/24bb600)) * **gatsby-theme-docz:** no reload on relative links ([#1482](https://github.com/doczjs/docz/issues/1482)) ([ff7211c](https://github.com/doczjs/docz/commit/ff7211c)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **babel-plugin-export-metadata:** fix `hasOwnProperty` method call ([#1581](https://github.com/doczjs/docz/issues/1581)) ([9067ffb](https://github.com/doczjs/docz/commit/9067ffb)) * **dev-env/basic:** building and running development ([#1646](https://github.com/doczjs/docz/issues/1646)) ([7baaaf2](https://github.com/doczjs/docz/commit/7baaaf2)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * **examples:** import alert component by correct lib name. ([#1605](https://github.com/doczjs/docz/issues/1605)) ([fadb6dd](https://github.com/doczjs/docz/commit/fadb6dd)) * **gatsby-theme-docz:** wrong imports ([ed169cf](https://github.com/doczjs/docz/commit/ed169cf)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) ### Features * add gatsby https flag to use in dev mode ([#1569](https://github.com/doczjs/docz/issues/1569)) ([9d91503](https://github.com/doczjs/docz/commit/9d91503)) * **docz-core:** add modifyEntry plugin supported ([#1621](https://github.com/doczjs/docz/issues/1621)) ([317987e](https://github.com/doczjs/docz/commit/317987e)) * **gatsby-theme-docz:** configure SEO information from md/mdx files ([#1477](https://github.com/doczjs/docz/issues/1477)) ([24bb600](https://github.com/doczjs/docz/commit/24bb600)) * **gatsby-theme-docz:** no reload on relative links ([#1482](https://github.com/doczjs/docz/issues/1482)) ([ff7211c](https://github.com/doczjs/docz/commit/ff7211c)) ## [2.3.2-alpha.0](https://github.com/doczjs/docz/compare/v2.3.1...v2.3.2-alpha.0) (2020-04-07) ### Bug Fixes * **docz-core:** use user-provided 404 page when it exists ([05417d3](https://github.com/doczjs/docz/commit/05417d3)) ## [2.3.1](https://github.com/doczjs/docz/compare/v2.3.1-alpha.0...v2.3.1) (2020-04-05) **Note:** Version bump only for package docz ## [2.3.1-alpha.0](https://github.com/doczjs/docz/compare/v2.3.0...v2.3.1-alpha.0) (2020-04-05) ### Bug Fixes * **gatsby-theme-docz:** fix theme components customization bug ([a9384b0](https://github.com/doczjs/docz/commit/a9384b0)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package docz # [2.3.0-alpha.14](https://github.com/doczjs/docz/compare/v2.3.0-alpha.13...v2.3.0-alpha.14) (2020-03-31) ### Bug Fixes * **babel-plugin-export-metadata:** add case for export default… ([#1417](https://github.com/doczjs/docz/issues/1417)) ([31ebd08](https://github.com/doczjs/docz/commit/31ebd08)) * **docz-core:** always use custom prop filter if it's provided… ([#1415](https://github.com/doczjs/docz/issues/1415)) ([53063ff](https://github.com/doczjs/docz/commit/53063ff)) * **gatsby-theme-docz:** add pre-wrap to error ([#1406](https://github.com/doczjs/docz/issues/1406)) ([ca6b02d](https://github.com/doczjs/docz/commit/ca6b02d)) * **gatsby-theme-docz:** content overflowing issue ([#1437](https://github.com/doczjs/docz/issues/1437)) ([56f4cb8](https://github.com/doczjs/docz/commit/56f4cb8)) ### Features * **docz:** bump babel-preset-react-app to 9.1.2 ([#1435](https://github.com/doczjs/docz/issues/1435)) ([8f071eb](https://github.com/doczjs/docz/commit/8f071eb)) * **gatsby-theme-docz:** include MDX transclusion support ([#1436](https://github.com/doczjs/docz/issues/1436)) ([435001a](https://github.com/doczjs/docz/commit/435001a)) # [2.3.0-alpha.13](https://github.com/doczjs/docz/compare/v2.3.0-alpha.12...v2.3.0-alpha.13) (2020-02-13) ### Bug Fixes * **docz:** pass useScoping to theme Playground ([6ec7315](https://github.com/doczjs/docz/commit/6ec7315)), closes [#1390](https://github.com/doczjs/docz/issues/1390) * **gatsby-theme-docz:** flex component aligmItems -> alignItems ([#1391](https://github.com/doczjs/docz/issues/1391)) ([b80524f](https://github.com/doczjs/docz/commit/b80524f)) # [2.3.0-alpha.12](https://github.com/doczjs/docz/compare/v2.3.0-alpha.11...v2.3.0-alpha.12) (2020-02-12) ### Bug Fixes * **docz-core:** pass down host when running serve ([#1384](https://github.com/doczjs/docz/issues/1384)) ([80a0e1e](https://github.com/doczjs/docz/commit/80a0e1e)) * **gatsby-theme-docz:** use sx instead of style prop in Playgro… ([#1389](https://github.com/doczjs/docz/issues/1389)) ([98f3311](https://github.com/doczjs/docz/commit/98f3311)) # [2.3.0-alpha.11](https://github.com/doczjs/docz/compare/v2.3.0-alpha.10...v2.3.0-alpha.11) (2020-02-07) ### Bug Fixes * **docz-core:** be explicit about cli args ([6f5b4ee](https://github.com/doczjs/docz/commit/6f5b4ee)) ### Features * **docz-core:** pass down cli args to Gatsby + fix open flag ([385b006](https://github.com/doczjs/docz/commit/385b006)) * **gatsby-theme-docz:** create MainContainer component ([#1381](https://github.com/doczjs/docz/issues/1381)) ([e8d1c04](https://github.com/doczjs/docz/commit/e8d1c04)) # [2.3.0-alpha.10](https://github.com/doczjs/docz/compare/v2.3.0-alpha.9...v2.3.0-alpha.10) (2020-02-06) ### Bug Fixes * **docz-core:** parse port when running serve ([29d0edd](https://github.com/doczjs/docz/commit/29d0edd)) # [2.3.0-alpha.9](https://github.com/doczjs/docz/compare/v2.3.0-alpha.8...v2.3.0-alpha.9) (2020-02-06) ### Bug Fixes * **docz:** fix capitalization of ts interfaces ([9e950eb](https://github.com/doczjs/docz/commit/9e950eb)) # [2.3.0-alpha.8](https://github.com/doczjs/docz/compare/v2.3.0-alpha.7...v2.3.0-alpha.8) (2020-02-06) **Note:** Version bump only for package docz # [2.3.0-alpha.7](https://github.com/doczjs/docz/compare/v2.3.0-alpha.6...v2.3.0-alpha.7) (2020-02-04) ### Bug Fixes * **gatsby-theme-docz:** removed unused gatsby-plugin-manifest ([#1368](https://github.com/doczjs/docz/issues/1368)) ([44edc68](https://github.com/doczjs/docz/commit/44edc68)) * warning in Alert component ([#1353](https://github.com/doczjs/docz/issues/1353)) ([8ee156d](https://github.com/doczjs/docz/commit/8ee156d)) * **gatsby-theme-docz:** fix playground react-resize-detector usage ([#1350](https://github.com/doczjs/docz/issues/1350)) ([f0baf67](https://github.com/doczjs/docz/commit/f0baf67)) ### Features * add hook to find docgen props ([#1371](https://github.com/doczjs/docz/issues/1371)) ([8fffa26](https://github.com/doczjs/docz/commit/8fffa26)) * add the ability to hide a document from the menu ([#1354](https://github.com/doczjs/docz/issues/1354)) ([95b0d7f](https://github.com/doczjs/docz/commit/95b0d7f)) # [2.3.0-alpha.6](https://github.com/doczjs/docz/compare/v2.3.0-alpha.5...v2.3.0-alpha.6) (2020-01-02) ### Bug Fixes * **docz-core:** prevent falsy error code on cli ([#1332](https://github.com/doczjs/docz/issues/1332)) ([1437b59](https://github.com/doczjs/docz/commit/1437b59)) * **docz-core:** revert ts auto-detect ([f0ce584](https://github.com/doczjs/docz/commit/f0ce584)) # [2.3.0-alpha.5](https://github.com/doczjs/docz/compare/v2.3.0-alpha.4...v2.3.0-alpha.5) (2019-12-17) ### Bug Fixes * **gatsby-theme-docz:** src -> gatsbyRoot for file system source ([71dd572](https://github.com/doczjs/docz/commit/71dd572)) ### Features * **docz-core:** introduce gatsbyRoot to use for fs sourcing ([8e89d64](https://github.com/doczjs/docz/commit/8e89d64)) # [2.3.0-alpha.4](https://github.com/doczjs/docz/compare/v2.3.0-alpha.3...v2.3.0-alpha.4) (2019-12-16) ### Bug Fixes * **gatsby-theme-docz:** make Props isToggle work again ([#1326](https://github.com/doczjs/docz/issues/1326)) ([4921ef5](https://github.com/doczjs/docz/commit/4921ef5)) * update dev-env dependencies ([e1b185f](https://github.com/doczjs/docz/commit/e1b185f)) # [2.3.0-alpha.3](https://github.com/doczjs/docz/compare/v2.3.0-alpha.2...v2.3.0-alpha.3) (2019-12-16) ### Bug Fixes * **gatsby-theme-docz:** fix preview padding ([ebebd1c](https://github.com/doczjs/docz/commit/ebebd1c)), closes [#1325](https://github.com/doczjs/docz/issues/1325) # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) ### Bug Fixes * **docz-core:** forward cli status code properly ([#1319](https://github.com/doczjs/docz/issues/1319)) ([99ebf82](https://github.com/doczjs/docz/commit/99ebf82)) ### Features * **docz-core:** allow custom pattern for globbing components with docgenConfig.searchPatterns ([#1316](https://github.com/doczjs/docz/issues/1316)) ([29e0165](https://github.com/doczjs/docz/commit/29e0165)) * **docz-core:** support kebab & pascal case component file name pattern ([#1314](https://github.com/doczjs/docz/issues/1314)) ([9d5b129](https://github.com/doczjs/docz/commit/9d5b129)) * **docz-utils:** add exports parser to add to Playground scope ([9c564d0](https://github.com/doczjs/docz/commit/9c564d0)), closes [#1247](https://github.com/doczjs/docz/issues/1247) * **rehype-docz:** add mdx exports to Playground scope ([d902e2a](https://github.com/doczjs/docz/commit/d902e2a)), closes [#1247](https://github.com/doczjs/docz/issues/1247) # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) ### Bug Fixes * **docz-core:** properly support node_modules for multiple file patterns ([#1315](https://github.com/doczjs/docz/issues/1315)) ([4d9f9b3](https://github.com/doczjs/docz/commit/4d9f9b3)) * **docz-core:** use docz-utils for get and mergeWith ([f222083](https://github.com/doczjs/docz/commit/f222083)) ### Features * **docz-utils:** export mergeWith and get from lodash@4 ([53fbde0](https://github.com/doczjs/docz/commit/53fbde0)), closes [#1313](https://github.com/doczjs/docz/issues/1313) # [2.3.0-alpha.0](https://github.com/doczjs/docz/compare/v2.2.1-alpha.1...v2.3.0-alpha.0) (2019-12-12) ### Features * **docz-core:** detect typescript without config ([bbaecb2](https://github.com/doczjs/docz/commit/bbaecb2)) ## [2.2.1-alpha.1](https://github.com/doczjs/docz/compare/v2.2.1-alpha.0...v2.2.1-alpha.1) (2019-12-12) ### Bug Fixes * **docz-core:** add native styled-components support ([b072f78](https://github.com/doczjs/docz/commit/b072f78)) ## [2.2.1-alpha.0](https://github.com/doczjs/docz/compare/v2.2.0...v2.2.1-alpha.0) (2019-12-11) ### Bug Fixes * **gatsby-theme-docz:** fix mdx components theming from config ([3a9bdb7](https://github.com/doczjs/docz/commit/3a9bdb7)), closes [#1309](https://github.com/doczjs/docz/issues/1309) # [2.2.0](https://github.com/doczjs/docz/compare/v2.2.0-alpha.8...v2.2.0) (2019-12-11) **Note:** Version bump only for package docz # [2.2.0-alpha.8](https://github.com/doczjs/docz/compare/v2.2.0-alpha.7...v2.2.0-alpha.8) (2019-12-06) ### Features * **gatsby-theme-docz:** add optional iframe for preview and ed… ([#1305](https://github.com/doczjs/docz/issues/1305)) ([9c5082e](https://github.com/doczjs/docz/commit/9c5082e)), closes [#1306](https://github.com/doczjs/docz/issues/1306) # [2.2.0-alpha.7](https://github.com/doczjs/docz/compare/v2.2.0-alpha.6...v2.2.0-alpha.7) (2019-12-03) ### Bug Fixes * **gatsby-theme-docz:** fix infinite renders in playground on hot reload ([3451fd1](https://github.com/doczjs/docz/commit/3451fd1)), closes [#1299](https://github.com/doczjs/docz/issues/1299) # [2.2.0-alpha.6](https://github.com/doczjs/docz/compare/v2.2.0-alpha.5...v2.2.0-alpha.6) (2019-12-03) ### Bug Fixes * **gatsby-theme-docz:** fix horizontal code overflow ([a0b7823](https://github.com/doczjs/docz/commit/a0b7823)) # [2.2.0-alpha.5](https://github.com/doczjs/docz/compare/v2.2.0-alpha.4...v2.2.0-alpha.5) (2019-12-01) ### Bug Fixes * **gatsby-theme-docz:** fix tsx parsing in code blocks ([b321ff8](https://github.com/doczjs/docz/commit/b321ff8)) # [2.2.0-alpha.4](https://github.com/doczjs/docz/compare/v2.2.0-alpha.3...v2.2.0-alpha.4) (2019-11-30) ### Features * **gatsby-theme-docz:** add showMarkdownEditButton flag ([8fd04e8](https://github.com/doczjs/docz/commit/8fd04e8)), closes [#1291](https://github.com/doczjs/docz/issues/1291) # [2.2.0-alpha.3](https://github.com/doczjs/docz/compare/v2.2.0-alpha.2...v2.2.0-alpha.3) (2019-11-29) ### Bug Fixes * **docz-core:** re-sync .docz on build ([dfd4262](https://github.com/doczjs/docz/commit/dfd4262)) # [2.2.0-alpha.2](https://github.com/doczjs/docz/compare/v2.2.0-alpha.1...v2.2.0-alpha.2) (2019-11-29) ### Bug Fixes * **docz-core:** log errors that happen in gatsby-config ([fe1e2da](https://github.com/doczjs/docz/commit/fe1e2da)) ### Features * **docz-core:** copy .env ([51f7027](https://github.com/doczjs/docz/commit/51f7027)) # [2.2.0-alpha.1](https://github.com/doczjs/docz/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2019-11-28) ### Bug Fixes * **gatsby-theme-docz:** remove typo from the theme styles ([a25da88](https://github.com/doczjs/docz/commit/a25da88)) ### Features * **docz-core:** add all gatsby node apis to generated gatsby-node ([918b44c](https://github.com/doczjs/docz/commit/918b44c)), closes [#1285](https://github.com/doczjs/docz/issues/1285) # [2.2.0-alpha.0](https://github.com/doczjs/docz/compare/v2.1.1...v2.2.0-alpha.0) (2019-11-28) ### Bug Fixes * **gatsby-theme-docz:** set gatsby root from doczrc src ([e6b1521](https://github.com/doczjs/docz/commit/e6b1521)) ### Features * **docz-core:** recommend commands on typo ([#1282](https://github.com/doczjs/docz/issues/1282)) ([0f8430d](https://github.com/doczjs/docz/commit/0f8430d)) ## [2.1.1](https://github.com/doczjs/docz/compare/v2.1.0...v2.1.1) (2019-11-27) ### Bug Fixes * **docz-core:** prepend dot to default mdx extensions ([18f78d6](https://github.com/doczjs/docz/commit/18f78d6)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) ### Bug Fixes * **docz:** remove lowercasing of enum ts prop type ([8f7b949](https://github.com/doczjs/docz/commit/8f7b949)) * **gatsby-theme-docz:** allow empty ts prop defaultValue ([2512aa1](https://github.com/doczjs/docz/commit/2512aa1)) * **gatsby-theme-docz:** fix min-height ([34fc31f](https://github.com/doczjs/docz/commit/34fc31f)) ### Features * **docz:** spread remaining props to Props component ([#1276](https://github.com/doczjs/docz/issues/1276)) ([531244f](https://github.com/doczjs/docz/commit/531244f)) * **docz-core:** add mdxExtensions to config ([77b84e8](https://github.com/doczjs/docz/commit/77b84e8)) * **gatsby-theme-docz:** use mdxExtensions from config ([7d405c5](https://github.com/doczjs/docz/commit/7d405c5)) ### Bug Fixes * **docz-core:** add docz init command ([43cdeca](https://github.com/pedronauck/docz/commit/43cdeca)) * **docz-core:** remove installation step in .docz 🎉 ([4d01ead](https://github.com/pedronauck/docz/commit/4d01ead)) * **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) * add normalize for trailing slashes ([4b0a710](https://github.com/pedronauck/docz/commit/4b0a710)) * adds theme path overrrite option ([bb62c6b](https://github.com/pedronauck/docz/commit/bb62c6b)) * rewrite dest path for themeDir override ([7418e55](https://github.com/pedronauck/docz/commit/7418e55)) # [2.0.0-rc.33](https://github.com/pedronauck/docz/compare/v2.0.0-rc.32...v2.0.0-rc.33) (2019-09-04) ### Features * **docz-core:** remove installation step in .docz 🎉 ([6790179](https://github.com/pedronauck/docz/commit/6790179)) # [2.0.0-rc.32](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.32) (2019-09-04) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([1246b19](https://github.com/pedronauck/docz/commit/1246b19)) - **docz-core:** make onCreateWebpackConfig extendable ([8968a6c](https://github.com/pedronauck/docz/commit/8968a6c)) - **docz-core:** run init on build if docz is not initialized ([26aa7f6](https://github.com/pedronauck/docz/commit/26aa7f6)) - **docz-core:** set yarn production to false to download all deps ([2b4cc6b](https://github.com/pedronauck/docz/commit/2b4cc6b)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** expose gatsby actions to plugin ([66546a4](https://github.com/pedronauck/docz/commit/66546a4)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-core:** add docz init command ([43cdeca](https://github.com/pedronauck/docz/commit/43cdeca)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) # [2.0.0-rc.31](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.31) (2019-09-03) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([1246b19](https://github.com/pedronauck/docz/commit/1246b19)) - **docz-core:** make onCreateWebpackConfig extendable ([8968a6c](https://github.com/pedronauck/docz/commit/8968a6c)) - **docz-core:** run init on build if docz is not initialized ([fe984fd](https://github.com/pedronauck/docz/commit/fe984fd)) - **docz-core:** set yarn production to false to download all deps ([1258553](https://github.com/pedronauck/docz/commit/1258553)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-core:** add docz init command ([2cd87ee](https://github.com/pedronauck/docz/commit/2cd87ee)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) # [2.0.0-rc.30](https://github.com/pedronauck/docz/compare/v2.0.0-rc.29...v2.0.0-rc.30) (2019-09-03) ### Bug Fixes - **docz-core:** set yarn production to false to download all deps ([c9db7f1](https://github.com/pedronauck/docz/commit/c9db7f1)) # [2.0.0-rc.29](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.29) (2019-09-03) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([1246b19](https://github.com/pedronauck/docz/commit/1246b19)) - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** run init on build if docz is not initialized ([23bc575](https://github.com/pedronauck/docz/commit/23bc575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-core:** add docz init command ([6aaa3e4](https://github.com/pedronauck/docz/commit/6aaa3e4)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-03) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([1246b19](https://github.com/pedronauck/docz/commit/1246b19)) - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([1246b19](https://github.com/pedronauck/docz/commit/1246b19)) - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** run init on build if docz is not initialized ([23bc575](https://github.com/pedronauck/docz/commit/23bc575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-core:** add docz init command ([6aaa3e4](https://github.com/pedronauck/docz/commit/6aaa3e4)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) # [2.0.0-rc.27](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.27) (2019-09-02) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** better prop types for playground ([f35f3ca](https://github.com/pedronauck/docz/commit/f35f3ca)) - **docz-components:** fix development example ([faf2134](https://github.com/pedronauck/docz/commit/faf2134)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-components:** typo boder -> border ([d101f9c](https://github.com/pedronauck/docz/commit/d101f9c)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([45b7767](https://github.com/pedronauck/docz/commit/45b7767)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) - **docz-components:** working playground ([344ffbb](https://github.com/pedronauck/docz/commit/344ffbb)) - **docz-gatsby-monorepo:** add example showing docz usage in a monorepo ([241c757](https://github.com/pedronauck/docz/commit/241c757)) # [2.0.0-rc.9](https://github.com/pedronauck/docz/compare/v2.0.0-rc.7...v2.0.0-rc.9) (2019-08-30) ### Bug Fixes - **docz:** better default playground component ([f90d7a9](https://github.com/pedronauck/docz/commit/f90d7a9)) - **docz:** bump docz-core version ([f60fce8](https://github.com/pedronauck/docz/commit/f60fce8)) # [2.0.0-rc.7](https://github.com/pedronauck/docz/compare/v2.0.0-rc.6...v2.0.0-rc.7) (2019-08-29) ### Bug Fixes - **docz:** initialize components context with defaultComponents ([ceaafea](https://github.com/pedronauck/docz/commit/ceaafea)) # [2.0.0-rc.6](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.6) (2019-08-29) ### Bug Fixes - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([cf9ea90](https://github.com/pedronauck/docz/commit/cf9ea90)) # [2.0.0-rc.2](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-08-28) ### Bug Fixes - **docz:** make scheduler dependency explicit ([84918d8](https://github.com/pedronauck/docz/commit/84918d8)) - **docz:** remove window check from useCurrentDoc fixes [#985](https://github.com/pedronauck/docz/issues/985) ([#1023](https://github.com/pedronauck/docz/issues/1023)) ([b90ea82](https://github.com/pedronauck/docz/commit/b90ea82)) - **docz-core:** extend base config instead of overwriting user config ([#1028](https://github.com/pedronauck/docz/issues/1028)) ([7b46c2b](https://github.com/pedronauck/docz/commit/7b46c2b)) - **docz-core:** wait for app to be ready before opening the browser ([c5cd14d](https://github.com/pedronauck/docz/commit/c5cd14d)) - **docz-example-basic:** add explicit dependency to scheduler ([a4c5f9c](https://github.com/pedronauck/docz/commit/a4c5f9c)) - **docz-example-flow:** add scheduler dep ([5063fc2](https://github.com/pedronauck/docz/commit/5063fc2)) - **docz-example-styled-components:** add scheduler and remove caaf ([1d66cad](https://github.com/pedronauck/docz/commit/1d66cad)) - **docz-example-typescript:** add extension of tsx file in mdx ([f43f454](https://github.com/pedronauck/docz/commit/f43f454)) - **docz-example-typescript:** add externally usable tsconfig ([1806abb](https://github.com/pedronauck/docz/commit/1806abb)) - **docz-example-typescript:** add scheduler dep and docs [#1020](https://github.com/pedronauck/docz/issues/1020) ([fbc8e89](https://github.com/pedronauck/docz/commit/fbc8e89)) - **gatsby-theme-docz:** add missing source sans pro font ([#991](https://github.com/pedronauck/docz/issues/991)) ([51240df](https://github.com/pedronauck/docz/commit/51240df)) - **gatsby-theme-docz:** replace fragment tag to the short syntax ([#992](https://github.com/pedronauck/docz/issues/992)) ([044f351](https://github.com/pedronauck/docz/commit/044f351)) ### Features - **docz-core:** setup jest and add first test ([bf02ac1](https://github.com/pedronauck/docz/commit/bf02ac1)) # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes - bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) - resizable props import ([2926896](https://github.com/pedronauck/docz/commit/2926896)) - **babel-plugin-export-metadata:** disable enumerable for \_\_filemeta ([38d10fc](https://github.com/pedronauck/docz/commit/38d10fc)) - **babel-plugin-export-metadata:** fix root relative path ([eccbac4](https://github.com/pedronauck/docz/commit/eccbac4)) - **babel-plugin-export-metadata:** transform to Unix slash ([#825](https://github.com/pedronauck/docz/issues/825)) ([#829](https://github.com/pedronauck/docz/issues/829)) ([f823cc6](https://github.com/pedronauck/docz/commit/f823cc6)) - **docz:** component Props false positives when looking in state ([baa9bb3](https://github.com/pedronauck/docz/commit/baa9bb3)) - **docz:** parse description of props ([0672c3e](https://github.com/pedronauck/docz/commit/0672c3e)) - **docz:** props markdown compiler ([99ba83c](https://github.com/pedronauck/docz/commit/99ba83c)) - **docz-core:** create deps algorithm ([a4b8eb9](https://github.com/pedronauck/docz/commit/a4b8eb9)) - **docz-core:** some adjustments ([86f95b5](https://github.com/pedronauck/docz/commit/86f95b5)) - **docz-core:** vendor react-docgen-external-proptypes-handler ([#866](https://github.com/pedronauck/docz/issues/866)) ([efb89ee](https://github.com/pedronauck/docz/commit/efb89ee)), closes [#727](https://github.com/pedronauck/docz/issues/727) - **gatsby-theme-docz:** entry not in context ([e582221](https://github.com/pedronauck/docz/commit/e582221)) - **gatsby-theme-docz:** resizable import ([3916265](https://github.com/pedronauck/docz/commit/3916265)) - on create webpack plugin hook ([56e974a](https://github.com/pedronauck/docz/commit/56e974a)) - packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) - remove react & react-dom from dependencies [#924](https://github.com/pedronauck/docz/issues/924) ([faf4288](https://github.com/pedronauck/docz/commit/faf4288)) - **remark-docz:** fix alias in the src of a mdx's image [#897](https://github.com/pedronauck/docz/issues/897) ([058732d](https://github.com/pedronauck/docz/commit/058732d)) - some typescript adjustments ([4ba6eaf](https://github.com/pedronauck/docz/commit/4ba6eaf)) - **gatsby-theme-docz:** prisms theme by themeConfig ([c0b5c34](https://github.com/pedronauck/docz/commit/c0b5c34)) - eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) - no-undef eslint rule ([125c5cf](https://github.com/pedronauck/docz/commit/125c5cf)) ### Features - **docz-core:** ensure files before running machine ([1876540](https://github.com/pedronauck/docz/commit/1876540)) - **docz-core:** watch custom theme files ([5ee7abe](https://github.com/pedronauck/docz/commit/5ee7abe)) - **docz-core:** watch gatsby config files ([1539378](https://github.com/pedronauck/docz/commit/1539378)) - **gatsby-theme-docz:** add blockquote styles ([b9f11a1](https://github.com/pedronauck/docz/commit/b9f11a1)) - **gatsby-theme-docz:** add custom logo support ([dec4b2b](https://github.com/pedronauck/docz/commit/dec4b2b)) - **gatsby-theme-docz:** add iframe and re-resizable on playground ([6922717](https://github.com/pedronauck/docz/commit/6922717)) - **gatsby-theme-docz:** add new Pre component ([a6be6a1](https://github.com/pedronauck/docz/commit/a6be6a1)) - **gatsby-theme-docz:** add new Props component ([8eb780d](https://github.com/pedronauck/docz/commit/8eb780d)) - **gatsby-theme-docz:** add showLiveError on Playground ([e593897](https://github.com/pedronauck/docz/commit/e593897)) - **gatsby-theme-docz:** add some improvements ([03d9fec](https://github.com/pedronauck/docz/commit/03d9fec)) - **gatsby-theme-docz:** improve documentation ([80b35f8](https://github.com/pedronauck/docz/commit/80b35f8)) - a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) - adapt core plugins to gatsby hooks ([4caa47a](https://github.com/pedronauck/docz/commit/4caa47a)) - add main package improvements ([8c8005d](https://github.com/pedronauck/docz/commit/8c8005d)) - add markdown parsing on props description ([1087539](https://github.com/pedronauck/docz/commit/1087539)) - add new Playground component ([7bf03b2](https://github.com/pedronauck/docz/commit/7bf03b2)) - add new theme sidebar ([a01d100](https://github.com/pedronauck/docz/commit/a01d100)) - add typescript support (need fix) ([13947f9](https://github.com/pedronauck/docz/commit/13947f9)) - docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) - dynamic src and root path ([c071556](https://github.com/pedronauck/docz/commit/c071556)) - open browser integration ([132c472](https://github.com/pedronauck/docz/commit/132c472)) - some playground improvements ([afa00df](https://github.com/pedronauck/docz/commit/afa00df)) - **docz-core:** add build and serve command with gatsby ([e85c82b](https://github.com/pedronauck/docz/commit/e85c82b)) - **docz-core:** add doczrc config watcher on dev ([5aa0455](https://github.com/pedronauck/docz/commit/5aa0455)) - **docz-core:** add initial gatsby bundler algorithm ([9249e34](https://github.com/pedronauck/docz/commit/9249e34)) - **gatsby-theme-docz:** improve code highlight ([d265444](https://github.com/pedronauck/docz/commit/d265444)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) ### Bug Fixes - **docz-theme-default:** allow use of link component in ssr ([#854](https://github.com/pedronauck/docz/issues/854)) ([90c27e0](https://github.com/pedronauck/docz/commit/90c27e0)), closes [#832](https://github.com/pedronauck/docz/issues/832) - **docz-theme-default:** useMemo with conditional ([3b653e5](https://github.com/pedronauck/docz/commit/3b653e5)) ### Features - **docz-core:** add config docgen ts resolver ([#848](https://github.com/pedronauck/docz/issues/848)) ([256b600](https://github.com/pedronauck/docz/commit/256b600)) - **docz-core:** add serve command ([#855](https://github.com/pedronauck/docz/issues/855)) ([73311bd](https://github.com/pedronauck/docz/commit/73311bd)) - resolve markdown images ([#851](https://github.com/pedronauck/docz/issues/851)) ([0fb41c8](https://github.com/pedronauck/docz/commit/0fb41c8)) - **docz-core:** add config not use specifiers ([#849](https://github.com/pedronauck/docz/issues/849)) ([d8595a9](https://github.com/pedronauck/docz/commit/d8595a9)) # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) ### Bug Fixes - correct props loading ([#836](https://github.com/pedronauck/docz/issues/836)) ([ed85f14](https://github.com/pedronauck/docz/commit/ed85f14)) - **docz:** non latin menu headings ([#840](https://github.com/pedronauck/docz/issues/840)) ([80b186c](https://github.com/pedronauck/docz/commit/80b186c)) - **docz-core:** prevent watch in production ([d673262](https://github.com/pedronauck/docz/commit/d673262)) ### Features - **docz-core:** extended path configuration for docgen ([#846](https://github.com/pedronauck/docz/issues/846)) ([aa96739](https://github.com/pedronauck/docz/commit/aa96739)) - **docz-core:** use react-dev-utils create compiler ([4d062de](https://github.com/pedronauck/docz/commit/4d062de)) - **docz-theme-default:** add options to the props component ([#823](https://github.com/pedronauck/docz/issues/823)) ([9edaac8](https://github.com/pedronauck/docz/commit/9edaac8)) ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) ### Bug Fixes - **babel-plugin-export-metadata:** avoid adding \_\_filemeta to non-extensible objects ([#798](https://github.com/pedronauck/docz/issues/798)) ([794ebc4](https://github.com/pedronauck/docz/commit/794ebc4)) - **babel-plugin-export-metadata:** re-export causes meta error ([#805](https://github.com/pedronauck/docz/issues/805)) ([9401676](https://github.com/pedronauck/docz/commit/9401676)) - **docz-rollup:** fixed rollup configs to be Windows tolerant ([#812](https://github.com/pedronauck/docz/issues/812)) ([10f6bfd](https://github.com/pedronauck/docz/commit/10f6bfd)) - **docz-theme-default:** logo link point to dynamic base ([#815](https://github.com/pedronauck/docz/issues/815)) ([f7cc750](https://github.com/pedronauck/docz/commit/f7cc750)) ## [1.0.3](https://github.com/pedronauck/docz/compare/v1.0.2...v1.0.3) (2019-04-15) ### Bug Fixes - **docz:** props parser for build ([31612e7](https://github.com/pedronauck/docz/commit/31612e7)) ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) ### Bug Fixes - **docz-theme-default:** overlay just for mobile resolutions ([a927389](https://github.com/pedronauck/docz/commit/a927389)) - pin typescript version ([8ae97d3](https://github.com/pedronauck/docz/commit/8ae97d3)) - window check ([cfbda29](https://github.com/pedronauck/docz/commit/cfbda29)) ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) ### Bug Fixes - **babel-plugin-export-metadata:** fix re-export default ([#790](https://github.com/pedronauck/docz/issues/790)) ([#791](https://github.com/pedronauck/docz/issues/791)) ([89b3928](https://github.com/pedronauck/docz/commit/89b3928)) # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) ### Bug Fixes - **babel-plugin-export-metadata:** remove cache folders from parse ([2978a26](https://github.com/pedronauck/docz/commit/2978a26)) - **docz:** crash using suspense ([315f7ad](https://github.com/pedronauck/docz/commit/315f7ad)) - **docz-core:** typescript doesn't work with several exports ([#771](https://github.com/pedronauck/docz/issues/771)) ([c96878d](https://github.com/pedronauck/docz/commit/c96878d)) - **docz-theme-default:** styled error margin ([53104e8](https://github.com/pedronauck/docz/commit/53104e8)) - **docz-theme-default:** table media query style ([#782](https://github.com/pedronauck/docz/issues/782)) ([205ce75](https://github.com/pedronauck/docz/commit/205ce75)) ### Features - **docz-core:** auto open browser when start dev mode ([#774](https://github.com/pedronauck/docz/issues/774)) ([c0e6c13](https://github.com/pedronauck/docz/commit/c0e6c13)) # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes - **docz-core:** add src as prefix on ignore ([2bae93b](https://github.com/pedronauck/docz/commit/2bae93b)) - **docz-core:** remove DataServer from production build ([b8770ec](https://github.com/pedronauck/docz/commit/b8770ec)) - add missing dependency on examples ([af8ec2d](https://github.com/pedronauck/docz/commit/af8ec2d)) - get component filename relative (fix [#706](https://github.com/pedronauck/docz/issues/706)) ([84b23ea](https://github.com/pedronauck/docz/commit/84b23ea)) - remove data server from build ([8715129](https://github.com/pedronauck/docz/commit/8715129)) - remove modularized lodash packages ([d81c568](https://github.com/pedronauck/docz/commit/d81c568)) - **docz:** incompatible props on Link ([281cb13](https://github.com/pedronauck/docz/commit/281cb13)) - **docz-core:** base prop for router ([9ca39d7](https://github.com/pedronauck/docz/commit/9ca39d7)) - **docz-core:** entries not initialized on build ([#725](https://github.com/pedronauck/docz/issues/725)) ([3e99db0](https://github.com/pedronauck/docz/commit/3e99db0)) - **docz-core:** resolve symlinks right for the react-docgen ([#699](https://github.com/pedronauck/docz/issues/699)) ([783a836](https://github.com/pedronauck/docz/commit/783a836)) - **docz-theme-default:** allows hamburger menu to be opened on mobile ([#698](https://github.com/pedronauck/docz/issues/698)) ([fd06381](https://github.com/pedronauck/docz/commit/fd06381)) - **docz-theme-default:** apply ignore in props parsing ([#723](https://github.com/pedronauck/docz/issues/723)) ([6dd068c](https://github.com/pedronauck/docz/commit/6dd068c)) - **docz-theme-default:** mobile menu following anchor clicks ([#713](https://github.com/pedronauck/docz/issues/713)) ([e3bbf1a](https://github.com/pedronauck/docz/commit/e3bbf1a)) - **docz-theme-default:** stop nested ul from rendering flat ([#714](https://github.com/pedronauck/docz/issues/714)) ([2711e6d](https://github.com/pedronauck/docz/commit/2711e6d)) # [1.0.0-rc.3](https://github.com/pedronauck/docz/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2019-03-21) ### Bug Fixes - **gatsby-theme-docz:** menu field on entry source node ([05457f2](https://github.com/pedronauck/docz/commit/05457f2)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package docz # [1.0.0-alpha.1](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2019-03-19) ### Bug Fixes - bump internal versions ([1658aaf](https://github.com/pedronauck/docz/commit/1658aaf)) # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes - **babel-plugin-export-metadata:** update snapshot test ([6ca7b87](https://github.com/pedronauck/docz/commit/6ca7b87)) - **docz:** add window check to useWindowSize hook ([#669](https://github.com/pedronauck/docz/issues/669)) ([e4d7cb4](https://github.com/pedronauck/docz/commit/e4d7cb4)) - **docz:** merge menus on useMenus ([af4afe2](https://github.com/pedronauck/docz/commit/af4afe2)) - **docz:** merge new config for useConfig hook ([c63bbc8](https://github.com/pedronauck/docz/commit/c63bbc8)) - **docz:** optional opts for useMenus() ([571ffcd](https://github.com/pedronauck/docz/commit/571ffcd)) - **docz:** remove config conditional from hooks ([6b6f134](https://github.com/pedronauck/docz/commit/6b6f134)) - **docz:** remove null return on routes ([5bbbbb3](https://github.com/pedronauck/docz/commit/5bbbbb3)) - **docz-core:** config passed on argv ([12f6385](https://github.com/pedronauck/docz/commit/12f6385)) - **docz-core:** hot loader and mdx plugins ([0531d65](https://github.com/pedronauck/docz/commit/0531d65)) - **docz-core:** initialize config state on data server start ([#678](https://github.com/pedronauck/docz/issues/678)) ([8c740b8](https://github.com/pedronauck/docz/commit/8c740b8)) - **docz-core:** remove dev things from prod build ([3f5b5d7](https://github.com/pedronauck/docz/commit/3f5b5d7)) - **docz-core:** remove order from Entry class ([e12c37d](https://github.com/pedronauck/docz/commit/e12c37d)) - **docz-core:** write first imports ([b856168](https://github.com/pedronauck/docz/commit/b856168)) - **docz-theme-default:** active menu link ([5e04e0d](https://github.com/pedronauck/docz/commit/5e04e0d)) - **docz-theme-default:** add active class manually for gatsby ([c3faed3](https://github.com/pedronauck/docz/commit/c3faed3)) - **docz-theme-default:** react live error size ([7f2e0ff](https://github.com/pedronauck/docz/commit/7f2e0ff)) - **docz-theme-default:** support absolute page elements ([#683](https://github.com/pedronauck/docz/issues/683)) ([a4ced2b](https://github.com/pedronauck/docz/commit/a4ced2b)) - **docz-theme-default:** toggle active links on location change ([#666](https://github.com/pedronauck/docz/issues/666)) ([1274b97](https://github.com/pedronauck/docz/commit/1274b97)) - **docz-utils:** add docz imports on react live scope ([01004ed](https://github.com/pedronauck/docz/commit/01004ed)) - **gatsby-theme-docz:** add null fields for entries ([b0409a8](https://github.com/pedronauck/docz/commit/b0409a8)) - **gatsby-theme-docz:** add ssr support for styled-components ([b490010](https://github.com/pedronauck/docz/commit/b490010)) - **gatsby-theme-docz:** check entries before find on it ([8565128](https://github.com/pedronauck/docz/commit/8565128)) - **gatsby-theme-docz:** create pages hook ([2f5765e](https://github.com/pedronauck/docz/commit/2f5765e)) - **gatsby-theme-docz:** readme typo ([9e3314a](https://github.com/pedronauck/docz/commit/9e3314a)) - **gatsby-theme-docz:** throws false for json stringify ([289ca75](https://github.com/pedronauck/docz/commit/289ca75)) - gatsby theme fixes ([dcc5f19](https://github.com/pedronauck/docz/commit/dcc5f19)) - **gatsby-theme-docz:** check data before access ([8f8ed12](https://github.com/pedronauck/docz/commit/8f8ed12)) - **gatsby-theme-docz:** use options from gatsby-config ([#665](https://github.com/pedronauck/docz/issues/665)) ([c694bdf](https://github.com/pedronauck/docz/commit/c694bdf)) - **rehype-docz:** update tests ([548f940](https://github.com/pedronauck/docz/commit/548f940)) - immutable merge with lodash ([2fe94d4](https://github.com/pedronauck/docz/commit/2fe94d4)) - **remark-docz:** visit correct nodes ([d5e243d](https://github.com/pedronauck/docz/commit/d5e243d)) - some general adjustments ([0c61f64](https://github.com/pedronauck/docz/commit/0c61f64)) - **load-cfg:** merge default config on load ([d3b4bc6](https://github.com/pedronauck/docz/commit/d3b4bc6)) - use lodash merge instead of deepmerge ([18ac37b](https://github.com/pedronauck/docz/commit/18ac37b)) - **docz-theme-default:** styles adjustments ([aca1bee](https://github.com/pedronauck/docz/commit/aca1bee)) - **gatsby-theme-docz:** add specific nodes for entries ([26f7f90](https://github.com/pedronauck/docz/commit/26f7f90)) - define right internal dependencies version ([30a91b4](https://github.com/pedronauck/docz/commit/30a91b4)) - prop types parser ([a3cc319](https://github.com/pedronauck/docz/commit/a3cc319)) - **babel-plugin-export-metadata:** just define pro non-primitive types ([ed78a13](https://github.com/pedronauck/docz/commit/ed78a13)) - **babel-plugin-export-metadata:** prettier fix script ([3a34b72](https://github.com/pedronauck/docz/commit/3a34b72)) - **docz:** remove deduplicated search results (thanks [@ivan-dalmet](https://github.com/ivan-dalmet)) ([1b456f7](https://github.com/pedronauck/docz/commit/1b456f7)) - **docz:** sort menu and submenus alphabetically ([fbbd51c](https://github.com/pedronauck/docz/commit/fbbd51c)) - **docz:** use @loadable/component instead of react-imported-component ([18f02f2](https://github.com/pedronauck/docz/commit/18f02f2)) - **docz-core:** add spaces when write db.json ([3a84af3](https://github.com/pedronauck/docz/commit/3a84af3)) - **docz-core:** add typescript as dependency ([9f314cd](https://github.com/pedronauck/docz/commit/9f314cd)) - **docz-core:** apply mdast plugins to entries parse too ([c2554b8](https://github.com/pedronauck/docz/commit/c2554b8)) - **docz-core:** docgen if file has not component definition ([b0fb846](https://github.com/pedronauck/docz/commit/b0fb846)) - **docz-core:** exclude node modules from source map loader ([1c7c9f7](https://github.com/pedronauck/docz/commit/1c7c9f7)) - **docz-core:** mdx loader options ([9114f9b](https://github.com/pedronauck/docz/commit/9114f9b)) - **docz-core:** props state parser ([87767e8](https://github.com/pedronauck/docz/commit/87767e8)) - **docz-core:** react docgen typescript performance ([2967e7c](https://github.com/pedronauck/docz/commit/2967e7c)) - **docz-core:** return http server on bundler.start() ([cdba3bf](https://github.com/pedronauck/docz/commit/cdba3bf)) - **docz-core:** run right hook name ([f500971](https://github.com/pedronauck/docz/commit/f500971)) - **docz-theme-default:** fix padding in Playground elements ([4af7376](https://github.com/pedronauck/docz/commit/4af7376)), closes [/github.com/pedronauck/docz/issues/398#issuecomment-453663552](https://github.com//github.com/pedronauck/docz/issues/398/issues/issuecomment-453663552) - **docz-theme-default:** force codemirror to refresh ([#637](https://github.com/pedronauck/docz/issues/637)) ([#638](https://github.com/pedronauck/docz/issues/638)) ([e745c7d](https://github.com/pedronauck/docz/commit/e745c7d)) - **docz-theme-default:** show cursor on playground editor focus ([9f99c30](https://github.com/pedronauck/docz/commit/9f99c30)) - **docz-theme-default:** show heading anchor on hover ([3e453f5](https://github.com/pedronauck/docz/commit/3e453f5)) - **docz-utils:** extract headings from ast ([9f8565b](https://github.com/pedronauck/docz/commit/9f8565b)) - **docz-utils:** parser config for prettier ([54ad0fa](https://github.com/pedronauck/docz/commit/54ad0fa)) - **gatsby-theme-docz:** hot reload ([bf4e440](https://github.com/pedronauck/docz/commit/bf4e440)) - **gatsby-theme-docz:** use createPages instead of createPagesStatefully ([37b73c6](https://github.com/pedronauck/docz/commit/37b73c6)) - **load-cfg:** use babel register in order to require using es6 ([7ad3b64](https://github.com/pedronauck/docz/commit/7ad3b64)) - a lot of bug fixes ([c10a8bd](https://github.com/pedronauck/docz/commit/c10a8bd)) - scroll to anchor if url has hash ([389577f](https://github.com/pedronauck/docz/commit/389577f)) - trim whitespaces before and after class ([a184913](https://github.com/pedronauck/docz/commit/a184913)) - use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) - wrapper property is ignored in ([3cda0de](https://github.com/pedronauck/docz/commit/3cda0de)) ### Features - **docz:** add filter option for useMenus ([aeeb311](https://github.com/pedronauck/docz/commit/aeeb311)) - **docz:** use getInitialProps instead of getInitialData ([d4406e0](https://github.com/pedronauck/docz/commit/d4406e0)) - new Props component ([80451b1](https://github.com/pedronauck/docz/commit/80451b1)) - **docz:** hooks migrations ([f57f987](https://github.com/pedronauck/docz/commit/f57f987)) - **docz-core:** remove ordering deprecated field ([39660bb](https://github.com/pedronauck/docz/commit/39660bb)) - **docz-core:** support for configuring the separator during slugifying ([10bb134](https://github.com/pedronauck/docz/commit/10bb134)) - **docz-theme-default:** automatically render links with relative path ([624bbf0](https://github.com/pedronauck/docz/commit/624bbf0)) - **docz-theme-default:** use styled-components instead of emotion ([19047fd](https://github.com/pedronauck/docz/commit/19047fd)) - **gatsby-theme-docz:** add custom theme support ([fdfddcb](https://github.com/pedronauck/docz/commit/fdfddcb)) - **gatsby-theme-docz:** add wrapper support ([a99d62f](https://github.com/pedronauck/docz/commit/a99d62f)) - add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) - add playground component ([cde6511](https://github.com/pedronauck/docz/commit/cde6511)) - docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) - split router logic from theme ([a9c26e6](https://github.com/pedronauck/docz/commit/a9c26e6)) - use @reach/router instead of react-router ([81a4a82](https://github.com/pedronauck/docz/commit/81a4a82)) ### BREAKING CHANGES - does not wrap the component anymore before passing it to the renderer. Instead it passes the wrapper explicitly to the renderer, making it the renderer's duty to apply the wrapper. ## [0.13.6](https://github.com/pedronauck/docz/compare/v0.13.5...v0.13.6) (2018-12-26) ### Bug Fixes - **docz-core:** default value for arguments ([5644343](https://github.com/pedronauck/docz/commit/5644343)) - **docz-core:** happypack plugin name ([cbf7692](https://github.com/pedronauck/docz/commit/cbf7692)) ## [0.13.5](https://github.com/pedronauck/docz/compare/v0.13.4...v0.13.5) (2018-12-19) ### Bug Fixes - **docz-core:** add react docgen loader inside happypack ([4433561](https://github.com/pedronauck/docz/commit/4433561)) - **docz-core:** close data server when need ([6a2b96a](https://github.com/pedronauck/docz/commit/6a2b96a)) - **docz-core:** escape template string in playground ([#529](https://github.com/pedronauck/docz/issues/529)) ([5ab2349](https://github.com/pedronauck/docz/commit/5ab2349)) - **docz-core:** public folder in dev mode ([abb3626](https://github.com/pedronauck/docz/commit/abb3626)) - **docz-core:** webpack dev server log level ([1d72539](https://github.com/pedronauck/docz/commit/1d72539)) - **docz-theme-default:** add default value for rgba of polished ([dcb74af](https://github.com/pedronauck/docz/commit/dcb74af)) - **docz-utils:** add missing dependency for codesandbox ([3a51066](https://github.com/pedronauck/docz/commit/3a51066)) - **docz-utils:** escape code for playground ([3fc4187](https://github.com/pedronauck/docz/commit/3fc4187)) ## [0.13.4](https://github.com/pedronauck/docz/compare/v0.13.3...v0.13.4) (2018-12-17) ### Bug Fixes - **docz-theme-default:** remove overflow from playground wrapper ([e007762](https://github.com/pedronauck/docz/commit/e007762)) ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) ### Bug Fixes - **docz-core:** react hot loader config for hooks ([444cac2](https://github.com/pedronauck/docz/commit/444cac2)) ### Features - **docz-core:** add sourcemap config argument ([3baad4a](https://github.com/pedronauck/docz/commit/3baad4a)) ## [0.13.2](https://github.com/pedronauck/docz/compare/v0.13.1...v0.13.2) (2018-12-17) ### Bug Fixes - **docz-core:** ensure dir for promise logger ([6240f21](https://github.com/pedronauck/docz/commit/6240f21)) ## [0.13.1](https://github.com/pedronauck/docz/compare/v0.13.0...v0.13.1) (2018-12-17) ### Bug Fixes - **docz-core:** typescript loader config ([01f568e](https://github.com/pedronauck/docz/commit/01f568e)) # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes - **docz:** ts warning ([19ccc09](https://github.com/pedronauck/docz/commit/19ccc09)) - **docz-core:** add setMaxListener for chokidar watchers ([6053c16](https://github.com/pedronauck/docz/commit/6053c16)) - **docz-core:** log level based on debug argument ([507e149](https://github.com/pedronauck/docz/commit/507e149)) - **docz-core:** node path resolve modules merge ([27102fd](https://github.com/pedronauck/docz/commit/27102fd)) - **docz-core:** turn off htmlMinifier when loading from templates ([#518](https://github.com/pedronauck/docz/issues/518)) ([9cb0e1d](https://github.com/pedronauck/docz/commit/9cb0e1d)) - **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ### Features - **docz-core:** add onCreateWebpackChain hook ([70bb242](https://github.com/pedronauck/docz/commit/70bb242)) - **docz-core:** add promise logger using progress-estimator ([2797608](https://github.com/pedronauck/docz/commit/2797608)) - **docz-core:** use NODE_PATH to resolve modules ([#516](https://github.com/pedronauck/docz/issues/516)) ([cc86f93](https://github.com/pedronauck/docz/commit/cc86f93)) - **docz-theme-default:** set max lines before scroll editor ([#519](https://github.com/pedronauck/docz/issues/519)) ([698261b](https://github.com/pedronauck/docz/commit/698261b)) ## [0.12.17](https://github.com/pedronauck/docz/compare/v0.12.16...v0.12.17) (2018-12-14) ### Bug Fixes - **docz:** cycled dependency ([5132195](https://github.com/pedronauck/docz/commit/5132195)) - **docz-theme-default:** link color ([21d58fb](https://github.com/pedronauck/docz/commit/21d58fb)) - **docz-theme-default:** some fixes on styles ([a17e914](https://github.com/pedronauck/docz/commit/a17e914)) - **docz-theme-default:** use theme getter instead of literal obj access ([89e1d03](https://github.com/pedronauck/docz/commit/89e1d03)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) ### Bug Fixes - **docz-core:** correct koa mounting path on windows systems ([#491](https://github.com/pedronauck/docz/issues/491)) ([6addd32](https://github.com/pedronauck/docz/commit/6addd32)) - **docz-theme-default:** refresh editor after it's mounted ([#406](https://github.com/pedronauck/docz/issues/406)) ([#506](https://github.com/pedronauck/docz/issues/506)) ([c67fa41](https://github.com/pedronauck/docz/commit/c67fa41)) - edit page button is overlayed by github link ([341e03a](https://github.com/pedronauck/docz/commit/341e03a)) - **docz-theme-default:** ts warning ([452904b](https://github.com/pedronauck/docz/commit/452904b)) ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) ### Bug Fixes - babel class plugin update ([236331a](https://github.com/pedronauck/docz/commit/236331a)) - **docz-core:** add setMaxListener in the top of script ([2eef307](https://github.com/pedronauck/docz/commit/2eef307)) - **docz-core:** update react-hot-loader to support hooks ([4394a5b](https://github.com/pedronauck/docz/commit/4394a5b)) ### Features - add native support for react-native ([f998874](https://github.com/pedronauck/docz/commit/f998874)) ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) ### Bug Fixes - some typings warnings ([4afb87b](https://github.com/pedronauck/docz/commit/4afb87b)) - **docz-core:** set max listener ([898010b](https://github.com/pedronauck/docz/commit/898010b)) - **docz-core:** watcher close ([caa8151](https://github.com/pedronauck/docz/commit/caa8151)) - **docz-theme-default:** editor border-radius ([7a7d1f8](https://github.com/pedronauck/docz/commit/7a7d1f8)) - **docz-theme-default:** overlay logic ([8b3fdc9](https://github.com/pedronauck/docz/commit/8b3fdc9)) - **docz-theme-default:** playground relative position ([a097b5f](https://github.com/pedronauck/docz/commit/a097b5f)) ### Features - **docz:** add preload async route ([f800c70](https://github.com/pedronauck/docz/commit/f800c70)) ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) ### Bug Fixes - **docz:** resolve react warnings in ErrorReporter ([#465](https://github.com/pedronauck/docz/issues/465)) ([1b0e09d](https://github.com/pedronauck/docz/commit/1b0e09d)) - **docz-theme-default:** fixes flexbox text overflow issue ([#471](https://github.com/pedronauck/docz/issues/471)) ([b37f25e](https://github.com/pedronauck/docz/commit/b37f25e)) - **docz-theme-default:** fullscreen mode ([ac02c17](https://github.com/pedronauck/docz/commit/ac02c17)) - **rehype-docz:** scope for playground ([677a785](https://github.com/pedronauck/docz/commit/677a785)) ## [0.12.12](https://github.com/pedronauck/docz/compare/v0.12.11...v0.12.12) (2018-11-16) ### Bug Fixes - **docz-theme-default:** add theme provider around all theme ([5596446](https://github.com/pedronauck/docz/commit/5596446)) - **docz-utils:** add .scss to codesandbox assemble files ([59e8fa8](https://github.com/pedronauck/docz/commit/59e8fa8)) ## [0.12.11](https://github.com/pedronauck/docz/compare/v0.12.10...v0.12.11) (2018-11-15) ### Bug Fixes - **docz-core:** add happypack again :cry: ([f0e219e](https://github.com/pedronauck/docz/commit/f0e219e)) - **docz-core:** create app files before start server ([43bc3fd](https://github.com/pedronauck/docz/commit/43bc3fd)) - **docz-theme-default:** adjust z-index of menu ([ea9a864](https://github.com/pedronauck/docz/commit/ea9a864)) - **docz-theme-default:** font size of heading ([5cf6144](https://github.com/pedronauck/docz/commit/5cf6144)) ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) ### Bug Fixes - **docz-core:** add cache just for non-debug ([cede436](https://github.com/pedronauck/docz/commit/cede436)) - **docz-core:** add default favicon ([a0ed2ab](https://github.com/pedronauck/docz/commit/a0ed2ab)) - **docz-core:** add ignore md files by args ([d8c8045](https://github.com/pedronauck/docz/commit/d8c8045)) - **docz-core:** kill server on signals ([be0855f](https://github.com/pedronauck/docz/commit/be0855f)) - **docz-core:** use assets from public folder ([210c3a1](https://github.com/pedronauck/docz/commit/210c3a1)) - **docz-theme-default:** add styles or classname on playground ([01110d4](https://github.com/pedronauck/docz/commit/01110d4)) - **docz-utils:** resolve codesandbox code ([33dc6e5](https://github.com/pedronauck/docz/commit/33dc6e5)) ### Features - **docz-core:** add detect-one-changed in development ([#433](https://github.com/pedronauck/docz/issues/433)) ([0585b97](https://github.com/pedronauck/docz/commit/0585b97)) - **docz-core:** add two new plugin hooks ([#431](https://github.com/pedronauck/docz/issues/431)) ([f4a122f](https://github.com/pedronauck/docz/commit/f4a122f)) - **docz-theme-default:** show and hide playground ([b665f81](https://github.com/pedronauck/docz/commit/b665f81)) ## [0.12.9](https://github.com/pedronauck/docz/compare/v0.12.8...v0.12.9) (2018-11-01) ### Bug Fixes - **docz-theme-default:** table margin bottom ([36e322f](https://github.com/pedronauck/docz/commit/36e322f)) - **docz-theme-default:** use class inside playground ([cecbea1](https://github.com/pedronauck/docz/commit/cecbea1)) ### Features - **docz-theme-default:** add style for hr component ([5b24400](https://github.com/pedronauck/docz/commit/5b24400)) - **docz-theme-default:** hide playground editor by default ([0ccda92](https://github.com/pedronauck/docz/commit/0ccda92)) ## [0.12.8](https://github.com/pedronauck/docz/compare/v0.12.7...v0.12.8) (2018-10-31) ### Bug Fixes - **docz:** update to new react imported component api ([759160e](https://github.com/pedronauck/docz/commit/759160e)) - **docz-core:** add support to react hooks ([f26a990](https://github.com/pedronauck/docz/commit/f26a990)) ## [0.12.7](https://github.com/pedronauck/docz/compare/v0.12.6...v0.12.7) (2018-10-30) ### Bug Fixes - **docz-core:** webpack chain minimizer config ([ab13208](https://github.com/pedronauck/docz/commit/ab13208)) ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) ### Bug Fixes - **docz:** conditionally description column on PropsTable ([#385](https://github.com/pedronauck/docz/issues/385)) ([829a3aa](https://github.com/pedronauck/docz/commit/829a3aa)), closes [#427](https://github.com/pedronauck/docz/issues/427) [#421](https://github.com/pedronauck/docz/issues/421) - **docz-theme-default:** fill adjustments ([119e4a7](https://github.com/pedronauck/docz/commit/119e4a7)) - **docz-theme-default:** rename playground container to avoid conflicts ([#429](https://github.com/pedronauck/docz/issues/429)) ([86845bf](https://github.com/pedronauck/docz/commit/86845bf)) - **docz-theme-default:** text alignment in table thead ([#403](https://github.com/pedronauck/docz/issues/403)) ([475eb52](https://github.com/pedronauck/docz/commit/475eb52)) - **docz-theme-default:** tooltip component ([9234b5e](https://github.com/pedronauck/docz/commit/9234b5e)) ### Features - add support to disable codesandbox ([be94b0e](https://github.com/pedronauck/docz/commit/be94b0e)) - **docz:** render [Empty String] on PropsTable ([#427](https://github.com/pedronauck/docz/issues/427)) ([10a3eda](https://github.com/pedronauck/docz/commit/10a3eda)) - **docz:** render [Empty String] on PropsTable ([#427](https://github.com/pedronauck/docz/issues/427)) ([2a9db98](https://github.com/pedronauck/docz/commit/2a9db98)) - **docz-theme-default:** add code editor toggle on playground ([#387](https://github.com/pedronauck/docz/issues/387)) ([f833eaa](https://github.com/pedronauck/docz/commit/f833eaa)) - **docz-theme-default:** add support to show/hide playground editor ([cacc6fb](https://github.com/pedronauck/docz/commit/cacc6fb)) ## [0.12.5](https://github.com/pedronauck/docz/compare/v0.12.4...v0.12.5) (2018-09-30) ### Bug Fixes - **docz-core:** close dataserver connection on build ([0f6bd7b](https://github.com/pedronauck/docz/commit/0f6bd7b)) - **docz-theme-default:** adjust theme colors ([eed7212](https://github.com/pedronauck/docz/commit/eed7212)) ## [0.12.4](https://github.com/pedronauck/docz/compare/v0.12.3...v0.12.4) (2018-09-28) ### Bug Fixes - **docz:** merge menus and submenus ([f8249da](https://github.com/pedronauck/docz/commit/f8249da)) ## [0.12.3](https://github.com/pedronauck/docz/compare/v0.12.2...v0.12.3) (2018-09-28) ### Bug Fixes - **docz:** remove Children.only ([656d8f1](https://github.com/pedronauck/docz/commit/656d8f1)) ## [0.11.2](https://github.com/pedronauck/docz/compare/v0.11.1...v0.11.2) (2018-09-11) ### Bug Fixes - **docz:** prevent crash when use imported props ([ef6de9d](https://github.com/pedronauck/docz/commit/ef6de9d)) - **docz-core:** add watcher outside of update method scope ([18c744d](https://github.com/pedronauck/docz/commit/18c744d)) - **docz-core:** prevent entries block when parse mdx crash ([07ae769](https://github.com/pedronauck/docz/commit/07ae769)) - **docz-core:** remove https option and fix message ([#321](https://github.com/pedronauck/docz/issues/321)) ([ea88841](https://github.com/pedronauck/docz/commit/ea88841)) - **docz-theme-default:** scrolling and overflows performance ([a28ab79](https://github.com/pedronauck/docz/commit/a28ab79)) - heading hash link with hash router config ([7d7f557](https://github.com/pedronauck/docz/commit/7d7f557)) ### Features - add native config for doczrc ([2580712](https://github.com/pedronauck/docz/commit/2580712)) ## [0.11.1](https://github.com/pedronauck/docz/compare/v0.11.0...v0.11.1) (2018-09-07) ### Bug Fixes - **docz:** add react router inside the docz bundle ([a293aa4](https://github.com/pedronauck/docz/commit/a293aa4)) - **docz-core:** basename configuration ([5fad743](https://github.com/pedronauck/docz/commit/5fad743)) - update no documents found text ([#289](https://github.com/pedronauck/docz/issues/289)) ([cb782f9](https://github.com/pedronauck/docz/commit/cb782f9)) - **docz-core:** chokidar performance improvements ([0c344d8](https://github.com/pedronauck/docz/commit/0c344d8)) - **docz-core:** literal value of headings for menus ([85e4083](https://github.com/pedronauck/docz/commit/85e4083)) - **docz-core:** open js and ts loader scope of files ([03c01b7](https://github.com/pedronauck/docz/commit/03c01b7)) - **docz-theme-default:** prevent sidebar toggle on desktop ([7a3b97d](https://github.com/pedronauck/docz/commit/7a3b97d)) ### Features - **docz-core:** add config as parameter for onPrebuild and onPostBuild ([98692bb](https://github.com/pedronauck/docz/commit/98692bb)) # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) ### Bug Fixes - **docz-core:** dispose hmr on imports ([ba51086](https://github.com/pedronauck/docz/commit/ba51086)) - **docz-core:** join head tags ([#255](https://github.com/pedronauck/docz/issues/255)) ([065e8b3](https://github.com/pedronauck/docz/commit/065e8b3)) - **docz-core:** update react-docgen-typescript-loader to fix props table ([34b2fdf](https://github.com/pedronauck/docz/commit/34b2fdf)) - **docz-plugin-css:** fix empty loaderOpts ([193367b](https://github.com/pedronauck/docz/commit/193367b)) - **docz-plugin-css:** fix empty loaderOpts ([bb9b946](https://github.com/pedronauck/docz/commit/bb9b946)) - **docz-theme-default:** add prop to keep codemirror last line ([5c1e813](https://github.com/pedronauck/docz/commit/5c1e813)) - **docz-theme-default:** add prop to keep codemirror last line ([bf19ad5](https://github.com/pedronauck/docz/commit/bf19ad5)) - **docz-theme-default:** codemirror line end bug ([9b07d27](https://github.com/pedronauck/docz/commit/9b07d27)) - **docz-theme-default:** fix mobile menu peaking ([#262](https://github.com/pedronauck/docz/issues/262)) ([77b627f](https://github.com/pedronauck/docz/commit/77b627f)) - **docz-theme-default:** remove react-breakpoints ([c8288b0](https://github.com/pedronauck/docz/commit/c8288b0)) - **docz-theme-default:** update the empty message ([9db9231](https://github.com/pedronauck/docz/commit/9db9231)) - **load-cfg:** use fs-extra to read json sync instead of JSON.parse ([04d1e1a](https://github.com/pedronauck/docz/commit/04d1e1a)) - base url and hash router making weird url ([f483638](https://github.com/pedronauck/docz/commit/f483638)) ### Features - add link of repository from website ([#245](https://github.com/pedronauck/docz/issues/245)) ([85cc9e7](https://github.com/pedronauck/docz/commit/85cc9e7)) - **babel-preset-docz:** add new babel preset ([5efb568](https://github.com/pedronauck/docz/commit/5efb568)) - **docz:** move docz/docz-core to dev dependency on examples ([e7153a4](https://github.com/pedronauck/docz/commit/e7153a4)) - integration with react native ([#271](https://github.com/pedronauck/docz/issues/271)) ([ac359ce](https://github.com/pedronauck/docz/commit/ac359ce)) - **docz-example-styled-components:** add new example ([0cef75e](https://github.com/pedronauck/docz/commit/0cef75e)) - **docz-theme-default:** add auto close tags on playground editor ([a6e5cf7](https://github.com/pedronauck/docz/commit/a6e5cf7)) - **docz-theme-default:** add blockquote component ([86ada87](https://github.com/pedronauck/docz/commit/86ada87)) - **docz-theme-default:** add refresh btn on playground ([#254](https://github.com/pedronauck/docz/issues/254)) ([ebefd91](https://github.com/pedronauck/docz/commit/ebefd91)), closes [#251](https://github.com/pedronauck/docz/issues/251) - **docz-theme-default:** add scrollbar on playground ([#279](https://github.com/pedronauck/docz/issues/279)) ([0f6ea2a](https://github.com/pedronauck/docz/commit/0f6ea2a)) ## [0.10.3](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.3) (2018-08-16) ### Bug Fixes - **docz-core:** correct data server websocket port ([47fe714](https://github.com/pedronauck/docz/commit/47fe714)) - **docz-core:** try catch on get repo info ([2016736](https://github.com/pedronauck/docz/commit/2016736)) - **docz-example-typescript:** fix dependencies ([#222](https://github.com/pedronauck/docz/issues/222)) ([67e68aa](https://github.com/pedronauck/docz/commit/67e68aa)) - **docz-theme-default:** add playground min-height just on fullscreen ([a82903a](https://github.com/pedronauck/docz/commit/a82903a)) - **docz-theme-default:** use padding on link instead of margin ([b15457c](https://github.com/pedronauck/docz/commit/b15457c)) ### Features - **docz-core:** add editBranch option to mount repo link ([c619d9c](https://github.com/pedronauck/docz/commit/c619d9c)) ## [0.10.2](https://github.com/pedronauck/docz/compare/v0.10.1...v0.10.2) (2018-08-13) ### Bug Fixes - prevent codemirror bug on build ([3d0894e](https://github.com/pedronauck/docz/commit/3d0894e)) - **docz-core:** remove data server cache :confused: ([9683280](https://github.com/pedronauck/docz/commit/9683280)) - **docz-core:** try catch on get repo info ([bdfbf0b](https://github.com/pedronauck/docz/commit/bdfbf0b)) ## [0.10.1](https://github.com/pedronauck/docz/compare/v0.10.0...v0.10.1) (2018-08-13) ### Bug Fixes - **docz-core:** prevent crash when not have cache ([cd3609a](https://github.com/pedronauck/docz/commit/cd3609a)) - **docz-example-flow:** scale and outline props ([#211](https://github.com/pedronauck/docz/issues/211)) ([c8a4195](https://github.com/pedronauck/docz/commit/c8a4195)) # [0.10.0](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.0) (2018-08-13) ### Bug Fixes - bug template typo ([#197](https://github.com/pedronauck/docz/issues/197)) ([497fcfb](https://github.com/pedronauck/docz/commit/497fcfb)) - bug template typo ([#197](https://github.com/pedronauck/docz/issues/197)) ([fce98c4](https://github.com/pedronauck/docz/commit/fce98c4)) - **docz:** add initial loading as true ([3f05536](https://github.com/pedronauck/docz/commit/3f05536)) - **docz-core:** prevent crash on delete entry ([28e1728](https://github.com/pedronauck/docz/commit/28e1728)) - **docz-core:** prevent delete entire app folder on build ([e345896](https://github.com/pedronauck/docz/commit/e345896)) - **docz-theme-default:** playground overflow on mobile ([db1eb5b](https://github.com/pedronauck/docz/commit/db1eb5b)) - **rehype-docz:** add props on playground scope ([ee4b6c0](https://github.com/pedronauck/docz/commit/ee4b6c0)) - **rehype-docz:** allow ticks and backticks inside playground ([#203](https://github.com/pedronauck/docz/issues/203)) ([fa4ff40](https://github.com/pedronauck/docz/commit/fa4ff40)) ### Features - **docz:** fetch data on documents ([04ff0d6](https://github.com/pedronauck/docz/commit/04ff0d6)) - **docz-core:** add cache system for entries ([b90e598](https://github.com/pedronauck/docz/commit/b90e598)) - **docz-core:** add htmlContext and mini-html-webpack-plugin ([4b6ec0f](https://github.com/pedronauck/docz/commit/4b6ec0f)) - **docz-core:** resolve markdown files by default ([#210](https://github.com/pedronauck/docz/issues/210)) ([e0a95b3](https://github.com/pedronauck/docz/commit/e0a95b3)) - add github repository link ([78a19f6](https://github.com/pedronauck/docz/commit/78a19f6)) - allow edit code inside playground ([#205](https://github.com/pedronauck/docz/issues/205)) ([4f948f7](https://github.com/pedronauck/docz/commit/4f948f7)) ## [0.9.6](https://github.com/pedronauck/docz/compare/v0.9.5...v0.9.6) (2018-08-06) ### Bug Fixes - **docz-core:** remove [@babel](https://github.com/babel)/runtime alias ([0dbd8f0](https://github.com/pedronauck/docz/commit/0dbd8f0)) - **docz-theme-default:** using lodash.get to prevent classname crash ([befc643](https://github.com/pedronauck/docz/commit/befc643)) ## [0.9.5](https://github.com/pedronauck/docz/compare/v0.9.4...v0.9.5) (2018-08-04) ### Bug Fixes - **docz-theme-default:** copy html output ([#189](https://github.com/pedronauck/docz/issues/189)) ([2cb834c](https://github.com/pedronauck/docz/commit/2cb834c)) ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) ### Bug Fixes - **docz-core:** use of src config in edit button link ([#186](https://github.com/pedronauck/docz/issues/186)) ([553f90c](https://github.com/pedronauck/docz/commit/553f90c)) - remove external deps ([470bdd3](https://github.com/pedronauck/docz/commit/470bdd3)) ## [0.9.3](https://github.com/pedronauck/docz/compare/v0.9.2...v0.9.3) (2018-08-03) ### Bug Fixes - **docz-core:** use of src config in edit button link ([#186](https://github.com/pedronauck/docz/issues/186)) ([553f90c](https://github.com/pedronauck/docz/commit/553f90c)) ## [0.9.2](https://github.com/pedronauck/docz/compare/v0.9.1...v0.9.2) (2018-08-02) ### Bug Fixes - **docz-core:** add isProd to remove hot client overlay on build ([83f2e36](https://github.com/pedronauck/docz/commit/83f2e36)) ## [0.9.1](https://github.com/pedronauck/docz/compare/v0.9.0...v0.9.1) (2018-08-02) ### Bug Fixes - **docz:** finish process after build ([58bebb6](https://github.com/pedronauck/docz/commit/58bebb6)) # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) ### Bug Fixes - **docz:** transform and merge theme config ([999ab73](https://github.com/pedronauck/docz/commit/999ab73)) - **docz:** using context for imports to prevent disposed hmr ([b37284c](https://github.com/pedronauck/docz/commit/b37284c)) - **docz-plugin-babel6:** change babel syntax dynamic import when needed ([8cb278a](https://github.com/pedronauck/docz/commit/8cb278a)) - **docz-plugin-css:** pass default parameter ([389979a](https://github.com/pedronauck/docz/commit/389979a)) - **docz-theme-default:** support chinese input method ([#182](https://github.com/pedronauck/docz/issues/182)) ([94544a6](https://github.com/pedronauck/docz/commit/94544a6)) - **docz-theme-default:** table layout adjustment ([e8e8ec8](https://github.com/pedronauck/docz/commit/e8e8ec8)) - **docz-theme-default:** use docz link when href is internal ([00deef5](https://github.com/pedronauck/docz/commit/00deef5)) # [0.9.0-beta.1](https://github.com/pedronauck/docz/compare/v0.9.0-beta.0...v0.9.0-beta.1) (2018-08-01) **Note:** Version bump only for package undefined # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) ### Bug Fixes - **docz:** add playground wrapper just around children ([66abfe8](https://github.com/pedronauck/docz/commit/66abfe8)) - **docz-core:** remove babel plugin/presets when needed ([011baad](https://github.com/pedronauck/docz/commit/011baad)) - **docz-theme-default:** hot reload on fullscreen mode ([1c68e2d](https://github.com/pedronauck/docz/commit/1c68e2d)) - **docz-theme-default:** not found typo ([#173](https://github.com/pedronauck/docz/issues/173)) ([8c9f74e](https://github.com/pedronauck/docz/commit/8c9f74e)) - **docz-theme-default:** resolve emotion theming conflict ([659cd79](https://github.com/pedronauck/docz/commit/659cd79)) ### Features - **docz-core:** add webpack-serve-overlay as error overlay ([263badf](https://github.com/pedronauck/docz/commit/263badf)) - **docz-core:** support env files to set configuration ([#171](https://github.com/pedronauck/docz/issues/171)) ([259b72d](https://github.com/pedronauck/docz/commit/259b72d)), closes [#140](https://github.com/pedronauck/docz/issues/140) - **docz-plugin-svgr:** add initial version of plugin ([1ac1ea8](https://github.com/pedronauck/docz/commit/1ac1ea8)) - **docz-theme-default:** add edit button for document ([#180](https://github.com/pedronauck/docz/issues/180)) ([e125a4f](https://github.com/pedronauck/docz/commit/e125a4f)) # [0.8.0](https://github.com/pedronauck/docz/compare/v0.7.1...v0.8.0) (2018-07-28) ### Bug Fixes - change link on readme ([#168](https://github.com/pedronauck/docz/issues/168)) ([30a9390](https://github.com/pedronauck/docz/commit/30a9390)) - **docz:** humanize array type of flow (fix [#167](https://github.com/pedronauck/docz/issues/167)) ([18798bc](https://github.com/pedronauck/docz/commit/18798bc)) - **docz-theme-default:** get fullscreen from localstorage ([0f8aa56](https://github.com/pedronauck/docz/commit/0f8aa56)) ### Features - **docz-theme-default:** add html output on playground ([be7a749](https://github.com/pedronauck/docz/commit/be7a749)) ## [0.7.1](https://github.com/pedronauck/docz/compare/v0.7.0...v0.7.1) (2018-07-24) ### Bug Fixes - **docz:** add wrapper prop on Playground ([566aaf8](https://github.com/pedronauck/docz/commit/566aaf8)) - **docz:** sort algorithm off docs and menus ([dad83ce](https://github.com/pedronauck/docz/commit/dad83ce)) - **docz-plugin-css:** allow css from node_modules ([c21929a](https://github.com/pedronauck/docz/commit/c21929a)) # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) ### Bug Fixes - **docz:** humanize prop types on PropTable ([c1f4c6f](https://github.com/pedronauck/docz/commit/c1f4c6f)) - **docz-plugin-css:** css modules applied logic ([c5fa378](https://github.com/pedronauck/docz/commit/c5fa378)) - **docz-theme-default:** not found page ([fb1ac49](https://github.com/pedronauck/docz/commit/fb1ac49)) - **docz-theme-default:** resize bar style ([df0ae82](https://github.com/pedronauck/docz/commit/df0ae82)) ### Features - **docz:** add rawCode for Playground ([70d4735](https://github.com/pedronauck/docz/commit/70d4735)) - **docz-theme-default:** add close on esc on playground fullscreen ([4ebf202](https://github.com/pedronauck/docz/commit/4ebf202)) - **docz-theme-default:** add copy to clipboard on pre ([78149ad](https://github.com/pedronauck/docz/commit/78149ad)) - **docz-theme-default:** add fullpage support for docs ([af88d0e](https://github.com/pedronauck/docz/commit/af88d0e)) - **docz-theme-default:** add line numbers on Playground ([204f1bb](https://github.com/pedronauck/docz/commit/204f1bb)) - **docz-theme-default:** add resize bar for fullscreen playground ([392009f](https://github.com/pedronauck/docz/commit/392009f)) - **docz-theme-default:** add responsive mode for playground ([e04452e](https://github.com/pedronauck/docz/commit/e04452e)) ## [0.6.2](https://github.com/pedronauck/docz/compare/v0.6.1...v0.6.2) (2018-07-20) ### Bug Fixes - **docz-core:** set env vars for commands ([29f0098](https://github.com/pedronauck/docz/commit/29f0098)) ## [0.6.1](https://github.com/pedronauck/docz/compare/v0.6.0...v0.6.1) (2018-07-19) ### Bug Fixes - **docz:** default DocPreview components ([ff7cf32](https://github.com/pedronauck/docz/commit/ff7cf32)) - **docz-theme-default:** add background and color on NotFound ([f0bd532](https://github.com/pedronauck/docz/commit/f0bd532)) # [0.6.0](https://github.com/pedronauck/docz/compare/v0.5.9...v0.6.0) (2018-07-19) ### Bug Fixes - **docz:** prevent default components object with no render ([4535aef](https://github.com/pedronauck/docz/commit/4535aef)) - **docz-core:** add error when dest is working directory ([b1c87b5](https://github.com/pedronauck/docz/commit/b1c87b5)) - **docz-core:** process.env vars for scripts ([f6b6260](https://github.com/pedronauck/docz/commit/f6b6260)) - **docz-core:** serve static files from public ([c866856](https://github.com/pedronauck/docz/commit/c866856)) - **docz-theme-default:** open menu if has some link active ([8399aad](https://github.com/pedronauck/docz/commit/8399aad)) ### Features - **docz-core:** add onCreateApp plugin method ([13c07e7](https://github.com/pedronauck/docz/commit/13c07e7)) ## [0.5.9](https://github.com/pedronauck/docz/compare/v0.5.8...v0.5.9) (2018-07-16) ### Bug Fixes - **docz-theme-default:** add overflow config on Pre component ([#146](https://github.com/pedronauck/docz/issues/146)) ([9d4ce59](https://github.com/pedronauck/docz/commit/9d4ce59)) ## [0.5.8](https://github.com/pedronauck/docz/compare/v0.5.7...v0.5.8) (2018-07-11) ### Bug Fixes - **docz-theme-default:** config transform function ([fdb3118](https://github.com/pedronauck/docz/commit/fdb3118)) ## [0.5.7](https://github.com/pedronauck/docz/compare/v0.5.6...v0.5.7) (2018-07-11) ### Bug Fixes - **docz-plugin-babel6:** props parsing when typescript is enable ([0564bdf](https://github.com/pedronauck/docz/commit/0564bdf)) ## [0.5.6](https://github.com/pedronauck/docz/compare/v0.5.5...v0.5.6) (2018-07-11) ### Bug Fixes - **docz:** add theme config transform before merge ([dc3448a](https://github.com/pedronauck/docz/commit/dc3448a)) - **docz-theme-default:** sidebar search ([8fd77ec](https://github.com/pedronauck/docz/commit/8fd77ec)) ### Features - **docz:** add classname and style props for Playground ([1b64ed3](https://github.com/pedronauck/docz/commit/1b64ed3)) - **docz-core:** add webpack-serve-waitpage ([83c493b](https://github.com/pedronauck/docz/commit/83c493b)) ## [0.5.5](https://github.com/pedronauck/docz/compare/v0.5.4...v0.5.5) (2018-07-07) ### Bug Fixes - **docz-core:** add ordering to initial config data object ([2926ade](https://github.com/pedronauck/docz/commit/2926ade)) - **docz-theme-default:** padding on sidebar footer ([df25fa1](https://github.com/pedronauck/docz/commit/df25fa1)) ## [0.5.4](https://github.com/pedronauck/docz/compare/v0.5.3...v0.5.4) (2018-07-07) **Note:** Version bump only for package undefined ## [0.5.3](https://github.com/pedronauck/docz/compare/v0.5.2...v0.5.3) (2018-07-05) ### Bug Fixes - **docz-theme-default:** link isActive logic ([205ea8d](https://github.com/pedronauck/docz/commit/205ea8d)) ## [0.5.2](https://github.com/pedronauck/docz/compare/v0.5.1...v0.5.2) (2018-07-05) ### Bug Fixes - props table css class ([#116](https://github.com/pedronauck/docz/issues/116)) ([065473c](https://github.com/pedronauck/docz/commit/065473c)) - **docz-core:** remove unnescessary Entry.check ([1871db8](https://github.com/pedronauck/docz/commit/1871db8)) ## [0.5.1](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.1) (2018-07-03) ### Bug Fixes - broken links to examples ([#101](https://github.com/pedronauck/docz/issues/101)) ([26458f2](https://github.com/pedronauck/docz/commit/26458f2)) - **docz-core:** add a fallback name on Entry ([ec38139](https://github.com/pedronauck/docz/commit/ec38139)) - **docz-core:** app running port message ([4aec595](https://github.com/pedronauck/docz/commit/4aec595)) - CHANGELOG.md ([8be3724](https://github.com/pedronauck/docz/commit/8be3724)) - **docz-core:** check name on package json ([6cdbebc](https://github.com/pedronauck/docz/commit/6cdbebc)) - **docz-theme-default:** add overflow auto to nav ([4cdbcfd](https://github.com/pedronauck/docz/commit/4cdbcfd)) ### Features - **docz-core:** add ordering property for config ([efd215e](https://github.com/pedronauck/docz/commit/efd215e)) - **docz-core:** read name from package.json to populate initial title ([1eeb049](https://github.com/pedronauck/docz/commit/1eeb049)) - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) - **docz-theme-default:** add sidebar search ([7886e75](https://github.com/pedronauck/docz/commit/7886e75)) # [0.5.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.0) (2018-07-03) ### Bug Fixes - **docz-core:** app running port message ([1b94114](https://github.com/pedronauck/docz/commit/1b94114)) ### Features - **docz-core:** add ordering property for config ([a6c307d](https://github.com/pedronauck/docz/commit/a6c307d)) - **docz-core:** read name from package.json to populate initial title ([4f10a6d](https://github.com/pedronauck/docz/commit/4f10a6d)) - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) - **docz-theme-default:** add sidebar search ([8218dc1](https://github.com/pedronauck/docz/commit/8218dc1)) # [0.4.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.4.0) (2018-06-30) ### Bug Fixes - broken links to examples ([#101](https://github.com/pedronauck/docz/issues/101)) ([26458f2](https://github.com/pedronauck/docz/commit/26458f2)) - **docz-core:** add a fallback name on Entry ([ec38139](https://github.com/pedronauck/docz/commit/ec38139)) - **docz-theme-default:** add overflow auto to nav ([4cdbcfd](https://github.com/pedronauck/docz/commit/4cdbcfd)) ### Features - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) ## [0.3.4](https://github.com/pedronauck/docz/compare/v0.3.3...v0.3.4) (2018-06-26) ### Bug Fixes - remove color transparent on body ([#93](https://github.com/pedronauck/docz/issues/93)) ([a1942ef](https://github.com/pedronauck/docz/commit/a1942ef)) - unclosed tag in README.md ([#89](https://github.com/pedronauck/docz/issues/89)) ([0552351](https://github.com/pedronauck/docz/commit/0552351)) # [0.3.0](https://github.com/pedronauck/docz/compare/v0.3.0-beta.0...v0.3.0) (2018-06-25) ### Bug Fixes - **docz-theme-default:** prettier format ([cb5643d](https://github.com/pedronauck/docz/commit/cb5643d)) # [0.3.0-beta.0](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.0-beta.0) (2018-06-25) ### Bug Fixes - **docz-theme-default:** change background based on toggle ([2241f8b](https://github.com/pedronauck/docz/commit/2241f8b)) - **docz-theme-default:** change chevronDown to burguer icon with animation ([8649938](https://github.com/pedronauck/docz/commit/8649938)) - **docz-theme-default:** include breakpoints as const ([43490bb](https://github.com/pedronauck/docz/commit/43490bb)) - **docz-theme-default:** lint code ([7c97a41](https://github.com/pedronauck/docz/commit/7c97a41)) - **docz-theme-default:** made container responsive ([ddf078d](https://github.com/pedronauck/docz/commit/ddf078d)) - **docz-theme-default:** responsive position for wrapper ([bb56449](https://github.com/pedronauck/docz/commit/bb56449)) - **docz-theme-default:** sidebar toggle for links and sub-links ([9cd6321](https://github.com/pedronauck/docz/commit/9cd6321)) ### Features - **docz-theme-default:** add dark mode 🌚 ([#81](https://github.com/pedronauck/docz/issues/81)) ([964cf4d](https://github.com/pedronauck/docz/commit/964cf4d)) - **docz-theme-default:** include breakpoints reactive on sidebar ([d3911b4](https://github.com/pedronauck/docz/commit/d3911b4)) - **docz-theme-default:** include media queries facepaint ([5f78734](https://github.com/pedronauck/docz/commit/5f78734)) - **docz-theme-default:** include toggle to sidebar ([a94e517](https://github.com/pedronauck/docz/commit/a94e517)) - **docz-theme-default:** include ToggleBackground ([cac7ecd](https://github.com/pedronauck/docz/commit/cac7ecd)) - **docz-theme-default:** table responsive ([0580a77](https://github.com/pedronauck/docz/commit/0580a77)) ## [0.3.3](https://github.com/pedronauck/docz/compare/v0.3.2...v0.3.3) (2018-06-26) ### Bug Fixes - **docz-core:** copy templates files for dist ([#88](https://github.com/pedronauck/docz/issues/88)) ([5e4b98d](https://github.com/pedronauck/docz/commit/5e4b98d)) ## [0.3.2](https://github.com/pedronauck/docz/compare/v0.3.1...v0.3.2) (2018-06-25) ### Bug Fixes - **docz:** mdxtag import ([4ed20bf](https://github.com/pedronauck/docz/commit/4ed20bf)) ## [0.3.1](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.1) (2018-06-25) ### Bug Fixes - **docz:** mdx provider import ([ded8cbb](https://github.com/pedronauck/docz/commit/ded8cbb)) - use docz-theme-default as docz-core dependency ([1a2fb67](https://github.com/pedronauck/docz/commit/1a2fb67)) ### Features - **docz-default-theme:** dark mode and responsiveness ([#87](https://github.com/pedronauck/docz/issues/87)) ([a4db115](https://github.com/pedronauck/docz/commit/a4db115)), closes [#81](https://github.com/pedronauck/docz/issues/81) # [0.3.0](https://github.com/pedronauck/docz/compare/v0.3.0-beta.0...v0.3.0) (2018-06-25) ### Bug Fixes - **docz-theme-default:** prettier format ([cb5643d](https://github.com/pedronauck/docz/commit/cb5643d)) # [0.3.0-beta.0](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.0-beta.0) (2018-06-25) ### Bug Fixes - **docz-theme-default:** change background based on toggle ([2241f8b](https://github.com/pedronauck/docz/commit/2241f8b)) - **docz-theme-default:** change chevronDown to burguer icon with animation ([8649938](https://github.com/pedronauck/docz/commit/8649938)) - **docz-theme-default:** include breakpoints as const ([43490bb](https://github.com/pedronauck/docz/commit/43490bb)) - **docz-theme-default:** lint code ([7c97a41](https://github.com/pedronauck/docz/commit/7c97a41)) - **docz-theme-default:** made container responsive ([ddf078d](https://github.com/pedronauck/docz/commit/ddf078d)) - **docz-theme-default:** responsive position for wrapper ([bb56449](https://github.com/pedronauck/docz/commit/bb56449)) - **docz-theme-default:** sidebar toggle for links and sub-links ([9cd6321](https://github.com/pedronauck/docz/commit/9cd6321)) ### Features - **docz-theme-default:** add dark mode 🌚 ([#81](https://github.com/pedronauck/docz/issues/81)) ([964cf4d](https://github.com/pedronauck/docz/commit/964cf4d)) - **docz-theme-default:** include breakpoints reactive on sidebar ([d3911b4](https://github.com/pedronauck/docz/commit/d3911b4)) - **docz-theme-default:** include media queries facepaint ([5f78734](https://github.com/pedronauck/docz/commit/5f78734)) - **docz-theme-default:** include toggle to sidebar ([a94e517](https://github.com/pedronauck/docz/commit/a94e517)) - **docz-theme-default:** include ToggleBackground ([cac7ecd](https://github.com/pedronauck/docz/commit/cac7ecd)) - **docz-theme-default:** table responsive ([0580a77](https://github.com/pedronauck/docz/commit/0580a77)) ## [0.2.11](https://github.com/pedronauck/docz/compare/v0.2.10...v0.2.11) (2018-06-22) ### Bug Fixes - **docz-core:** node env for production ([615aa1f](https://github.com/pedronauck/docz/commit/615aa1f)) - **docz-plugin-css:** production build ([1a66d8a](https://github.com/pedronauck/docz/commit/1a66d8a)) - **docz-theme-default:** use webfontloader instead of css import ([5973969](https://github.com/pedronauck/docz/commit/5973969)) - some changes on css examples ([058660f](https://github.com/pedronauck/docz/commit/058660f)) ## [0.2.10](https://github.com/pedronauck/docz/compare/v0.2.9...v0.2.10) (2018-06-21) ### Features - **docz-plugin-css:** add initial version ([#78](https://github.com/pedronauck/docz/issues/78)) ([299372e](https://github.com/pedronauck/docz/commit/299372e)) ## [0.2.9](https://github.com/pedronauck/docz/compare/v0.2.8...v0.2.9) (2018-06-21) **Note:** Version bump only for package undefined ## [0.2.8](https://github.com/pedronauck/docz/compare/v0.2.7...v0.2.8) (2018-06-21) ### Bug Fixes - **docz-core:** typescript resolve extensions ([689b057](https://github.com/pedronauck/docz/commit/689b057)) ## [0.2.7](https://github.com/pedronauck/docz/compare/v0.2.6...v0.2.7) (2018-06-20) ### Bug Fixes - **docz:** typo ([#63](https://github.com/pedronauck/docz/issues/63)) ([6af5db2](https://github.com/pedronauck/docz/commit/6af5db2)) - **docz-plugin-babel6:** documentation for babel plugin ([#60](https://github.com/pedronauck/docz/issues/60)) ([8a14e2a](https://github.com/pedronauck/docz/commit/8a14e2a)) - **docz-plugin-babel6:** readme typo ([b77e986](https://github.com/pedronauck/docz/commit/b77e986)) - **docz-plugin-babel6:** typo ([d2f92b7](https://github.com/pedronauck/docz/commit/d2f92b7)) - **docz-theme-default:** improve spacing on jsx attributes ([#54](https://github.com/pedronauck/docz/issues/54)) ([49fe0b8](https://github.com/pedronauck/docz/commit/49fe0b8)) ## [0.2.6](https://github.com/pedronauck/docz/compare/v0.2.5...v0.2.6) (2018-06-17) ### Bug Fixes - **docz-core:** change filepath entry for windows ([#31](https://github.com/pedronauck/docz/issues/31)) ([14bf0e2](https://github.com/pedronauck/docz/commit/14bf0e2)) ### Features - **docz-example-babel6:** add package ([92ead5a](https://github.com/pedronauck/docz/commit/92ead5a)) - **docz-plugin-babel6:** add package ([68e364a](https://github.com/pedronauck/docz/commit/68e364a)) ## [0.2.5](https://github.com/pedronauck/docz/compare/v0.2.4...v0.2.5) (2018-06-15) ### Bug Fixes - **docz:** add extractTypeDescribedValue to PropsTable ([#38](https://github.com/pedronauck/docz/issues/38)) ([cca862c](https://github.com/pedronauck/docz/commit/cca862c)) - **docz:** PropsTable component ([48638cc](https://github.com/pedronauck/docz/commit/48638cc)) ## [0.2.4](https://github.com/pedronauck/docz/compare/v0.2.3...v0.2.4) (2018-06-13) **Note:** Version bump only for package undefined ## [0.2.3](https://github.com/pedronauck/docz/compare/v0.2.2...v0.2.3) (2018-06-13) ### Bug Fixes - **docz-core:** change config hosts to support windows os ([9e3c4f6](https://github.com/pedronauck/docz/commit/9e3c4f6)) - readme typo ([a13dc3c](https://github.com/pedronauck/docz/commit/a13dc3c)) ## [0.2.2](https://github.com/pedronauck/docz/compare/v0.2.1...v0.2.2) (2018-06-12) **Note:** Version bump only for package undefined ## [0.2.1](https://github.com/pedronauck/docz/compare/v0.2.0...v0.2.1) (2018-06-12) ### Bug Fixes - corrections on readme [#2](https://github.com/pedronauck/docz/issues/2) ([bd1b7a6](https://github.com/pedronauck/docz/commit/bd1b7a6)) - playground component destructuring bug ([#4](https://github.com/pedronauck/docz/issues/4)) ([f9026cf](https://github.com/pedronauck/docz/commit/f9026cf)) - readme typos ([16662eb](https://github.com/pedronauck/docz/commit/16662eb)) # [0.2.0](https://github.com/pedronauck/docz/compare/v0.2.0-beta.2...v0.2.0) (2018-06-11) ### Bug Fixes - readme image ([470b235](https://github.com/pedronauck/docz/commit/470b235)) - readme links ([61de7cd](https://github.com/pedronauck/docz/commit/61de7cd)) - readme links ([f7b1120](https://github.com/pedronauck/docz/commit/f7b1120)) # [0.2.0-beta.2](https://github.com/doczjs/docz/compare/v0.2.0-beta.1...v0.2.0-beta.2) (2018-06-10) ### Bug Fixes - **docz-core:** autolink headings ([0b8369d](https://github.com/doczjs/docz/commit/0b8369d)) # [0.2.0-beta.1](https://github.com/doczjs/docz/compare/v0.2.0-beta.0...v0.2.0-beta.1) (2018-06-10) ### Features - **docz-core:** add headings property for entries and autolink on headings ([7711c3c](https://github.com/doczjs/docz/commit/7711c3c)) # [0.2.0-beta.0](https://github.com/doczjs/docz/compare/v0.1.2-beta.6...v0.2.0-beta.0) (2018-06-10) ### Features - **docz-core:** add indexHtml property on project configuration ([6bb5167](https://github.com/doczjs/docz/commit/6bb5167)) ## [0.1.2-beta.6](https://github.com/doczjs/docz/compare/v0.1.2-beta.5...v0.1.2-beta.6) (2018-06-09) ### Bug Fixes - **docz:** typing definition ([1a3648e](https://github.com/doczjs/docz/commit/1a3648e)) ## [0.1.2-beta.5](https://github.com/doczjs/docz/compare/v0.1.2-beta.4...v0.1.2-beta.5) (2018-06-09) ### Bug Fixes - **docz-core:** build when base prop ([6001171](https://github.com/doczjs/docz/commit/6001171)) - **docz-theme-default:** loading component height ([b198075](https://github.com/doczjs/docz/commit/b198075)) ## [0.1.2-beta.4](https://github.com/doczjs/docz/compare/v0.1.2-beta.3...v0.1.2-beta.4) (2018-06-09) **Note:** Version bump only for package undefined ## [0.1.2-beta.3](https://github.com/doczjs/docz/compare/v0.1.2-beta.2...v0.1.2-beta.3) (2018-06-09) **Note:** Version bump only for package undefined ## [0.1.2-beta.2](https://github.com/doczjs/docz/compare/v0.1.2-beta.1...v0.1.2-beta.2) (2018-06-09) ### Features - **docz:** add support for custom not found route ([455dcca](https://github.com/doczjs/docz/commit/455dcca)) - **docz-theme-default:** add custom not found component ([1773fe1](https://github.com/doczjs/docz/commit/1773fe1)) ## [0.1.2-beta.1](https://github.com/doczjs/docz/compare/v0.1.2-beta.0...v0.1.2-beta.1) (2018-06-09) ### Bug Fixes - **docz-theme-default:** emotion typings ([270e38c](https://github.com/doczjs/docz/commit/270e38c)) ### Features - **docz:** add loading component setting for loadable ([4352ce3](https://github.com/doczjs/docz/commit/4352ce3)) - **docz-core:** add base config argument ([20f29c2](https://github.com/doczjs/docz/commit/20f29c2)) - **docz-core:** add dest config property ([d6c5506](https://github.com/doczjs/docz/commit/d6c5506)) - **docz-core:** add modifyBundlerConfig configuration property ([ec04bee](https://github.com/doczjs/docz/commit/ec04bee)) - **docz-core:** use html template as component ([b7a2dc0](https://github.com/doczjs/docz/commit/b7a2dc0)) - **docz-theme-default:** add Loading component for DocPreview ([97859e2](https://github.com/doczjs/docz/commit/97859e2)) ## [0.1.2-beta.0](https://github.com/doczjs/docz/compare/v0.1.1...v0.1.2-beta.0) (2018-06-02) **Note:** Version bump only for package undefined ## [0.1.1-beta.6](https://github.com/doczjs/docz/compare/v0.1.1-beta.5...v0.1.1-beta.6) (2018-06-01) ### Bug Fixes - **docz:** add docz-theme-default as dependecy ([0dff6c0](https://github.com/doczjs/docz/commit/0dff6c0)) ## [0.1.1-beta.5](https://github.com/doczjs/docz/compare/v0.1.1-beta.4...v0.1.1-beta.5) (2018-06-01) ### Bug Fixes - **docz:** link component ([7626982](https://github.com/doczjs/docz/commit/7626982)) - **load-cfg:** add namedExports options ([d36194d](https://github.com/doczjs/docz/commit/d36194d)) ### Features - **load-cfg:** add esm module loader ([12a7610](https://github.com/doczjs/docz/commit/12a7610)) ## [0.1.1-beta.4](https://github.com/doczjs/docz/compare/v0.1.1-beta.3...v0.1.1-beta.4) (2018-05-29) ### Bug Fixes - **docz:** add isActive to Link components ([9cecc08](https://github.com/doczjs/docz/commit/9cecc08)) - **docz-core:** module rule test for typescript ([bdeffc1](https://github.com/doczjs/docz/commit/bdeffc1)) ## [0.1.1-beta.3](https://github.com/doczjs/docz/compare/v0.1.1-beta.2...v0.1.1-beta.3) (2018-05-29) **Note:** Version bump only for package undefined ## [0.1.1-beta.2](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.2) (2018-05-29) ### Bug Fixes - **docz:** set docz-core as dependency ([6c257e8](https://github.com/doczjs/docz/commit/6c257e8)) ## [0.1.1-beta.1](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2018-05-29) **Note:** Version bump only for package undefined ## [0.1.1-beta.0](https://github.com/doczjs/docz/compare/v0.1.0...v0.1.1-beta.0) (2018-05-29) ### Bug Fixes - **docz:** add bin folder for npm publish ([f463a98](https://github.com/doczjs/docz/commit/f463a98)) # 0.1.0 (2018-05-29) ### Bug Fixes - **docz:** Docs render props orders and types ([d7e9ee2](https://github.com/doczjs/docz/commit/d7e9ee2)) - **docz:** docs categories for themes ([687720c](https://github.com/doczjs/docz/commit/687720c)) - **docz:** flow props parser integration ([5a83610](https://github.com/doczjs/docz/commit/5a83610)) - **docz:** validate route passed for docs.route() ([48a0484](https://github.com/doczjs/docz/commit/48a0484)) - **docz-core:** async plugin ([ddfbcf1](https://github.com/doczjs/docz/commit/ddfbcf1)) - **docz-core:** check if found name exist when parse entry ([f75881e](https://github.com/doczjs/docz/commit/f75881e)) - **docz-core:** config watch for directory operations ([43fa7ab](https://github.com/doczjs/docz/commit/43fa7ab)) - **docz-core:** create plugin to fix paragraph parse on mdx ([42b4f05](https://github.com/doczjs/docz/commit/42b4f05)) - **docz-core:** data server class ([12c0558](https://github.com/doczjs/docz/commit/12c0558)) - **docz-core:** don't exit when catch prettier ([5423d96](https://github.com/doczjs/docz/commit/5423d96)) - **docz-core:** entries filepath ([e45fea0](https://github.com/doczjs/docz/commit/e45fea0)) - webpack errors message ([90f6064](https://github.com/doczjs/docz/commit/90f6064)) - **docz-core:** entries rewrite ([986ba65](https://github.com/doczjs/docz/commit/986ba65)) - **docz-core:** entries updates ([7147ac1](https://github.com/doczjs/docz/commit/7147ac1)) - **docz-core:** packages splitting ([d2e74ee](https://github.com/doczjs/docz/commit/d2e74ee)) - **docz-core:** templates files ([a5cda97](https://github.com/doczjs/docz/commit/a5cda97)) - **docz-core:** throw error when parse ast ([05138bf](https://github.com/doczjs/docz/commit/05138bf)) - **docz-example-basic:** package name ([dec5713](https://github.com/doczjs/docz/commit/dec5713)) ### Features - **docz-core:** add title and description on settings ([ad9ee58](https://github.com/doczjs/docz/commit/ad9ee58)) - add basic monorepo structure ([5a977ed](https://github.com/doczjs/docz/commit/5a977ed)) - **docz:** add a mvp version of project ([05ac064](https://github.com/doczjs/docz/commit/05ac064)) - **docz:** add components parser ([a4127d9](https://github.com/doczjs/docz/commit/a4127d9)) - **docz:** add custom routes for docs ([8458d91](https://github.com/doczjs/docz/commit/8458d91)) - **docz:** add doc page wrapper as component ([1150373](https://github.com/doczjs/docz/commit/1150373)) - **docz:** add groups feature ([9652b30](https://github.com/doczjs/docz/commit/9652b30)) - **docz:** add module declarations for typescript ([ae597af](https://github.com/doczjs/docz/commit/ae597af)) - **docz:** add routes from parsed entries ([fc37f73](https://github.com/doczjs/docz/commit/fc37f73)) - **docz:** add some improvements for default package ([51188d4](https://github.com/doczjs/docz/commit/51188d4)) - **docz:** make server bundler api concise ([ae5f0c0](https://github.com/doczjs/docz/commit/ae5f0c0)) - **docz:** some refactors ([7f6660c](https://github.com/doczjs/docz/commit/7f6660c)) - **docz:** use webpack 4 instead of parcel ([1e5742c](https://github.com/doczjs/docz/commit/1e5742c)) - **docz-bundler-webpack:** add bundler as package ([d7be8a9](https://github.com/doczjs/docz/commit/d7be8a9)) - **docz-bundler-webpack:** improve webpack config ([964832a](https://github.com/doczjs/docz/commit/964832a)) - **docz-core:** add basic plugin logic ([add17ad](https://github.com/doczjs/docz/commit/add17ad)) - **docz-core:** add build command ([ef7abd2](https://github.com/doczjs/docz/commit/ef7abd2)) - **docz-core:** add chokidar to watch new entries ([2f073d5](https://github.com/doczjs/docz/commit/2f073d5)) - **docz-core:** add entry settings field ([2ec5d66](https://github.com/doczjs/docz/commit/2ec5d66)) - **docz-core:** add hot reload ([9ebe65d](https://github.com/doczjs/docz/commit/9ebe65d)) - **docz-core:** add playground code parse section ([6bbf158](https://github.com/doczjs/docz/commit/6bbf158)) - **docz-core:** add setConfig method for Plugin ([9ba6507](https://github.com/doczjs/docz/commit/9ba6507)) - **docz-core:** add some improvements to work with server config ([8bf33bc](https://github.com/doczjs/docz/commit/8bf33bc)) - **docz-core:** add support for custom head or scripts ([69f4d56](https://github.com/doczjs/docz/commit/69f4d56)) - **docz-core:** add support for load custom themes ([ade98ce](https://github.com/doczjs/docz/commit/ade98ce)) - **docz-core:** add support for parse sections via ast ([6db0cd8](https://github.com/doczjs/docz/commit/6db0cd8)) - **docz-core:** add template using art-template ([7484267](https://github.com/doczjs/docz/commit/7484267)) - **docz-core:** add typescript support ([17dae8b](https://github.com/doczjs/docz/commit/17dae8b)) - **docz-core:** improve plugin and add support to modify babel ([cf3ec4e](https://github.com/doczjs/docz/commit/cf3ec4e)) - **docz-core:** pass theme config via websockets for dev ([5222de7](https://github.com/doczjs/docz/commit/5222de7)) - **docz-core:** set babel on the fly ([672be49](https://github.com/doczjs/docz/commit/672be49)) - **docz-core:** split bundler logic ([a7db904](https://github.com/doczjs/docz/commit/a7db904)) - **docz-core:** use websockets instead of generate json to process entries ([e0773a0](https://github.com/doczjs/docz/commit/e0773a0)) - **docz-core:** webpack middlewares ([68cbcba](https://github.com/doczjs/docz/commit/68cbcba)) - **docz-example-flow:** add example folder ([27002d8](https://github.com/doczjs/docz/commit/27002d8)) - refac to use mdx ([04b59e5](https://github.com/doczjs/docz/commit/04b59e5)) - **docz-example-typescript:** add new example ([9052d0f](https://github.com/doczjs/docz/commit/9052d0f)) - **docz-theme-default:** add default theme as a package ([108dc4c](https://github.com/doczjs/docz/commit/108dc4c)) - **docz-theme-default:** add highlight code on theme ([1126e67](https://github.com/doczjs/docz/commit/1126e67)) - **docz-theme-default:** add logo option ([435da9b](https://github.com/doczjs/docz/commit/435da9b)) - **docz-theme-default:** add sidebar footer ([ffc4b18](https://github.com/doczjs/docz/commit/ffc4b18)) - **docz-theme-default:** add tooltip on props ([dc3c4cd](https://github.com/doczjs/docz/commit/dc3c4cd)) - **docz-theme-default:** improve theme styles ([2ca5e21](https://github.com/doczjs/docz/commit/2ca5e21)) - **docz-theme-default:** start logic to create theme feature ([900cf2b](https://github.com/doczjs/docz/commit/900cf2b)) - **docz-theme-default:** use typescript instead of javascript ([4de326a](https://github.com/doczjs/docz/commit/4de326a)) - use custom render method on section ([8ccf99c](https://github.com/doczjs/docz/commit/8ccf99c)) - **load-cfg:** add script as package ([11e409c](https://github.com/doczjs/docz/commit/11e409c)) - **load-cfg:** set cache to require file ([c49fc64](https://github.com/doczjs/docz/commit/c49fc64)) - add component props parse feature ([987627d](https://github.com/doczjs/docz/commit/987627d)) - add support for highlight code sections ([19bf7ea](https://github.com/doczjs/docz/commit/19bf7ea)) - improve docz theme to use theme config ([9207ed2](https://github.com/doczjs/docz/commit/9207ed2)) - parse doc class to object ([e7f9cf0](https://github.com/doczjs/docz/commit/e7f9cf0)) ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at pedronauck@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR! ## Pre-requisites - _Node:_ `^9.0.0` or higher. - _Npm:_ `6.0.0` or higher. - _Yarn:_ `^1.7.0` or higher. ## Getting started Clone the project from Github : ```sh git clone git@github.com:doczjs/docz.git cd docz ``` Install dependencies : ```sh yarn ``` Setup development environment: ```sh yarn dev ``` That's it you're ready to start contributing 👍! The example docz app is in `dev-env/basic` and runs on `http://localhost:3000` You can change any of the core packages and see the effect or edit the mdx and jsx in `dev-env/basic` ### What does `yarn dev` do ? 1. Builds and watches all core docz packages. 2. Copies build output to local dev-env node_modules on every change. 3. Runs a docz app on `http://localhost:3000/` that listens to changes of docz packages' build output. ### Other questions or concerns ? Feel free to join [our contributors' slack channel](https://join.slack.com/t/docz-workspace/shared_invite/enQtNzc4ODc2ODA3NzUxLWI0ZmYwY2NhNjhkNDFjN2UzYzlmMDcwZjQyZGY4MWQ1NmQwZDVlZDE4MmE3N2I4MWRjZTAxZjY4ODk4NGMzZjg) for longer form discussion. ## Developing ### Project structure docz follows the [Monorepo](https://en.wikipedia.org/wiki/Monorepo) design managed by [Lerna](https://github.com/lerna/lerna). The are just two directories to care about if you would like to contribute: - **Packages**: Host all docz source code. - **Examples**: Host all available usage examples. #### Packages There are lots of [packages](https://github.com/pedronauck/docz/tree/master/core) that are necessary to run docz, the most important packages that are important to care about: #### **[docz-core](https://github.com/pedronauck/docz/tree/master/core/docz-core)** - This is the core of docz. All build algorithms, server process and parses belongs to here. - If you break this package, probably you'll break all packages! Please, be careful. - All CLI commands are built here and imported on `docz` package using `./bin` script. - Do not create scripts that run on browser here, only node scripts. #### **[docz](https://github.com/pedronauck/docz/tree/master/core/docz)** - Main and top level package. - Scripts that run on browser belongs to this package - Built-ins components are built here, most specifically on [this folder](https://github.com/pedronauck/docz/tree/master/core/docz/src/components) - This package shouldn't have any component style, just boilerplate and logic! ### Creating plugins If there are some plugins that you want to create, please contact me before to talk about the possibility to make this plugin official! ## Commit messages Commit messages should follow the [commit message convention](https://conventionalcommits.org/) so, changelogs could be generated automatically by that. Commit messages are validated automatically upon commit. If you aren't familiar with the commit message convention, you can use yarn commit (or `npm run commit`) instead of git commit, which provides an interactive CLI for generating proper commit messages. ### Pull Requests - Work in the **src** folder of a respective package and **DO NOT** check `dist` in the commits. - It's OK - and a very nice thing - to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging. ### If adding a new feature: - Make sure that [all examples](https://github.com/pedronauck/docz/tree/master/examples) are running as expected - Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it. ## Contributors This project exists thanks to all the people who contribute. ================================================ FILE: LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: MIGRATION_GUIDE.md ================================================ # Migration Guide The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes to our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version. It’s not a big deal, but you will need to follow this guide in order to get Docz running properly on your project after the upgrade. ## Gatsby as default bundler The biggest change in the new v2 is that our core is now entirely built using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on building new features instead of handling a lot of bundlers issues (our biggest bottleneck) and leverage the entire Gatsby ecosystem. So, in order to refactor our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system. ### List of removed properties from `doczrc.js` * **`websocketHost`** ▶︎ _no longer need_ * **`websocketPort`** ︎︎︎▶︎ _no longer need_ * **`wrapper`** ▶︎ _removed_ * **`theme`** ▶︎ _removed_ * **`indexHtml`** ▶︎ _removed_ * **`codeSandbox`** ▶︎ _removed_ * **`onCreateWebpackChain`** ▶︎ _removed_ * **`modifyBundlerConfig`** ▶︎ use Gatsby [`onCreateWebpackConfig`](https://www.gatsbyjs.org/docs/node-apis/#onCreateWebpackConfig) hook * **`modifyBabelRc`** ▶︎ use Gatsby [`onCreateBabelConfig`](https://www.gatsbyjs.org/docs/node-apis/#onCreateBabelConfig) hook ## New hooks for plugins The `createPlugin` method also changed in order to fit with Gatsby now. ### List of removed/changed properties from `createPlugin()` * **`modifyBundlerConfig`** ▶︎ `onCreateWebpackConfig` * **`modifyBabelRc`** ▶︎ `onCreateBabelConfig` * **`onCreateApp`** ▶︎ `onCreateDevServer` * **`onPreCreateApp`** ▶︎ _removed_ * **`onServerListening`** ▶︎ _removed_ * **`onPreRender`** ▶︎ _removed_ * **`onPostRender`** ▶︎ _removed_ > All methods that changed now are using the same API as Gatsby hooks. > You can have more details about then [here](https://www.gatsbyjs.org/docs/node-apis). ## `docz-theme-default` removed Make sure to remove `docz-theme-default` from your dependencies when migrating : ```sh yarn remove docz-theme-default # npm uninstall docz-theme-default ``` The main reason that made us change our core to use Gatsby is that they have added a feature called themes. In the last major version we launched our own Gatsby theme `gatsby-theme-docz` and this was a huge step forward because we can now use Docz inside a Gatsby project and bring a lot of new possibilities when creating documentation. One of the best benefits of Gatsby themes is a feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people very often ask, for example: “I want just to change the head in the Docz theme”. In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` to your project. Check [here](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz#customizing-components) for more information about customizing the Gatsby theme. ### Code highlight with PrismJS In the last version of Docz we used Codemirror to highlight code inside `` and code blocks. Starting from v2 docz uses [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI. Check [here](https://github.com/FormidableLabs/prism-react-renderer) for more information. ### New `themeConfig` properties Another great thing launched in the newest version is the integration with [Theme UI](https://theme-ui.com). Theme UI is a library for building consistent, themeable React apps based on constraint-based design principles. So, in order to integrate it with our new theme, a lot of changes have been made inside the `themeConfig` object. ## `theme` property removed The property used to define your Docz theme inside the `doczrc.js` was removed. But you can still create and use your own theme from scratch if you want. If you want to use your own theme, just create a file called `src/gatsby-theme-docz/index.js` in order to use component shadowing and replace it with your new theme. ```js // src/gatsby-theme-docz/index.js import React from 'react' import Theme from './my-custom-theme' export default (props) => ``` Check [here](https://www.docz.site/docs/creating-your-themes) for more information about how to create themes. ## `wrapper` property removed The same thing happened here for the oldest `wrapper` property. Now you can wrap your entire application by just creating a file called `src/gatsby-theme-docz/wrapper.js` ```js // src/gatsby-theme-docz/index.js import React from 'react' export default ({ children }) => (

My custom wrapper

{children}
) ``` ## CSS preprocessors managed by gatsby CSS preprocessors and modules were handled by [`docz-plugin-css`](https://github.com/doczjs/docz-plugin-css) which hooked into the bundler config to add different loader support via webpack. With the change to gatsby, css preprocessors like `sass` can be handled by gatsby via [Plugins](https://www.gatsbyjs.org/plugins/) These plugins are added by adding a `gatsby-config.js` in your project root or modifying an existing one. For example if you want to add support for `sass` you would do the following: 1. Install [`node-sass`](https://github.com/sass/node-sass) and [`gatsby-plugin-sass`](https://www.gatsbyjs.org/packages/gatsby-plugin-sass/) ```bash # npm npm install --save node-sass gatsby-plugin-sass # yarn yarn add node-sass gatsby-plugin-sass ``` 2. Add the plugin to your `gatsby-config.js` ```js //gatsby-config.js module.exports = { plugins: ['gatsby-plugin-sass'] } ``` ================================================ FILE: README.md ================================================ # Docz Docz makes it easy to write and publish beautiful interactive documentation for your code. Create MDX files showcasing your code and Docz turns them into a live-reloading, production-ready site. ## Why? Documenting code is one of the most important and time-consuming tasks when developing software. A lot of time is spent on building and maintaining custom documentation sites. Docz enables you to quickly create a live-reloading, SEO-friendly, production-ready documentation site with MDX and customize the look, feel and behavior when required by leveraging [GatsbyJS](https://www.gatsbyjs.org) and [Gatsby theme shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/). ## Getting started Start by adding `docz` as a dependency to your project with Yarn or npm: ```bash $ yarn add docz # react react-dom # or $ npm install docz # react react-dom ``` > **Note**: `react` and `react-dom` will not be installed automatically. You'll have to install them yourself. Then, create `.mdx` files anywhere in your project: ```mdx --- name: Button route: / --- import { Playground, Props } from 'docz' import Button from './Button' # Button ## Basic usage ``` And a Button component `Button.jsx`: ```typescript import React from 'react' import t from 'prop-types' const Button = ({ children, type }) => Button.propTypes = { /** * This is a description for this prop. * Button type. */ type: t.oneOf(['button', 'submit', 'reset']), } Button.defaultProps = { type: 'button', } export default Button ``` Finally, run: ```bash yarn docz dev ``` This starts a local development server and opens your documentation site in the browser. ## Build `yarn docz build` generates a static site in `.docz/dist/`. Try it with `yarn docz serve` or by serving the generated site with your favorite static file server (e.g. `npx serve .docz/dist`). You can have `yarn docz build` emit to a different directory by providing a path to the `dest` field in your `doczrc.js` or from the command line: `yarn docz build --dest docs-site-directory`. ## Deploying The output of docz consists of static assets only. This allows you to deploy your generated `docz` site with any static site hosting provider you'd like. Start by building your site with `yarn docz build`, if you haven't provided a `dest` flag to your config then you will find your generated files in `.docz/dist` to copy to the server. ## Examples - **[with basic](https://github.com/doczjs/docz/tree/main/examples/basic)** - **[with a gatsby site](https://github.com/doczjs/docz/tree/main/examples/gatsby)** - **[with react native](https://github.com/doczjs/docz/tree/main/examples/react-native)** - **[with styled-components](https://github.com/doczjs/docz/tree/main/examples/styled-components)** - **[with typescript](https://github.com/doczjs/docz/tree/main/examples/typescript)** - **[with algolia search](https://github.com/doczjs/docz/tree/main/examples/with-algolia-search)** - **[with gatsby-remark-vscode](https://github.com/doczjs/docz/tree/main/examples/with-gatsby-remark-vscode)** - **[with react-router](https://github.com/doczjs/docz/tree/main/examples/react-router)** - **[with flow](https://github.com/doczjs/docz/tree/main/examples/flow)** - **[with images](https://github.com/doczjs/docz/tree/main/examples/images)** - **[with sass](https://github.com/doczjs/docz/tree/main/examples/sass)** - **[with less](https://github.com/doczjs/docz/tree/main/examples/less)** - **[with stylus](https://github.com/doczjs/docz/tree/main/examples/css-stylus)** - **with css modules**: works out of the box. ### You can check the complete list of docz examples [here](https://github.com/doczjs/docz/tree/main/examples). ## Used by - **[Welcome UI](https://welcome-ui.com/)**: Customizable design system with react • styled-components • styled-system and reakit. - **[React Hooks Testing Library](https://react-hooks-testing-library.com/)**: 🐏 Simple and complete React hooks testing utilities that encourage good testing practices. - **[Mobx React](https://mobx-react.js.org/)**: mobx-react documentation site. - **[React Google Charts](https://react-google-charts.com/)**: A thin, typed, React wrapper over Google Charts Visualization and Charts API. - **[Entur](https://developer.entur.org/)**: Entur operates the national registry for all public transport in Norway. - **[FAB Specification](https://fab.dev/)**: 💎 FABs are a compile target for frontend applications. - **[@umijs/hooks](https://hooks.umijs.org/)**: React Hooks Library. - **[React Yandex Maps](https://react-yandex-maps.now.sh/)**: Yandex Maps API bindings for React. - **[Components-extra](https://components-extra.netlify.com)**: Customizable react component blocks built with material-ui and styled-components. - **[Add your site](https://github.com/doczjs/docz/edit/main/README.md)** ## Contributors This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. ## Contributing All kinds of contributions are very welcome and appreciated! If you want to contribute time to docz then here's a list of suggestions to get you started: 1. Star the project on GitHub. 2. Help people in the [issues](https://github.com/doczjs/docz/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) by sharing your knowledge and experience. 3. Find and report issues. 4. Submit pull requests to help solve issues or add features. 5. Influence the future of docz with feature requests. If you're looking for a place to start make sure to check issues tagged with the `good first issue` label: [![Good First Issue](https://img.shields.io/github/issues/doczjs/docz/good%20first%20issue.svg)](https://github.com/doczjs/docz/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) Read the [Contributing Guide](/CONTRIBUTING.md) before you open a pull request. You can also sponsor us via OpenCollective to help secure docz's future.

Open Collective

================================================ FILE: core/docz/.babelrc ================================================ { "plugins": ["@babel/plugin-syntax-dynamic-import", "lodash"] } ================================================ FILE: core/docz/.eslintignore ================================================ dist ================================================ FILE: core/docz/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: core/docz/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: core/docz/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) ## [2.3.2-alpha.0](https://github.com/doczjs/docz/compare/v2.3.1...v2.3.2-alpha.0) (2020-04-07) **Note:** Version bump only for package docz ## [2.3.1](https://github.com/doczjs/docz/compare/v2.3.1-alpha.0...v2.3.1) (2020-04-05) **Note:** Version bump only for package docz ## [2.3.1-alpha.0](https://github.com/doczjs/docz/compare/v2.3.0...v2.3.1-alpha.0) (2020-04-05) **Note:** Version bump only for package docz # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package docz # [2.3.0-alpha.14](https://github.com/doczjs/docz/compare/v2.3.0-alpha.13...v2.3.0-alpha.14) (2020-03-31) **Note:** Version bump only for package docz # [2.3.0-alpha.13](https://github.com/doczjs/docz/compare/v2.3.0-alpha.12...v2.3.0-alpha.13) (2020-02-13) ### Bug Fixes * **docz:** pass useScoping to theme Playground ([6ec7315](https://github.com/doczjs/docz/commit/6ec7315)), closes [#1390](https://github.com/doczjs/docz/issues/1390) # [2.3.0-alpha.12](https://github.com/doczjs/docz/compare/v2.3.0-alpha.11...v2.3.0-alpha.12) (2020-02-12) **Note:** Version bump only for package docz # [2.3.0-alpha.11](https://github.com/doczjs/docz/compare/v2.3.0-alpha.10...v2.3.0-alpha.11) (2020-02-07) **Note:** Version bump only for package docz # [2.3.0-alpha.10](https://github.com/doczjs/docz/compare/v2.3.0-alpha.9...v2.3.0-alpha.10) (2020-02-06) **Note:** Version bump only for package docz # [2.3.0-alpha.9](https://github.com/doczjs/docz/compare/v2.3.0-alpha.8...v2.3.0-alpha.9) (2020-02-06) ### Bug Fixes * **docz:** fix capitalization of ts interfaces ([9e950eb](https://github.com/doczjs/docz/commit/9e950eb)) # [2.3.0-alpha.8](https://github.com/doczjs/docz/compare/v2.3.0-alpha.7...v2.3.0-alpha.8) (2020-02-06) **Note:** Version bump only for package docz # [2.3.0-alpha.7](https://github.com/doczjs/docz/compare/v2.3.0-alpha.6...v2.3.0-alpha.7) (2020-02-04) ### Features * add hook to find docgen props ([#1371](https://github.com/doczjs/docz/issues/1371)) ([8fffa26](https://github.com/doczjs/docz/commit/8fffa26)) # [2.3.0-alpha.6](https://github.com/doczjs/docz/compare/v2.3.0-alpha.5...v2.3.0-alpha.6) (2020-01-02) **Note:** Version bump only for package docz # [2.3.0-alpha.5](https://github.com/doczjs/docz/compare/v2.3.0-alpha.4...v2.3.0-alpha.5) (2019-12-17) **Note:** Version bump only for package docz # [2.3.0-alpha.4](https://github.com/doczjs/docz/compare/v2.3.0-alpha.3...v2.3.0-alpha.4) (2019-12-16) **Note:** Version bump only for package docz # [2.3.0-alpha.3](https://github.com/doczjs/docz/compare/v2.3.0-alpha.2...v2.3.0-alpha.3) (2019-12-16) **Note:** Version bump only for package docz # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) ### Features * **docz-core:** support kebab & pascal case component file name pattern ([#1314](https://github.com/doczjs/docz/issues/1314)) ([9d5b129](https://github.com/doczjs/docz/commit/9d5b129)) # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) **Note:** Version bump only for package docz # [2.3.0-alpha.0](https://github.com/doczjs/docz/compare/v2.2.1-alpha.1...v2.3.0-alpha.0) (2019-12-12) **Note:** Version bump only for package docz ## [2.2.1-alpha.1](https://github.com/doczjs/docz/compare/v2.2.1-alpha.0...v2.2.1-alpha.1) (2019-12-12) **Note:** Version bump only for package docz ## [2.2.1-alpha.0](https://github.com/doczjs/docz/compare/v2.2.0...v2.2.1-alpha.0) (2019-12-11) **Note:** Version bump only for package docz # [2.2.0](https://github.com/doczjs/docz/compare/v2.2.0-alpha.8...v2.2.0) (2019-12-11) **Note:** Version bump only for package docz # [2.2.0-alpha.8](https://github.com/doczjs/docz/compare/v2.2.0-alpha.7...v2.2.0-alpha.8) (2019-12-06) **Note:** Version bump only for package docz # [2.2.0-alpha.7](https://github.com/doczjs/docz/compare/v2.2.0-alpha.6...v2.2.0-alpha.7) (2019-12-03) **Note:** Version bump only for package docz # [2.2.0-alpha.6](https://github.com/doczjs/docz/compare/v2.2.0-alpha.5...v2.2.0-alpha.6) (2019-12-03) **Note:** Version bump only for package docz # [2.2.0-alpha.5](https://github.com/doczjs/docz/compare/v2.2.0-alpha.4...v2.2.0-alpha.5) (2019-12-01) **Note:** Version bump only for package docz # [2.2.0-alpha.4](https://github.com/doczjs/docz/compare/v2.2.0-alpha.3...v2.2.0-alpha.4) (2019-11-30) **Note:** Version bump only for package docz # [2.2.0-alpha.3](https://github.com/doczjs/docz/compare/v2.2.0-alpha.2...v2.2.0-alpha.3) (2019-11-29) **Note:** Version bump only for package docz # [2.2.0-alpha.2](https://github.com/doczjs/docz/compare/v2.2.0-alpha.1...v2.2.0-alpha.2) (2019-11-29) **Note:** Version bump only for package docz # [2.2.0-alpha.1](https://github.com/doczjs/docz/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2019-11-28) **Note:** Version bump only for package docz # [2.2.0-alpha.0](https://github.com/doczjs/docz/compare/v2.1.1...v2.2.0-alpha.0) (2019-11-28) **Note:** Version bump only for package docz ## [2.1.1](https://github.com/doczjs/docz/compare/v2.1.0...v2.1.1) (2019-11-27) **Note:** Version bump only for package docz # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) ### Bug Fixes * **docz:** remove lowercasing of enum ts prop type ([8f7b949](https://github.com/doczjs/docz/commit/8f7b949)) ### Features * **docz:** spread remaining props to Props component ([#1276](https://github.com/doczjs/docz/issues/1276)) ([531244f](https://github.com/doczjs/docz/commit/531244f)) * **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) * **docz-core:** remove installation step in .docz 🎉 ([4d01ead](https://github.com/pedronauck/docz/commit/4d01ead)) # [2.0.0-rc.33](https://github.com/pedronauck/docz/compare/v2.0.0-rc.32...v2.0.0-rc.33) (2019-09-04) ### Features * **docz-core:** remove installation step in .docz 🎉 ([6790179](https://github.com/pedronauck/docz/commit/6790179)) # [2.0.0-rc.32](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.32) (2019-09-04) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) # [2.0.0-rc.31](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.31) (2019-09-03) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) <<<<<<< HEAD # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-02) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) ======= # [2.0.0-rc.29](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.29) (2019-09-03) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-03) > > > > > > > v2.0.0-rc.29 ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) # [2.0.0-rc.27](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.27) (2019-09-02) ### Bug Fixes - **docz:** add @emotion/core dependency ([52126df](https://github.com/pedronauck/docz/commit/52126df)) - **docz:** better default playground component ([80b1c66](https://github.com/pedronauck/docz/commit/80b1c66)) - **docz:** bump docz-core version ([c56e0c6](https://github.com/pedronauck/docz/commit/c56e0c6)) - **docz:** initialize components context with defaultComponents ([a808795](https://github.com/pedronauck/docz/commit/a808795)) - **docz:** use playground from docz-components ([52874c4](https://github.com/pedronauck/docz/commit/52874c4)) - **docz-components:** fix syntax highlighting in Playground ([c72c575](https://github.com/pedronauck/docz/commit/c72c575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-component:** initialize ([73fafd1](https://github.com/pedronauck/docz/commit/73fafd1)) # [2.0.0-rc.9](https://github.com/pedronauck/docz/compare/v2.0.0-rc.7...v2.0.0-rc.9) (2019-08-30) ### Bug Fixes - **docz:** better default playground component ([f90d7a9](https://github.com/pedronauck/docz/commit/f90d7a9)) - **docz:** bump docz-core version ([f60fce8](https://github.com/pedronauck/docz/commit/f60fce8)) # [2.0.0-rc.7](https://github.com/pedronauck/docz/compare/v2.0.0-rc.6...v2.0.0-rc.7) (2019-08-29) ### Bug Fixes - **docz:** initialize components context with defaultComponents ([ceaafea](https://github.com/pedronauck/docz/commit/ceaafea)) # [2.0.0-rc.6](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.6) (2019-08-29) **Note:** Version bump only for package docz # [2.0.0-rc.2](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-08-28) ### Bug Fixes - **docz:** make scheduler dependency explicit ([84918d8](https://github.com/pedronauck/docz/commit/84918d8)) - **docz:** remove window check from useCurrentDoc fixes [#985](https://github.com/pedronauck/docz/issues/985) ([#1023](https://github.com/pedronauck/docz/issues/1023)) ([b90ea82](https://github.com/pedronauck/docz/commit/b90ea82)) # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes - bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) - **docz:** component Props false positives when looking in state ([baa9bb3](https://github.com/pedronauck/docz/commit/baa9bb3)) - **docz:** parse description of props ([0672c3e](https://github.com/pedronauck/docz/commit/0672c3e)) - **docz:** props markdown compiler ([99ba83c](https://github.com/pedronauck/docz/commit/99ba83c)) - eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) - packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) - remove react & react-dom from dependencies [#924](https://github.com/pedronauck/docz/issues/924) ([faf4288](https://github.com/pedronauck/docz/commit/faf4288)) ### Features - a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) - add markdown parsing on props description ([1087539](https://github.com/pedronauck/docz/commit/1087539)) - **gatsby-theme-docz:** add new Props component ([8eb780d](https://github.com/pedronauck/docz/commit/8eb780d)) - add main package improvements ([8c8005d](https://github.com/pedronauck/docz/commit/8c8005d)) - add new theme sidebar ([a01d100](https://github.com/pedronauck/docz/commit/a01d100)) - add typescript support (need fix) ([13947f9](https://github.com/pedronauck/docz/commit/13947f9)) - docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package docz # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) ### Bug Fixes - correct props loading ([#836](https://github.com/pedronauck/docz/issues/836)) ([ed85f14](https://github.com/pedronauck/docz/commit/ed85f14)) - **docz:** non latin menu headings ([#840](https://github.com/pedronauck/docz/issues/840)) ([80b186c](https://github.com/pedronauck/docz/commit/80b186c)) - **docz-core:** prevent watch in production ([d673262](https://github.com/pedronauck/docz/commit/d673262)) ### Features - **docz-core:** extended path configuration for docgen ([#846](https://github.com/pedronauck/docz/issues/846)) ([aa96739](https://github.com/pedronauck/docz/commit/aa96739)) - **docz-theme-default:** add options to the props component ([#823](https://github.com/pedronauck/docz/issues/823)) ([9edaac8](https://github.com/pedronauck/docz/commit/9edaac8)) ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) ### Bug Fixes - **docz-rollup:** fixed rollup configs to be Windows tolerant ([#812](https://github.com/pedronauck/docz/issues/812)) ([10f6bfd](https://github.com/pedronauck/docz/commit/10f6bfd)) - **docz-theme-default:** logo link point to dynamic base ([#815](https://github.com/pedronauck/docz/issues/815)) ([f7cc750](https://github.com/pedronauck/docz/commit/f7cc750)) ## [1.0.3](https://github.com/pedronauck/docz/compare/v1.0.2...v1.0.3) (2019-04-15) ### Bug Fixes - **docz:** props parser for build ([31612e7](https://github.com/pedronauck/docz/commit/31612e7)) ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) ### Bug Fixes - window check ([cfbda29](https://github.com/pedronauck/docz/commit/cfbda29)) ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package docz # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) ### Bug Fixes - **docz:** crash using suspense ([315f7ad](https://github.com/pedronauck/docz/commit/315f7ad)) - **docz-core:** typescript doesn't work with several exports ([#771](https://github.com/pedronauck/docz/issues/771)) ([c96878d](https://github.com/pedronauck/docz/commit/c96878d)) # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes - remove modularized lodash packages ([d81c568](https://github.com/pedronauck/docz/commit/d81c568)) - **docz:** incompatible props on Link ([281cb13](https://github.com/pedronauck/docz/commit/281cb13)) - **docz-core:** base prop for router ([9ca39d7](https://github.com/pedronauck/docz/commit/9ca39d7)) # [1.0.0-rc.3](https://github.com/pedronauck/docz/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2019-03-21) **Note:** Version bump only for package docz # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package docz # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes - **docz:** remove null return on routes ([5bbbbb3](https://github.com/pedronauck/docz/commit/5bbbbb3)) - gatsby theme fixes ([dcc5f19](https://github.com/pedronauck/docz/commit/dcc5f19)) - **docz:** add window check to useWindowSize hook ([#669](https://github.com/pedronauck/docz/issues/669)) ([e4d7cb4](https://github.com/pedronauck/docz/commit/e4d7cb4)) - **docz:** merge menus on useMenus ([af4afe2](https://github.com/pedronauck/docz/commit/af4afe2)) - **docz:** merge new config for useConfig hook ([c63bbc8](https://github.com/pedronauck/docz/commit/c63bbc8)) - **docz:** remove config conditional from hooks ([6b6f134](https://github.com/pedronauck/docz/commit/6b6f134)) - a lot of bug fixes ([c10a8bd](https://github.com/pedronauck/docz/commit/c10a8bd)) - prop types parser ([a3cc319](https://github.com/pedronauck/docz/commit/a3cc319)) - scroll to anchor if url has hash ([389577f](https://github.com/pedronauck/docz/commit/389577f)) - some general adjustments ([0c61f64](https://github.com/pedronauck/docz/commit/0c61f64)) - use lodash merge instead of deepmerge ([18ac37b](https://github.com/pedronauck/docz/commit/18ac37b)) - **docz:** optional opts for useMenus() ([571ffcd](https://github.com/pedronauck/docz/commit/571ffcd)) - **docz:** remove deduplicated search results (thanks [@ivan-dalmet](https://github.com/ivan-dalmet)) ([1b456f7](https://github.com/pedronauck/docz/commit/1b456f7)) - **docz:** sort menu and submenus alphabetically ([fbbd51c](https://github.com/pedronauck/docz/commit/fbbd51c)) - **docz:** use @loadable/component instead of react-imported-component ([18f02f2](https://github.com/pedronauck/docz/commit/18f02f2)) - **gatsby-theme-docz:** hot reload ([bf4e440](https://github.com/pedronauck/docz/commit/bf4e440)) - use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) - wrapper property is ignored in ([3cda0de](https://github.com/pedronauck/docz/commit/3cda0de)) ### Features - **docz:** add filter option for useMenus ([aeeb311](https://github.com/pedronauck/docz/commit/aeeb311)) - **docz:** use getInitialProps instead of getInitialData ([d4406e0](https://github.com/pedronauck/docz/commit/d4406e0)) - add playground component ([cde6511](https://github.com/pedronauck/docz/commit/cde6511)) - new Props component ([80451b1](https://github.com/pedronauck/docz/commit/80451b1)) - **docz-core:** remove ordering deprecated field ([39660bb](https://github.com/pedronauck/docz/commit/39660bb)) - docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) - use @reach/router instead of react-router ([81a4a82](https://github.com/pedronauck/docz/commit/81a4a82)) - **docz:** hooks migrations ([f57f987](https://github.com/pedronauck/docz/commit/f57f987)) - **docz-theme-default:** use styled-components instead of emotion ([19047fd](https://github.com/pedronauck/docz/commit/19047fd)) - add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) - split router logic from theme ([a9c26e6](https://github.com/pedronauck/docz/commit/a9c26e6)) ### BREAKING CHANGES - does not wrap the component anymore before passing it to the renderer. Instead it passes the wrapper explicitly to the renderer, making it the renderer's duty to apply the wrapper. ## [0.13.6](https://github.com/pedronauck/docz/compare/v0.13.5...v0.13.6) (2018-12-26) **Note:** Version bump only for package docz ## [0.13.5](https://github.com/pedronauck/docz/compare/v0.13.4...v0.13.5) (2018-12-19) **Note:** Version bump only for package docz ## [0.13.4](https://github.com/pedronauck/docz/compare/v0.13.3...v0.13.4) (2018-12-17) **Note:** Version bump only for package docz ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) **Note:** Version bump only for package docz ## [0.13.2](https://github.com/pedronauck/docz/compare/v0.13.1...v0.13.2) (2018-12-17) **Note:** Version bump only for package docz ## [0.13.1](https://github.com/pedronauck/docz/compare/v0.13.0...v0.13.1) (2018-12-17) **Note:** Version bump only for package docz # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes - **docz:** ts warning ([19ccc09](https://github.com/pedronauck/docz/commit/19ccc09)) - **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ### Features - **docz-theme-default:** set max lines before scroll editor ([#519](https://github.com/pedronauck/docz/issues/519)) ([698261b](https://github.com/pedronauck/docz/commit/698261b)) ## [0.12.17](https://github.com/pedronauck/docz/compare/v0.12.16...v0.12.17) (2018-12-14) ### Bug Fixes - **docz:** cycled dependency ([5132195](https://github.com/pedronauck/docz/commit/5132195)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) **Note:** Version bump only for package docz ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) **Note:** Version bump only for package docz ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) ### Features - **docz:** add preload async route ([f800c70](https://github.com/pedronauck/docz/commit/f800c70)) ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) ### Bug Fixes - **docz:** resolve react warnings in ErrorReporter ([#465](https://github.com/pedronauck/docz/issues/465)) ([1b0e09d](https://github.com/pedronauck/docz/commit/1b0e09d)) ## [0.12.12](https://github.com/pedronauck/docz/compare/v0.12.11...v0.12.12) (2018-11-16) **Note:** Version bump only for package docz ## [0.12.11](https://github.com/pedronauck/docz/compare/v0.12.10...v0.12.11) (2018-11-15) **Note:** Version bump only for package docz ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) **Note:** Version bump only for package docz ## [0.12.9](https://github.com/pedronauck/docz/compare/v0.12.8...v0.12.9) (2018-11-01) ### Bug Fixes - **docz-theme-default:** use class inside playground ([cecbea1](https://github.com/pedronauck/docz/commit/cecbea1)) ## [0.12.8](https://github.com/pedronauck/docz/compare/v0.12.7...v0.12.8) (2018-10-31) ### Bug Fixes - **docz:** update to new react imported component api ([759160e](https://github.com/pedronauck/docz/commit/759160e)) ## [0.12.7](https://github.com/pedronauck/docz/compare/v0.12.6...v0.12.7) (2018-10-30) **Note:** Version bump only for package docz ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) ### Bug Fixes - **docz:** conditionally description column on PropsTable ([#385](https://github.com/pedronauck/docz/issues/385)) ([829a3aa](https://github.com/pedronauck/docz/commit/829a3aa)), closes [#427](https://github.com/pedronauck/docz/issues/427) [#421](https://github.com/pedronauck/docz/issues/421) - **docz-theme-default:** text alignment in table thead ([#403](https://github.com/pedronauck/docz/issues/403)) ([475eb52](https://github.com/pedronauck/docz/commit/475eb52)) ### Features - **docz:** render [Empty String] on PropsTable ([#427](https://github.com/pedronauck/docz/issues/427)) ([10a3eda](https://github.com/pedronauck/docz/commit/10a3eda)) - **docz:** render [Empty String] on PropsTable ([#427](https://github.com/pedronauck/docz/issues/427)) ([2a9db98](https://github.com/pedronauck/docz/commit/2a9db98)) - **docz-theme-default:** add support to show/hide playground editor ([cacc6fb](https://github.com/pedronauck/docz/commit/cacc6fb)) ## [0.12.5](https://github.com/pedronauck/docz/compare/v0.12.4...v0.12.5) (2018-09-30) **Note:** Version bump only for package docz ## [0.12.4](https://github.com/pedronauck/docz/compare/v0.12.3...v0.12.4) (2018-09-28) ### Bug Fixes - **docz:** merge menus and submenus ([f8249da](https://github.com/pedronauck/docz/commit/f8249da)) ## [0.12.3](https://github.com/pedronauck/docz/compare/v0.12.2...v0.12.3) (2018-09-28) ### Bug Fixes - **docz:** remove Children.only ([656d8f1](https://github.com/pedronauck/docz/commit/656d8f1)) ## [0.11.2](https://github.com/pedronauck/docz/compare/v0.11.1...v0.11.2) (2018-09-11) ### Bug Fixes - **docz:** prevent crash when use imported props ([ef6de9d](https://github.com/pedronauck/docz/commit/ef6de9d)) ### Features - add native config for doczrc ([2580712](https://github.com/pedronauck/docz/commit/2580712)) ## [0.11.1](https://github.com/pedronauck/docz/compare/v0.11.0...v0.11.1) (2018-09-07) ### Bug Fixes - **docz:** add react router inside the docz bundle ([a293aa4](https://github.com/pedronauck/docz/commit/a293aa4)) - **docz-core:** basename configuration ([5fad743](https://github.com/pedronauck/docz/commit/5fad743)) # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) ### Bug Fixes - base url and hash router making weird url ([f483638](https://github.com/pedronauck/docz/commit/f483638)) ## [0.10.3](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.3) (2018-08-16) **Note:** Version bump only for package docz ## [0.10.2](https://github.com/pedronauck/docz/compare/v0.10.1...v0.10.2) (2018-08-13) **Note:** Version bump only for package docz ## [0.10.1](https://github.com/pedronauck/docz/compare/v0.10.0...v0.10.1) (2018-08-13) **Note:** Version bump only for package docz # [0.10.0](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.0) (2018-08-13) ### Bug Fixes - **docz:** add initial loading as true ([3f05536](https://github.com/pedronauck/docz/commit/3f05536)) - **docz-core:** prevent crash on delete entry ([28e1728](https://github.com/pedronauck/docz/commit/28e1728)) ### Features - add github repository link ([78a19f6](https://github.com/pedronauck/docz/commit/78a19f6)) - allow edit code inside playground ([#205](https://github.com/pedronauck/docz/issues/205)) ([4f948f7](https://github.com/pedronauck/docz/commit/4f948f7)) ## [0.9.6](https://github.com/pedronauck/docz/compare/v0.9.5...v0.9.6) (2018-08-06) **Note:** Version bump only for package docz ## [0.9.5](https://github.com/pedronauck/docz/compare/v0.9.4...v0.9.5) (2018-08-04) **Note:** Version bump only for package docz ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) ### Bug Fixes - remove external deps ([470bdd3](https://github.com/pedronauck/docz/commit/470bdd3)) ## [0.9.3](https://github.com/pedronauck/docz/compare/v0.9.2...v0.9.3) (2018-08-03) **Note:** Version bump only for package docz ## [0.9.2](https://github.com/pedronauck/docz/compare/v0.9.1...v0.9.2) (2018-08-02) **Note:** Version bump only for package docz ## [0.9.1](https://github.com/pedronauck/docz/compare/v0.9.0...v0.9.1) (2018-08-02) ### Bug Fixes - **docz:** finish process after build ([58bebb6](https://github.com/pedronauck/docz/commit/58bebb6)) # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) ### Bug Fixes - **docz:** transform and merge theme config ([999ab73](https://github.com/pedronauck/docz/commit/999ab73)) - **docz:** using context for imports to prevent disposed hmr ([b37284c](https://github.com/pedronauck/docz/commit/b37284c)) # [0.9.0-beta.1](https://github.com/pedronauck/docz/compare/v0.9.0-beta.0...v0.9.0-beta.1) (2018-08-01) **Note:** Version bump only for package docz # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) ### Bug Fixes - **docz:** add playground wrapper just around children ([66abfe8](https://github.com/pedronauck/docz/commit/66abfe8)) ### Features - **docz-core:** support env files to set configuration ([#171](https://github.com/pedronauck/docz/issues/171)) ([259b72d](https://github.com/pedronauck/docz/commit/259b72d)), closes [#140](https://github.com/pedronauck/docz/issues/140) # [0.8.0](https://github.com/pedronauck/docz/compare/v0.7.1...v0.8.0) (2018-07-28) ### Bug Fixes - **docz:** humanize array type of flow (fix [#167](https://github.com/pedronauck/docz/issues/167)) ([18798bc](https://github.com/pedronauck/docz/commit/18798bc)) ## [0.7.1](https://github.com/pedronauck/docz/compare/v0.7.0...v0.7.1) (2018-07-24) ### Bug Fixes - **docz:** add wrapper prop on Playground ([566aaf8](https://github.com/pedronauck/docz/commit/566aaf8)) - **docz:** sort algorithm off docs and menus ([dad83ce](https://github.com/pedronauck/docz/commit/dad83ce)) # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) ### Bug Fixes - **docz:** humanize prop types on PropTable ([c1f4c6f](https://github.com/pedronauck/docz/commit/c1f4c6f)) ### Features - **docz:** add rawCode for Playground ([70d4735](https://github.com/pedronauck/docz/commit/70d4735)) - **docz-theme-default:** add resize bar for fullscreen playground ([392009f](https://github.com/pedronauck/docz/commit/392009f)) ## [0.6.2](https://github.com/pedronauck/docz/compare/v0.6.1...v0.6.2) (2018-07-20) ### Bug Fixes - **docz-core:** set env vars for commands ([29f0098](https://github.com/pedronauck/docz/commit/29f0098)) ## [0.6.1](https://github.com/pedronauck/docz/compare/v0.6.0...v0.6.1) (2018-07-19) ### Bug Fixes - **docz:** default DocPreview components ([ff7cf32](https://github.com/pedronauck/docz/commit/ff7cf32)) # [0.6.0](https://github.com/pedronauck/docz/compare/v0.5.9...v0.6.0) (2018-07-19) ### Bug Fixes - **docz:** prevent default components object with no render ([4535aef](https://github.com/pedronauck/docz/commit/4535aef)) ## [0.5.9](https://github.com/pedronauck/docz/compare/v0.5.8...v0.5.9) (2018-07-16) **Note:** Version bump only for package docz ## [0.5.8](https://github.com/pedronauck/docz/compare/v0.5.7...v0.5.8) (2018-07-11) ### Bug Fixes - **docz-theme-default:** config transform function ([fdb3118](https://github.com/pedronauck/docz/commit/fdb3118)) ## [0.5.7](https://github.com/pedronauck/docz/compare/v0.5.6...v0.5.7) (2018-07-11) **Note:** Version bump only for package docz ## [0.5.6](https://github.com/pedronauck/docz/compare/v0.5.5...v0.5.6) (2018-07-11) ### Bug Fixes - **docz:** add theme config transform before merge ([dc3448a](https://github.com/pedronauck/docz/commit/dc3448a)) ### Features - **docz:** add classname and style props for Playground ([1b64ed3](https://github.com/pedronauck/docz/commit/1b64ed3)) ## [0.5.5](https://github.com/pedronauck/docz/compare/v0.5.4...v0.5.5) (2018-07-07) **Note:** Version bump only for package docz ## [0.5.4](https://github.com/pedronauck/docz/compare/v0.5.3...v0.5.4) (2018-07-07) **Note:** Version bump only for package docz ## [0.5.3](https://github.com/pedronauck/docz/compare/v0.5.2...v0.5.3) (2018-07-05) **Note:** Version bump only for package docz ## [0.5.2](https://github.com/pedronauck/docz/compare/v0.5.1...v0.5.2) (2018-07-05) ### Bug Fixes - props table css class ([#116](https://github.com/pedronauck/docz/issues/116)) ([065473c](https://github.com/pedronauck/docz/commit/065473c)) ## [0.5.1](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.1) (2018-07-03) ### Features - **docz-core:** add ordering property for config ([efd215e](https://github.com/pedronauck/docz/commit/efd215e)) - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) - **docz-theme-default:** add sidebar search ([7886e75](https://github.com/pedronauck/docz/commit/7886e75)) # [0.5.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.0) (2018-07-03) ### Features - **docz-core:** add ordering property for config ([a6c307d](https://github.com/pedronauck/docz/commit/a6c307d)) - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) - **docz-theme-default:** add sidebar search ([8218dc1](https://github.com/pedronauck/docz/commit/8218dc1)) # [0.4.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.4.0) (2018-06-30) ### Features - **docz-theme-default:** add automatic table of content ([#106](https://github.com/pedronauck/docz/issues/106)) ([6ce9e84](https://github.com/pedronauck/docz/commit/6ce9e84)) ## [0.3.4](https://github.com/pedronauck/docz/compare/v0.3.3...v0.3.4) (2018-06-26) # [0.3.0](https://github.com/pedronauck/docz/compare/v0.3.0-beta.0...v0.3.0) (2018-06-25) # [0.3.0-beta.0](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.0-beta.0) (2018-06-25) ### Features - **docz-theme-default:** add dark mode 🌚 ([#81](https://github.com/pedronauck/docz/issues/81)) ([964cf4d](https://github.com/pedronauck/docz/commit/964cf4d)) ## [0.3.3](https://github.com/pedronauck/docz/compare/v0.3.2...v0.3.3) (2018-06-26) ### Bug Fixes - **docz-core:** copy templates files for dist ([#88](https://github.com/pedronauck/docz/issues/88)) ([5e4b98d](https://github.com/pedronauck/docz/commit/5e4b98d)) ## [0.3.2](https://github.com/pedronauck/docz/compare/v0.3.1...v0.3.2) (2018-06-25) ### Bug Fixes - **docz:** mdxtag import ([4ed20bf](https://github.com/pedronauck/docz/commit/4ed20bf)) ## [0.3.1](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.1) (2018-06-25) ### Bug Fixes - **docz:** mdx provider import ([ded8cbb](https://github.com/pedronauck/docz/commit/ded8cbb)) - use docz-theme-default as docz-core dependency ([1a2fb67](https://github.com/pedronauck/docz/commit/1a2fb67)) ### Features - **docz-default-theme:** dark mode and responsiveness ([#87](https://github.com/pedronauck/docz/issues/87)) ([a4db115](https://github.com/pedronauck/docz/commit/a4db115)), closes [#81](https://github.com/pedronauck/docz/issues/81) # [0.3.0](https://github.com/pedronauck/docz/compare/v0.3.0-beta.0...v0.3.0) (2018-06-25) **Note:** Version bump only for package docz # [0.3.0-beta.0](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.0-beta.0) (2018-06-25) ### Features - **docz-theme-default:** add dark mode 🌚 ([#81](https://github.com/pedronauck/docz/issues/81)) ([964cf4d](https://github.com/pedronauck/docz/commit/964cf4d)) ## [0.2.11](https://github.com/pedronauck/docz/compare/v0.2.10...v0.2.11) (2018-06-22) **Note:** Version bump only for package docz ## [0.2.10](https://github.com/pedronauck/docz/compare/v0.2.9...v0.2.10) (2018-06-21) **Note:** Version bump only for package docz ## [0.2.9](https://github.com/pedronauck/docz/compare/v0.2.8...v0.2.9) (2018-06-21) **Note:** Version bump only for package docz ## [0.2.8](https://github.com/pedronauck/docz/compare/v0.2.7...v0.2.8) (2018-06-21) **Note:** Version bump only for package docz ## [0.2.7](https://github.com/pedronauck/docz/compare/v0.2.6...v0.2.7) (2018-06-20) ### Bug Fixes - **docz:** typo ([#63](https://github.com/pedronauck/docz/issues/63)) ([6af5db2](https://github.com/pedronauck/docz/commit/6af5db2)) ## [0.2.6](https://github.com/pedronauck/docz/compare/v0.2.5...v0.2.6) (2018-06-17) **Note:** Version bump only for package docz ## [0.2.5](https://github.com/pedronauck/docz/compare/v0.2.4...v0.2.5) (2018-06-15) ### Bug Fixes - **docz:** add extractTypeDescribedValue to PropsTable ([#38](https://github.com/pedronauck/docz/issues/38)) ([cca862c](https://github.com/pedronauck/docz/commit/cca862c)) - **docz:** PropsTable component ([48638cc](https://github.com/pedronauck/docz/commit/48638cc)) ## [0.2.4](https://github.com/pedronauck/docz/compare/v0.2.3...v0.2.4) (2018-06-13) **Note:** Version bump only for package docz ## [0.2.3](https://github.com/pedronauck/docz/compare/v0.2.2...v0.2.3) (2018-06-13) **Note:** Version bump only for package docz ## [0.2.2](https://github.com/pedronauck/docz/compare/v0.2.1...v0.2.2) (2018-06-12) **Note:** Version bump only for package docz ## [0.2.1](https://github.com/pedronauck/docz/compare/v0.2.0...v0.2.1) (2018-06-12) ### Bug Fixes - playground component destructuring bug ([#4](https://github.com/pedronauck/docz/issues/4)) ([f9026cf](https://github.com/pedronauck/docz/commit/f9026cf)) # [0.2.0](https://github.com/pedronauck/docz/compare/v0.2.0-beta.2...v0.2.0) (2018-06-11) **Note:** Version bump only for package docz # [0.2.0-beta.2](https://github.com/doczjs/docz/compare/v0.2.0-beta.1...v0.2.0-beta.2) (2018-06-10) ### Bug Fixes - **docz-core:** autolink headings ([0b8369d](https://github.com/doczjs/docz/commit/0b8369d)) # [0.2.0-beta.1](https://github.com/doczjs/docz/compare/v0.2.0-beta.0...v0.2.0-beta.1) (2018-06-10) ### Features - **docz-core:** add headings property for entries and autolink on headings ([7711c3c](https://github.com/doczjs/docz/commit/7711c3c)) # [0.2.0-beta.0](https://github.com/doczjs/docz/compare/v0.1.2-beta.6...v0.2.0-beta.0) (2018-06-10) **Note:** Version bump only for package docz ## [0.1.2-beta.6](https://github.com/doczjs/docz/compare/v0.1.2-beta.5...v0.1.2-beta.6) (2018-06-09) ### Bug Fixes - **docz:** typing definition ([1a3648e](https://github.com/doczjs/docz/commit/1a3648e)) ## [0.1.2-beta.5](https://github.com/doczjs/docz/compare/v0.1.2-beta.4...v0.1.2-beta.5) (2018-06-09) **Note:** Version bump only for package docz ## [0.1.2-beta.4](https://github.com/doczjs/docz/compare/v0.1.2-beta.3...v0.1.2-beta.4) (2018-06-09) **Note:** Version bump only for package docz ## [0.1.2-beta.3](https://github.com/doczjs/docz/compare/v0.1.2-beta.2...v0.1.2-beta.3) (2018-06-09) **Note:** Version bump only for package docz ## [0.1.2-beta.2](https://github.com/doczjs/docz/compare/v0.1.2-beta.1...v0.1.2-beta.2) (2018-06-09) ### Features - **docz:** add support for custom not found route ([455dcca](https://github.com/doczjs/docz/commit/455dcca)) ## [0.1.2-beta.1](https://github.com/doczjs/docz/compare/v0.1.2-beta.0...v0.1.2-beta.1) (2018-06-09) ### Features - **docz:** add loading component setting for loadable ([4352ce3](https://github.com/doczjs/docz/commit/4352ce3)) - **docz-core:** add base config argument ([20f29c2](https://github.com/doczjs/docz/commit/20f29c2)) ## [0.1.2-beta.0](https://github.com/doczjs/docz/compare/v0.1.1...v0.1.2-beta.0) (2018-06-02) **Note:** Version bump only for package docz ## [0.1.1-beta.6](https://github.com/doczjs/docz/compare/v0.1.1-beta.5...v0.1.1-beta.6) (2018-06-01) ### Bug Fixes - **docz:** add docz-theme-default as dependecy ([0dff6c0](https://github.com/doczjs/docz/commit/0dff6c0)) ## [0.1.1-beta.5](https://github.com/doczjs/docz/compare/v0.1.1-beta.4...v0.1.1-beta.5) (2018-06-01) ### Bug Fixes - **docz:** link component ([7626982](https://github.com/doczjs/docz/commit/7626982)) ## [0.1.1-beta.4](https://github.com/doczjs/docz/compare/v0.1.1-beta.3...v0.1.1-beta.4) (2018-05-29) ### Bug Fixes - **docz:** add isActive to Link components ([9cecc08](https://github.com/doczjs/docz/commit/9cecc08)) ## [0.1.1-beta.3](https://github.com/doczjs/docz/compare/v0.1.1-beta.2...v0.1.1-beta.3) (2018-05-29) **Note:** Version bump only for package docz ## [0.1.1-beta.2](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.2) (2018-05-29) ### Bug Fixes - **docz:** set docz-core as dependency ([6c257e8](https://github.com/doczjs/docz/commit/6c257e8)) ## [0.1.1-beta.1](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2018-05-29) **Note:** Version bump only for package docz ## [0.1.1-beta.0](https://github.com/doczjs/docz/compare/v0.1.0...v0.1.1-beta.0) (2018-05-29) ### Bug Fixes - **docz:** add bin folder for npm publish ([f463a98](https://github.com/doczjs/docz/commit/f463a98)) # 0.1.0 (2018-05-29) ### Bug Fixes - **docz:** Docs render props orders and types ([d7e9ee2](https://github.com/doczjs/docz/commit/d7e9ee2)) - **docz:** docs categories for themes ([687720c](https://github.com/doczjs/docz/commit/687720c)) - **docz:** flow props parser integration ([5a83610](https://github.com/doczjs/docz/commit/5a83610)) - **docz:** validate route passed for docs.route() ([48a0484](https://github.com/doczjs/docz/commit/48a0484)) - **docz-core:** entries rewrite ([986ba65](https://github.com/doczjs/docz/commit/986ba65)) ### Features - **docz:** add doc page wrapper as component ([1150373](https://github.com/doczjs/docz/commit/1150373)) - **docz:** add groups feature ([9652b30](https://github.com/doczjs/docz/commit/9652b30)) - **docz:** make server bundler api concise ([ae5f0c0](https://github.com/doczjs/docz/commit/ae5f0c0)) - **docz-core:** add build command ([ef7abd2](https://github.com/doczjs/docz/commit/ef7abd2)) - **docz-core:** add entry settings field ([2ec5d66](https://github.com/doczjs/docz/commit/2ec5d66)) - **docz-core:** add playground code parse section ([6bbf158](https://github.com/doczjs/docz/commit/6bbf158)) - **docz-core:** add title and description on settings ([ad9ee58](https://github.com/doczjs/docz/commit/ad9ee58)) - **docz-core:** add typescript support ([17dae8b](https://github.com/doczjs/docz/commit/17dae8b)) - **docz-core:** pass theme config via websockets for dev ([5222de7](https://github.com/doczjs/docz/commit/5222de7)) - add component props parse feature ([987627d](https://github.com/doczjs/docz/commit/987627d)) - improve docz theme to use theme config ([9207ed2](https://github.com/doczjs/docz/commit/9207ed2)) - parse doc class to object ([e7f9cf0](https://github.com/doczjs/docz/commit/e7f9cf0)) - refac to use mdx ([04b59e5](https://github.com/doczjs/docz/commit/04b59e5)) - use custom render method on section ([8ccf99c](https://github.com/doczjs/docz/commit/8ccf99c)) - **docz-core:** use websockets instead of generate json to process entries ([e0773a0](https://github.com/doczjs/docz/commit/e0773a0)) - **docz-theme-default:** add logo option ([435da9b](https://github.com/doczjs/docz/commit/435da9b)) - **docz-theme-default:** add tooltip on props ([dc3c4cd](https://github.com/doczjs/docz/commit/dc3c4cd)) ================================================ FILE: core/docz/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/docz/README.md ================================================

Chat

Docz makes it easy to write and publish beautiful interactive documentation for your code. Create MDX files showcasing your code and Docz turns them into a live-reloading, production-ready site. ![docz example](https://cdn-std.dprcdn.net/files/acc_649651/S2YCID) ## Table of Contents - [Why ?](#why) - [Start a New Project](#start-a-new-project) - [Add Docz to an Existing Project](#add-docz-to-an-existing-project) - [Build](#build) - [Deploy](#deploy) - [Examples](#examples) - [More info on docz.site](#more-info-on-doczsite) - [Used by](#used-by) - [Contributors](#contributors) - [Contributing](#contributing) ## Why ? Documenting code is one of the most important and time-heavy processes when developing software. A lot of time is spent on building and maintaining custom documentation sites. Docz enables you to quickly create live-reloading, seo-friendly, production-ready documentation sites with MDX and customize the look, feel and behavior when required by leveraging [GatsbyJS](https://www.gatsbyjs.org) and [Gatsby theme shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/). ## Start a New Project Use [create-docz-app](https://www.npmjs.com/package/create-docz-app) to quickly get started : ```sh npx create-docz-app my-docz-app # or yarn create docz-app my-docz-app --example typescript ``` ## Add Docz to an Existing Project Start by adding `docz` as a dependency : ```bash $ yarn add docz@next # react react-dom # or $ npm install docz@next # react react-dom ``` > **Note**: `react` and `react-dom` will not be installed automatically. You'll have to install them yourself. Then, add `.mdx` files anywhere in your project: ```mdx --- name: Button route: / --- import { Playground, Props } from 'docz' import Button from './Button' # Button ## Basic usage ``` And a Button component `Button.jsx`: ```typescript import React from 'react' import t from 'prop-types' const Button = ({ children, type }) => Button.propTypes = { /** * This is a description for this prop. * Button type. */ type: t.oneOf(['button', 'submit', 'reset']), } Button.defaultProps = { type: 'button', } export default Button ``` Finally, run: ```bash yarn docz dev ``` This will start a local development server and open your documentation site in the browser. ## Build `yarn docz build` will generate a static site for your site in `.docz/dist/`. You can try it out with `yarn docz serve` or by serving the generated site with your favorite static file server (e.g. `npx serve .docz/dist`). You can have `yarn docz build` emit to a different directory by providing a path to the `dest` field in your doczrc.js or from the command line : `yarn docz build --dest docs-site-directory`. ## Deploy The output of docz consists of static assets only. This allows you to deploy your generated `docz` site with any static site hosting provider you'd like. Start by building your site with `yarn docz build`, if you haven't provided a `dest` flag to your config then you will find your generated files in `.docz/dist` to copy to the server. ## Examples - **[basic](https://github.com/doczjs/docz/tree/master/examples/basic)** - Barebones example. - **[gatsby](https://github.com/doczjs/docz/tree/master/examples/gatsby)** - Example using Docz in a Gastby project. - **[react native](https://github.com/doczjs/docz/tree/master/examples/react-native)** - Using Docz in a React Native project. - **[styled-components](https://github.com/doczjs/docz/tree/master/examples/styled-components)** - Using Docz with `styled-components`. - **[with typescript](https://github.com/doczjs/docz/tree/master/examples/typescript)** - Using Docz with Typescript. - **[with flow](https://github.com/doczjs/docz/tree/master/examples/flow)** - Using Docz with Flow. - **[with images](https://github.com/doczjs/docz/tree/master/examples/images)** - Using Docz with images in mdx and jsx. - **[with sass](https://github.com/doczjs/docz/tree/master/examples/sass)** - Using Docz parsing CSS with SASS. - **[with less](https://github.com/doczjs/docz/tree/master/examples/less)** - Using Docz parsing CSS with LESS. - **[with stylus](https://github.com/doczjs/docz/tree/master/examples/css-stylus)** - Using Docz parsing CSS with Stylus. - **with css modules**: works out of the box with gatsby You can check the complete list of docz examples [here](https://github.com/doczjs/docz/tree/master/examples). ## More info on [docz.site](https://docz.site) ## Used by - **[Smooth UI](https://smooth-ui.smooth-code.com/)** - Modern React UI library. - **[Set Protocol Docs](https://docs.setprotocol.com/)** - Documentation site of Set Protocol. - **[RBX](https://dfee.github.io/rbx)** - The Comprehensive Bulma UI Framework for React. - **[Circuit UI](https://circuit.sumup.com/#/)** - React component library for [SumUp](https://sumup.com) web apps. - **[Fannypack](https://fannypack.style)** - A friendly & accessible React UI Kit built with [Reakit](https://reakit.io/). - **[React Pixi](https://reactpixi.org/#/)** - React Fiber renderer for Pixi. - **[React Hotkey Tooltip](https://react-hotkey-tooltip.netlify.com/#/)** - A global Hotkey provider with built in tooltip for React. - **[Sajari React SDK](https://sajari-sdk-react.netlify.com/)** - Library of React Components for the Sajari. ## Contributors This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. ## Contributing All kinds of contributions are very welcome and appreciated ! If you want to contribute time to docz then here's a list of suggestions to get you started : 1. Star the project. 2. Help people in the [issues](https://github.com/doczjs/docz/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) by sharing your knowledge and experience. 3. Find and report issues. 4. Submit PRs to help solve issues or add features. 5. Influence the future of docz with feature requests. If you're looking for a place to start make sure to check issues tagged with : [![Good First Issue](https://img.shields.io/github/issues/doczjs/docz/good%20first%20issue.svg)](https://github.com/doczjs/docz/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) And make sure to read the [Contributing Guide](/CONTRIBUTING.md) before making a pull request. You can also contribute money to help secure docz's future.

Open Collective

================================================ FILE: core/docz/bin/index.js ================================================ #!/usr/bin/env node require('docz-core').cli() ================================================ FILE: core/docz/package.json ================================================ { "name": "docz", "version": "2.4.0", "description": "It's has never been so easy to documents your things!", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "bin": { "docz": "./bin/index.js" }, "files": [ "bin/", "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/docz" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged" }, "dependencies": { "@emotion/react": "^11.1.1", "@mdx-js/react": "^1.0.27", "array-sort": "^1.0.0", "capitalize": "^2.0.0", "docz-core": "^2.4.0", "fast-deep-equal": "^2.0.1", "gatsby": "^2.13.27", "gatsby-plugin-eslint": "^2.0.5", "gatsby-plugin-typescript": "^2.1.6", "gatsby-theme-docz": "^2.4.0", "lodash": "^4.17.14", "marksy": "^8.0.0", "match-sorter": "^3.1.1", "pascal-case": "^3.1.0", "prop-types": "^15.7.2", "scheduler": "^0.15.0", "ulid": "^2.3.0", "yargs": "^13.3.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.2", "react-dom": "^16.8.0 || ^17.0.2" } } ================================================ FILE: core/docz/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: './src/index.ts', }) ================================================ FILE: core/docz/src/components/Link.tsx ================================================ export { Link, GatsbyLinkProps as LinkProps } from 'gatsby' ================================================ FILE: core/docz/src/components/Playground.tsx ================================================ import React from 'react' import { ComponentType, FC } from 'react' import { useComponents } from '../hooks' export interface PlaygroundProps { className?: string style?: any wrapper?: ComponentType children: any __scope: Record __position: number __code: string useScoping?: boolean language?: string } export const Playground: FC = ({ className, children, style, wrapper, __scope, __position, __code, language, useScoping, }) => { const components = useComponents() const PlaygroundComponent = components.playground if (!PlaygroundComponent) return null return ( ) } ================================================ FILE: core/docz/src/components/Props.tsx ================================================ import React from 'react' import { FC, ComponentType } from 'react' import { get } from 'lodash/fp' import { useComponents, useComponentProps } from '../hooks' import { humanize } from '../utils/humanize-prop' export interface EnumValue { value: string computed: boolean } export interface FlowTypeElement { name: string value: string } export interface FlowTypeArgs { name: string type: { name: string } } export interface PropType { name: string value?: any raw?: any computed?: boolean } export interface FlowType extends PropType { elements: FlowTypeElement[] name: string raw: string type?: string computed?: boolean signature?: { arguments: FlowTypeArgs[] return: { name: string } } } export interface Prop { required: boolean description?: string type: PropType defaultValue?: { value: string computed: boolean } flowType?: FlowType } export type ComponentWithDocGenInfo = ComponentType & { __docgenInfo: { description?: string props?: Record } } export interface PropsProps { title?: Node isRaw?: boolean isToggle?: boolean of: ComponentWithDocGenInfo [key: string]: any } export const getPropType = (prop: Prop) => { const propName = get('name', prop.flowType || prop.type) if (!propName) return null const isEnum = propName.startsWith('"') || propName === 'enum' const name = isEnum ? 'enum' : propName const value = get('type.value', prop) if (!name) return null if ( (isEnum && typeof value === 'string') || (!prop.flowType && !isEnum && !value) || (prop.flowType && !prop.flowType.elements) ) { return name } return prop.flowType ? humanize(prop.flowType) : humanize(prop.type) } export interface PropsComponentProps { title?: Node isRaw?: boolean isToggle?: boolean props: Record getPropType(prop: Prop): string of: ComponentWithDocGenInfo [key: string]: any } export const Props: FC = ({ title, isToggle, isRaw, of: component, ...rest }) => { const components = useComponents() const PropsComponent = components.props const fileName = get('__filemeta.filename', component) const filemetaName = get('__filemeta.name', component) const componentName = filemetaName || get('displayName', component) || get('name', component) const props = useComponentProps({ componentName, fileName }) if (!PropsComponent) return null return ( ) } ================================================ FILE: core/docz/src/hooks/index.ts ================================================ export * from './useComponents' export { useConfig, UseConfigObj } from './useConfig' export { useComponentProps } from './useComponentProps' export { useCurrentDoc } from './useCurrentDoc' export { useDataServer } from './useDataServer' export { useDocs } from './useDocs' export { useMenus } from './useMenus' export { usePrevious } from './usePrevious' export { useWindowSize } from './useWindowSize' ================================================ FILE: core/docz/src/hooks/useComponentProps.ts ================================================ import { createElement, useContext, useMemo } from 'react' import { assoc, first, get, mapValues, kebabCase } from 'lodash/fp' import { pascalCase } from 'pascal-case' import marksy from 'marksy' import { useComponents } from '../hooks' import { doczState } from '../state' interface UseComponentPropsParams { componentName: string fileName: string } export const useComponentProps = ({ componentName, fileName, }: UseComponentPropsParams) => { const components = useComponents() const { props: stateProps } = useContext(doczState.context) const componentMatcher = (componentName: string, item: any) => { const matchingPatterns = [ fileName, `/${componentName}.`, `/${kebabCase(componentName)}.`, `/${pascalCase(componentName)}.`, ] return !!matchingPatterns.find(pattern => item.key.includes(pattern)) } const found = stateProps && stateProps.length > 0 && stateProps.find(item => componentMatcher(componentName, item)) const value = get('value', found) || [] const firstDefinition = first(value) const definition = value.find((i: any) => i.displayName === componentName) const compile = useMemo( () => marksy({ createElement, elements: components }), [components] ) const props = useMemo(() => { const props = get('props', definition || firstDefinition) const parseDescs = mapValues((prop: any) => { const desc = get('description', prop) return !desc ? prop : assoc('description', compile(desc).tree, prop) }) return parseDescs(props) }, [compile, definition || firstDefinition]) return props } ================================================ FILE: core/docz/src/hooks/useComponents.tsx ================================================ import React, { useContext, createContext } from 'react' import { FC, ComponentType as CT } from 'react' import { Entry } from '../state' export interface PlaygroundProps { className?: string style?: any wrapper?: CT components: ComponentsMap component: JSX.Element position: number code: string scope: Record language?: string showLivePreview?: boolean useScoping?: boolean } export interface LayoutProps { doc: Entry [key: string]: any } export interface ComponentsMap { notFound?: CT layout?: CT playground?: CT [key: string]: any } const DefNotFound: FC = () => <>Not found const DefLayout: FC = ({ children }) => <>{children} const DefPlayground: FC = ({ component, code }) => (
{component}
{code}
) const defaultComponents: ComponentsMap = { layout: DefLayout, notFound: DefNotFound, playground: DefPlayground, } export interface ComponentsProviderProps { components: ComponentsMap } const ctx = createContext(defaultComponents) export const ComponentsProvider: FC = ({ components: themeComponents = {}, children, }) => ( {children} ) export const useComponents = (): ComponentsMap => { return useContext(ctx) } ================================================ FILE: core/docz/src/hooks/useConfig.ts ================================================ import { useContext } from 'react' import { merge } from 'lodash/fp' import { doczState, ThemeConfig, Config } from '../state' export interface UseConfigObj extends Config { themeConfig: ThemeConfig } export const useConfig = (): UseConfigObj => { const state = useContext(doczState.context) const { transform, config, themeConfig = {} } = state const newConfig = merge(themeConfig, config ? config.themeConfig : {}) const transformed = transform ? transform(newConfig) : newConfig return { ...config, themeConfig: transformed, } } ================================================ FILE: core/docz/src/hooks/useCurrentDoc.tsx ================================================ import { useContext } from 'react' import { get } from 'lodash/fp' import { doczState } from '../state' export const useCurrentDoc = () => { const state = useContext(doczState.context) return get('currentEntry.value', state) } ================================================ FILE: core/docz/src/hooks/useDataServer.ts ================================================ import { useEffect } from 'react' import { doczState } from '../state' const updateState = (ev: any) => { const { type, payload } = JSON.parse(ev.data) const prop = type.startsWith('state.') && type.split('.')[1] if (prop) { doczState.set(state => ({ ...state, [prop]: payload })) } } export const useDataServer = (url: string | undefined) => { useEffect(() => { if (!url) return const socket = new WebSocket(url) socket.onmessage = updateState return () => socket.close() }, []) } ================================================ FILE: core/docz/src/hooks/useDocs.ts ================================================ import { useContext } from 'react' import sort from 'array-sort' import { doczState, Entry } from '../state' import { compare } from '../utils/helpers' export const useDocs = (): Entry[] | null => { const { entries = [] } = useContext(doczState.context) const arr = entries.map(({ value }) => value) return sort(arr, (a: Entry, b: Entry) => compare(a.name, b.name)) } ================================================ FILE: core/docz/src/hooks/useMenus.ts ================================================ import { useMemo, useContext } from 'react' import { pipe, get, omit, flattenDepth, unionBy } from 'lodash/fp' import { ulid } from 'ulid' import match from 'match-sorter' import sort from 'array-sort' import { compare, flatArrFromObject } from '../utils/helpers' import { Entry, MenuItem, doczState } from '../state' const noMenu = (entry: Entry) => !entry.menu const fromMenu = (menu: string) => (entry: Entry) => entry.menu === menu const entriesOfMenu = (menu: string, entries: Entry[]) => entries.filter(fromMenu(menu)) const parseMenu = (entries: Entry[]) => (name: string) => ({ name, menu: entriesOfMenu(name, entries), }) type Menus = MenuItem[] const menusFromEntries = (entries: Entry[]) => { const entriesWithoutMenu = entries.filter(noMenu) const menus = flatArrFromObject(entries, 'menu').map(parseMenu(entries)) return unionBy('name', menus, entriesWithoutMenu as any) } const parseItemStr = (item: MenuItem | string) => typeof item === 'string' ? { name: item } : item const normalize = (item: MenuItem | string): MenuItem => { const selected = parseItemStr(item) as MenuItem return { ...selected, id: selected.id || ulid(), parent: get('parent', selected) || get('parent', item), menu: Array.isArray(selected.menu) ? selected.menu.map(normalize) : selected.menu, } } const clean = (item: MenuItem) => item.href || item.route ? omit('menu', item) : item const normalizeAndClean = pipe( normalize, clean ) const mergeMenus = (entriesMenu: Menus, configMenu: Menus): Menus => { const first = entriesMenu.map(normalizeAndClean) const second = configMenu.map(normalizeAndClean) const merged = unionBy('name', first, second) as MenuItem[] return merged.map(item => { if (!item.menu) return item const found: any = second.find(i => i.name === item.name) const foundMenu = found && found.menu return { ...item, menu: foundMenu ? mergeMenus(item.menu, foundMenu) : item.menu || found.menu, } }) } const UNKNOWN_POS = Infinity const findPos = (item: any, orderedList: string[] = []) => { const name = typeof item !== 'string' ? get('name', item) : item const pos = orderedList.findIndex(item => item === name) return pos !== -1 ? pos : UNKNOWN_POS } type ToCompare = Menus | undefined const compareWithMenu = (to: ToCompare = []) => (a: string, b: string) => { const list = to.map((i: any) => i.name || i) return compare(findPos(a, list), findPos(b, list)) } const sortByName = (a: MenuItem, b: MenuItem) => { return a.name < b.name ? -1 : a.name > b.name ? 1 : 0 } const sortMenus = (first: Menus, second: Menus | undefined = []): Menus => { const sorted: Menus = sort(first, compareWithMenu(second), sortByName) return sorted.map(item => { if (!item.menu) return item const found = second.find(menu => menu.name === item.name) const foundMenu = found && found.menu return { ...item, menu: foundMenu ? sortMenus(item.menu, foundMenu) : sort(item.menu, sortByName), } }) } const search = (val: string, menu: MenuItem[]) => { const items = menu.map(item => [item].concat(item.menu || [])) const flattened = flattenDepth(2, items) const flattenedDeduplicated = Array.from(new Set(flattened)) return match(flattenedDeduplicated, val, { keys: ['name'] }) } type FilterFn = (item: MenuItem) => boolean const filterMenus = (items: MenuItem[], filter?: FilterFn) => { if (!filter) return items return items.filter(filter).map(item => { if (!item.menu) return item return { ...item, menu: item.menu.filter(filter) } }) } export interface UseMenusParams { query?: string filter?: FilterFn } export const useMenus = (opts?: UseMenusParams) => { const { query = '' } = opts || {} const { entries, config } = useContext(doczState.context) if (!entries) return null const arr = entries.map(({ value }) => value) as Entry[] const entriesMenu = menusFromEntries(arr) const sorted = useMemo(() => { const merged = mergeMenus(entriesMenu as any[], config.menu) const result = sortMenus(merged, config.menu) as MenuItem[] return filterMenus(result, opts && opts.filter) }, [entries, config]) return query && query.length > 0 ? (search(query, sorted) as MenuItem[]) : sorted } ================================================ FILE: core/docz/src/hooks/usePrevious.ts ================================================ import { useEffect, useRef } from 'react' export const usePrevious = (value: any, defaultValue?: any) => { const ref = useRef(defaultValue) useEffect(() => { ref.current = value }) return ref.current } ================================================ FILE: core/docz/src/hooks/useWindowSize.ts ================================================ import { useState, useEffect } from 'react' import { throttle } from 'lodash/fp' const isClient = typeof window === 'object' const getSize = (initialWidth: number, initialHeight: number) => ({ innerHeight: isClient ? window.innerHeight : initialHeight, innerWidth: isClient ? window.innerWidth : initialWidth, outerHeight: isClient ? window.outerHeight : initialHeight, outerWidth: isClient ? window.outerWidth : initialWidth, }) export const useWindowSize = ( throttleMs: number = 300, _initialWidth = Infinity, initialHeight = Infinity ) => { const [windowSize, setWindowSize] = useState( getSize(initialHeight, initialHeight) ) const tSetWindowResize = throttle(throttleMs, () => setWindowSize(getSize(initialHeight, initialHeight)) ) useEffect(() => { window.addEventListener('resize', tSetWindowResize) return () => void window.removeEventListener('resize', tSetWindowResize) }, []) return windowSize } ================================================ FILE: core/docz/src/index.ts ================================================ export { Link, LinkProps } from './components/Link' export { Playground, PlaygroundProps } from './components/Playground' export { Props, PropsComponentProps } from './components/Props' export * from './hooks' export { theme } from './theme' export { doczState, Entry, MenuItem, ThemeConfig } from './state' ================================================ FILE: core/docz/src/state.tsx ================================================ import { create } from './utils/createState' export interface Heading { depth: number slug: string value: string } export interface Entry { id: string filepath: string slug: string route: string name: string order: number menu: string | null headings: Heading[] [key: string]: any } export interface MenuItem { id: string name: string route?: string href?: string menu?: MenuItem[] order?: number parent?: string [key: string]: any } export type ThemeConfig = Record export interface Config { title: string description: string themeConfig: ThemeConfig menu: MenuItem[] version: string | null repository: string | null native: boolean separator: string base?: string } export type Entries = { key: string; value: Entry }[] export type Props = { key: string; value: any }[] export type TransformFn = (config: ThemeConfig) => ThemeConfig export interface Database { config: Config currentEntry: Entry props?: Props entries?: Entries } export interface DoczState extends Database { themeConfig?: ThemeConfig transform?: TransformFn } export const doczState = create({} as any) ================================================ FILE: core/docz/src/theme.tsx ================================================ import React, { memo } from 'react' import { FC, ComponentType as CT } from 'react' import { doczState, Database, ThemeConfig, TransformFn, Entry } from './state' export interface ThemeProps { db: Database currentEntry: Entry children(WrappedComponent: CT): JSX.Element } export function theme( themeConfig: ThemeConfig, transform: TransformFn = c => c ): (WrappedComponent: CT) => CT { return WrappedComponent => { const Theme: FC = memo(props => { const { db, currentEntry, children } = props const initial: any = { ...db, currentEntry, themeConfig, transform } return ( {children} ) }) Theme.displayName = WrappedComponent.displayName || 'DoczTheme' return Theme } } ================================================ FILE: core/docz/src/types.d.ts ================================================ declare module '@mdx-js/react' declare module 'array-sort' declare module 'capitalize' declare module 'match-sorter' declare module 'marksy' declare module 'react-router-hash-link' declare module 'use-react-router' ================================================ FILE: core/docz/src/utils/createState.tsx ================================================ import React, { createContext } from 'react' import { Component, ReactNode, Context, ComponentType } from 'react' import equal from 'fast-deep-equal' export interface ProviderProps { initial?: T } export type PrevState = (prevState: T) => T export type GetFn = (state: T) => ReactNode export type Dispatch = T | PrevState export interface State { context: Context set: (param: Dispatch) => void Provider: ComponentType> } export function create(initial: T): State { const ctx = createContext(initial) const listeners = new Set() const dispatch = (fn: Dispatch) => { listeners.forEach((listener: any) => listener(fn)) } return { context: ctx, set: fn => dispatch(fn), Provider: class Provider extends Component, T> { public static displayName = 'DoczStateProvider' public static getDerivedStateFromProps(props: any, state: any): any { if (!equal(props.initial, state)) return props.initial return null } public state = this.props.initial || initial || ({} as T) public componentDidMount(): void { listeners.add((fn: Dispatch) => this.setState(fn)) } public componentWillUnmount(): void { listeners.clear() } public render(): ReactNode { return ( {this.props.children} ) } }, } } ================================================ FILE: core/docz/src/utils/helpers.ts ================================================ import { get } from 'lodash/fp' export const isFn = (value: any): boolean => typeof value === 'function' export function flatArrFromObject(arr: T[], prop: string): string[] { const reducer = (arr: string[], obj: T): string[] => { const value = get(prop)(obj) return value ? arr.concat([value]) : arr } return Array.from(new Set(arr.reduce(reducer, []))) } export function compare(a: T, b: T, reverse?: boolean): number { if (a < b) return reverse ? 1 : -1 if (a > b) return reverse ? -1 : 1 return 0 } ================================================ FILE: core/docz/src/utils/humanize-prop.ts ================================================ import capitalize from 'capitalize' import { PropType, FlowType } from '../components/Props' const RE_OBJECTOF = /(?:React\.)?(?:PropTypes\.)?objectOf\((?:React\.)?(?:PropTypes\.)?(\w+)\)/ const getTypeStr = (type: PropType | FlowType): any => { switch (type.name.toLowerCase()) { case 'instanceof': return `Class(${type.value})` case 'enum': if (type.computed) return type.value return type.value ? type.value.map((v: any) => `${v.value}`).join(' │ ') : type.raw case 'union': return type.value ? type.value.map((t: any) => `${getTypeStr(t)}`).join(' │ ') : type.raw case 'array': return type.raw case 'arrayof': return `Array<${getTypeStr(type.value)}>` case 'custom': if (type.raw.indexOf('function') !== -1 || type.raw.indexOf('=>') !== -1) return 'Custom(Function)' else if (type.raw.toLowerCase().indexOf('objectof') !== -1) { const m = type.raw.match(RE_OBJECTOF) if (m && m[1]) return `ObjectOf(${capitalize(m[1])})` return 'ObjectOf' } return 'Custom' case 'bool': return 'Boolean' case 'func': return 'Function' case 'shape': const shape = type.value const rst: any = {} Object.keys(shape).forEach(key => { rst[key] = getTypeStr(shape[key]) }) return JSON.stringify(rst, null, 2) default: return type.name } } export const humanize = (type: PropType | FlowType) => getTypeStr(type) ================================================ FILE: core/docz/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "declaration": true, "sourceMap": false, "outDir": "./dist", "rootDir": "./src", "baseUrl": "./", "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*"], "exclude": ["node_modules/**", "templates/**"] } ================================================ FILE: core/docz-core/.babelrc ================================================ { "plugins": ["lodash"], "presets": [ "@babel/preset-typescript", [ "@babel/preset-env", { "targets": { "node": "current" } } ] ] } ================================================ FILE: core/docz-core/.eslintignore ================================================ dist ================================================ FILE: core/docz-core/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: core/docz-core/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: core/docz-core/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) ### Features * add gatsby https flag to use in dev mode ([#1569](https://github.com/doczjs/docz/issues/1569)) ([9d91503](https://github.com/doczjs/docz/commit/9d91503)) * **docz-core:** add modifyEntry plugin supported ([#1621](https://github.com/doczjs/docz/issues/1621)) ([317987e](https://github.com/doczjs/docz/commit/317987e)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) ### Features * add gatsby https flag to use in dev mode ([#1569](https://github.com/doczjs/docz/issues/1569)) ([9d91503](https://github.com/doczjs/docz/commit/9d91503)) * **docz-core:** add modifyEntry plugin supported ([#1621](https://github.com/doczjs/docz/issues/1621)) ([317987e](https://github.com/doczjs/docz/commit/317987e)) ## [2.3.2-alpha.0](https://github.com/doczjs/docz/compare/v2.3.1...v2.3.2-alpha.0) (2020-04-07) ### Bug Fixes * **docz-core:** use user-provided 404 page when it exists ([05417d3](https://github.com/doczjs/docz/commit/05417d3)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package docz-core # [2.3.0-alpha.14](https://github.com/doczjs/docz/compare/v2.3.0-alpha.13...v2.3.0-alpha.14) (2020-03-31) ### Bug Fixes * **docz-core:** always use custom prop filter if it's provided… ([#1415](https://github.com/doczjs/docz/issues/1415)) ([53063ff](https://github.com/doczjs/docz/commit/53063ff)) # [2.3.0-alpha.12](https://github.com/doczjs/docz/compare/v2.3.0-alpha.11...v2.3.0-alpha.12) (2020-02-12) ### Bug Fixes * **docz-core:** pass down host when running serve ([#1384](https://github.com/doczjs/docz/issues/1384)) ([80a0e1e](https://github.com/doczjs/docz/commit/80a0e1e)) # [2.3.0-alpha.11](https://github.com/doczjs/docz/compare/v2.3.0-alpha.10...v2.3.0-alpha.11) (2020-02-07) ### Bug Fixes * **docz-core:** be explicit about cli args ([6f5b4ee](https://github.com/doczjs/docz/commit/6f5b4ee)) ### Features * **docz-core:** pass down cli args to Gatsby + fix open flag ([385b006](https://github.com/doczjs/docz/commit/385b006)) # [2.3.0-alpha.10](https://github.com/doczjs/docz/compare/v2.3.0-alpha.9...v2.3.0-alpha.10) (2020-02-06) ### Bug Fixes * **docz-core:** parse port when running serve ([29d0edd](https://github.com/doczjs/docz/commit/29d0edd)) # [2.3.0-alpha.8](https://github.com/doczjs/docz/compare/v2.3.0-alpha.7...v2.3.0-alpha.8) (2020-02-06) **Note:** Version bump only for package docz-core # [2.3.0-alpha.7](https://github.com/doczjs/docz/compare/v2.3.0-alpha.6...v2.3.0-alpha.7) (2020-02-04) ### Features * add the ability to hide a document from the menu ([#1354](https://github.com/doczjs/docz/issues/1354)) ([95b0d7f](https://github.com/doczjs/docz/commit/95b0d7f)) # [2.3.0-alpha.6](https://github.com/doczjs/docz/compare/v2.3.0-alpha.5...v2.3.0-alpha.6) (2020-01-02) ### Bug Fixes * **docz-core:** prevent falsy error code on cli ([#1332](https://github.com/doczjs/docz/issues/1332)) ([1437b59](https://github.com/doczjs/docz/commit/1437b59)) * **docz-core:** revert ts auto-detect ([f0ce584](https://github.com/doczjs/docz/commit/f0ce584)) # [2.3.0-alpha.5](https://github.com/doczjs/docz/compare/v2.3.0-alpha.4...v2.3.0-alpha.5) (2019-12-17) ### Features * **docz-core:** introduce gatsbyRoot to use for fs sourcing ([8e89d64](https://github.com/doczjs/docz/commit/8e89d64)) # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) ### Bug Fixes * **docz-core:** forward cli status code properly ([#1319](https://github.com/doczjs/docz/issues/1319)) ([99ebf82](https://github.com/doczjs/docz/commit/99ebf82)) ### Features * **docz-core:** allow custom pattern for globbing components with docgenConfig.searchPatterns ([#1316](https://github.com/doczjs/docz/issues/1316)) ([29e0165](https://github.com/doczjs/docz/commit/29e0165)) # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) ### Bug Fixes * **docz-core:** properly support node_modules for multiple file patterns ([#1315](https://github.com/doczjs/docz/issues/1315)) ([4d9f9b3](https://github.com/doczjs/docz/commit/4d9f9b3)) * **docz-core:** use docz-utils for get and mergeWith ([f222083](https://github.com/doczjs/docz/commit/f222083)) # [2.3.0-alpha.0](https://github.com/doczjs/docz/compare/v2.2.1-alpha.1...v2.3.0-alpha.0) (2019-12-12) ### Features * **docz-core:** detect typescript without config ([bbaecb2](https://github.com/doczjs/docz/commit/bbaecb2)) ## [2.2.1-alpha.1](https://github.com/doczjs/docz/compare/v2.2.1-alpha.0...v2.2.1-alpha.1) (2019-12-12) ### Bug Fixes * **docz-core:** add native styled-components support ([b072f78](https://github.com/doczjs/docz/commit/b072f78)) ## [2.2.1-alpha.0](https://github.com/doczjs/docz/compare/v2.2.0...v2.2.1-alpha.0) (2019-12-11) **Note:** Version bump only for package docz-core # [2.2.0](https://github.com/doczjs/docz/compare/v2.2.0-alpha.8...v2.2.0) (2019-12-11) **Note:** Version bump only for package docz-core # [2.2.0-alpha.3](https://github.com/doczjs/docz/compare/v2.2.0-alpha.2...v2.2.0-alpha.3) (2019-11-29) ### Bug Fixes * **docz-core:** re-sync .docz on build ([dfd4262](https://github.com/doczjs/docz/commit/dfd4262)) # [2.2.0-alpha.2](https://github.com/doczjs/docz/compare/v2.2.0-alpha.1...v2.2.0-alpha.2) (2019-11-29) ### Bug Fixes * **docz-core:** log errors that happen in gatsby-config ([fe1e2da](https://github.com/doczjs/docz/commit/fe1e2da)) ### Features * **docz-core:** copy .env ([51f7027](https://github.com/doczjs/docz/commit/51f7027)) # [2.2.0-alpha.1](https://github.com/doczjs/docz/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2019-11-28) ### Features * **docz-core:** add all gatsby node apis to generated gatsby-node ([918b44c](https://github.com/doczjs/docz/commit/918b44c)), closes [#1285](https://github.com/doczjs/docz/issues/1285) # [2.2.0-alpha.0](https://github.com/doczjs/docz/compare/v2.1.1...v2.2.0-alpha.0) (2019-11-28) ### Features * **docz-core:** recommend commands on typo ([#1282](https://github.com/doczjs/docz/issues/1282)) ([0f8430d](https://github.com/doczjs/docz/commit/0f8430d)) ## [2.1.1](https://github.com/doczjs/docz/compare/v2.1.0...v2.1.1) (2019-11-27) ### Bug Fixes * **docz-core:** prepend dot to default mdx extensions ([18f78d6](https://github.com/doczjs/docz/commit/18f78d6)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) ### Features * **docz-core:** add mdxExtensions to config ([77b84e8](https://github.com/doczjs/docz/commit/77b84e8)) # [2.0.0-rc.34](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.34) (2019-09-04) ### Bug Fixes * **docz-core:** make onCreateWebpackConfig extendable ([8968a6c](https://github.com/pedronauck/docz/commit/8968a6c)) * **docz-core:** run init on build if docz is not initialized ([26aa7f6](https://github.com/pedronauck/docz/commit/26aa7f6)) * **docz-core:** set yarn production to false to download all deps ([2b4cc6b](https://github.com/pedronauck/docz/commit/2b4cc6b)) * **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) * change themeDir occurences to themesDir ([c841f01](https://github.com/pedronauck/docz/commit/c841f01)) ### Features * **docz-core:** add docz init command ([43cdeca](https://github.com/pedronauck/docz/commit/43cdeca)) * **docz-core:** remove installation step in .docz 🎉 ([4d01ead](https://github.com/pedronauck/docz/commit/4d01ead)) * add normalize for trailing slashes ([4b0a710](https://github.com/pedronauck/docz/commit/4b0a710)) * adds theme path overrrite option ([bb62c6b](https://github.com/pedronauck/docz/commit/bb62c6b)) * rewrite dest path for themeDir override ([7418e55](https://github.com/pedronauck/docz/commit/7418e55)) # [2.0.0-rc.33](https://github.com/pedronauck/docz/compare/v2.0.0-rc.32...v2.0.0-rc.33) (2019-09-04) ### Features * **docz-core:** remove installation step in .docz 🎉 ([6790179](https://github.com/pedronauck/docz/commit/6790179)) # [2.0.0-rc.32](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.32) (2019-09-04) ### Bug Fixes - **docz-core:** make onCreateWebpackConfig extendable ([8968a6c](https://github.com/pedronauck/docz/commit/8968a6c)) - **docz-core:** run init on build if docz is not initialized ([26aa7f6](https://github.com/pedronauck/docz/commit/26aa7f6)) - **docz-core:** set yarn production to false to download all deps ([2b4cc6b](https://github.com/pedronauck/docz/commit/2b4cc6b)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-core:** add docz init command ([43cdeca](https://github.com/pedronauck/docz/commit/43cdeca)) # [2.0.0-rc.31](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.31) (2019-09-03) ### Bug Fixes - **docz-core:** make onCreateWebpackConfig extendable ([8968a6c](https://github.com/pedronauck/docz/commit/8968a6c)) - **docz-core:** run init on build if docz is not initialized ([fe984fd](https://github.com/pedronauck/docz/commit/fe984fd)) - **docz-core:** set yarn production to false to download all deps ([1258553](https://github.com/pedronauck/docz/commit/1258553)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-core:** add docz init command ([2cd87ee](https://github.com/pedronauck/docz/commit/2cd87ee)) # [2.0.0-rc.30](https://github.com/pedronauck/docz/compare/v2.0.0-rc.29...v2.0.0-rc.30) (2019-09-03) ### Bug Fixes - **docz-core:** set yarn production to false to download all deps ([c9db7f1](https://github.com/pedronauck/docz/commit/c9db7f1)) # [2.0.0-rc.29](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.29) (2019-09-03) ### Bug Fixes - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** run init on build if docz is not initialized ([23bc575](https://github.com/pedronauck/docz/commit/23bc575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-core:** add docz init command ([6aaa3e4](https://github.com/pedronauck/docz/commit/6aaa3e4)) # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-03) ### Bug Fixes - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Bug Fixes - **docz-core:** make onCreateWebpackConfig extendable ([d2aff82](https://github.com/pedronauck/docz/commit/d2aff82)) - **docz-core:** run init on build if docz is not initialized ([23bc575](https://github.com/pedronauck/docz/commit/23bc575)) - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) ### Features - **docz-core:** add docz init command ([6aaa3e4](https://github.com/pedronauck/docz/commit/6aaa3e4)) # [2.0.0-rc.27](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.27) (2019-09-02) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) # [2.0.0-rc.6](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.6) (2019-08-29) **Note:** Version bump only for package docz-core # [2.0.0-rc.2](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-08-28) ### Bug Fixes - **docz-core:** extend base config instead of overwriting user config ([#1028](https://github.com/pedronauck/docz/issues/1028)) ([7b46c2b](https://github.com/pedronauck/docz/commit/7b46c2b)) - **docz-core:** wait for app to be ready before opening the browser ([c5cd14d](https://github.com/pedronauck/docz/commit/c5cd14d)) ### Features - **docz-core:** setup jest and add first test ([bf02ac1](https://github.com/pedronauck/docz/commit/bf02ac1)) # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes - bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) - resizable props import ([2926896](https://github.com/pedronauck/docz/commit/2926896)) - **docz-core:** create deps algorithm ([a4b8eb9](https://github.com/pedronauck/docz/commit/a4b8eb9)) - eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) - on create webpack plugin hook ([56e974a](https://github.com/pedronauck/docz/commit/56e974a)) - packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) - some typescript adjustments ([4ba6eaf](https://github.com/pedronauck/docz/commit/4ba6eaf)) - **docz-core:** some adjustments ([86f95b5](https://github.com/pedronauck/docz/commit/86f95b5)) - **docz-core:** vendor react-docgen-external-proptypes-handler ([#866](https://github.com/pedronauck/docz/issues/866)) ([efb89ee](https://github.com/pedronauck/docz/commit/efb89ee)), closes [#727](https://github.com/pedronauck/docz/issues/727) ### Features - open browser integration ([132c472](https://github.com/pedronauck/docz/commit/132c472)) - **docz-core:** add initial gatsby bundler algorithm ([9249e34](https://github.com/pedronauck/docz/commit/9249e34)) - **docz-core:** ensure files before running machine ([1876540](https://github.com/pedronauck/docz/commit/1876540)) - **docz-core:** watch custom theme files ([5ee7abe](https://github.com/pedronauck/docz/commit/5ee7abe)) - **docz-core:** watch gatsby config files ([1539378](https://github.com/pedronauck/docz/commit/1539378)) - a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) - adapt core plugins to gatsby hooks ([4caa47a](https://github.com/pedronauck/docz/commit/4caa47a)) - **gatsby-theme-docz:** add new Props component ([8eb780d](https://github.com/pedronauck/docz/commit/8eb780d)) - add new theme sidebar ([a01d100](https://github.com/pedronauck/docz/commit/a01d100)) - add typescript support (need fix) ([13947f9](https://github.com/pedronauck/docz/commit/13947f9)) - docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) - dynamic src and root path ([c071556](https://github.com/pedronauck/docz/commit/c071556)) - **docz-core:** add build and serve command with gatsby ([e85c82b](https://github.com/pedronauck/docz/commit/e85c82b)) - **docz-core:** add doczrc config watcher on dev ([5aa0455](https://github.com/pedronauck/docz/commit/5aa0455)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) ### Features - **docz-core:** add config docgen ts resolver ([#848](https://github.com/pedronauck/docz/issues/848)) ([256b600](https://github.com/pedronauck/docz/commit/256b600)) - **docz-core:** add config not use specifiers ([#849](https://github.com/pedronauck/docz/issues/849)) ([d8595a9](https://github.com/pedronauck/docz/commit/d8595a9)) - **docz-core:** add serve command ([#855](https://github.com/pedronauck/docz/issues/855)) ([73311bd](https://github.com/pedronauck/docz/commit/73311bd)) # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) ### Bug Fixes - correct props loading ([#836](https://github.com/pedronauck/docz/issues/836)) ([ed85f14](https://github.com/pedronauck/docz/commit/ed85f14)) - **docz-core:** prevent watch in production ([d673262](https://github.com/pedronauck/docz/commit/d673262)) ### Features - **docz-core:** extended path configuration for docgen ([#846](https://github.com/pedronauck/docz/issues/846)) ([aa96739](https://github.com/pedronauck/docz/commit/aa96739)) - **docz-core:** use react-dev-utils create compiler ([4d062de](https://github.com/pedronauck/docz/commit/4d062de)) ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package docz-core ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) ### Bug Fixes - pin typescript version ([8ae97d3](https://github.com/pedronauck/docz/commit/8ae97d3)) ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package docz-core # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) ### Bug Fixes - **docz-core:** typescript doesn't work with several exports ([#771](https://github.com/pedronauck/docz/issues/771)) ([c96878d](https://github.com/pedronauck/docz/commit/c96878d)) ### Features - **docz-core:** auto open browser when start dev mode ([#774](https://github.com/pedronauck/docz/issues/774)) ([c0e6c13](https://github.com/pedronauck/docz/commit/c0e6c13)) # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes - **docz-core:** add src as prefix on ignore ([2bae93b](https://github.com/pedronauck/docz/commit/2bae93b)) - **docz-core:** remove DataServer from production build ([b8770ec](https://github.com/pedronauck/docz/commit/b8770ec)) - get component filename relative (fix [#706](https://github.com/pedronauck/docz/issues/706)) ([84b23ea](https://github.com/pedronauck/docz/commit/84b23ea)) - remove data server from build ([8715129](https://github.com/pedronauck/docz/commit/8715129)) - **docz-core:** base prop for router ([9ca39d7](https://github.com/pedronauck/docz/commit/9ca39d7)) - **docz-core:** entries not initialized on build ([#725](https://github.com/pedronauck/docz/issues/725)) ([3e99db0](https://github.com/pedronauck/docz/commit/3e99db0)) - **docz-core:** resolve symlinks right for the react-docgen ([#699](https://github.com/pedronauck/docz/issues/699)) ([783a836](https://github.com/pedronauck/docz/commit/783a836)) - **docz-theme-default:** apply ignore in props parsing ([#723](https://github.com/pedronauck/docz/issues/723)) ([6dd068c](https://github.com/pedronauck/docz/commit/6dd068c)) # [1.0.0-rc.3](https://github.com/pedronauck/docz/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2019-03-21) ### Bug Fixes - **gatsby-theme-docz:** menu field on entry source node ([05457f2](https://github.com/pedronauck/docz/commit/05457f2)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package docz-core # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes - **docz-core:** config passed on argv ([12f6385](https://github.com/pedronauck/docz/commit/12f6385)) - **docz-core:** hot loader and mdx plugins ([0531d65](https://github.com/pedronauck/docz/commit/0531d65)) - **docz-core:** initialize config state on data server start ([#678](https://github.com/pedronauck/docz/issues/678)) ([8c740b8](https://github.com/pedronauck/docz/commit/8c740b8)) - **docz-core:** remove dev things from prod build ([3f5b5d7](https://github.com/pedronauck/docz/commit/3f5b5d7)) - **docz-core:** write first imports ([b856168](https://github.com/pedronauck/docz/commit/b856168)) - immutable merge with lodash ([2fe94d4](https://github.com/pedronauck/docz/commit/2fe94d4)) - some general adjustments ([0c61f64](https://github.com/pedronauck/docz/commit/0c61f64)) - **docz-core:** remove order from Entry class ([e12c37d](https://github.com/pedronauck/docz/commit/e12c37d)) - define right internal dependencies version ([30a91b4](https://github.com/pedronauck/docz/commit/30a91b4)) - use lodash merge instead of deepmerge ([18ac37b](https://github.com/pedronauck/docz/commit/18ac37b)) - **docz-core:** add spaces when write db.json ([3a84af3](https://github.com/pedronauck/docz/commit/3a84af3)) - **docz-core:** add typescript as dependency ([9f314cd](https://github.com/pedronauck/docz/commit/9f314cd)) - **docz-core:** apply mdast plugins to entries parse too ([c2554b8](https://github.com/pedronauck/docz/commit/c2554b8)) - **docz-core:** docgen if file has not component definition ([b0fb846](https://github.com/pedronauck/docz/commit/b0fb846)) - **docz-core:** exclude node modules from source map loader ([1c7c9f7](https://github.com/pedronauck/docz/commit/1c7c9f7)) - **docz-core:** mdx loader options ([9114f9b](https://github.com/pedronauck/docz/commit/9114f9b)) - **docz-core:** props state parser ([87767e8](https://github.com/pedronauck/docz/commit/87767e8)) - **docz-core:** react docgen typescript performance ([2967e7c](https://github.com/pedronauck/docz/commit/2967e7c)) - **docz-core:** return http server on bundler.start() ([cdba3bf](https://github.com/pedronauck/docz/commit/cdba3bf)) - **docz-core:** run right hook name ([f500971](https://github.com/pedronauck/docz/commit/f500971)) - **gatsby-theme-docz:** use createPages instead of createPagesStatefully ([37b73c6](https://github.com/pedronauck/docz/commit/37b73c6)) - **load-cfg:** use babel register in order to require using es6 ([7ad3b64](https://github.com/pedronauck/docz/commit/7ad3b64)) - a lot of bug fixes ([c10a8bd](https://github.com/pedronauck/docz/commit/c10a8bd)) - use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features - **docz-core:** remove ordering deprecated field ([39660bb](https://github.com/pedronauck/docz/commit/39660bb)) - **gatsby-theme-docz:** add custom theme support ([fdfddcb](https://github.com/pedronauck/docz/commit/fdfddcb)) - add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) - add playground component ([cde6511](https://github.com/pedronauck/docz/commit/cde6511)) - docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) - split router logic from theme ([a9c26e6](https://github.com/pedronauck/docz/commit/a9c26e6)) - use @reach/router instead of react-router ([81a4a82](https://github.com/pedronauck/docz/commit/81a4a82)) - **docz-core:** support for configuring the separator during slugifying ([10bb134](https://github.com/pedronauck/docz/commit/10bb134)) ## [0.13.6](https://github.com/pedronauck/docz/compare/v0.13.5...v0.13.6) (2018-12-26) ### Bug Fixes - **docz-core:** default value for arguments ([5644343](https://github.com/pedronauck/docz/commit/5644343)) - **docz-core:** happypack plugin name ([cbf7692](https://github.com/pedronauck/docz/commit/cbf7692)) ## [0.13.5](https://github.com/pedronauck/docz/compare/v0.13.4...v0.13.5) (2018-12-19) ### Bug Fixes - **docz-core:** add react docgen loader inside happypack ([4433561](https://github.com/pedronauck/docz/commit/4433561)) - **docz-core:** close data server when need ([6a2b96a](https://github.com/pedronauck/docz/commit/6a2b96a)) - **docz-core:** public folder in dev mode ([abb3626](https://github.com/pedronauck/docz/commit/abb3626)) - **docz-core:** webpack dev server log level ([1d72539](https://github.com/pedronauck/docz/commit/1d72539)) ## [0.13.4](https://github.com/pedronauck/docz/compare/v0.13.3...v0.13.4) (2018-12-17) **Note:** Version bump only for package docz-core ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) ### Bug Fixes - **docz-core:** react hot loader config for hooks ([444cac2](https://github.com/pedronauck/docz/commit/444cac2)) ### Features - **docz-core:** add sourcemap config argument ([3baad4a](https://github.com/pedronauck/docz/commit/3baad4a)) ## [0.13.2](https://github.com/pedronauck/docz/compare/v0.13.1...v0.13.2) (2018-12-17) ### Bug Fixes - **docz-core:** ensure dir for promise logger ([6240f21](https://github.com/pedronauck/docz/commit/6240f21)) ## [0.13.1](https://github.com/pedronauck/docz/compare/v0.13.0...v0.13.1) (2018-12-17) ### Bug Fixes - **docz-core:** typescript loader config ([01f568e](https://github.com/pedronauck/docz/commit/01f568e)) # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes - **docz-core:** add setMaxListener for chokidar watchers ([6053c16](https://github.com/pedronauck/docz/commit/6053c16)) - **docz-core:** log level based on debug argument ([507e149](https://github.com/pedronauck/docz/commit/507e149)) - **docz-core:** node path resolve modules merge ([27102fd](https://github.com/pedronauck/docz/commit/27102fd)) - **docz-core:** turn off htmlMinifier when loading from templates ([#518](https://github.com/pedronauck/docz/issues/518)) ([9cb0e1d](https://github.com/pedronauck/docz/commit/9cb0e1d)) - **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ### Features - **docz-core:** add onCreateWebpackChain hook ([70bb242](https://github.com/pedronauck/docz/commit/70bb242)) - **docz-core:** add promise logger using progress-estimator ([2797608](https://github.com/pedronauck/docz/commit/2797608)) - **docz-core:** use NODE_PATH to resolve modules ([#516](https://github.com/pedronauck/docz/issues/516)) ([cc86f93](https://github.com/pedronauck/docz/commit/cc86f93)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) ### Bug Fixes - **docz-core:** correct koa mounting path on windows systems ([#491](https://github.com/pedronauck/docz/issues/491)) ([6addd32](https://github.com/pedronauck/docz/commit/6addd32)) ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) ### Bug Fixes - **docz-core:** add setMaxListener in the top of script ([2eef307](https://github.com/pedronauck/docz/commit/2eef307)) - **docz-core:** update react-hot-loader to support hooks ([4394a5b](https://github.com/pedronauck/docz/commit/4394a5b)) ### Features - add native support for react-native ([f998874](https://github.com/pedronauck/docz/commit/f998874)) ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) ### Bug Fixes - **docz-core:** set max listener ([898010b](https://github.com/pedronauck/docz/commit/898010b)) - **docz-core:** watcher close ([caa8151](https://github.com/pedronauck/docz/commit/caa8151)) ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) **Note:** Version bump only for package docz-core ## [0.12.12](https://github.com/pedronauck/docz/compare/v0.12.11...v0.12.12) (2018-11-16) **Note:** Version bump only for package docz-core ## [0.12.11](https://github.com/pedronauck/docz/compare/v0.12.10...v0.12.11) (2018-11-15) ### Bug Fixes - **docz-core:** add happypack again :cry: ([f0e219e](https://github.com/pedronauck/docz/commit/f0e219e)) - **docz-core:** create app files before start server ([43bc3fd](https://github.com/pedronauck/docz/commit/43bc3fd)) ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) ### Bug Fixes - **docz-core:** add cache just for non-debug ([cede436](https://github.com/pedronauck/docz/commit/cede436)) - **docz-core:** add default favicon ([a0ed2ab](https://github.com/pedronauck/docz/commit/a0ed2ab)) - **docz-core:** add ignore md files by args ([d8c8045](https://github.com/pedronauck/docz/commit/d8c8045)) - **docz-core:** kill server on signals ([be0855f](https://github.com/pedronauck/docz/commit/be0855f)) - **docz-core:** use assets from public folder ([210c3a1](https://github.com/pedronauck/docz/commit/210c3a1)) ### Features - **docz-core:** add detect-one-changed in development ([#433](https://github.com/pedronauck/docz/issues/433)) ([0585b97](https://github.com/pedronauck/docz/commit/0585b97)) - **docz-core:** add two new plugin hooks ([#431](https://github.com/pedronauck/docz/issues/431)) ([f4a122f](https://github.com/pedronauck/docz/commit/f4a122f)) ## [0.12.9](https://github.com/pedronauck/docz/compare/v0.12.8...v0.12.9) (2018-11-01) **Note:** Version bump only for package docz-core ## [0.12.8](https://github.com/pedronauck/docz/compare/v0.12.7...v0.12.8) (2018-10-31) ### Bug Fixes - **docz-core:** add support to react hooks ([f26a990](https://github.com/pedronauck/docz/commit/f26a990)) ## [0.12.7](https://github.com/pedronauck/docz/compare/v0.12.6...v0.12.7) (2018-10-30) ### Bug Fixes - **docz-core:** webpack chain minimizer config ([ab13208](https://github.com/pedronauck/docz/commit/ab13208)) ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) ### Features - add support to disable codesandbox ([be94b0e](https://github.com/pedronauck/docz/commit/be94b0e)) ## [0.12.5](https://github.com/pedronauck/docz/compare/v0.12.4...v0.12.5) (2018-09-30) ### Bug Fixes - **docz-core:** close dataserver connection on build ([0f6bd7b](https://github.com/pedronauck/docz/commit/0f6bd7b)) ## [0.11.2](https://github.com/pedronauck/docz/compare/v0.11.1...v0.11.2) (2018-09-11) ### Bug Fixes - **docz-core:** add watcher outside of update method scope ([18c744d](https://github.com/pedronauck/docz/commit/18c744d)) - **docz-core:** prevent entries block when parse mdx crash ([07ae769](https://github.com/pedronauck/docz/commit/07ae769)) - **docz-core:** remove https option and fix message ([#321](https://github.com/pedronauck/docz/issues/321)) ([ea88841](https://github.com/pedronauck/docz/commit/ea88841)) - heading hash link with hash router config ([7d7f557](https://github.com/pedronauck/docz/commit/7d7f557)) ### Features - add native config for doczrc ([2580712](https://github.com/pedronauck/docz/commit/2580712)) ## [0.11.1](https://github.com/pedronauck/docz/compare/v0.11.0...v0.11.1) (2018-09-07) ### Bug Fixes - **docz-core:** basename configuration ([5fad743](https://github.com/pedronauck/docz/commit/5fad743)) - **docz-core:** chokidar performance improvements ([0c344d8](https://github.com/pedronauck/docz/commit/0c344d8)) - **docz-core:** literal value of headings for menus ([85e4083](https://github.com/pedronauck/docz/commit/85e4083)) - **docz-core:** open js and ts loader scope of files ([03c01b7](https://github.com/pedronauck/docz/commit/03c01b7)) ### Features - **docz-core:** add config as parameter for onPrebuild and onPostBuild ([98692bb](https://github.com/pedronauck/docz/commit/98692bb)) # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) ### Bug Fixes - base url and hash router making weird url ([f483638](https://github.com/pedronauck/docz/commit/f483638)) - **docz-core:** dispose hmr on imports ([ba51086](https://github.com/pedronauck/docz/commit/ba51086)) - **docz-core:** join head tags ([#255](https://github.com/pedronauck/docz/issues/255)) ([065e8b3](https://github.com/pedronauck/docz/commit/065e8b3)) - **docz-core:** update react-docgen-typescript-loader to fix props table ([34b2fdf](https://github.com/pedronauck/docz/commit/34b2fdf)) ### Features - **babel-preset-docz:** add new babel preset ([5efb568](https://github.com/pedronauck/docz/commit/5efb568)) ## [0.10.3](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.3) (2018-08-16) ### Bug Fixes - **docz-core:** correct data server websocket port ([47fe714](https://github.com/pedronauck/docz/commit/47fe714)) - **docz-core:** try catch on get repo info ([2016736](https://github.com/pedronauck/docz/commit/2016736)) ### Features - **docz-core:** add editBranch option to mount repo link ([c619d9c](https://github.com/pedronauck/docz/commit/c619d9c)) ## [0.10.2](https://github.com/pedronauck/docz/compare/v0.10.1...v0.10.2) (2018-08-13) ### Bug Fixes - prevent codemirror bug on build ([3d0894e](https://github.com/pedronauck/docz/commit/3d0894e)) - **docz-core:** remove data server cache :confused: ([9683280](https://github.com/pedronauck/docz/commit/9683280)) - **docz-core:** try catch on get repo info ([bdfbf0b](https://github.com/pedronauck/docz/commit/bdfbf0b)) ## [0.10.1](https://github.com/pedronauck/docz/compare/v0.10.0...v0.10.1) (2018-08-13) ### Bug Fixes - **docz-core:** prevent crash when not have cache ([cd3609a](https://github.com/pedronauck/docz/commit/cd3609a)) # [0.10.0](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.0) (2018-08-13) ### Bug Fixes - **docz-core:** prevent crash on delete entry ([28e1728](https://github.com/pedronauck/docz/commit/28e1728)) - **docz-core:** prevent delete entire app folder on build ([e345896](https://github.com/pedronauck/docz/commit/e345896)) ### Features - **docz-core:** add cache system for entries ([b90e598](https://github.com/pedronauck/docz/commit/b90e598)) - **docz-core:** add htmlContext and mini-html-webpack-plugin ([4b6ec0f](https://github.com/pedronauck/docz/commit/4b6ec0f)) - **docz-core:** resolve markdown files by default ([#210](https://github.com/pedronauck/docz/issues/210)) ([e0a95b3](https://github.com/pedronauck/docz/commit/e0a95b3)) - add github repository link ([78a19f6](https://github.com/pedronauck/docz/commit/78a19f6)) ## [0.9.6](https://github.com/pedronauck/docz/compare/v0.9.5...v0.9.6) (2018-08-06) ### Bug Fixes - **docz-core:** remove [@babel](https://github.com/babel)/runtime alias ([0dbd8f0](https://github.com/pedronauck/docz/commit/0dbd8f0)) ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) ### Bug Fixes - **docz-core:** use of src config in edit button link ([#186](https://github.com/pedronauck/docz/issues/186)) ([553f90c](https://github.com/pedronauck/docz/commit/553f90c)) - remove external deps ([470bdd3](https://github.com/pedronauck/docz/commit/470bdd3)) ## [0.9.3](https://github.com/pedronauck/docz/compare/v0.9.2...v0.9.3) (2018-08-03) ### Bug Fixes - **docz-core:** use of src config in edit button link ([#186](https://github.com/pedronauck/docz/issues/186)) ([553f90c](https://github.com/pedronauck/docz/commit/553f90c)) ## [0.9.2](https://github.com/pedronauck/docz/compare/v0.9.1...v0.9.2) (2018-08-02) ### Bug Fixes - **docz-core:** add isProd to remove hot client overlay on build ([83f2e36](https://github.com/pedronauck/docz/commit/83f2e36)) ## [0.9.1](https://github.com/pedronauck/docz/compare/v0.9.0...v0.9.1) (2018-08-02) ### Bug Fixes - **docz:** finish process after build ([58bebb6](https://github.com/pedronauck/docz/commit/58bebb6)) # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) ### Bug Fixes - **docz:** using context for imports to prevent disposed hmr ([b37284c](https://github.com/pedronauck/docz/commit/b37284c)) - **docz-plugin-babel6:** change babel syntax dynamic import when needed ([8cb278a](https://github.com/pedronauck/docz/commit/8cb278a)) # [0.9.0-beta.1](https://github.com/pedronauck/docz/compare/v0.9.0-beta.0...v0.9.0-beta.1) (2018-08-01) **Note:** Version bump only for package docz-core # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) ### Bug Fixes - **docz-core:** remove babel plugin/presets when needed ([011baad](https://github.com/pedronauck/docz/commit/011baad)) ### Features - **docz-core:** add webpack-serve-overlay as error overlay ([263badf](https://github.com/pedronauck/docz/commit/263badf)) - **docz-core:** support env files to set configuration ([#171](https://github.com/pedronauck/docz/issues/171)) ([259b72d](https://github.com/pedronauck/docz/commit/259b72d)), closes [#140](https://github.com/pedronauck/docz/issues/140) - **docz-theme-default:** add edit button for document ([#180](https://github.com/pedronauck/docz/issues/180)) ([e125a4f](https://github.com/pedronauck/docz/commit/e125a4f)) # [0.8.0](https://github.com/pedronauck/docz/compare/v0.7.1...v0.8.0) (2018-07-28) **Note:** Version bump only for package docz-core # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) **Note:** Version bump only for package docz-core ## [0.6.2](https://github.com/pedronauck/docz/compare/v0.6.1...v0.6.2) (2018-07-20) ### Bug Fixes - **docz-core:** set env vars for commands ([29f0098](https://github.com/pedronauck/docz/commit/29f0098)) # [0.6.0](https://github.com/pedronauck/docz/compare/v0.5.9...v0.6.0) (2018-07-19) ### Bug Fixes - **docz-core:** add error when dest is working directory ([b1c87b5](https://github.com/pedronauck/docz/commit/b1c87b5)) - **docz-core:** process.env vars for scripts ([f6b6260](https://github.com/pedronauck/docz/commit/f6b6260)) - **docz-core:** serve static files from public ([c866856](https://github.com/pedronauck/docz/commit/c866856)) ### Features - **docz-core:** add onCreateApp plugin method ([13c07e7](https://github.com/pedronauck/docz/commit/13c07e7)) ## [0.5.9](https://github.com/pedronauck/docz/compare/v0.5.8...v0.5.9) (2018-07-16) **Note:** Version bump only for package docz-core ## [0.5.7](https://github.com/pedronauck/docz/compare/v0.5.6...v0.5.7) (2018-07-11) **Note:** Version bump only for package docz-core ## [0.5.6](https://github.com/pedronauck/docz/compare/v0.5.5...v0.5.6) (2018-07-11) ### Features - **docz-core:** add webpack-serve-waitpage ([83c493b](https://github.com/pedronauck/docz/commit/83c493b)) ## [0.5.5](https://github.com/pedronauck/docz/compare/v0.5.4...v0.5.5) (2018-07-07) ### Bug Fixes - **docz-core:** add ordering to initial config data object ([2926ade](https://github.com/pedronauck/docz/commit/2926ade)) ## [0.5.4](https://github.com/pedronauck/docz/compare/v0.5.3...v0.5.4) (2018-07-07) **Note:** Version bump only for package docz-core ## [0.5.2](https://github.com/pedronauck/docz/compare/v0.5.1...v0.5.2) (2018-07-05) ### Bug Fixes - **docz-core:** remove unnescessary Entry.check ([1871db8](https://github.com/pedronauck/docz/commit/1871db8)) ## [0.5.1](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.1) (2018-07-03) ### Bug Fixes - **docz-core:** add a fallback name on Entry ([ec38139](https://github.com/pedronauck/docz/commit/ec38139)) - **docz-core:** app running port message ([4aec595](https://github.com/pedronauck/docz/commit/4aec595)) - **docz-core:** check name on package json ([6cdbebc](https://github.com/pedronauck/docz/commit/6cdbebc)) ### Features - **docz-core:** add ordering property for config ([efd215e](https://github.com/pedronauck/docz/commit/efd215e)) - **docz-core:** read name from package.json to populate initial title ([1eeb049](https://github.com/pedronauck/docz/commit/1eeb049)) # [0.5.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.0) (2018-07-03) ### Bug Fixes - **docz-core:** add a fallback name on Entry ([ec38139](https://github.com/pedronauck/docz/commit/ec38139)) - **docz-core:** app running port message ([1b94114](https://github.com/pedronauck/docz/commit/1b94114)) ### Features - **docz-core:** add ordering property for config ([a6c307d](https://github.com/pedronauck/docz/commit/a6c307d)) - **docz-core:** read name from package.json to populate initial title ([4f10a6d](https://github.com/pedronauck/docz/commit/4f10a6d)) # [0.4.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.4.0) (2018-06-30) ### Bug Fixes - **docz-core:** add a fallback name on Entry ([ec38139](https://github.com/pedronauck/docz/commit/ec38139)) ## [0.3.4](https://github.com/pedronauck/docz/compare/v0.3.3...v0.3.4) (2018-06-26) **Note:** Version bump only for package docz-core ## [0.3.3](https://github.com/pedronauck/docz/compare/v0.3.2...v0.3.3) (2018-06-26) ### Bug Fixes - **docz-core:** copy templates files for dist ([#88](https://github.com/pedronauck/docz/issues/88)) ([5e4b98d](https://github.com/pedronauck/docz/commit/5e4b98d)) ## [0.3.2](https://github.com/pedronauck/docz/compare/v0.3.1...v0.3.2) (2018-06-25) **Note:** Version bump only for package docz-core ## [0.3.1](https://github.com/pedronauck/docz/compare/v0.2.11...v0.3.1) (2018-06-25) ### Bug Fixes - use docz-theme-default as docz-core dependency ([1a2fb67](https://github.com/pedronauck/docz/commit/1a2fb67)) ## [0.2.11](https://github.com/pedronauck/docz/compare/v0.2.10...v0.2.11) (2018-06-22) ### Bug Fixes - **docz-core:** node env for production ([615aa1f](https://github.com/pedronauck/docz/commit/615aa1f)) ## [0.2.10](https://github.com/pedronauck/docz/compare/v0.2.9...v0.2.10) (2018-06-21) ### Features - **docz-plugin-css:** add initial version ([#78](https://github.com/pedronauck/docz/issues/78)) ([299372e](https://github.com/pedronauck/docz/commit/299372e)) ## [0.2.9](https://github.com/pedronauck/docz/compare/v0.2.8...v0.2.9) (2018-06-21) **Note:** Version bump only for package docz-core ## [0.2.8](https://github.com/pedronauck/docz/compare/v0.2.7...v0.2.8) (2018-06-21) ### Bug Fixes - **docz-core:** typescript resolve extensions ([689b057](https://github.com/pedronauck/docz/commit/689b057)) ## [0.2.7](https://github.com/pedronauck/docz/compare/v0.2.6...v0.2.7) (2018-06-20) **Note:** Version bump only for package docz-core ## [0.2.6](https://github.com/pedronauck/docz/compare/v0.2.5...v0.2.6) (2018-06-17) ### Bug Fixes - **docz-core:** change filepath entry for windows ([#31](https://github.com/pedronauck/docz/issues/31)) ([14bf0e2](https://github.com/pedronauck/docz/commit/14bf0e2)) ## [0.2.4](https://github.com/pedronauck/docz/compare/v0.2.3...v0.2.4) (2018-06-13) **Note:** Version bump only for package docz-core ## [0.2.3](https://github.com/pedronauck/docz/compare/v0.2.2...v0.2.3) (2018-06-13) ### Bug Fixes - **docz-core:** change config hosts to support windows os ([9e3c4f6](https://github.com/pedronauck/docz/commit/9e3c4f6)) ## [0.2.2](https://github.com/pedronauck/docz/compare/v0.2.1...v0.2.2) (2018-06-12) **Note:** Version bump only for package docz-core # [0.2.0](https://github.com/pedronauck/docz/compare/v0.2.0-beta.2...v0.2.0) (2018-06-11) **Note:** Version bump only for package docz-core # [0.2.0-beta.2](https://github.com/doczjs/docz/compare/v0.2.0-beta.1...v0.2.0-beta.2) (2018-06-10) ### Bug Fixes - **docz-core:** autolink headings ([0b8369d](https://github.com/doczjs/docz/commit/0b8369d)) # [0.2.0-beta.1](https://github.com/doczjs/docz/compare/v0.2.0-beta.0...v0.2.0-beta.1) (2018-06-10) ### Features - **docz-core:** add headings property for entries and autolink on headings ([7711c3c](https://github.com/doczjs/docz/commit/7711c3c)) # [0.2.0-beta.0](https://github.com/doczjs/docz/compare/v0.1.2-beta.6...v0.2.0-beta.0) (2018-06-10) ### Features - **docz-core:** add indexHtml property on project configuration ([6bb5167](https://github.com/doczjs/docz/commit/6bb5167)) ## [0.1.2-beta.5](https://github.com/doczjs/docz/compare/v0.1.2-beta.4...v0.1.2-beta.5) (2018-06-09) ### Bug Fixes - **docz-core:** build when base prop ([6001171](https://github.com/doczjs/docz/commit/6001171)) ## [0.1.2-beta.1](https://github.com/doczjs/docz/compare/v0.1.2-beta.0...v0.1.2-beta.1) (2018-06-09) ### Features - **docz-core:** add base config argument ([20f29c2](https://github.com/doczjs/docz/commit/20f29c2)) - **docz-core:** add dest config property ([d6c5506](https://github.com/doczjs/docz/commit/d6c5506)) - **docz-core:** add modifyBundlerConfig configuration property ([ec04bee](https://github.com/doczjs/docz/commit/ec04bee)) - **docz-core:** use html template as component ([b7a2dc0](https://github.com/doczjs/docz/commit/b7a2dc0)) ## [0.1.2-beta.0](https://github.com/doczjs/docz/compare/v0.1.1...v0.1.2-beta.0) (2018-06-02) **Note:** Version bump only for package docz-core ## [0.1.1-beta.5](https://github.com/doczjs/docz/compare/v0.1.1-beta.4...v0.1.1-beta.5) (2018-06-01) **Note:** Version bump only for package docz-core ## [0.1.1-beta.4](https://github.com/doczjs/docz/compare/v0.1.1-beta.3...v0.1.1-beta.4) (2018-05-29) ### Bug Fixes - **docz-core:** module rule test for typescript ([bdeffc1](https://github.com/doczjs/docz/commit/bdeffc1)) ## [0.1.1-beta.3](https://github.com/doczjs/docz/compare/v0.1.1-beta.2...v0.1.1-beta.3) (2018-05-29) **Note:** Version bump only for package docz-core # 0.1.0 (2018-05-29) ### Bug Fixes - **docz-core:** async plugin ([ddfbcf1](https://github.com/doczjs/docz/commit/ddfbcf1)) - **docz-core:** check if found name exist when parse entry ([f75881e](https://github.com/doczjs/docz/commit/f75881e)) - **docz-core:** config watch for directory operations ([43fa7ab](https://github.com/doczjs/docz/commit/43fa7ab)) - **docz-core:** create plugin to fix paragraph parse on mdx ([42b4f05](https://github.com/doczjs/docz/commit/42b4f05)) - **docz-core:** data server class ([12c0558](https://github.com/doczjs/docz/commit/12c0558)) - **docz-core:** don't exit when catch prettier ([5423d96](https://github.com/doczjs/docz/commit/5423d96)) - **docz-core:** entries rewrite ([986ba65](https://github.com/doczjs/docz/commit/986ba65)) - **docz-core:** entries updates ([7147ac1](https://github.com/doczjs/docz/commit/7147ac1)) - **docz-core:** throw error when parse ast ([05138bf](https://github.com/doczjs/docz/commit/05138bf)) ### Features - **docz-core:** add build command ([ef7abd2](https://github.com/doczjs/docz/commit/ef7abd2)) - **docz-core:** add chokidar to watch new entries ([2f073d5](https://github.com/doczjs/docz/commit/2f073d5)) - **docz-core:** add entry settings field ([2ec5d66](https://github.com/doczjs/docz/commit/2ec5d66)) - **docz-core:** add playground code parse section ([6bbf158](https://github.com/doczjs/docz/commit/6bbf158)) - **docz-core:** add setConfig method for Plugin ([9ba6507](https://github.com/doczjs/docz/commit/9ba6507)) - **docz-core:** add support for custom head or scripts ([69f4d56](https://github.com/doczjs/docz/commit/69f4d56)) - **docz-core:** add support for parse sections via ast ([6db0cd8](https://github.com/doczjs/docz/commit/6db0cd8)) - **docz-core:** add title and description on settings ([ad9ee58](https://github.com/doczjs/docz/commit/ad9ee58)) - **docz-core:** add typescript support ([17dae8b](https://github.com/doczjs/docz/commit/17dae8b)) - **docz-core:** improve plugin and add support to modify babel ([cf3ec4e](https://github.com/doczjs/docz/commit/cf3ec4e)) - add component props parse feature ([987627d](https://github.com/doczjs/docz/commit/987627d)) - **docz-core:** pass theme config via websockets for dev ([5222de7](https://github.com/doczjs/docz/commit/5222de7)) - **docz-core:** use websockets instead of generate json to process entries ([e0773a0](https://github.com/doczjs/docz/commit/e0773a0)) - **docz-theme-default:** add logo option ([435da9b](https://github.com/doczjs/docz/commit/435da9b)) - add support for highlight code sections ([19bf7ea](https://github.com/doczjs/docz/commit/19bf7ea)) - improve docz theme to use theme config ([9207ed2](https://github.com/doczjs/docz/commit/9207ed2)) - refac to use mdx ([04b59e5](https://github.com/doczjs/docz/commit/04b59e5)) ================================================ FILE: core/docz-core/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/docz-core/README.md ================================================ ## docz-core All CLI commands are built here and imported from `docz` package using `./bin` script. Code in this package does not run on the browser, it runs on node. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: core/docz-core/__fixtures__/Alert/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: core/docz-core/__fixtures__/Alert/Alert.tsx ================================================ import React, { FC } from 'react' import styled from '@emotion/styled' export type Kind = 'info' | 'positive' | 'negative' | 'warning' export type KindMap = Record const kinds: KindMap = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export interface AlertProps { /** * Set this to change alert kind * @default info */ kind: 'info' | 'positive' | 'negative' | 'warning' } const AlertStyled = styled('div')` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` export const Alert: FC = ({ kind, ...props }) => ( ) ================================================ FILE: core/docz-core/__fixtures__/Label.jsx ================================================ import React from 'react' import t from 'prop-types' const Label = ({ text, ...props }) => (
{text}
) Label.propTypes = { /** A nice string */ text: t.string, } export default Label ================================================ FILE: core/docz-core/__fixtures__/Label.tsx ================================================ import React, { FC } from 'react' export interface LabelProps { /** * Set this to do the thing * @default info */ text: string } const Label: FC = ({ text, ...props }) => (
{text}
) export default Label ================================================ FILE: core/docz-core/__tests__/config.test.ts ================================================ import * as path from 'path' import { setArgs } from '../src/config/argv' import { getBaseConfig } from '../src/config/docz' import { getThemesDir } from '../src/config/paths' import yargs from 'yargs' describe('config.argv & config.docz', () => { test('works', () => { const { argv } = setArgs(yargs) // expect(argv).toMatchInlineSnapshot(`undefined`) //@ts-ignore getBaseConfig(argv, {}) // expect(c) }) }) describe('getThemeDir', () => { test('returns src/ for default config', () => { const { argv } = setArgs(yargs) //@ts-ignore const config = getBaseConfig(argv, {}) expect(getThemesDir(config)).toBe(path.join(config.root, '/src')) }) test('returns correct path for custom themesDir entry', () => { const { argv } = setArgs(yargs) //@ts-ignore const config = getBaseConfig(argv, { themesDir: 'theme' }) expect(getThemesDir(config)).toBe(path.join(config.root, '/theme')) }) test('custom themesDir entries with trailing slashes are handled correctly', () => { const { argv } = setArgs(yargs) //@ts-ignore const config = getBaseConfig(argv, { themesDir: 'theme/' }) expect(getThemesDir(config)).toBe(path.join(config.root, '/theme')) }) }) ================================================ FILE: core/docz-core/__tests__/entries.test.ts ================================================ import { Entries } from '../src/lib/Entries' import { getTestConfig } from '../src/test-utils' describe('Entries', () => { test('get entries', async () => { const config = getTestConfig() const entries = new Entries(config) expect(entries).toBeTruthy() }) }) ================================================ FILE: core/docz-core/__tests__/props.test.ts ================================================ import * as fs from 'fs-extra' import { getPattern, initial } from '../src/states/props' import { readCacheFile } from '../src/utils/docgen/typescript' import { getTestConfig, mockedParams } from '../src/test-utils' describe('props', () => { beforeEach(() => { if (fs.existsSync('./.docz/.cache/propsParser.json')) { fs.unlinkSync('./.docz/.cache/propsParser.json') } }) describe('typescript', () => { test('should set props from typescript files', async () => { const config = getTestConfig() const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) expect(params.getState().props.length).toBeGreaterThan(0) }) test('should set correct key on parsed typescript files', async () => { const config = getTestConfig() const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) const expectedFirstPropName = '__fixtures__/Label.tsx' const firstProp = params.getState().props[0] expect(firstProp.key).toEqual(expectedFirstPropName) expect(firstProp.value).toBeTruthy() }) }) describe('javascript', () => { test('should set correct key on parsed javascript files', async () => { const config = getTestConfig({ typescript: undefined }) const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) const expectedFirstPropName = '__fixtures__/Label.jsx' const firstProp = params.getState().props[0] expect(firstProp.key).toEqual(expectedFirstPropName) expect(firstProp.value).toBeTruthy() }) test('should set props from javascript files', async () => { const config = getTestConfig({ typescript: undefined }) const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) expect(params.getState().props.length).toBeGreaterThan(0) }) test('should have props on javascript files', async () => { const config = getTestConfig({ typescript: undefined }) const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) const firstProp = params.getState().props[0] expect(firstProp.value[0].props).toBeTruthy() }) }) describe('cache', () => { test('should have empty cache on start', async () => { const cache = readCacheFile() expect(cache).toBeNull() }) test('should set cache on loading props', async () => { const cache = readCacheFile() expect(cache).toBeNull() const config = getTestConfig() const pattern = getPattern(config) const data = initial(config, pattern) const params = mockedParams() await data(params) expect(readCacheFile()).not.toBeNull() }) }) }) ================================================ FILE: core/docz-core/__tests__/states.test.ts ================================================ import * as states from '../src/states/index' import { createConfigStateInput } from '../src/test-utils/data-bank' import { getBaseConfig } from '../src/config/docz' import * as paths from '../src/config/paths' import { Entries } from '../src/lib/Entries' import { setArgs } from '../src/config/argv' describe('states', () => { test('exports', () => { expect(states).toBeDefined() expect(typeof states.config).toEqual('function') expect(typeof states.entries).toEqual('function') expect(typeof states.props).toEqual('function') }) }) describe('states.config', () => { test('config returns valid state', () => { const state = states.config({}) expect(typeof state.close).toEqual('function') expect(typeof state.start).toEqual('function') expect(state.id).toEqual('config') state.close() }) test('config state writes config to state when started', async () => { const config = createConfigStateInput() const setState = jest.fn() const getState = jest.fn() const state = states.config(config) await state.start({ getState, setState }) delete config.paths delete config.src expect(setState).toBeCalledWith('config', expect.objectContaining(config)) state.close() }) }) describe('states.entries', () => { test('entries returns start-able state', async () => { const yargs = { argv: {}, option: jest.fn().mockImplementation((key, value) => { yargs.argv[value.alias ? value.alias : key] = value.default return yargs }), } const { argv } = setArgs(yargs) //@ts-ignore const config = { ...getBaseConfig(argv), paths } const entries = new Entries(config) const state = states.entries(entries, config) const setState = jest.fn() const getState = jest.fn() await state.start({ getState, setState }) expect(getState).toBeCalledWith() // expect(setState).toBeCalledWith('entries', []) state.close() }) }) ================================================ FILE: core/docz-core/bin/index.js ================================================ require('../dist/').cli() ================================================ FILE: core/docz-core/nodemon.json ================================================ { "ignore": ["dist/"], "//verbose": true, "exec": "yarn build && node bin/index.js init", "ext": "js,ts,json" } ================================================ FILE: core/docz-core/package.json ================================================ { "name": "docz-core", "version": "2.4.0", "description": "All docz core logic of bundle and parsing is included on this package", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "files": [ "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/docz-core" }, "scripts": { "build": "yarn cross-env NODE_ENV=production rollup -c", "dev": "yarn cross-env NODE_ENV=development yarn build -w", "fix": "yarn lint --fix", "lint": "yarn eslint . --ext mdx,ts,tsx", "precommit": "lint-staged", "prepare": "yarn build", "test": "yarn jest" }, "peerDependencies": { "typescript": "^3.5.0 || ^4.0.0" }, "dependencies": { "@sindresorhus/slugify": "^0.9.1", "chalk": "^2.4.2", "chokidar": "^3.0.2", "cross-spawn": "^7.0.2", "detect-port": "^1.3.0", "docz-utils": "^2.4.0", "env-dot-prop": "^2.0.1", "fast-deep-equal": "^2.0.1", "fast-glob": "^3.0.4", "find-up": "^4.1.0", "fs-extra": "^8.1.0", "gatsby-plugin-eslint": "^2.0.5", "gatsby-plugin-typescript": "^2.1.6", "get-pkg-repo": "4.1.1", "humanize-string": "^2.1.0", "load-cfg": "^2.4.0", "lodash": "^4.17.14", "minimatch": "^3.0.4", "open": "^7.0.3", "ora": "^3.4.0", "react-docgen": "^4.1.1", "react-docgen-actual-name-handler": "^2.4.0", "react-docgen-external-proptypes-handler": "^1.0.3", "react-docgen-typescript": "^2.1.0", "recast": "^0.18.1", "resolve": "^1.11.1", "shelljs": "^0.8.3", "signale": "^1.4.0", "titleize": "^2.1.0", "tslib": "^1.11.1", "wait-on": "^3.3.0", "xstate": "^4.6.7", "yargs": "^13.3.0" } } ================================================ FILE: core/docz-core/rollup.config.js ================================================ import { config, copy } from 'docz-rollup' export default config({ input: './src/index.ts', plugins: [copy('templates', 'dist/templates')], }) ================================================ FILE: core/docz-core/src/bundler/build.ts ================================================ import * as fs from 'fs-extra' import * as path from 'path' import sh from 'shelljs' import * as paths from '../config/paths' import { BuildFn } from '../lib/Bundler' import { ensureFiles } from './machine/actions' import { spawnSync } from '../utils/spawn' export const build: BuildFn = async (config, dist) => { const publicDir = path.join(paths.docz, 'public') const cliArgs = ['run', 'build'] if (typeof config.base === 'string' && config.base.length) { cliArgs.push('--') // Append gatsby option `--prefix-paths`to CLI args which will prepend pathPrefix from gatsby-config to urls // https://www.gatsbyjs.org/docs/path-prefix/ cliArgs.push('--prefix-paths') } ensureFiles({ args: config }) sh.cd(paths.docz) spawnSync('npm', cliArgs) await fs.copy(publicDir, dist) } ================================================ FILE: core/docz-core/src/bundler/index.ts ================================================ import { Bundler } from '../lib/Bundler' import { Config as Args } from '../config/argv' import { server } from './server' import { build } from './build' export const bundler = (args: Args) => { return new Bundler({ args, build, server: server(args) }) } ================================================ FILE: core/docz-core/src/bundler/machine/actions.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { assign, Event } from 'xstate' import { assoc } from 'lodash/fp' import glob from 'fast-glob' import log from 'signale' import sh from 'shelljs' import * as paths from '../../config/paths' import { ServerMachineCtx } from './context' import { copyDoczRc } from './services/create-resources' const ensureFile = (filename: string, toDelete?: string) => { const ghost = path.resolve(paths.docz, toDelete || filename) const original = path.resolve(paths.root, filename) if (fs.pathExistsSync(ghost) && !fs.pathExistsSync(original)) { fs.removeSync(ghost) } } export const ensureFiles = ({ args }: ServerMachineCtx) => { // themesDir defaults to "src" to behave like a normal gatsby site const appPath = path.join(paths.root, args.themesDir) const themeNames = glob.sync('gatsby-theme-**', { cwd: appPath, onlyDirectories: true, }) themeNames.forEach(themeName => { fs.copySync( path.join(appPath, themeName), path.join(paths.docz, 'src', themeName) ) }) const userPagesPath = path.join(appPath, 'pages') const doczPagesPath = path.join(paths.docz, 'src', 'pages') // Copy 404 and other possible Gatsby pages if (fs.existsSync(userPagesPath)) { fs.copySync(userPagesPath, doczPagesPath) } copyDoczRc(args.config) ensureFile('gatsby-browser.js') ensureFile('gatsby-ssr.js') ensureFile('gatsby-node.js') ensureFile('gatsby-config.js', 'gatsby-config.custom.js') const publicPath = path.join(paths.docz, '..', args.public) if (fs.existsSync(publicPath)) { const destinationPath = path.join(paths.docz, 'static', args.public) try { fs.copySync(publicPath, destinationPath) } catch (err) { console.log( `Failed to copy static assets from ${publicPath} to ${destinationPath} : ${err.message}` ) } } } export const getIsFirstInstall = () => { return !sh.test('-e', path.join(paths.docz, 'package.json')) } export const getIsDoczRepo = () => { return sh.test('-e', path.join(paths.root, '../../core')) } export const assignFirstInstall = assign((ctx: ServerMachineCtx) => { const firstInstall = getIsFirstInstall() return assoc('firstInstall', firstInstall, ctx) }) export const checkIsDoczRepo = assign((ctx: ServerMachineCtx) => { const isDoczRepo = getIsDoczRepo() return assoc('isDoczRepo', isDoczRepo, ctx) }) export const logError = (ctx: ServerMachineCtx, ev: Event) => { log.fatal(ev.data) sh.exit(0) } ================================================ FILE: core/docz-core/src/bundler/machine/context.ts ================================================ import { Config } from '../../config/argv' export interface ServerMachineCtx { args: Config doczrcFilepath?: string firstInstall?: boolean isDoczRepo?: boolean } ================================================ FILE: core/docz-core/src/bundler/machine/index.ts ================================================ import { Machine } from 'xstate' import { ServerMachineCtx } from './context' import * as services from './services' import * as actions from './actions' const asyncState = (src: string, onDoneTarget?: string) => ({ initial: 'exec', states: { exec: { invoke: { src, onDone: 'success', onError: 'failure', }, }, success: { type: 'final', }, failure: { actions: ['logError'], type: 'final', }, }, onDone: { target: onDoneTarget || 'exit', }, }) const machine = Machine({ id: 'devServer', type: 'parallel', states: { watch: { onEntry: 'ensureFiles', invoke: { src: 'watchFiles', }, }, server: { initial: 'idle', states: { idle: { on: { START_MACHINE: { actions: ['assignFirstInstall', 'checkIsDoczRepo'], target: 'ensuringDirs', }, }, }, ensuringDirs: asyncState('ensureDirs', 'creatingResources'), creatingResources: asyncState('createResources', 'executingCommand'), executingCommand: asyncState('execDevCommand'), exit: { type: 'final', }, }, }, }, }) export const devServerMachine = machine.withConfig({ services, actions, } as any) ================================================ FILE: core/docz-core/src/bundler/machine/services/create-resources.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { omit } from 'lodash/fp' import * as paths from '../../../config/paths' import { ServerMachineCtx } from '../context' import { outputFileFromTemplate } from '../../../utils/template' export const copyDoczRc = (configPath?: string) => { const sourceDoczRc = configPath ? path.join(paths.root, configPath) : path.join(paths.root, 'doczrc.js') const hasDoczRc = fs.existsSync(sourceDoczRc) if (!hasDoczRc) return const destinationDoczRc = path.join(paths.docz, 'doczrc.js') try { fs.copySync(sourceDoczRc, destinationDoczRc) } catch (err) {} } const copyAndModifyPkgJson = async (ctx: ServerMachineCtx) => { const movePath = path.join(paths.docz, 'package.json') // const pkg = await fs.readJSON(filepath, { throws: false }) const newPkg = { name: 'docz-app', license: 'MIT', dependencies: { gatsby: 'just-to-fool-cli-never-installed', }, scripts: { dev: 'gatsby develop', build: 'gatsby build', serve: 'gatsby serve', }, ...(ctx.isDoczRepo && { private: true, workspaces: ['../../../core/**', '../../../other-packages/**'], }), } await fs.outputJSON(movePath, newPkg, { spaces: 2 }) } const writeEslintRc = async () => { const possibleFilenames = [ '.eslintrc.js', '.eslintrc.yaml', '.eslintrc.yml', '.eslintrc.json', '.eslintrc', ] for (const filename of possibleFilenames) { const filepath = path.join(paths.root, filename) const dest = path.join(paths.docz, filename) if (fs.pathExistsSync(filepath)) { await fs.copy(filepath, dest) return } } } const copyDotEnv = () => { const filename = '.env' const filepath = path.join(paths.root, filename) const dest = path.join(paths.docz, filename) if (fs.pathExistsSync(filepath)) { fs.copySync(filepath, dest) } } const copyEslintIgnore = async () => { const filename = '.eslintignore' const filepath = path.join(paths.root, filename) const dest = path.join(paths.docz, filename) if (fs.pathExistsSync(filepath)) { await fs.copy(filepath, dest) } } export const writeDefaultNotFound = async () => { const outputPath = path.join(paths.docz, 'src/pages/404.js') // If it exists then it would have been created in ensureFiles while copying the theme if (fs.existsSync(outputPath)) return await outputFileFromTemplate('404.tpl.js', outputPath, {}) } const writeGatsbyConfig = async ({ args, isDoczRepo }: ServerMachineCtx) => { const outputPath = path.join(paths.docz, 'gatsby-config.js') const config = omit(['plugins'], args) const newConfig = { ...config, root: paths.docz, } await outputFileFromTemplate('gatsby-config.tpl.js', outputPath, { isDoczRepo, config: newConfig, opts: JSON.stringify(newConfig), }) } const writeGatsbyConfigNode = async () => { const outputPath = path.join(paths.docz, 'gatsby-node.js') await outputFileFromTemplate('gatsby-node.tpl.js', outputPath) } const copyGatsbyConfigFile = async (from: string, to: string) => { const filepath = path.join(paths.root, from) const dest = path.join(paths.docz, to) if (fs.pathExistsSync(filepath)) { await fs.copy(filepath, dest) } } const writeGatsbyConfigCustom = async () => copyGatsbyConfigFile('gatsby-config.js', 'gatsby-config.custom.js') const writeGatsbyNodeCustom = async () => copyGatsbyConfigFile('gatsby-node.js', 'gatsby-node.custom.js') const writeGatsbySSR = async () => copyGatsbyConfigFile('gatsby-ssr.js', 'gatsby-ssr.js') const writeGatsbyBrowser = async () => copyGatsbyConfigFile('gatsby-browser.js', 'gatsby-browser.js') export const createResources = async (ctx: ServerMachineCtx) => { try { copyDoczRc(ctx.args.config) copyDotEnv() await copyAndModifyPkgJson(ctx) await writeEslintRc() await copyEslintIgnore() await writeDefaultNotFound() await writeGatsbyConfig(ctx) await writeGatsbyConfigNode() await writeGatsbyConfigCustom() await writeGatsbyNodeCustom() await writeGatsbyBrowser() await writeGatsbySSR() } catch (err) { console.error(err) } } ================================================ FILE: core/docz-core/src/bundler/machine/services/ensure-dirs.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import * as paths from '../../../config/paths' export const ensureDirs = async () => { await fs.ensureDir(paths.docz) return await fs.ensureDir(path.join(paths.docz, 'src/pages')) } ================================================ FILE: core/docz-core/src/bundler/machine/services/exec-dev-command.ts ================================================ import spawn from 'cross-spawn' import waitOn from 'wait-on' import get from 'lodash/get' import path from 'path' import findUp from 'find-up' import { ServerMachineCtx } from '../context' import { openBrowser } from '../../../utils/open-browser' import * as paths from '../../../config/paths' export const findRootPath = async () => { let repoRootPath = path.join(paths.docz, '../') try { const foundRootPath = await findUp( async directory => { const hasGatsby = await findUp.exists( path.join(directory, 'node_modules', 'gatsby') ) return hasGatsby ? directory : '' }, { type: 'directory' } ) if (typeof foundRootPath === 'string') { repoRootPath = foundRootPath } } catch (err) { console.log( `Failed to find root folder ${err.message} \n Assuming it is ${repoRootPath}` ) } return repoRootPath } export const execDevCommand = async ({ args }: ServerMachineCtx) => { // For monorepos that install dependencies higher in the fs tree const repoRootPath = get(args, 'repoRootPath', await findRootPath()) const gatsbyPath = path.join(repoRootPath, 'node_modules/.bin/gatsby') // const cliArgs = process.argv.slice(3) // Has --https flag to enable https in dev mode const useHttps = args.https const caFile = args.caFile const keyFile = args.keyFile const certFile = args.certFile const caFileOption = caFile ? ['--ca-file', caFile] : [] const keyFileOption = keyFile ? ['--key-file', keyFile] : [] const certFileOption = certFile ? ['--cert-file', certFile] : [] spawn( gatsbyPath, [ 'develop', '--host', `${args.host}`, '--port', `${args.port}`, useHttps ? '--https' : '', ...caFileOption, ...keyFileOption, ...certFileOption, ].filter(Boolean), { stdio: 'inherit', cwd: paths.docz, } ) const protocol = useHttps ? 'https' : 'http' const url = `${protocol}://${args.host}:${args.port}` console.log() console.log('Building app') await waitOn({ resources: [url], timeout: 30000, }) console.log() console.log('App ready on ' + url) if (args.open !== null && Boolean(args.open) === false) { return } openBrowser(url) } ================================================ FILE: core/docz-core/src/bundler/machine/services/index.ts ================================================ export { createResources } from './create-resources' export { ensureDirs } from './ensure-dirs' export { execDevCommand } from './exec-dev-command' export { installDeps } from './install-deps' export { watchFiles } from './watch-files' ================================================ FILE: core/docz-core/src/bundler/machine/services/install-deps.ts ================================================ export const installDeps = async () => { // No need to install dependencies return } ================================================ FILE: core/docz-core/src/bundler/machine/services/watch-files.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { Config } from '../../../config/argv' import * as paths from '../../../config/paths' import { createWatcher } from '../../../states/config' import { ServerMachineCtx as Context } from '../context' /** * Maps a given relative 'filepath' from 'themesDir/...' to 'src/...' */ const replaceThemesDir = (filepath: string, args: Config) => { // Make the path to a given relative`filepath` relative to themesDir: const rawFilePath = path.relative( paths.getThemesDir(args), path.resolve(paths.root, filepath) ) // => e.g. '/gatsby-theme-docz/**/index.tsx' // Prefix with 'src': return path.join('src', rawFilePath) // => 'src/gatsby-theme-docz/**/index.tsx' } const watchGatsbyThemeFiles = (args: Config) => { const watcher = createWatcher( path.join(args.themesDir, 'gatsby-theme-**/**/*'), args ) const copy = (filepath: string) => { const src = path.resolve(paths.root, filepath) const dest = path.resolve(paths.docz, replaceThemesDir(filepath, args)) fs.copySync(src, dest) } const remove = (filepath: string) => { fs.removeSync(path.resolve(paths.docz, filepath)) } watcher .on('add', copy) .on('addDir', copy) .on('change', copy) .on('unlink', remove) .on('unlinkDir', remove) return () => watcher.close() } const createWatch = (args: Config) => ( glob: any, src: string, custom?: boolean ) => { const watcher = createWatcher(glob, args) const srcPath = path.join(paths.root, src) const destPath = path.join( paths.docz, custom ? src.replace('.js', '.custom.js') : src ) const copyFile = () => fs.copySync(srcPath, destPath) const deleteFile = () => fs.removeSync(destPath) watcher .on('add', copyFile) .on('change', copyFile) .on('unlink', deleteFile) return () => watcher.close() } const watchDoczRc = (args: Context['args']) => { const watcher = createWatcher( path.join(paths.root, args.config ? args.config : 'doczrc.js'), args ) const copy = (filepath: string) => { const src = path.resolve(paths.root, filepath) const dest = path.resolve(paths.docz, 'doczrc.js') fs.copySync(src, dest) } const remove = () => { fs.removeSync(path.resolve(paths.docz, 'doczrc.js')) } watcher .on('add', copy) .on('change', copy) .on('unlink', remove) return () => watcher.close() } export const watchFiles = ({ args }: Context) => () => { const watch = createWatch(args) const doczrc = watchDoczRc(args) const gatsbyBrowser = watch(paths.gatsbyBrowser, 'gatsby-browser.js') const gatsbyNode = watch(paths.gatsbyNode, 'gatsby-node.js') const gatsbySSR = watch(paths.gatsbySSR, 'gatsby-ssr.js') const gatsbyConfig = watch(paths.gatsbyConfig, 'gatsby-config.js', true) const themeFilesWatcher = watchGatsbyThemeFiles(args) return () => { doczrc() gatsbyConfig() gatsbyBrowser() gatsbyNode() gatsbySSR() themeFilesWatcher() } } ================================================ FILE: core/docz-core/src/bundler/server.ts ================================================ import { interpret } from 'xstate' import { finds } from 'load-cfg' import findUp from 'find-up' import { devServerMachine } from './machine' import { Config as Args } from '../config/argv' export const server = (args: Args) => async () => { const doczrcFilepath = await findUp(finds('docz')) const machine = devServerMachine.withContext({ args, doczrcFilepath }) const service = interpret(machine).onTransition(state => { if (args.debug) { console.log(state.value) } }) return { start: async () => { service.start() service.send('START_MACHINE') process.on('exit', () => { service.stop() }) }, } } ================================================ FILE: core/docz-core/src/cli.ts ================================================ import * as yargs from 'yargs' import { setArgs } from './config/argv' import { setEnv } from './config/env' import * as commands from './commands' export const cli = () => { return yargs .command('init', 'initialize docz in your app', setArgs, async args => { setEnv('development') await commands.init(args) }) .command('dev', 'initialize docz dev server', setArgs, async args => { setEnv('development') await commands.dev(args) }) .command('build', 'build dir as static site', setArgs, async args => { setEnv('production') await commands.build(args) process.exit() }) .command('serve', 'serve dir as static site', setArgs, async args => { setEnv('production') await commands.serve(args) process.exit() }) .demandCommand() .recommendCommands() .help() .wrap(72) .epilog('for more information visit https://github.com/doczjs/docz') .showHelpOnFail(false, 'whoops, something went wrong! run with --help').argv } ================================================ FILE: core/docz-core/src/commands/build.ts ================================================ import { Arguments } from 'yargs' import * as logger from 'signale' import { parseConfig } from '../config/docz' import { bundler as gatsby } from '../bundler' import { init } from './init' import { copyDoczRc } from '../bundler/machine/services/create-resources' export const build = async (args: Arguments) => { copyDoczRc(args.config) const config = await parseConfig(args) const bundler = gatsby(config) try { await init(args) } catch (err) { logger.error(`Failed to initialize docz : ${err.message}`) } try { await bundler.build() } catch (err) { logger.error(err) process.exit(1) } } ================================================ FILE: core/docz-core/src/commands/dev.ts ================================================ process.setMaxListeners(Infinity) import { Arguments } from 'yargs' import logger from 'signale' import { parseConfig } from '../config/docz' import { bundler as gatsby } from '../bundler' import { copyDoczRc } from '../bundler/machine/services/create-resources' export const dev = async (args: Arguments) => { copyDoczRc(args.config) const config = await parseConfig(args) const bundler = gatsby(config) const app = await bundler.createApp() try { await app.start() } catch (err) { logger.fatal('Failed to process data server') logger.error(err) process.exit(1) } } ================================================ FILE: core/docz-core/src/commands/index.ts ================================================ export { dev } from './dev' export { build } from './build' export { serve } from './serve' export { init } from './init' ================================================ FILE: core/docz-core/src/commands/init.ts ================================================ process.setMaxListeners(Infinity) import { Arguments } from 'yargs' import path from 'path' import { parseConfig } from '../config/docz' import { getIsFirstInstall, getIsDoczRepo } from '../bundler/machine/actions' import { ensureDirs, createResources } from '../bundler/machine/services' import { copyDoczRc } from '../bundler/machine/services/create-resources' import * as paths from '../config/paths' export const init = async (args: Arguments) => { copyDoczRc(args.config) const doczrcFilepath = path.join(paths.docz, 'doczrc.js') const config = await parseConfig(args) const isFirstInstall = getIsFirstInstall() const isDoczRepo = getIsDoczRepo() await ensureDirs() const serverMachineContext = { args: config, isDoczRepo, firstInstall: isFirstInstall, doczrcFilepath, } await createResources(serverMachineContext) } ================================================ FILE: core/docz-core/src/commands/serve.ts ================================================ import sh from 'shelljs' import { Arguments } from 'yargs' import * as paths from '../config/paths' import { spawnSync } from '../utils/spawn' import { parseConfig } from '../config/docz' export const serve = async (args: Arguments) => { const config = await parseConfig(args) const cliArgs = ['run', 'serve'] if (config.port) { cliArgs.push('--') // Append gatsby option `port` to CLI args // https://www.gatsbyjs.org/docs/cheat-sheet/#cheat_sheet-text cliArgs.push('--port') cliArgs.push(String(config.port)) } if (config.host) { // Append gatsby option `host` to CLI args // https://www.gatsbyjs.org/docs/cheat-sheet/#cheat_sheet-text cliArgs.push('--host') cliArgs.push(String(config.host)) } sh.cd(paths.docz) spawnSync('npm', cliArgs) } ================================================ FILE: core/docz-core/src/config/argv.ts ================================================ import * as fs from 'fs-extra' import { Argv as Yargs } from 'yargs' import * as envDotProp from 'env-dot-prop' import humanize from 'humanize-string' import titleize from 'titleize' import { get } from 'lodash/fp' import { Plugin } from '../lib/Plugin' import * as paths from '../config/paths' import { doczRcBaseConfig } from './docz' const getEnv = (val: string | string[], defaultValue: any = null): any => envDotProp.get(val, defaultValue, { parse: true }) const getInitialTitle = (pkg: any): string => { const name = get('name', pkg) || 'MyDoc' return titleize(humanize(name.replace(/^@.*\//, ''))) } const getInitialDescription = (pkg: any): string => get('description', pkg) || 'My awesome app using docz' export type Env = 'production' | 'development' export type ThemeConfig = Record export interface DocgenConfig { handlers?: any[] resolver?: (ast: any, recast: any) => any propFilter?: (prop: any) => boolean searchPath: string searchPatterns: string[] } export interface Menu { name: string route?: string href?: string menu?: Menu[] } export interface Argv { /* io args */ root: string base: string src: string gatsbyRoot: string | string[] files: string | string[] ignore: any[] watchIgnore: string public: string dest: string editBranch: string config: string /* bundler args */ debug: boolean typescript: boolean propsParser: boolean host: string port: number native: boolean notUseSpecifiers: boolean open: null | boolean /* template args */ title: string description: string /** slugify separator */ separator: string https: boolean certFile: string keyFile: string caFile: string } export interface Config extends Argv { docgenConfig: DocgenConfig hastPlugins: any[] mdPlugins: any[] menu: Menu[] paths: paths.Paths plugins: Plugin[] themeConfig: ThemeConfig themesDir: string mdxExtensions: string[] filterComponents: (files: string[]) => string[] } export const setArgs = (yargs: Yargs) => { const pkg = fs.readJsonSync(paths.appPackageJson, { throws: false }) return yargs .option('root', { type: 'string', default: getEnv('docz.root', paths.root), }) .option('base', { type: 'string', default: getEnv('docz.base', '/'), }) .option('source', { alias: 'src', type: 'string', default: getEnv('docz.source', doczRcBaseConfig.src), }) .option('gatsbyRoot', { type: 'string', default: getEnv('docz.gatsbyRoot', doczRcBaseConfig.gatsbyRoot), }) .option('files', { type: 'string', default: getEnv('docz.files', '**/*.{md,markdown,mdx}'), }) .option('ignore', { type: 'array', default: getEnv('docz.ignore', []), }) .option('public', { type: 'string', default: getEnv('docz.public', '/public'), }) .option('dest', { alias: 'd', type: 'string', default: getEnv('docz.dest', '.docz/dist'), }) .option('editBranch', { alias: 'eb', type: 'string', default: getEnv('docz.edit.branch', 'master'), }) .option('config', { type: 'string', default: getEnv('docz.config', ''), }) .option('title', { type: 'string', default: getEnv('docz.title', getInitialTitle(pkg)), }) .option('description', { type: 'string', default: getEnv('docz.description', getInitialDescription(pkg)), }) .option('typescript', { alias: 'ts', type: 'boolean', default: getEnv('docz.typescript', false), }) .option('propsParser', { type: 'boolean', default: getEnv('docz.props.parser', true), }) .option('debug', { type: 'boolean', default: getEnv('docz.debug', false), }) .option('host', { type: 'string', default: getEnv('docz.host', 'localhost'), }) .option('port', { alias: 'p', type: 'number', default: getEnv('docz.port', 3000), }) .option('native', { type: 'boolean', default: getEnv('docz.native', false), }) .option('separator', { type: 'string', default: getEnv('docz.separator', '-'), }) .option('openBrowser', { alias: ['o', 'open'], describe: 'auto open browser in dev mode', type: 'boolean', default: null, }) } ================================================ FILE: core/docz-core/src/config/docz.ts ================================================ import * as path from 'path' import { Arguments } from 'yargs' import { omit, merge } from 'lodash/fp' import { load, loadFrom } from 'load-cfg' import detectPort from 'detect-port' import * as paths from '../config/paths' import { Config, Argv } from '../config/argv' import { Plugin } from '../lib/Plugin' const toOmit = ['_', '$0', 'version', 'help'] export const doczRcBaseConfig = { themeConfig: {}, src: './', gatsbyRoot: null, themesDir: 'src', mdxExtensions: ['.md', '.mdx'], docgenConfig: {}, menu: [], plugins: [], mdPlugins: [], hastPlugins: [], ignore: [ /readme.md/i, /changelog.md/i, /code_of_conduct.md/i, /contributing.md/i, /license.md/i, ], filterComponents: (files: string[]) => files.filter(filepath => { const isTestFile = /\.(test|spec)\.(js|jsx|ts|tsx)$/.test(filepath) if (isTestFile) { return false } const startsWithCapitalLetter = /\/([A-Z]\w*)\.(js|jsx|ts|tsx)$/.test( filepath ) const isCalledIndex = /\/index\.(js|jsx|ts|tsx)$/.test(filepath) const hasJsxOrTsxExtension = /.(jsx|tsx)$/.test(filepath) return startsWithCapitalLetter || isCalledIndex || hasJsxOrTsxExtension }), } export const getBaseConfig = ( argv: Arguments, custom?: Partial ): Config => { const initial = omit, any>(toOmit, argv) const base = { ...doczRcBaseConfig, ...initial, paths } return merge(base, custom) as Config } export const parseConfig = async ( argv: Arguments, custom?: Partial ): Promise => { const port = await detectPort(argv.port) const defaultConfig = getBaseConfig(argv, { port, ...custom }) const config = argv.config ? loadFrom(path.join(paths.docz, 'doczrc.js'), defaultConfig) : load('docz', defaultConfig) const reduceAsync = Plugin.reduceFromPluginsAsync(config.plugins) return reduceAsync('setConfig', config) } ================================================ FILE: core/docz-core/src/config/env.ts ================================================ import * as path from 'path' import * as envDotProp from 'env-dot-prop' import { root, resolveApp } from './paths' const populateNodePath = () => { // We support resolving modules according to `NODE_PATH`. // It works similar to `NODE_PATH` in Node itself: // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421 // We also resolve them to make sure all tools using them work consistently. envDotProp.set( 'node.path', envDotProp .get('node.path', '') .split(path.delimiter) .filter((folder: any) => folder && !path.isAbsolute(folder)) .map((folder: any) => path.resolve(root, folder)) .join(path.delimiter) ) } const configDotEnv = () => { const NODE_ENV = envDotProp.get('node.env') const dotenv = resolveApp('.env') const dotenvFiles = [ `${dotenv}.${NODE_ENV}.local`, `${dotenv}.${NODE_ENV}`, // Don't include `.env.local` for `test` environment // since normally you expect tests to produce the same // results for everyone NODE_ENV !== 'test' && `${dotenv}.local`, dotenv, ] // Load environment variables from .env* files. Suppress warnings using silent // if this file is missing. dotenv will never modify any environment variables // that have already been set. Variable expansion is supported in .env files. // https://github.com/motdotla/dotenv dotenvFiles.filter(Boolean).forEach(dotenvFile => { require('dotenv').config({ path: dotenvFile, }) }) } export const setEnv = (env: string) => { envDotProp.set('babel.env', env) envDotProp.set('node.env', env) configDotEnv() populateNodePath() } export interface RT { [key: string]: any } export const getClientEnvironment = (publicUrl: string) => { const APP_TEST = /^(REACT_APP_)|(ANGULAR_APP_)|(VUE_APP_)|(DOCZ_)/i const raw: RT = Object.keys(process.env) .filter(key => APP_TEST.test(key)) .reduce( (env: RT, key) => { env[key] = process.env[key] return env }, { // Useful for determining whether we’re running in production mode. Most // importantly, it switches React into the correct mode. NODE_ENV: envDotProp.get('node.env') || 'development', // Useful for resolving the correct path to static assets in `public`. For // example, . This should // only be used as an escape hatch. Normally you would put images into the `src` // and `import` them in code to get their PUBLIC_URL: publicUrl, } ) const stringified = { 'process.env': Object.keys(raw).reduce((env: RT, key) => { env[key] = JSON.stringify(raw[key]) return env }, {}), } return { raw, stringified } } ================================================ FILE: core/docz-core/src/config/paths.ts ================================================ import * as fs from 'fs' import * as path from 'path' import * as resolve from 'resolve' import { Config } from './argv' export const ensureSlash = (filepath: any, needsSlash: boolean) => { const hasSlash = filepath.endsWith('/') if (hasSlash && !needsSlash) { return filepath.substr(filepath, filepath.length - 1) } else if (!hasSlash && needsSlash) { return `${filepath}/` } else { return filepath } } export const root = fs.realpathSync(process.cwd()) const IS_DOCZ_PROJECT = path.parse(root).base === '.docz' export const resolveApp = (to: string) => path.resolve(root, IS_DOCZ_PROJECT ? '../' : './', to) export const checkIsDoczProject = (config: Config) => { return path.parse(config.root || root).base === '.docz' } export const getRootDir = (config: Config) => { const isDoczProject = checkIsDoczProject(config) return isDoczProject ? path.resolve(root, '../') : root } export const getThemesDir = (config: Config) => { // resolve normalizes the new path and removes trailing slashes return path.resolve(path.join(getRootDir(config), config.themesDir)) } export interface Paths { root: string templates: string servedPath: (base: string) => string docz: string app: string cache: string appPackageJson: string gatsbyConfig: string gatsbyBrowser: string gatsbyNode: string gatsbySSR: string checkIsDoczProject: (config: any) => boolean getRootDir: (config: any) => string getThemesDir: (config: any) => string getDist: (dest: string) => string distPublic: (dest: string) => string importsJs: string rootJs: string indexJs: string indexHtml: string db: string } export const templates = path.join(resolve.sync('docz-core'), '../templates') export const servedPath = (base: string) => ensureSlash(base, true) export const docz = resolveApp('.docz') export const cache = path.resolve(docz, '.cache/') export const app = path.resolve(docz, 'app/') export const appPackageJson = resolveApp('package.json') export const appTsConfig = resolveApp('tsconfig.json') export const gatsbyConfig = resolveApp('gatsby-config.js') export const gatsbyBrowser = resolveApp('gatsby-browser.js') export const gatsbyNode = resolveApp('gatsby-node.js') export const gatsbySSR = resolveApp('gatsby-ssr.js') export const getDist = (dest: string) => path.join(root, dest) export const distPublic = (dest: string) => path.join(dest, 'public/') export const importsJs = path.resolve(app, 'imports.js') export const rootJs = path.resolve(app, 'root.jsx') export const indexJs = path.resolve(app, 'index.jsx') export const indexHtml = path.resolve(app, 'index.html') export const db = path.resolve(app, 'db.json') ================================================ FILE: core/docz-core/src/index.ts ================================================ /** cli exports */ export { cli } from './cli' /** config exports */ export { parseConfig, getBaseConfig } from './config/docz' export { Config, setArgs } from './config/argv' /** states */ import * as states from './states' export { states } /** lib exports */ export { Plugin, createPlugin } from './lib/Plugin' export { DataServer } from './lib/DataServer' export { Entries } from './lib/Entries' export { Entry } from './lib/Entry' ================================================ FILE: core/docz-core/src/lib/Bundler.ts ================================================ import * as path from 'path' import logger from 'signale' import { Config as Args } from '../config/argv' import * as paths from '../config/paths' export interface BundlerServer { start(): void } export type BuildFn = (config: Args, dist: string) => void export type ServerFn = () => BundlerServer | Promise export interface BundlerConstructor { args: Args server: ServerFn build: BuildFn } export interface ConfigObj { [key: string]: any } export class Bundler { private readonly args: Args private server: ServerFn private builder: BuildFn constructor(params: BundlerConstructor) { const { args, server, build } = params this.args = args this.server = server this.builder = build } public async createApp(): Promise { return this.server() } public async build(): Promise { const dist = paths.getDist(this.args.dest) const root = paths.getRootDir(this.args) if (root === path.resolve(dist)) { logger.fatal( new Error( 'Unexpected option: "dest" cannot be set to the current working directory.' ) ) process.exit(1) } await this.builder(this.args, dist) } } ================================================ FILE: core/docz-core/src/lib/DataServer.ts ================================================ import * as fs from 'fs-extra' import { get, isFunction } from 'lodash/fp' import * as paths from '../config/paths' export interface Params { getState: () => Record setState: (key: string, val: any) => void } export interface State { id: string start: (params: Params) => Promise close: () => void } export interface Action { type: string payload: any } export type Listener = (action: Action) => void export class DataServer { private states: Set private state: Map private listeners: Set constructor() { this.states = new Set() this.state = new Map() this.listeners = new Set() } public register(states: State[]): DataServer { for (const state of states) this.states.add(state) return this } public async start(): Promise { const setState = (key: string, val: any) => this.setState(key, val) const getState = () => this.getState() await Promise.all( Array.from(this.states).map(async state => { if (!isFunction(state.start)) return return state.start({ setState, getState, }) }) ) } public close(): void { for (const state of this.states) { if (isFunction(state.close)) { state.close() } } } public onStateChange(listener: Listener): () => void { this.listeners.add(listener) return () => this.listeners.clear() } public getState(): Map { return this.mapToObject(this.state) } private setState(key: string, val: any): void { const prev = get(key, this.getState()) const next = typeof val === 'function' ? val(prev) : val this.state.set(key, next) this.writeDbFile() this.listeners.forEach(listener => { listener({ type: `state.${key}`, payload: next }) }) } private async writeDbFile(): Promise { fs.outputJSONSync(paths.db, this.mapToObject(this.state), { spaces: 2 }) } private mapToObject(map: Map): T { return Array.from(map.entries()).reduce( (obj, [key, val]) => ({ ...obj, [key]: val }), {} as T ) } } ================================================ FILE: core/docz-core/src/lib/Entries.ts ================================================ import * as path from 'path' import * as logger from 'signale' import { parseMdx } from 'docz-utils/lib/mdast' import { isRegExp, isString } from 'lodash/fp' import minimatch from 'minimatch' import glob from 'fast-glob' import { Entry, EntryObj } from './Entry' import { Plugin } from './Plugin' import { Config } from '../config/argv' import { getRepoEditUrl } from '../utils/repo-info' const mapToObj = (map: Map) => Array.from(map.entries()).reduce( (obj, [key, value]) => ({ ...obj, [`${key}`]: value }), {} ) export const matchFilesWithSrc = (config: Config) => (files: string[]) => { const { paths, src } = config const rootDir = paths.getRootDir(config) const srcDir = path.resolve(rootDir, src) const prefix = path.relative(rootDir, srcDir) return files.map(file => file.startsWith(prefix) ? file : path.join(prefix, file) ) } export const getFilesToMatch = (config: Config) => { const { files: pattern } = config const arr = Array.isArray(pattern) ? pattern : [pattern] const toMatch = matchFilesWithSrc(config) return toMatch(arr) } export type EntryMap = Record export class Entries { public all: Map public get: () => Promise public repoEditUrl: string | null constructor(config: Config) { this.repoEditUrl = getRepoEditUrl(config) this.all = new Map() this.get = async () => this.getMap(config) } private async getMap(config: Config): Promise { const { paths, ignore, plugins, mdPlugins, src } = config const fileMatchingPatterns = getFilesToMatch(config) const srcHasNodeModules = src.indexOf('node_modules') !== -1 // Hack around fast-glob not returning the whole set when many patterns are provided in the array let initialFiles: string[] = [] for (let filePattern of fileMatchingPatterns) { const filePatternHasNodeModules = filePattern.indexOf('node_modules') !== -1 const shouldIncludeNodeModules = srcHasNodeModules || filePatternHasNodeModules const globIgnore = shouldIncludeNodeModules ? [] : ['**/node_modules/**'] const filesFromPattern = await glob([filePattern], { cwd: paths.getRootDir(config), ignore: globIgnore, onlyFiles: true, unique: true, baseNameMatch: false, caseSensitiveMatch: false, }) initialFiles = [...initialFiles, ...filesFromPattern] } const files = initialFiles.filter((value: string) => { return !ignore.some(pattern => { if (isString(pattern)) return minimatch(value, pattern) if (isRegExp(pattern)) return pattern.test(value) return false }) }) const rootDir = paths.getRootDir(config) const createEntry = async (file: string) => { try { const fullpath = path.resolve(rootDir, file) const ast = await parseMdx(fullpath, mdPlugins) const entry = new Entry(ast, file, config) if (this.repoEditUrl) entry.setLink(this.repoEditUrl) // reduce modify entry plugin const reduce = Plugin.reduceFromPlugins(plugins) const modifiedEntry = reduce('modifyEntry', entry, config) const { settings, ...rest } = modifiedEntry return { ...settings, ...rest, } } catch (err) { logger.error(err) return null } } const reduce = Plugin.reduceFromPlugins(plugins) const modifiedFiles = reduce('modifyFiles', files, config) const map = new Map() const entries = await Promise.all( modifiedFiles.map(createEntry).filter(Boolean) ) for (const entry of entries) { if (entry) { map.set(entry.filepath, entry) } } this.all = map return mapToObj(map) } } ================================================ FILE: core/docz-core/src/lib/Entry.ts ================================================ import * as path from 'path' import * as crypto from 'crypto' import slugify from '@sindresorhus/slugify' import humanize from 'humanize-string' import { get } from 'lodash/fp' import { getParsedData, headingsFromAst, Heading, ParsedData, } from 'docz-utils/lib/mdast' import * as paths from '../config/paths' import { Config } from '../config/argv' const createId = (file: string) => crypto .createHash('md5') .update(file) .digest('hex') export interface EntryObj { id: string filepath: string fullpath: string link: string | null slug: string name: string route: string menu: string | null headings: Heading[] [key: string]: any } export class Entry { public link: string | null public readonly filepath: string public readonly fullpath: string public readonly headings: Heading[] public readonly id: string public readonly hidden: boolean public readonly menu: string | null public readonly name: string public readonly route: string public readonly settings: { [key: string]: any } public readonly slug: string constructor(ast: any, file: string, config: Config) { const filepath = this.getFilepath(config, file) const parsed = getParsedData(ast) const name = this.getName(filepath, parsed) const root = paths.getRootDir(config) this.id = createId(file) this.filepath = filepath this.fullpath = path.resolve(root, file) this.link = '' this.hidden = parsed.hidden || false this.slug = this.slugify(filepath, config.separator) this.route = this.getRoute(parsed) this.name = name this.menu = parsed.menu || '' this.headings = headingsFromAst(ast) this.settings = parsed } public setLink(url: string): void { this.link = url.replace('{{filepath}}', this.filepath) } private getFilepath(config: Config, file: string): string { const root = paths.getRootDir(config) const fullpath = path.resolve(root, config.src, file) const filepath = path.relative(root, fullpath) if (process.platform === 'win32') { return filepath.split('\\').join('/') } return filepath } private getName(filepath: string, parsed: ParsedData): string { const filename = humanize(path.parse(filepath).name) return parsed && parsed.name ? parsed.name : filename } private slugify(filepath: string, separator: string): string { const ext = path.extname(filepath) const fileWithoutExt = filepath.replace(ext, '') return slugify(fileWithoutExt, { separator }) } private getRoute(parsed: any): string { const parsedRoute = get('route', parsed) return parsedRoute || `/${this.slug}` } } ================================================ FILE: core/docz-core/src/lib/Plugin.ts ================================================ import { get, isFunction } from 'lodash/fp' import { pReduce } from '../utils/p-reduce' import { Config } from '../config/argv' import { Entry } from './Entry' export type SetConfig = (config: Config) => Config | Promise export type OnCreateBabelConfig = (params: any, dev: boolean) => void export type OnCreateWebpackConfig = ( config: C, dev: boolean, args: Config ) => C export type ModifyFiles = (files: string[], args: Config) => string[] export type ModifyEntry = (entry: Entry, args: Config) => Entry export type OnCreateDevServer = (app: A) => void export type OnPreBuild = (args: Config) => void export type OnPostBuild = (args: Config) => void export type OnPreRender = () => void export type OnPostRender = () => void export interface PluginFactory { setConfig?: SetConfig onCreateBabelConfig?: OnCreateBabelConfig onCreateDevServer?: OnCreateDevServer onCreateWebpackConfig?: OnCreateWebpackConfig modifyFiles?: ModifyFiles modifyEntry?: ModifyEntry onPreBuild?: OnPreBuild onPostBuild?: OnPostBuild } export class Plugin implements PluginFactory { public static runPluginsMethod( plugins: Plugin[] | undefined ): (method: keyof Plugin, ...args: any[]) => void { return (method, ...args) => { if (plugins && plugins.length > 0) { for (const plugin of plugins) { const fn = get(method, plugin) if (isFunction(fn)) { fn(...args) } } } } } public static propsOfPlugins( plugins: Plugin[] ): (prop: keyof Plugin) => any[] { return prop => plugins && plugins.length > 0 ? plugins.map(p => get(prop, p)).filter(Boolean) : [] } public static reduceFromPlugins( plugins: Plugin[] | undefined ): (method: keyof Plugin, initial: C, ...args: any[]) => C { return (method, initial, ...args) => { return [...(plugins || [])].reduce((obj: any, plugin) => { const fn = get(method, plugin) return fn && isFunction(fn) ? fn(obj, ...args) : obj }, initial) } } public static reduceFromPluginsAsync( plugins: Plugin[] | undefined ): (method: keyof Plugin, initial: C, ...args: any[]) => Promise { return (method, initial, ...args) => { return pReduce( [...(plugins || [])], (obj: any, plugin: any) => { const fn = get(method, plugin) return Promise.resolve(fn && isFunction(fn) ? fn(obj, ...args) : obj) }, initial ) } } public readonly setConfig?: SetConfig public readonly onCreateWebpackConfig?: OnCreateWebpackConfig public readonly onCreateBabelConfig?: OnCreateBabelConfig public readonly modifyFiles?: ModifyFiles public readonly modifyEntry?: ModifyEntry public readonly onCreateDevServer?: OnCreateDevServer public readonly onPreBuild?: OnPreBuild public readonly onPostBuild?: OnPostBuild constructor(p: PluginFactory) { this.setConfig = p.setConfig this.onCreateWebpackConfig = p.onCreateWebpackConfig this.onCreateBabelConfig = p.onCreateBabelConfig this.modifyFiles = p.modifyFiles this.modifyEntry = p.modifyEntry this.onCreateDevServer = p.onCreateDevServer this.onPreBuild = p.onPreBuild this.onPostBuild = p.onPostBuild } } export function createPlugin(factory: PluginFactory): Plugin { return new Plugin(factory) } ================================================ FILE: core/docz-core/src/states/config.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { load, loadFrom, finds } from 'load-cfg' import chokidar from 'chokidar' import get from 'lodash/get' import * as paths from '../config/paths' import { Params, State } from '../lib/DataServer' import { Config, Menu, ThemeConfig } from '../config/argv' import { getRepoUrl } from '../utils/repo-info' interface Payload { title: string description: string menu: Menu[] version: string | null repository: string | null native: boolean themeConfig: ThemeConfig separator: string } const getInitialConfig = (config: Config): Payload => { const pkg = fs.readJsonSync(paths.appPackageJson, { throws: false }) const repoUrl = getRepoUrl() return { title: config.title, description: config.description, menu: config.menu, version: get(pkg, 'version'), repository: repoUrl, native: config.native, themeConfig: config.themeConfig, separator: config.separator, } } const update = async (params: Params, initial: Payload, { config }: Config) => { const pathToConfig = path.join(paths.docz, 'doczrc.js') const next = config ? loadFrom(pathToConfig, initial, true, true) : load('docz', initial, true, true) params.setState('config', next) } export const WATCH_IGNORE = /(((^|[\/\\])\.((?!docz)(.+)))|(node_modules))/ export const createWatcher = (glob: any, config: Config) => { const ignored = config.watchIgnore || WATCH_IGNORE const watcher = chokidar.watch(glob, { ignored, cwd: paths.root, persistent: true, }) watcher.setMaxListeners(Infinity) return watcher } export const state = (config: Config, dev?: boolean): State => { const glob = config.config || finds('docz') const initial = getInitialConfig(config) const watcher = createWatcher(glob, config) return { id: 'config', start: async params => { const fn = async () => update(params, initial, config) await update(params, initial, config) if (dev) { watcher.on('add', fn) watcher.on('change', fn) watcher.on('unlink', fn) } }, close: () => { watcher.close() }, } } ================================================ FILE: core/docz-core/src/states/entries.ts ================================================ import chokidar from 'chokidar' import equal from 'fast-deep-equal' import { get } from 'lodash/fp' import { WATCH_IGNORE } from './config' import { Params, State } from '../lib/DataServer' import { Entries, getFilesToMatch } from '../lib/Entries' import { Config } from '../config/argv' import * as paths from '../config/paths' const mapToArray = (map: any = []) => Object.entries(map) .map(entry => entry && { key: entry[0], value: entry[1] }) .filter(Boolean) const updateEntries = (entries: Entries) => async (p: Params) => { const prev = get('entries', p.getState()) const map = await entries.get() if (map && !equal(prev, map)) { p.setState('entries', mapToArray(map)) } } export const state = ( entries: Entries, config: Config, dev?: boolean ): State => { const ignored = config.watchIgnore || WATCH_IGNORE const watcher = chokidar.watch(getFilesToMatch(config), { ignored, persistent: true, cwd: paths.getRootDir(config), }) watcher.setMaxListeners(Infinity) return { id: 'entries', start: async params => { const update = updateEntries(entries) await update(params) if (dev) { watcher.on('add', async () => update(params)) watcher.on('change', async () => update(params)) watcher.on('unlink', async () => update(params)) watcher.on('raw', async (event: string, path: string, details: any) => { if (details.event === 'moved' && details.type === 'directory') { await update(params) } }) } }, close: () => { watcher.close() }, } } ================================================ FILE: core/docz-core/src/states/index.ts ================================================ export { state as entries } from './entries' export { state as config } from './config' export { state as props } from './props' ================================================ FILE: core/docz-core/src/states/props.ts ================================================ import * as path from 'path' import chokidar from 'chokidar' import fastglob from 'fast-glob' import { State, Params } from '../lib/DataServer' import { get, propEq } from 'lodash/fp' import * as paths from '../config/paths' import { Config } from '../config/argv' import { docgen, unixPath } from '../utils/docgen' import { WATCH_IGNORE } from './config' export const getPattern = (config: Config) => { const { ignore, src: source, typescript: ts, docgenConfig: docgenConfig, } = config if (docgenConfig.searchPatterns) { return docgenConfig.searchPatterns } const searchPath = docgenConfig.searchPath ? docgenConfig.searchPath : source const root = paths.getRootDir(config) const srcDir = path.resolve(root, searchPath) const src = path.relative(root, srcDir) const filesPattern = path.join( src, ts ? '**/*.{ts,tsx,js,jsx,mjs}' : '**/*.{js,jsx,mjs}' ) return ignore .map(entry => typeof entry === 'string' && `!**/${entry}`) .filter(Boolean) .concat([ unixPath(filesPattern), '!**/node_modules', '!**/doczrc.js', ]) as string[] } const removeFilepath = (items: any[], filepath: string) => items.filter((item: any) => item.key !== filepath) export const initial = (config: Config, pattern: string[]) => async ( p: Params ) => { const { filterComponents } = config const cwd = paths.getRootDir(config) const files = await fastglob(pattern, { cwd, caseSensitiveMatch: false }) const filtered = filterComponents ? filterComponents(files) : files const metadata = await docgen(filtered, config) p.setState('props', metadata) } const change = (p: Params, config: Config) => async (filepath: string) => { const prev = get('props', p.getState()) const metadata = await docgen([filepath], config) const filtered = metadata.filter(propEq('key', filepath)) const next = removeFilepath(prev, filepath).concat(filtered) p.setState('props', next) } const remove = (p: Params) => async (filepath: string) => { const prev = get('props', p.getState()) const next = removeFilepath(prev, filepath) p.setState('props', next) } export const state = (config: Config, dev?: boolean): State => { const pattern = getPattern(config) const ignored = config.watchIgnore || WATCH_IGNORE const cwd = paths.getRootDir(config) const watcher = chokidar.watch(pattern, { cwd, ignored, persistent: true, }) watcher.setMaxListeners(Infinity) return { id: 'props', start: async params => { const addInitial = initial(config, pattern) await addInitial(params) if (dev) { watcher.on('change', change(params, config)) watcher.on('unlink', remove(params)) } }, close: () => { watcher.close() }, } } ================================================ FILE: core/docz-core/src/test-utils/data-bank.ts ================================================ import { Config } from '../config/argv' import * as paths from '../config/paths' // let a: Config export const createConfigStateInput = () => { return ({ title: 'test-tile', description: 'test-desc', menu: [{ name: 'menu-name' }], paths, native: undefined, themeConfig: undefined, separator: undefined, src: 'src/', } as unknown) as Config } ================================================ FILE: core/docz-core/src/test-utils/index.ts ================================================ import * as paths from '../config/paths' import yargs from 'yargs' import { setArgs, Config } from '../config/argv' import { Params } from '../lib/DataServer' import { getBaseConfig } from '../config/docz' export const mockedParams = (): Params => { let data: any = {} return { getState: () => data, setState: (key: string, value: string) => (data[key] = value), } } export const mockedArgv = () => { const yargsArgs: any = { argv: {}, //@ts-ignore option: jest.fn().mockImplementation((key, value) => { yargs.argv[value.alias ? value.alias : key] = value.default return yargs }), } const { argv } = setArgs(yargsArgs) return argv } export const getTestConfig = (overrides?: Partial): Config => { const argv = mockedArgv() return { //@ts-ignore ...getBaseConfig(argv), paths, typescript: true, src: './__fixtures__', ...overrides, } } ================================================ FILE: core/docz-core/src/types.d.ts ================================================ declare module '@sindresorhus/slugify' declare module 'art-template' declare module 'detect-port' declare module 'env-dot-prop' declare module 'get-pkg-repo' declare module 'humanize-string' declare module 'react-dev-utils/getCacheIdentifier' declare module 'react-docgen-external-proptypes-handler' declare module 'react-docgen' declare module 'titleize' ================================================ FILE: core/docz-core/src/utils/docgen/docz-docgen-resolver.ts ================================================ // Based on https://github.com/reactjs/react-docgen/issues/256#issuecomment-417352843 const { default: resolveHOC } = require('react-docgen/dist/utils/resolveHOC') const { default: resolveToModule, } = require('react-docgen/dist/utils/resolveToModule') const { utils, resolver: reactDocgenResolver } = require('react-docgen') type Todo = any export const createStyledComponentResolvers = () => { const moduleName = 'styled-components' const isStyledExpression = (tagPath: Todo, t: Todo) => (t.CallExpression.check(tagPath.node) && tagPath.get('callee').node.name === 'styled') || (t.MemberExpression.check(tagPath.node) && tagPath.get('object').node.name === 'styled') function isStyledComponent(def: Todo, t: Todo) { if ( !t.TaggedTemplateExpression.check(def.node) || !isStyledExpression(def.get('tag'), t) ) { return false } const module = resolveToModule(def.get('tag')) return !!module && module === moduleName } const exportTagged = (path: Todo, t: Todo) => { const definitions: Todo[] = utils.resolveExportDeclaration(path, t) const components: Todo[] = [] definitions.filter(Boolean).forEach(def => { let comp = def if (isStyledComponent(comp, t)) { components.push(comp) } else { comp = utils.resolveToValue(resolveHOC(comp)) if (isStyledComponent(comp, t)) components.push(comp) } }) return components } function findExportedStyledComponent(ast: Todo, recast: Todo) { const components: Todo[] = [] const t = recast.types.namedTypes const visitor = (path: Todo) => { components.push(...exportTagged(path, t)) return false } recast.visit(ast, { visitFunctionDeclaration: false, visitFunctionExpression: false, visitClassDeclaration: false, visitClassExpression: false, visitIfStatement: false, visitWithStatement: false, visitSwitchStatement: false, visitCatchCause: false, visitWhileStatement: false, visitDoWhileStatement: false, visitForStatement: false, visitForInStatement: false, visitExportDefaultDeclaration: visitor, }) return components } function findAllExportedStyledComponents(ast: Todo, recast: Todo) { const components: Todo[] = [] const t = recast.types.namedTypes const visitor = (path: Todo) => { components.push(...exportTagged(path, t)) return false } recast.visit(ast, { visitFunctionDeclaration: false, visitFunctionExpression: false, visitClassDeclaration: false, visitClassExpression: false, visitIfStatement: false, visitWithStatement: false, visitSwitchStatement: false, visitCatchCause: false, visitWhileStatement: false, visitDoWhileStatement: false, visitForStatement: false, visitForInStatement: false, visitExportDeclaration: visitor, visitExportNamedDeclaration: visitor, visitExportDefaultDeclaration: visitor, }) return components } function findAllStyledComponents(ast: Todo, recast: Todo) { const components: Todo[] = [] const t = recast.types.namedTypes recast.visit(ast, { visitFunctionDeclaration: false, visitFunctionExpression: false, visitClassDeclaration: false, visitClassExpression: false, visitIfStatement: false, visitWithStatement: false, visitSwitchStatement: false, visitCatchCause: false, visitWhileStatement: false, visitDoWhileStatement: false, visitForStatement: false, visitForInStatement: false, visitTaggedTemplateExpression(path: Todo) { let comp = path if (isStyledComponent(path, t)) { components.push(path) } else { comp = utils.resolveToValue(resolveHOC(path)) if (isStyledComponent(comp, t)) components.push(comp) } return false }, }) return components } return { findAllStyledComponents, findAllExportedStyledComponents, findExportedStyledComponent, } } export const resolver = (ast: Todo, recast: Todo) => [ ...reactDocgenResolver.findAllExportedComponentDefinitions(ast, recast), ...createStyledComponentResolvers().findAllExportedStyledComponents( ast, recast ), ] ================================================ FILE: core/docz-core/src/utils/docgen/externalProptypesHandler.ts ================================================ // vendored from react-docgen-external-proptypes-handler // which is not well maintained // https://github.com/doczjs/docz/issues/727 const path = require('path') const fs = require('fs') const recast = require('recast') /** * Re-using few private methods of react-docgen to avoid code duplication */ const isRequiredPropType = require('react-docgen/dist/utils/isRequiredPropType') .default const setPropDescription = require('react-docgen/dist/utils/setPropDescription') .default let babylon: any try { const buildParser = require('react-docgen/dist/babelParser').default babylon = buildParser() } catch (e) { /** DOCZ: special error message as people often encounter errors here because they misconfigure or lack a babel plugin */ console.error('Error while initializing babel in docz: ', e) /** DOCZ: disabling this require because it no longer exists */ throw new Error(e) // babylon = require('react-docgen/dist/babylon').default } const utils = require('react-docgen').utils const types = recast.types.namedTypes const HOP = Object.prototype.hasOwnProperty const createObject = Object.create function isPropTypesExpression(path: string) { const moduleName = utils.resolveToModule(path) if (moduleName) { return ( utils.isReactModuleName(moduleName) || moduleName === 'ReactPropTypes' ) } return false } /** * Amends the documentation object with propTypes information. * @method amendPropTypes * @param {Object} documentation documentation object * @param {Object} path node path reference of propTypes property */ function amendPropTypes(documentation: any, path: any) { if (!types.ObjectExpression.check(path.node)) { return } path.get('properties').each((propertyPath: any) => { let propDescriptor, valuePath, type, resolvedValuePath const nodeType = propertyPath.node.type if (nodeType === types.Property.name) { propDescriptor = documentation.getPropDescriptor( utils.getPropertyName(propertyPath) ) valuePath = propertyPath.get('value') type = isPropTypesExpression(valuePath) ? utils.getPropType(valuePath) : { name: 'custom', raw: utils.printValue(valuePath), } if (type) { propDescriptor.type = type propDescriptor.required = type.name !== 'custom' && isRequiredPropType(valuePath) } } else if (nodeType === types.SpreadProperty.name) { resolvedValuePath = utils.resolveToValue(propertyPath.get('argument')) // normal object literal if (resolvedValuePath.node.type === types.ObjectExpression.name) { amendPropTypes(documentation, resolvedValuePath) } } if (types.Property.check(propertyPath.node)) { setPropDescription(documentation, propertyPath) } }) } /** * Accepts absolute path of a source file and returns the file source as string. * @method getSrc * @param {String} filePath File path of the component * @return {String} Source code of the given file if file exist else returns empty */ function getSrc(filePath: string) { let src if (fs.existsSync(filePath)) { src = fs.readFileSync(filePath, 'utf-8') } return src } function getAST(src: string) { return recast.parse(src, { source: 'module', esprima: babylon, }) } /** * Resolves propTypes source file path relative to current component, * which resolves only file extension of type .js or .jsx * * @method resolveFilePath * @param {String} componentPath Relative file path of the component * @param {String} importedFilePath Relative file path of a dependent component * @return {String} Resolved file path if file exist else null */ function resolveFilePath(componentPath: string, importedFilePath: string) { const regEx = /\.(js|jsx)$/ let srcPath = path.resolve(path.dirname(componentPath), importedFilePath) if (regEx.exec(srcPath)) { return srcPath } else { srcPath += fs.existsSync(`${srcPath}.js`) ? '.js' : '.jsx' return srcPath } } /** * Method which returns actual values from the AST node of type specifiers. * * @method getSpecifiersOfNode */ function getSpecifiersOfNode(specifiers: any) { const specifier: string[] = [] specifiers.forEach((node: any) => { specifier.push(node.local.name) }) return specifier } /** * Filters the list of identifier node values or node paths from a given AST. * * @method getIdentifiers * @param {Object} ast Root AST node of a component * @return {Object} Which holds identifier relative file path as `key` and identifier name as `value` */ function getIdentifiers(ast: any) { const identifiers = createObject(null) recast.visit(ast, { visitVariableDeclarator(path: any) { const node = path.node const nodeType = node.init.type if (nodeType === types.Identifier.name) { if (identifiers[node.init.name]) { identifiers[node.init.name].push(node.init.name) } else { identifiers[node.init.name] = [node.init.name] } } else if (nodeType === types.Literal.name) { if (identifiers[node.id.name]) { identifiers[node.id.name].push(node.init.value) } else { identifiers[node.id.name] = [node.init.value] } } else if (nodeType === types.ArrayExpression.name) { if (identifiers[node.id.name]) { identifiers[node.id.name].push(node.init.elements) } else { identifiers[node.id.name] = node.init.elements } } else if (nodeType === types.ObjectExpression.name) { if (identifiers[node.id.name]) { identifiers[node.id.name].push({ path, value: node.init.properties, }) } else { identifiers[node.id.name] = { path, value: node.init.properties, } } } this.traverse(path) }, }) return identifiers } /** * Traverse through given AST and filters named and default export declarations. * * @method getExports * @param {Object} ast Root AST node of a component * @return {Array} which holds list of named identifiers */ function getExports(ast: any) { const exports: any = [] recast.visit(ast, { visitExportNamedDeclaration(path: any) { const node = path.node const specifiers = getSpecifiersOfNode(node.specifiers) const declarations = Object.keys(getIdentifiers(ast)) exports.push(...new Set(specifiers.concat(declarations))) this.traverse(path) }, visitExportDefaultDeclaration(path: any) { const node = path.node if (node.declaration.type === types.Identifier.name) { exports.push(node.declaration.name) } /* Commenting it for now, this might needed for further enhancements. else if (nodeType === types.Literal.name) { varDeclarators.push(node.init.value); } else if (nodeType === types.ArrayExpression.name) { computedPropNodes[node.id.name] = node.init.elements; }*/ this.traverse(path) }, }) return exports } /** * Method to list all specifiers of es6 `import` of a given file(AST) * * @method getImports * @param {Object} ast Root AST node of a component * @return {Object/Boolean} if Object: Holds import module name or file path as `key` * and identifier as `value`, else return false */ function getImports(ast: any) { const specifiers = createObject(null) recast.visit(ast, { visitImportDeclaration: (path: any) => { const name = path.node.source.value const specifier = getSpecifiersOfNode(path.node.specifiers) if (!specifiers[name]) { specifiers[name] = specifier } else { specifiers[name].push(...specifier) } return false }, }) return specifiers } /** * Method to resolve all dependent values(computed values, which are from external files). * * @method resolveImportedDependencies * @param {Object} ast Root AST node of the component * @param {Object} srcFilePath Absolute path of a dependent file * @return {Object} Holds export identifier as `key` and respective AST node path as value */ function resolveImportedDependencies(ast: any, srcFilePath: any) { const filteredItems = createObject(null) const importSpecifiers = getImports(ast) let identifiers, resolvedNodes if (importSpecifiers && Object.keys(importSpecifiers).length) { resolvedNodes = resolveDependencies(importSpecifiers, srcFilePath) } const exportSpecifiers = getExports(ast) if (exportSpecifiers && exportSpecifiers.length) { identifiers = getIdentifiers(ast) } if (resolvedNodes) { Object.assign(identifiers, ...resolvedNodes) } for (const identifier in identifiers) { if ( HOP.call(identifiers, identifier) && exportSpecifiers.indexOf(identifier) > -1 ) { filteredItems[identifier] = identifiers[identifier] } } return filteredItems } /** * Method to resolve all the external dependencies of the component propTypes * * @method resolveDependencies * @param {Array} filePaths List of files to resolve * @param {String} componentPath Absolute path of the component in case `propTypes` are declared in a component file or * absolute path to the file where `propTypes` is declared. */ function resolveDependencies(filePaths: string[], componentPath: string) { const importedNodes = [] for (const importedFilePath in filePaths) { if (HOP.call(filePaths, importedFilePath)) { const srcPath = resolveFilePath(componentPath, importedFilePath) if (!srcPath) { return } const src = getSrc(srcPath) if (src) { const ast = getAST(src) importedNodes.push(resolveImportedDependencies(ast, srcPath)) } } } return importedNodes } /** * Method to filter computed props(which are declared out side of the component and used in propTypes object). * * @method filterSpecifiers * @param {Object} specifiers List which holds all the values of external dependencies * @return {Object} computedPropNames List which holds all the computed values from `propTypes` property */ function filterSpecifiers(specifiers: any, computedPropNames: any) { const filteredSpecifiers = createObject(null) for (const cp in computedPropNames) { if (HOP.call(computedPropNames, cp)) { for (const sp in specifiers) { if (HOP.call(specifiers, sp) && specifiers[sp].indexOf(cp) > -1) { if (filteredSpecifiers[sp]) { filteredSpecifiers[sp].push(cp) } else { filteredSpecifiers[sp] = [cp] } } } } } return filteredSpecifiers } /** * Method to parse and get computed nodes from a document object * * @method getComputedPropValuesFromDoc * @param {Object} doc react-docgen document object * @return {Object/Boolean} Object with computed property identifer as `key` and AST node path as `value`, * If document object have any computed properties else return false. */ function getComputedPropValuesFromDoc(doc: any) { let flag const computedProps = createObject(null) const props = doc.toObject().props flag = false if (props) { for (const prop in props) { if (HOP.call(props, prop)) { const o = props[prop] if (o.type && o.type.name === 'enum' && o.type.computed) { flag = true computedProps[o.type.value] = o } } } return flag ? computedProps : false } else { return false } } /** * Method to update the document object computed values with actual values to generate doc for external dependent values. * * @method amendDocs * @param {Object} doc react-docgen document object * @param {Object} path AST node path of component `propTypes` * @param {Object} props list of actual values of computed properties */ function amendDocs(doc: any, path: any, props: any) { const propsToPatch = path.get('properties') function getComputedPropVal(name: string) { for (let i = 0; i < props.length; i++) { if (props[i][name]) { return props[i][name] } } } propsToPatch.each((propertyPath: string) => { const propDescriptor = doc.getPropDescriptor( utils.getPropertyName(propertyPath) ) if (propDescriptor.type.name === 'enum' && propDescriptor.type.computed) { const oldVal = propDescriptor.type.value const newVal = getComputedPropVal(propDescriptor.type.value) || oldVal propDescriptor.type.value = newVal propDescriptor.type.computed = false } }) } /** * Initializer of react-docgen custom handler. * * @method externalProptypesHandler * @param {String} componentPath Absolute path of the react component */ function externalProptypesHandler(componentPath: string) { return (doc: any, path: any) => { const root = path.scope.getGlobalScope().node let propTypesPath, propTypesFilePath, propTypesAST propTypesPath = utils.getMemberValuePath(path, 'propTypes') propTypesAST = root propTypesFilePath = componentPath if (!propTypesPath) { return } const propsNameIdentifier = propTypesPath.node.name propTypesPath = utils.resolveToValue(propTypesPath) if (!propTypesPath) { return } if (!types.ObjectExpression.check(propTypesPath.node)) { //First resolve dependencies against component path propTypesFilePath = resolveFilePath( componentPath, propTypesPath.node.source.value ) const propTypesSrc = getSrc(propTypesFilePath) propTypesAST = getAST(propTypesSrc) const importedPropTypes = getIdentifiers(propTypesAST)[ propsNameIdentifier ] if (!importedPropTypes) { return } propTypesPath = utils.resolveToValue(importedPropTypes.path) //updating doc object with external props amendPropTypes(doc, propTypesPath) } const computedPropNames = getComputedPropValuesFromDoc(doc) if (!computedPropNames) { return } const importSpecifiers = getImports(propTypesAST) if (!importSpecifiers) { return } const filteredProps = filterSpecifiers(importSpecifiers, computedPropNames) if (!Object.keys(filteredProps).length) { return } const resolvedImports = resolveDependencies( filteredProps, propTypesFilePath ) if (resolvedImports && !resolvedImports.length) { return } amendDocs(doc, propTypesPath, resolvedImports) } } export default externalProptypesHandler ================================================ FILE: core/docz-core/src/utils/docgen/index.ts ================================================ import findUp from 'find-up' import * as paths from '../../config/paths' import { Config } from '../../config/argv' import { jsParser } from './javascript' import { tsParser } from './typescript' import { normalize } from 'path' export const unixPath = (src: string): string => { return normalize(src).replace(/\\/g, '/') } export const docgen = async (files: string[], config: Config) => { const cwd = paths.getRootDir(config) const tsconfig = await findUp('tsconfig.json', { cwd }) const tsFiles = files.filter(file => file.match(/\.(tsx|ts)$/)) const jsFiles = files.filter(file => file.match(/\.(js|jsx|mjs)$/)) return config.typescript ? tsParser(tsFiles, config, tsconfig).concat(jsParser(jsFiles, config)) : jsParser(jsFiles, config) } ================================================ FILE: core/docz-core/src/utils/docgen/javascript.ts ================================================ import * as fs from 'fs-extra' import * as path from 'path' import logger from 'signale' import actualNameHandler from 'react-docgen-actual-name-handler' import * as reactDocgen from 'react-docgen' import { Config } from '../../config/argv' import { getRootDir } from '../../config/paths' import { unixPath } from '.' import { resolver as doczResolver } from './docz-docgen-resolver' import externalProptypesHandler from './externalProptypesHandler' const throwError = (err: any) => { logger.fatal(`Error parsing static types`) logger.error(err) } export const jsParser = (files: string[], config: Config) => { const resolver = config.docgenConfig.resolver || doczResolver const root = getRootDir(config) const parseFilepathProps = (filepath: string) => { const fullpath = path.resolve(root, filepath) const handlers = reactDocgen.defaultHandlers.concat([ externalProptypesHandler(filepath), actualNameHandler, ]) try { const code = fs.readFileSync(fullpath, { encoding: 'utf-8' }) const props = reactDocgen.parse(code, resolver, handlers) return { key: unixPath(filepath), value: props } } catch (err) { if (config.debug) throwError(err) return null } } return files.map(parseFilepathProps).filter(Boolean) } ================================================ FILE: core/docz-core/src/utils/docgen/typescript.ts ================================================ import * as fs from 'fs-extra' import * as path from 'path' import * as crypto from 'crypto' import * as _ from 'lodash/fp' import * as logger from 'signale' import * as reactDocgenTs from 'react-docgen-typescript' import ts from 'typescript' import { Config } from '../../config/argv' import * as paths from '../../config/paths' import { unixPath } from '.' export interface TSFile { text?: string version: number } interface PropItem { key: string value: any[] } const digest = (str: string) => crypto .createHash('md5') .update(str) .digest('hex') const cacheFilepath = path.join(paths.cache, 'propsParser.json') export const readCacheFile = () => fs.readJSONSync(cacheFilepath, { throws: false }) function checkFilesOnCache(files: string[], config: Config): string[] { const cache = readCacheFile() const root = paths.getRootDir(config) if (_.isEmpty(cache)) return files return files.filter(filepath => { const normalized = path.normalize(filepath) const fullpath = path.resolve(root, normalized) const hash = digest(fs.readFileSync(fullpath, 'utf-8')) const found = _.get(normalized, cache) return found && hash !== found.hash }) } function writePropsOnCache(items: PropItem[], config: Config): void { const cache = readCacheFile() const root = paths.getRootDir(config) const newCache = items.reduce((obj, { key: filepath, value }) => { const fullpath = path.resolve(root, path.normalize(filepath)) const hash = digest(fs.readFileSync(fullpath, 'utf-8')) return { ...obj, [unixPath(filepath)]: { hash, props: value } } }, {}) fs.outputJSONSync(cacheFilepath, { ...cache, ...newCache }) } function getPropsOnCache(): any { const cache = readCacheFile() if (_.isEmpty(cache)) { logger.warn('No cache was found with your props definitions') logger.warn("We'll parse your components to get props from them") logger.warn('Depending on your components, this could take while...') return [] } return Object.entries(cache).map(([key, value]) => ({ key: unixPath(key), value: _.get('props', value), })) } const mergeWithCache = (cache: any[], props: any[]) => { const keys = props.map(_.prop('key')) return cache.filter(item => !_.contains(item.key, keys)).concat(props) } const removeFromCache = (filepath: string) => { const cache = readCacheFile() fs.outputJSONSync(cacheFilepath, _.omit(filepath, cache)) } const getInitialFilesMap = (): Map => { const cache = readCacheFile() if (_.isEmpty(cache)) return new Map() const map = new Map() _.entries(cache).forEach(([filepath]: any) => { const exist = fs.pathExistsSync(filepath) if (!exist) { removeFromCache(filepath) } else { map.set(filepath, { text: fs.readFileSync(filepath, 'utf-8'), version: 0, }) } }) return map } let languageService: ts.LanguageService | null = null const filesMap = getInitialFilesMap() function getTSConfigFile(tsconfigPath: string): ts.ParsedCommandLine { const basePath = path.dirname(tsconfigPath) const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile) return ts.parseJsonConfigFileContent( configFile!.config, ts.sys, basePath, {}, tsconfigPath ) } function loadFiles(filesToLoad: string[], config: Config): void { const root = paths.getRootDir(config) filesToLoad.forEach(filepath => { const normalized = path.normalize(filepath) const fullpath = path.resolve(root, normalized) const found = filesMap.get(normalized) filesMap.set(normalized, { text: fs.readFileSync(fullpath, 'utf-8'), version: found ? found.version + 1 : 0, }) }) } function createServiceHost( compilerOptions: ts.CompilerOptions, files: Map, config: Config ): ts.LanguageServiceHost { const root = paths.getRootDir(config) return { getScriptFileNames: () => { return [...files.keys()] }, getScriptVersion: fileName => { const file = files.get(fileName) return (file && file.version.toString()) || '' }, getScriptSnapshot: fileName => { const fullpath = path.resolve(root, fileName) if (!fs.existsSync(fullpath)) { return undefined } let file = files.get(fileName) if (file === undefined) { const text = fs.readFileSync(fullpath).toString() file = { version: 0, text } files.set(fileName, file) } return ts.ScriptSnapshot.fromString(file!.text!) }, getCurrentDirectory: () => root, getCompilationSettings: () => compilerOptions, getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), fileExists: ts.sys.fileExists, readFile: ts.sys.readFile, readDirectory: ts.sys.readDirectory, } } const defaultPropFilter = (prop: any): boolean => { return prop.parent == null || !prop.parent.fileName.includes('node_modules') } const parseFiles = (files: string[], config: Config, tsconfig: string) => { const opts = { propFilter(prop: any): boolean { const customPropFilter = config.docgenConfig.propFilter const propFilter = customPropFilter && _.isFunction(customPropFilter) ? customPropFilter : defaultPropFilter return Boolean(propFilter(prop)) }, componentNameResolver(exp: ts.Symbol, source: ts.SourceFile): any { const componentNameResolver = config.docgenConfig.resolver const val = componentNameResolver && _.isFunction(componentNameResolver) && componentNameResolver(exp, source) return val }, } loadFiles(files, config) const parser = reactDocgenTs.withCustomConfig(tsconfig, opts) const compilerOptions = _.get('options', getTSConfigFile(tsconfig)) const programProvider = () => { if (languageService) return languageService.getProgram()! const servicesHost = createServiceHost(compilerOptions, filesMap, config) const documentRegistry = ts.createDocumentRegistry() languageService = ts.createLanguageService(servicesHost, documentRegistry) return languageService.getProgram()! } return files.map(filepath => ({ key: unixPath(filepath), value: parser.parseWithProgramProvider(filepath, programProvider), })) } export const tsParser = ( files: string[], config: Config, tsconfig?: string ) => { if (!tsconfig) return [] const filesToLoad = checkFilesOnCache(files, config) const propsOnCache = getPropsOnCache() if (!filesToLoad.length) return propsOnCache const next = parseFiles(filesToLoad, config, tsconfig) writePropsOnCache(next, config) return mergeWithCache(propsOnCache, next) } ================================================ FILE: core/docz-core/src/utils/open-browser.ts ================================================ /** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict' var chalk = require('chalk') var execSync = require('child_process').execSync var spawn = require('cross-spawn') var open = require('open') // https://github.com/sindresorhus/open#app var OSX_CHROME = 'google chrome' const Actions = Object.freeze({ NONE: 0, BROWSER: 1, SCRIPT: 2, }) function getBrowserEnv() { // Attempt to honor this environment variable. // It is specific to the operating system. // See https://github.com/sindresorhus/open#app for documentation. const value = process.env.BROWSER let action if (!value) { // Default. action = Actions.BROWSER } else if (value.toLowerCase().endsWith('.js')) { action = Actions.SCRIPT } else if (value.toLowerCase() === 'none') { action = Actions.NONE } else { action = Actions.BROWSER } return { action, value } } function executeNodeScript(scriptPath: any, url: any) { const extraArgs = process.argv.slice(2) const child = spawn('node', [scriptPath, ...extraArgs, url], { stdio: 'inherit', }) child.on('close', (code: any) => { if (code !== 0) { console.log() console.log( chalk.red( 'The script specified as BROWSER environment variable failed.' ) ) console.log(chalk.cyan(scriptPath) + ' exited with code ' + code + '.') console.log() return } }) return true } function startBrowserProcess(browser: any, url: any) { // If we're on OS X, the user hasn't specifically // requested a different browser, we can try opening // Chrome with AppleScript. This lets us reuse an // existing tab when possible instead of creating a new one. const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (typeof browser !== 'string' || browser === OSX_CHROME) if (shouldTryOpenChromeWithAppleScript) { try { // Try our best to reuse existing tab // on OS X Google Chrome with AppleScript execSync('ps cax | grep "Google Chrome"') execSync('osascript openChrome.applescript "' + encodeURI(url) + '"', { cwd: __dirname, stdio: 'ignore', }) return true } catch (err) { // Ignore errors. } } // Another special case: on OS X, check if BROWSER has been set to "open". // In this case, instead of passing `open` to `open` (which won't work), // just ignore it (thus ensuring the intended behavior, i.e. opening the system browser): // https://github.com/facebook/create-react-app/pull/1690#issuecomment-283518768 if (process.platform === 'darwin' && browser === 'open') { browser = undefined } // Fallback to opn // (It will always open new tab) try { var options = { app: browser, wait: false } open(url, options).catch(() => {}) // Prevent `unhandledRejection` error. return true } catch (err) { return false } } /** * Reads the BROWSER environment variable and decides what to do with it. Returns * true if it opened a browser or ran a node.js script, otherwise false. */ export function openBrowser(url: any) { const { action, value } = getBrowserEnv() switch (action) { case Actions.NONE: // Special case: BROWSER="none" will prevent opening completely. return false case Actions.SCRIPT: return executeNodeScript(value, url) case Actions.BROWSER: return startBrowserProcess(value, url) default: throw new Error('Not implemented.') } } // module.exports = openBrowser ================================================ FILE: core/docz-core/src/utils/openChrome.applescript ================================================ property targetTab: null property targetTabIndex: -1 property targetWindow: null on run argv set theURL to item 1 of argv tell application "Chrome" if (count every window) = 0 then make new window end if -- 1: Looking for tab running debugger -- then, Reload debugging tab if found -- then return set found to my lookupTabWithUrl(theURL) if found then set targetWindow's active tab index to targetTabIndex tell targetTab to reload tell targetWindow to activate set index of targetWindow to 1 return end if -- 2: Looking for Empty tab -- In case debugging tab was not found -- We try to find an empty tab instead set found to my lookupTabWithUrl("chrome://newtab/") if found then set targetWindow's active tab index to targetTabIndex set URL of targetTab to theURL tell targetWindow to activate return end if -- 3: Create new tab -- both debugging and empty tab were not found -- make a new tab with url tell window 1 activate make new tab with properties {URL:theURL} end tell end tell end run -- Function: -- Lookup tab with given url -- if found, store tab, index, and window in properties -- (properties were declared on top of file) on lookupTabWithUrl(lookupUrl) tell application "Chrome" -- Find a tab with the given url set found to false set theTabIndex to -1 repeat with theWindow in every window set theTabIndex to 0 repeat with theTab in every tab of theWindow set theTabIndex to theTabIndex + 1 if (theTab's URL as string) contains lookupUrl then -- assign tab, tab index, and window to properties set targetTab to theTab set targetTabIndex to theTabIndex set targetWindow to theWindow set found to true exit repeat end if end repeat if found then exit repeat end if end repeat end tell return found end lookupTabWithUrl ================================================ FILE: core/docz-core/src/utils/p-reduce.ts ================================================ export const pReduce = (iterable: any, reducer: any, initialValue: any): any => new Promise((resolve, reject) => { const iterator = iterable[Symbol.iterator]() let index = 0 const next = async (total: any) => { const element = iterator.next() if (element.done) { resolve(total) return } try { const value = await Promise.all([total, element.value]) next(reducer(value[0], value[1], index++)) } catch (error) { reject(error) } } next(initialValue) }) ================================================ FILE: core/docz-core/src/utils/repo-info.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import getPkgRepo from 'get-pkg-repo' import findup from 'find-up' import * as paths from '../config/paths' import { Config } from '../config/argv' // TODO: type repo object returned from get-pkg-repo export const parseRepo = (): any => { try { const pkg = fs.readJsonSync(paths.appPackageJson) return getPkgRepo(pkg) } catch (err) { return null } } export const getRepoUrl = () => { const repo = parseRepo() return ( repo && ((repo.browsetemplate && repo.browsetemplate .replace('{domain}', repo.domain) .replace('{user}', repo.user) .replace('{project}', repo.project) .replace('{/tree/committish}', '')) || (repo.browse && repo.browse())) ) } const getBitBucketPath = (branch: string, relative: string) => { const querystring = `?mode=edit&spa=0&at=${branch}&fileviewer=file-view-default` const filepath = path.join(`/src/${branch}`, relative, `{{filepath}}`) return `${filepath}${querystring}` } const getTree = (repo: any, branch: string, relative: string) => { const defaultPath = path.join(`/edit/${branch}`, relative, `{{filepath}}`) const bitBucketPath = getBitBucketPath(branch, relative) if (repo && repo.type === 'bitbucket') return bitBucketPath return defaultPath } export const getRepoEditUrl = (config: Config): string | null => { try { const repo = parseRepo() const gitDir = findup.sync('.git', { type: 'directory' }) if (!gitDir) return null const project = path.parse(gitDir).dir const root = path.join(paths.getRootDir(config), config.src) const relative = path.relative(project, root) const tree = getTree(repo, config.editBranch, relative) return ( repo && repo.browsetemplate && repo.browsetemplate .replace('{domain}', repo.domain) .replace('{user}', repo.user) .replace('{project}', repo.project) .replace('{/tree/committish}', tree) ) } catch (err) { console.log(err) return null } } ================================================ FILE: core/docz-core/src/utils/spawn.ts ================================================ import crossSpawn from 'cross-spawn' export const spawnSync = (command: string, args?: readonly string[]) => { const { status } = crossSpawn.sync(command, args, { stdio: 'inherit', }) if (status !== 0) { process.exitCode = status || 1 } } ================================================ FILE: core/docz-core/src/utils/template.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { compiled } from 'docz-utils/lib/fs' import { format } from 'docz-utils/lib/format' import * as paths from '../config/paths' export const fromTemplates = (file: string) => { return path.join(paths.templates, file) } export const outputFileFromTemplate = async ( templatePath: string, outputPath: string, templateProps?: Record, compileProps?: Record ) => { const filepath = fromTemplates(templatePath) const template = await compiled(filepath, compileProps || { minimize: false }) const file = template(templateProps || {}) const raw = await format(file) await fs.outputFile(outputPath, raw) } ================================================ FILE: core/docz-core/templates/404.tpl.js ================================================ import React from 'react' const NotFound = () => { const style = { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100vh', width: '100vw', fontSize: 32, } return
Not Found
} export default NotFound ================================================ FILE: core/docz-core/templates/gatsby-config.tpl.js ================================================ const { mergeWith } = require('docz-utils') const fs = require('fs-extra') let custom = {} const hasGatsbyConfig = fs.existsSync('./gatsby-config.custom.js') if (hasGatsbyConfig) { try { custom = require('./gatsby-config.custom') } catch (err) { console.error( `Failed to load your gatsby-config.js file : `, JSON.stringify(err) ) } } const config = { <% if (config.base) {%> pathPrefix: "<%- config.base %>", <%}%> siteMetadata: { title: "<%- config.title %>", description: "<%- config.description %>" }, plugins: [ <% if (config.typescript) {%> { resolve: 'gatsby-plugin-typescript', options: { isTSX: true, allExtensions: true } },<%}%> { resolve: 'gatsby-theme-docz', options: <%- opts %> },<% if (isDoczRepo) {%> { resolve: 'gatsby-plugin-eslint', options: { test: /\.js$|\.jsx$/, exclude: /.*/, stages: ['develop'], options: { emitWarning: false, failOnError: false, }, }, }, { resolve: 'gatsby-plugin-compile-es6-packages', options: { modules: ['docz', 'gatsby-theme-docz'], }, },<%}%> ], } const merge = mergeWith((objValue, srcValue) => { if (Array.isArray(objValue)) { return objValue.concat(srcValue) } }) module.exports = merge(config, custom) ================================================ FILE: core/docz-core/templates/gatsby-node.tpl.js ================================================ const { get } = require('docz-utils') const NO_OP = () => {} const DEFAULT_RESOLVABLE_EXTENSIONS = () => [`.js`, `.jsx`] let gatsbyNodeCustom = {} try { gatsbyNodeCustom = require('./gatsby-node.custom') } catch (err) {} // https://www.gatsbyjs.org/docs/node-apis/ exports.createPages = args => { const createPages = get(gatsbyNodeCustom, 'createPages', NO_OP) return createPages(args) } exports.createPagesStatefully = args => { const createPagesStatefully = get( gatsbyNodeCustom, 'createPagesStatefully', NO_OP ) return createPagesStatefully(args) } exports.createResolvers = args => { const createResolvers = get(gatsbyNodeCustom, 'createResolvers', NO_OP) return createResolvers(args) } exports.createSchemaCustomization = args => { const createSchemaCustomization = get( gatsbyNodeCustom, 'createSchemaCustomization', NO_OP ) return createSchemaCustomization(args) } exports.generateSideEffects = args => { const generateSideEffects = get( gatsbyNodeCustom, 'generateSideEffects', NO_OP ) return generateSideEffects(args) } exports.onCreateBabelConfig = args => { const onCreateBabelConfig = get( gatsbyNodeCustom, 'onCreateBabelConfig', NO_OP ) return onCreateBabelConfig(args) } exports.onCreateDevServer = args => { const onCreateDevServer = get(gatsbyNodeCustom, 'onCreateDevServer', NO_OP) return onCreateDevServer(args) } exports.onCreateNode = args => { const onCreateNode = get(gatsbyNodeCustom, 'onCreateNode', NO_OP) return onCreateNode(args) } exports.onCreatePage = args => { const onCreatePage = get(gatsbyNodeCustom, 'onCreatePage', NO_OP) return onCreatePage(args) } exports.onCreateWebpackConfig = args => { const onCreateWebpackConfig = get( gatsbyNodeCustom, 'onCreateWebpackConfig', NO_OP ) return onCreateWebpackConfig(args) } exports.onPostBootstrap = args => { const onPostBootstrap = get(gatsbyNodeCustom, 'onPostBootstrap', NO_OP) return onPostBootstrap(args) } exports.onPostBuild = args => { const onPostBuild = get(gatsbyNodeCustom, 'onPostBuild', NO_OP) return onPostBuild(args) } exports.onPreBootstrap = args => { const onPreBootstrap = get(gatsbyNodeCustom, 'onPreBootstrap', NO_OP) return onPreBootstrap(args) } exports.onPreBuild = args => { const onPreBuild = get(gatsbyNodeCustom, 'onPreBuild', NO_OP) return onPreBuild(args) } exports.onPreExtractQueries = args => { const onPreExtractQueries = get( gatsbyNodeCustom, 'onPreExtractQueries', NO_OP ) return onPreExtractQueries(args) } exports.onPreInit = args => { const onPreInit = get(gatsbyNodeCustom, 'onPreInit', NO_OP) return onPreInit(args) } exports.preprocessSource = args => { const preprocessSource = get(gatsbyNodeCustom, 'preprocessSource', NO_OP) return preprocessSource(args) } exports.resolvableExtensions = args => { const resolvableExtensions = get( gatsbyNodeCustom, 'resolvableExtensions', DEFAULT_RESOLVABLE_EXTENSIONS ) return resolvableExtensions(args) } exports.setFieldsOnGraphQLNodeType = args => { const setFieldsOnGraphQLNodeType = get( gatsbyNodeCustom, 'setFieldsOnGraphQLNodeType', () => ({}) ) return setFieldsOnGraphQLNodeType(args) } exports.sourceNodes = args => { const sourceNodes = get(gatsbyNodeCustom, 'sourceNodes', NO_OP) return sourceNodes(args) } ================================================ FILE: core/docz-core/templates/imports.tpl.js ================================================ export const imports = { <% entries.forEach(function(entry) { %>'<%- entry.filepath %>': () => import(/* webpackPrefetch: true, webpackChunkName: "<%- entry.slug %>" */ '<%- entry.filepath %>'),<% }) %> } ================================================ FILE: core/docz-core/templates/index.tpl.html ================================================ {{ title }} {{ head }}
{{ footer }} ================================================ FILE: core/docz-core/templates/index.tpl.js ================================================ import React from 'react' import ReactDOM from 'react-dom' import Root from './root' const _onPreRenders = [<% if (onPreRenders) {%><%- onPreRenders %><%}%>] const _onPostRenders = [<% if (onPostRenders) {%><%- onPostRenders %><%}%>] const onPreRender = () => _onPreRenders.forEach(f => f && f()) const onPostRender = () => _onPostRenders.forEach(f => f && f()) const root = document.querySelector('#root') const render = (Component = Root) => { onPreRender() ReactDOM.render(, root, onPostRender) } render(Root) ================================================ FILE: core/docz-core/templates/root.tpl.js ================================================ import React from 'react' import { Link, Router, Routes<% if (!isProd) {%>, useDataServer<%}%> } from 'docz' <% if (!isProd) {%>import { hot } from 'react-hot-loader'<%}%> import Theme from '<%- theme %>' import { imports } from './imports' import database from './db.json' <% if (wrapper) {%>import Wrapper from '<%- wrapper %>'<%}%> const Root = () => { <% if (!isProd && websocketUrl) {%>useDataServer('<%- websocketUrl %>')<%}%> return ( wrapper={Wrapper}<%}%> linkComponent={Link} db={database} > ) } <% if (!isProd) {%>export default hot(module)(Root)<%}%> <% if (isProd) {%>export default Root<%}%> ================================================ FILE: core/docz-core/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "dist", "rootDir": "src", "declaration": true, "types": ["node"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: core/docz-rollup/.eslintrc.js ================================================ module.exports = { extends: 'docz-js', } ================================================ FILE: core/docz-rollup/.lintstagedrc ================================================ { "*.js": ["yarn fix", "git add"] } ================================================ FILE: core/docz-rollup/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **dev-env/basic:** building and running development ([#1646](https://github.com/doczjs/docz/issues/1646)) ([7baaaf2](https://github.com/doczjs/docz/commit/7baaaf2)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **dev-env/basic:** building and running development ([#1646](https://github.com/doczjs/docz/issues/1646)) ([7baaaf2](https://github.com/doczjs/docz/commit/7baaaf2)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package docz-rollup # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) ### Features * **gatsby-theme-docz:** add new Props component ([8eb780d](https://github.com/pedronauck/docz/commit/8eb780d)) * add typescript support (need fix) ([13947f9](https://github.com/pedronauck/docz/commit/13947f9)) * docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package docz-rollup # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package docz-rollup ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) ### Bug Fixes * **docz-rollup:** fixed rollup configs to be Windows tolerant ([#812](https://github.com/pedronauck/docz/issues/812)) ([10f6bfd](https://github.com/pedronauck/docz/commit/10f6bfd)) ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package docz-rollup # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package docz-rollup # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) **Note:** Version bump only for package docz-rollup # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * **docz-theme-default:** use styled-components instead of emotion ([19047fd](https://github.com/pedronauck/docz/commit/19047fd)) * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) ================================================ FILE: core/docz-rollup/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/docz-rollup/README.md ================================================ ## docz-rollup This is an internal docz package containing a [rollup](https://github.com/rollup/rollup) config used by docz to build its packages. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: core/docz-rollup/package.json ================================================ { "name": "docz-rollup", "version": "2.4.0", "license": "MIT", "main": "src/index.js", "files": [ "src/", "package.json" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/docz-rollup" }, "scripts": { "fix": "yarn lint --fix", "lint": "eslint . --ext .js", "precommit": "lint-staged" }, "peerDependencies": { "typescript": "^3.5.0 || ^4.0.0" }, "dependencies": { "chalk": "^2.4.2", "figures": "3.0.0", "filesize": "^4.1.2", "fs-extra": "^8.1.0", "gzip-size": "^5.1.1", "lodash": "^4.17.14", "log-update": "^3.2.0", "rollup": "^1.17.0", "rollup-plugin-alias": "^1.5.2", "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.0.1", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-peer-deps-external": "^2.2.0", "rollup-plugin-postcss": "^2.0.3", "rollup-plugin-progress": "^1.1.2", "rollup-plugin-typescript2": "^0.22.0" } } ================================================ FILE: core/docz-rollup/src/index.js ================================================ const { omit } = require('lodash/fp') const autoprefixer = require('autoprefixer') const typescript = require('rollup-plugin-typescript2') const babel = require('rollup-plugin-babel') const json = require('rollup-plugin-json') const commonjs = require('rollup-plugin-commonjs') const nodeResolve = require('rollup-plugin-node-resolve') const alias = require('rollup-plugin-alias') const postcss = require('rollup-plugin-postcss') const progress = require('rollup-plugin-progress') const clean = require('./plugins/clean') const size = require('./plugins/size') const copy = require('./plugins/copy') const isDevMode = ['--watch', '-w'].some(devFlag => process.argv.includes(devFlag) ) const EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.es6', '.es', '.mjs'] const omitOpts = omit([ 'alias', 'external', 'output', 'plugins', 'runtimeHelpers', 'filename', ]) const defaultExternal = id => !id.startsWith('\0') && !id.startsWith('~') && !id.startsWith('.') && !id.startsWith(process.platform === 'win32' ? process.cwd() : '/') const createOutput = (dir = 'dist', defaultOpts) => { const opts = omitOpts(defaultOpts) const { alias: moduleAlias, external, output, plugins = [], runtimeHelpers, filename, } = defaultOpts const defaultPlugins = [ !isDevMode && clean(dir), postcss({ plugins: [autoprefixer()], inject: false, }), Object.keys(moduleAlias || {}).length > 0 && alias({ ...moduleAlias, resolve: EXTENSIONS, }), nodeResolve({ mainFields: ['module', 'main'], browser: true, }), commonjs({ include: /\/node_modules\//, }), json(), typescript({ typescript: require('typescript'), rollupCommonJSResolveHack: true, }), babel({ runtimeHelpers, extensions: EXTENSIONS, exclude: 'node_modules/**', }), size(dir), progress({ clearLine: false, }), ] const outputs = [ { dir, format: 'cjs', chunkFileNames: filename ? `${filename}.js` : `[name].js`, entryFileNames: filename ? `${filename}.js` : `[name].js`, ...output, }, { dir, format: 'esm', chunkFileNames: filename ? `${filename}.esm.js` : `[name].esm.js`, entryFileNames: filename ? `${filename}.esm.js` : `[name].esm.js`, ...output, }, ] return { ...opts, external: external || defaultExternal, plugins: defaultPlugins.filter(Boolean).concat(plugins), output: outputs, } } exports.copy = copy exports.config = opts => { const inputs = Array.isArray(opts) ? opts : [opts] return inputs.map(({ dest: dir, ...opts }) => createOutput(dir, opts)) } ================================================ FILE: core/docz-rollup/src/plugins/clean.js ================================================ const path = require('path') const fs = require('fs-extra') module.exports = dest => ({ name: 'clean', buildStart() { const cwd = process.cwd() const destDir = path.join(cwd, dest) fs.removeSync(destDir) }, }) ================================================ FILE: core/docz-rollup/src/plugins/copy.js ================================================ const path = require('path') const fs = require('fs-extra') module.exports = (source, dest) => ({ name: 'copy', generateBundle(opts, bundle, isWrite) { if (!isWrite) return const cwd = process.cwd() const destDir = path.join(cwd, dest) const sourceDir = path.join(cwd, source) fs.ensureDirSync(destDir) fs.copySync(sourceDir, destDir) }, }) ================================================ FILE: core/docz-rollup/src/plugins/size.js ================================================ const os = require('os') const fs = require('fs-extra') const path = require('path') const chalk = require('chalk') const figures = require('figures') const filesize = require('filesize') const gzip = require('gzip-size') const logUpdate = require('log-update') const label = `${chalk.cyan.bold(figures.arrowRight)}` const placeholder = text => chalk.gray(`${text}:`) const getFilesize = file => filesize(fs.statSync(file).size) const getGzipSize = file => filesize(gzip.sync(fs.readFileSync(file, 'utf-8'))) module.exports = dest => ({ name: 'size', generateBundle(opts, bundle, isWrite) { if (!isWrite) return const keys = Object.keys(bundle) const builds = keys.map(key => bundle[key]) builds.forEach((build, i) => { const filename = keys[i] const filepath = path.join(os.tmpdir(), filename) fs.outputFileSync(filepath, build.code) const size = `${placeholder('size')} ${getFilesize(filepath)}` const gzip = ` | ${placeholder('gzip')} ${getGzipSize(filepath)}` const sizes = chalk.gray.dim(`(${size}${gzip})`) const originalPath = path.join(dest, filename) const msg = `${label} ${chalk.cyan(originalPath)} ${sizes}` logUpdate(msg) logUpdate.done() fs.removeSync(filepath) }) }, }) ================================================ FILE: core/docz-utils/.babelrc ================================================ { "plugins": ["lodash"], "presets": [ "@babel/preset-typescript", [ "@babel/preset-env", { "targets": { "node": "current" } } ] ] } ================================================ FILE: core/docz-utils/.eslintignore ================================================ lib ================================================ FILE: core/docz-utils/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: core/docz-utils/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: core/docz-utils/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * **docz-utils:** fix closing tag detection in `removeTags` ([#1696](https://github.com/doczjs/docz/issues/1696)) ([bfcd923](https://github.com/doczjs/docz/commit/bfcd923)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package docz-utils # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) ### Features * **docz-utils:** add exports parser to add to Playground scope ([9c564d0](https://github.com/doczjs/docz/commit/9c564d0)), closes [#1247](https://github.com/doczjs/docz/issues/1247) # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) ### Features * **docz-utils:** export mergeWith and get from lodash@4 ([53fbde0](https://github.com/doczjs/docz/commit/53fbde0)), closes [#1313](https://github.com/doczjs/docz/issues/1313) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package docz-utils # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) ### Features * a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) * add new theme sidebar ([a01d100](https://github.com/pedronauck/docz/commit/a01d100)) * docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package docz-utils # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package docz-utils ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package docz-utils ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package docz-utils ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package docz-utils # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package docz-utils # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes * remove modularized lodash packages ([d81c568](https://github.com/pedronauck/docz/commit/d81c568)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package docz-utils # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * **docz-utils:** add docz imports on react live scope ([01004ed](https://github.com/pedronauck/docz/commit/01004ed)) * some general adjustments ([0c61f64](https://github.com/pedronauck/docz/commit/0c61f64)) * use lodash merge instead of deepmerge ([18ac37b](https://github.com/pedronauck/docz/commit/18ac37b)) * **docz-core:** apply mdast plugins to entries parse too ([c2554b8](https://github.com/pedronauck/docz/commit/c2554b8)) * **docz-utils:** extract headings from ast ([9f8565b](https://github.com/pedronauck/docz/commit/9f8565b)) * **docz-utils:** parser config for prettier ([54ad0fa](https://github.com/pedronauck/docz/commit/54ad0fa)) * trim whitespaces before and after class ([a184913](https://github.com/pedronauck/docz/commit/a184913)) * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) * docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) ## [0.13.6](https://github.com/pedronauck/docz/compare/v0.13.5...v0.13.6) (2018-12-26) **Note:** Version bump only for package docz-utils ## [0.13.5](https://github.com/pedronauck/docz/compare/v0.13.4...v0.13.5) (2018-12-19) ### Bug Fixes * **docz-core:** escape template string in playground ([#529](https://github.com/pedronauck/docz/issues/529)) ([5ab2349](https://github.com/pedronauck/docz/commit/5ab2349)) * **docz-utils:** add missing dependency for codesandbox ([3a51066](https://github.com/pedronauck/docz/commit/3a51066)) * **docz-utils:** escape code for playground ([3fc4187](https://github.com/pedronauck/docz/commit/3fc4187)) ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) **Note:** Version bump only for package docz-utils # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes * **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) **Note:** Version bump only for package docz-utils ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) **Note:** Version bump only for package docz-utils ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) **Note:** Version bump only for package docz-utils ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) **Note:** Version bump only for package docz-utils ## [0.12.12](https://github.com/pedronauck/docz/compare/v0.12.11...v0.12.12) (2018-11-16) ### Bug Fixes * **docz-utils:** add .scss to codesandbox assemble files ([59e8fa8](https://github.com/pedronauck/docz/commit/59e8fa8)) ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) ### Bug Fixes * **docz-utils:** resolve codesandbox code ([33dc6e5](https://github.com/pedronauck/docz/commit/33dc6e5)) ## [0.12.9](https://github.com/pedronauck/docz/compare/v0.12.8...v0.12.9) (2018-11-01) ### Bug Fixes * **docz-theme-default:** use class inside playground ([cecbea1](https://github.com/pedronauck/docz/commit/cecbea1)) ## [0.12.8](https://github.com/pedronauck/docz/compare/v0.12.7...v0.12.8) (2018-10-31) **Note:** Version bump only for package docz-utils ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) **Note:** Version bump only for package docz-utils ================================================ FILE: core/docz-utils/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/docz-utils/README.md ================================================ ## docz-utils This is an internal docz package containing utility functions used by multiple docz packages. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: core/docz-utils/__tests__/jsx.test.ts ================================================ import { removeTags } from '../src/jsx' describe('removeTags', () => { test('removes outer JSX tag', () => { expect( removeTags(`
Some text

Other text

`) ).toMatchInlineSnapshot(` "
Some text

Other text

" `) }) test('works when the closing tag is repeated in a comment', () => { expect( removeTags(` {/* */}
Some text
`) ).toMatchInlineSnapshot(` " {/*
*/}
Some text
" `) }) }) ================================================ FILE: core/docz-utils/package.json ================================================ { "name": "docz-utils", "version": "2.4.0", "description": "Some methods used and utilities used on docz", "license": "MIT", "main": "lib/index.js", "module": "lib/index.esm.js", "typings": "lib/index.d.ts", "files": [ "lib/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/docz-utils" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "trash lib && cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged", "test": "yarn jest" }, "dependencies": { "@babel/generator": "^7.16.8", "@babel/parser": "^7.16.12", "@babel/traverse": "^7.16.10", "art-template": "^4.13.2", "fs-extra": "^8.1.0", "humanize-string": "^2.1.0", "js-string-escape": "^1.0.1", "jsx-ast-utils": "^2.2.1", "lodash": "^4.17.14", "prettier": "^1.18.2", "remark-frontmatter": "^1.3.2", "remark-parse": "^6.0.2", "remark-parse-yaml": "^0.0.2", "remark-slug": "^5.1.2", "signale": "^1.4.0", "strip-indent": "^3.0.0", "to-vfile": "^6.0.0", "unescape-js": "^1.1.1", "unified": "^8.3.2", "unist-util-find": "^1.0.1", "unist-util-is": "^3.0.0", "unist-util-visit": "^1.4.1" } } ================================================ FILE: core/docz-utils/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: [ './src/ast.ts', './src/format.ts', './src/fs.ts', './src/index.ts', './src/imports.ts', './src/jsx.ts', './src/mdast.ts', './src/exports.ts', ], output: { dir: 'lib', }, }) ================================================ FILE: core/docz-utils/src/ast.ts ================================================ import * as parser from '@babel/parser' import traverse from '@babel/traverse' type Condition = (path: any) => boolean type Predicate = (path: any) => Value export const valueFromTraverse = ( condition: Condition, predicate: Predicate = p => p ) => (code: string): Value | '' => { let value: Value | '' = '' const ast = parser.parse(code, { plugins: ['jsx'] }) traverse(ast, { enter(path: any): void { if (condition(path)) { value = predicate(path) path.stop() return } }, }) return value } export const codeFromNode = (condition: Condition) => (code: string) => valueFromTraverse(condition, p => code.slice(p.node.start, p.node.end))(code) ================================================ FILE: core/docz-utils/src/exports.ts ================================================ import * as parser from '@babel/parser' import traverse from '@babel/traverse' import get from 'lodash/get' const fromDeclarations = (declarations: any = []) => Array.isArray(declarations) && declarations.length > 0 ? declarations.map(declaration => get(declaration, 'id.name')) : [] const traverseOnExports = (fn: (path: any) => any[]) => (node: any) => { try { const ast = parser.parse(node.value, { sourceType: 'module', }) let populated: any[] = [] traverse(ast, { enter(path: any): void { if (path.isExportDeclaration()) { populated = populated.concat(fn(path)) return } }, }) return populated } catch (err) { return [] } } export const getExportsVariables = traverseOnExports(path => { const type = get(path, 'node.declaration.type') switch (type) { case 'VariableDeclaration': return fromDeclarations(get(path, 'node.declaration.declarations', [])) case 'FunctionDeclaration': const declaration = get(path, 'node.declaration', false) return fromDeclarations(declaration ? [declaration] : []) case 'Identifier': return get(path, 'node.declaration.name') default: console.error(`Unexpected export type ${type} in docz-utils/exports`) } }) ================================================ FILE: core/docz-utils/src/format.ts ================================================ import * as prettier from 'prettier' import logger from 'signale' export const formatter = (code: string) => prettier.format(code, { parser: 'babel', semi: false, singleQuote: true, trailingComma: 'all', } as any) export const format = (code: string): Promise => new Promise(resolve => { try { const result = formatter(code) resolve(result) } catch (err) { logger.fatal(err) resolve(code) } }) ================================================ FILE: core/docz-utils/src/fs.ts ================================================ import * as path from 'path' import * as fs from 'fs-extra' import { compile } from 'art-template' import { format } from './format' export const touch = (file: string, raw: string) => new Promise(async (resolve, reject) => { const content = /jsx?$/.test(path.extname(file)) ? await format(raw) : raw const stream = fs.createWriteStream(file) stream.write(content, 'utf-8') stream.on('finish', () => resolve()) stream.on('error', err => reject(err)) stream.end() }) export const compiled = (file: string, opts: Record = {}) => { const raw = fs.readFileSync(file, { encoding: 'utf-8' }) return compile(raw, opts) } ================================================ FILE: core/docz-utils/src/imports.ts ================================================ import * as parser from '@babel/parser' import * as generator from '@babel/generator' import traverse from '@babel/traverse' import get from 'lodash/get' const fromSpecifiers = (specifiers: any = []) => Array.isArray(specifiers) && specifiers.length > 0 ? specifiers.map(specifier => get(specifier, 'local.name')) : [] const traverseOnImports = (fn: (path: any) => any[]) => (node: any) => { try { const ast = parser.parse(node.value, { sourceType: 'module' }) let populated: any[] = [] traverse(ast, { enter(path: any): void { if (path.isImportDeclaration()) { populated = populated.concat(fn(path)) return } }, }) return populated } catch (err) { return [] } } export const getFullImports = traverseOnImports((path: any) => [ get(generator.default(path.node), 'code'), ]) export const getImportsVariables = traverseOnImports((path: any) => fromSpecifiers(path.node.specifiers) ) ================================================ FILE: core/docz-utils/src/index.ts ================================================ export * from './ast' export * from './fs' export * from './imports' export * from './exports' export * from './jsx' export * from './mdast' export { format } from './format' export { mergeWith } from 'lodash/fp' export { get } from 'lodash' ================================================ FILE: core/docz-utils/src/jsx.ts ================================================ import * as jsxUtils from 'jsx-ast-utils' import strip from 'strip-indent' import escapeJS from 'js-string-escape' import { valueFromTraverse } from './ast' export const propFromElement = (prop: string) => valueFromTraverse( p => p.isJSXOpeningElement(), p => jsxUtils.getPropValue(jsxUtils.getProp(p.node.attributes, prop)) ) const getTagContentsRange = valueFromTraverse<[number, number] | null>( p => p.isJSXElement(), ({ node }) => { if (!node.closingElement) { // if the JSX element doesn't have a closingElement, it's because it's self-closed // and thus does not have any content: return null } return [node.openingElement.end, node.closingElement.start] } ) export const removeTags = (code: string) => { const [start, end] = getTagContentsRange(code) || [0, 0] return code.slice(start, end) } export const sanitizeCode = (code: string) => { const trimmed = strip(code).trim() const newCode = trimmed.startsWith('{') && trimmed.endsWith('}') ? trimmed.substr(1, trimmed.length - 2).trim() : trimmed return escapeJS(strip(newCode)) } export const componentName = (value: any) => { const match = value.match(/^\<\\?(\w+)/) return match && match[1] } ================================================ FILE: core/docz-utils/src/mdast.ts ================================================ import vfile from 'to-vfile' import unified from 'unified' import remark from 'remark-parse' import matter from 'remark-frontmatter' import slug from 'remark-slug' import parseFrontmatter from 'remark-parse-yaml' import find from 'unist-util-find' import visit from 'unist-util-visit' import humanize from 'humanize-string' import flatten from 'lodash/flatten' import get from 'lodash/get' export const parseMdx = (file: string, plugins: any[]): Promise => { const raw = vfile.readSync(file, 'utf-8') const parser = unified() .use(remark, { type: 'yaml', marker: '-' }) .use(matter) .use(parseFrontmatter) .use(slug) for (const plugin of plugins) { const [item, opts = {}] = Array.isArray(plugin) ? plugin : [plugin] parser.use(item, opts) } return parser.run(parser.parse(raw)) } const getChildValue = (children: any) => children.map((child: any) => child.children ? getChildValue(child.children) : child.value ) const valueFromHeading = (node: any) => { const children = get(node, 'children') const slug = get(node, 'data.id') if (Array.isArray(children)) { return flatten(getChildValue(children)) .filter(Boolean) .join(' ') } return humanize(slug) } function extractAst( callback: (node: any) => T, type: string ): (ast: any) => T[] { return ast => { const results: T[] = [] visit(ast, type, (node: any) => { results.push(callback(node)) }) return results } } export interface Heading { depth: number slug: string value: string } export const headingsFromAst = extractAst( (node: any) => ({ slug: get(node, 'data.id'), depth: get(node, 'depth'), value: valueFromHeading(node), }), 'heading' ) export interface ParsedData { [key: string]: any } export const getParsedData = (ast: any): ParsedData => { const node = find(ast, { type: 'yaml' }) return get(node, `data.parsedValue`) || {} } ================================================ FILE: core/docz-utils/src/types.d.ts ================================================ declare module 'to-vfile' declare module 'unified' declare module 'remark-parse' declare module 'remark-frontmatter' declare module 'remark-slug' declare module 'remark-parse-yaml' declare module 'humanize-string' declare module 'signale' declare module '@babel/parser' declare module '@babel/traverse' declare module '@babel/generator' declare module 'jsx-ast-utils' declare module 'strip-indent' declare module 'unist-util-visit' declare module 'unist-util-find' declare module 'unescape-js' declare module 'js-string-escape' ================================================ FILE: core/docz-utils/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "lib", "rootDir": "src", "declaration": true, "types": ["node"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: core/gatsby-theme-docz/.eslintrc.js ================================================ module.exports = { extends: 'docz-js', } ================================================ FILE: core/gatsby-theme-docz/.gitignore ================================================ # gatsby files .cache/ public ================================================ FILE: core/gatsby-theme-docz/.lintstagedrc ================================================ { "*.{js,jsx}": ["git add"] } ================================================ FILE: core/gatsby-theme-docz/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * **gatsby-theme-docz:** wrong imports ([ed169cf](https://github.com/doczjs/docz/commit/ed169cf)) ### Features * **gatsby-theme-docz:** configure SEO information from md/mdx files ([#1477](https://github.com/doczjs/docz/issues/1477)) ([24bb600](https://github.com/doczjs/docz/commit/24bb600)) * **gatsby-theme-docz:** no reload on relative links ([#1482](https://github.com/doczjs/docz/issues/1482)) ([ff7211c](https://github.com/doczjs/docz/commit/ff7211c)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * **gatsby-theme-docz:** wrong imports ([ed169cf](https://github.com/doczjs/docz/commit/ed169cf)) ### Features * **gatsby-theme-docz:** configure SEO information from md/mdx files ([#1477](https://github.com/doczjs/docz/issues/1477)) ([24bb600](https://github.com/doczjs/docz/commit/24bb600)) * **gatsby-theme-docz:** no reload on relative links ([#1482](https://github.com/doczjs/docz/issues/1482)) ([ff7211c](https://github.com/doczjs/docz/commit/ff7211c)) ## [2.3.1](https://github.com/doczjs/docz/compare/v2.3.1-alpha.0...v2.3.1) (2020-04-05) **Note:** Version bump only for package gatsby-theme-docz ## [2.3.1-alpha.0](https://github.com/doczjs/docz/compare/v2.3.0...v2.3.1-alpha.0) (2020-04-05) ### Bug Fixes * **gatsby-theme-docz:** fix theme components customization bug ([a9384b0](https://github.com/doczjs/docz/commit/a9384b0)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package gatsby-theme-docz # [2.3.0-alpha.14](https://github.com/doczjs/docz/compare/v2.3.0-alpha.13...v2.3.0-alpha.14) (2020-03-31) ### Bug Fixes * **gatsby-theme-docz:** add pre-wrap to error ([#1406](https://github.com/doczjs/docz/issues/1406)) ([ca6b02d](https://github.com/doczjs/docz/commit/ca6b02d)) * **gatsby-theme-docz:** content overflowing issue ([#1437](https://github.com/doczjs/docz/issues/1437)) ([56f4cb8](https://github.com/doczjs/docz/commit/56f4cb8)) ### Features * **gatsby-theme-docz:** include MDX transclusion support ([#1436](https://github.com/doczjs/docz/issues/1436)) ([435001a](https://github.com/doczjs/docz/commit/435001a)) # [2.3.0-alpha.13](https://github.com/doczjs/docz/compare/v2.3.0-alpha.12...v2.3.0-alpha.13) (2020-02-13) ### Bug Fixes * **gatsby-theme-docz:** flex component aligmItems -> alignItems ([#1391](https://github.com/doczjs/docz/issues/1391)) ([b80524f](https://github.com/doczjs/docz/commit/b80524f)) # [2.3.0-alpha.12](https://github.com/doczjs/docz/compare/v2.3.0-alpha.11...v2.3.0-alpha.12) (2020-02-12) ### Bug Fixes * **gatsby-theme-docz:** use sx instead of style prop in Playgro… ([#1389](https://github.com/doczjs/docz/issues/1389)) ([98f3311](https://github.com/doczjs/docz/commit/98f3311)) # [2.3.0-alpha.11](https://github.com/doczjs/docz/compare/v2.3.0-alpha.10...v2.3.0-alpha.11) (2020-02-07) ### Features * **gatsby-theme-docz:** create MainContainer component ([#1381](https://github.com/doczjs/docz/issues/1381)) ([e8d1c04](https://github.com/doczjs/docz/commit/e8d1c04)) # [2.3.0-alpha.8](https://github.com/doczjs/docz/compare/v2.3.0-alpha.7...v2.3.0-alpha.8) (2020-02-06) **Note:** Version bump only for package gatsby-theme-docz # [2.3.0-alpha.7](https://github.com/doczjs/docz/compare/v2.3.0-alpha.6...v2.3.0-alpha.7) (2020-02-04) ### Bug Fixes * **gatsby-theme-docz:** fix playground react-resize-detector usage ([#1350](https://github.com/doczjs/docz/issues/1350)) ([f0baf67](https://github.com/doczjs/docz/commit/f0baf67)) * **gatsby-theme-docz:** removed unused gatsby-plugin-manifest ([#1368](https://github.com/doczjs/docz/issues/1368)) ([44edc68](https://github.com/doczjs/docz/commit/44edc68)) ### Features * add the ability to hide a document from the menu ([#1354](https://github.com/doczjs/docz/issues/1354)) ([95b0d7f](https://github.com/doczjs/docz/commit/95b0d7f)) # [2.3.0-alpha.5](https://github.com/doczjs/docz/compare/v2.3.0-alpha.4...v2.3.0-alpha.5) (2019-12-17) ### Bug Fixes * **gatsby-theme-docz:** src -> gatsbyRoot for file system source ([71dd572](https://github.com/doczjs/docz/commit/71dd572)) # [2.3.0-alpha.4](https://github.com/doczjs/docz/compare/v2.3.0-alpha.3...v2.3.0-alpha.4) (2019-12-16) ### Bug Fixes * **gatsby-theme-docz:** make Props isToggle work again ([#1326](https://github.com/doczjs/docz/issues/1326)) ([4921ef5](https://github.com/doczjs/docz/commit/4921ef5)) * update dev-env dependencies ([e1b185f](https://github.com/doczjs/docz/commit/e1b185f)) # [2.3.0-alpha.3](https://github.com/doczjs/docz/compare/v2.3.0-alpha.2...v2.3.0-alpha.3) (2019-12-16) ### Bug Fixes * **gatsby-theme-docz:** fix preview padding ([ebebd1c](https://github.com/doczjs/docz/commit/ebebd1c)), closes [#1325](https://github.com/doczjs/docz/issues/1325) # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) **Note:** Version bump only for package gatsby-theme-docz # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) **Note:** Version bump only for package gatsby-theme-docz ## [2.2.1-alpha.0](https://github.com/doczjs/docz/compare/v2.2.0...v2.2.1-alpha.0) (2019-12-11) ### Bug Fixes * **gatsby-theme-docz:** fix mdx components theming from config ([3a9bdb7](https://github.com/doczjs/docz/commit/3a9bdb7)), closes [#1309](https://github.com/doczjs/docz/issues/1309) # [2.2.0](https://github.com/doczjs/docz/compare/v2.2.0-alpha.8...v2.2.0) (2019-12-11) **Note:** Version bump only for package gatsby-theme-docz # [2.2.0-alpha.8](https://github.com/doczjs/docz/compare/v2.2.0-alpha.7...v2.2.0-alpha.8) (2019-12-06) ### Features * **gatsby-theme-docz:** add optional iframe for preview and ed… ([#1305](https://github.com/doczjs/docz/issues/1305)) ([9c5082e](https://github.com/doczjs/docz/commit/9c5082e)), closes [#1306](https://github.com/doczjs/docz/issues/1306) # [2.2.0-alpha.7](https://github.com/doczjs/docz/compare/v2.2.0-alpha.6...v2.2.0-alpha.7) (2019-12-03) ### Bug Fixes * **gatsby-theme-docz:** fix infinite renders in playground on hot reload ([3451fd1](https://github.com/doczjs/docz/commit/3451fd1)), closes [#1299](https://github.com/doczjs/docz/issues/1299) # [2.2.0-alpha.6](https://github.com/doczjs/docz/compare/v2.2.0-alpha.5...v2.2.0-alpha.6) (2019-12-03) ### Bug Fixes * **gatsby-theme-docz:** fix horizontal code overflow ([a0b7823](https://github.com/doczjs/docz/commit/a0b7823)) # [2.2.0-alpha.5](https://github.com/doczjs/docz/compare/v2.2.0-alpha.4...v2.2.0-alpha.5) (2019-12-01) ### Bug Fixes * **gatsby-theme-docz:** fix tsx parsing in code blocks ([b321ff8](https://github.com/doczjs/docz/commit/b321ff8)) # [2.2.0-alpha.4](https://github.com/doczjs/docz/compare/v2.2.0-alpha.3...v2.2.0-alpha.4) (2019-11-30) ### Features * **gatsby-theme-docz:** add showMarkdownEditButton flag ([8fd04e8](https://github.com/doczjs/docz/commit/8fd04e8)), closes [#1291](https://github.com/doczjs/docz/issues/1291) # [2.2.0-alpha.1](https://github.com/doczjs/docz/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2019-11-28) ### Bug Fixes * **gatsby-theme-docz:** remove typo from the theme styles ([a25da88](https://github.com/doczjs/docz/commit/a25da88)) # [2.2.0-alpha.0](https://github.com/doczjs/docz/compare/v2.1.1...v2.2.0-alpha.0) (2019-11-28) ### Bug Fixes * **gatsby-theme-docz:** set gatsby root from doczrc src ([e6b1521](https://github.com/doczjs/docz/commit/e6b1521)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) ### Bug Fixes * **gatsby-theme-docz:** allow empty ts prop defaultValue ([2512aa1](https://github.com/doczjs/docz/commit/2512aa1)) * **gatsby-theme-docz:** fix min-height ([34fc31f](https://github.com/doczjs/docz/commit/34fc31f)) ### Features * **gatsby-theme-docz:** use mdxExtensions from config ([7d405c5](https://github.com/doczjs/docz/commit/7d405c5)) ### Bug Fixes ### Bug Fixes * **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) * **gatsby-theme-docz:** expose gatsby actions to plugin ([019eb9b](https://github.com/pedronauck/docz/commit/019eb9b)) * **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) * **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) # [2.0.0-rc.33](https://github.com/pedronauck/docz/compare/v2.0.0-rc.32...v2.0.0-rc.33) (2019-09-04) **Note:** Version bump only for package gatsby-theme-docz # [2.0.0-rc.32](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.32) (2019-09-04) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** expose gatsby actions to plugin ([66546a4](https://github.com/pedronauck/docz/commit/66546a4)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) # [2.0.0-rc.31](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.31) (2019-09-03) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) <<<<<<< HEAD # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-02) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) ======= # [2.0.0-rc.29](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.29) (2019-09-03) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) # [2.0.0-rc.28](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.28) (2019-09-03) > > > > > > > v2.0.0-rc.29 ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([9cb5237](https://github.com/pedronauck/docz/commit/9cb5237)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) # [2.0.0-rc.27](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.27) (2019-09-02) ### Bug Fixes - **docz-core:** use react from parent directory ([#1053](https://github.com/pedronauck/docz/issues/1053)) ([b55b786](https://github.com/pedronauck/docz/commit/b55b786)) - **gatsby-theme-docz:** fix style differences between dev and build ([45b7767](https://github.com/pedronauck/docz/commit/45b7767)) - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([4214180](https://github.com/pedronauck/docz/commit/4214180)) # [2.0.0-rc.9](https://github.com/pedronauck/docz/compare/v2.0.0-rc.7...v2.0.0-rc.9) (2019-08-30) **Note:** Version bump only for package gatsby-theme-docz # [2.0.0-rc.6](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.6) (2019-08-29) ### Bug Fixes - **gatsby-theme-docz:** replace iframe in playground with div [#984](https://github.com/pedronauck/docz/issues/984) [#1035](https://github.com/pedronauck/docz/issues/1035) ([cf9ea90](https://github.com/pedronauck/docz/commit/cf9ea90)) # [2.0.0-rc.2](https://github.com/pedronauck/docz/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-08-28) ### Bug Fixes - **gatsby-theme-docz:** add missing source sans pro font ([#991](https://github.com/pedronauck/docz/issues/991)) ([51240df](https://github.com/pedronauck/docz/commit/51240df)) - **gatsby-theme-docz:** replace fragment tag to the short syntax ([#992](https://github.com/pedronauck/docz/issues/992)) ([044f351](https://github.com/pedronauck/docz/commit/044f351)) # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes - bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) - resizable props import ([2926896](https://github.com/pedronauck/docz/commit/2926896)) - **gatsby-theme-docz:** resizable import ([3916265](https://github.com/pedronauck/docz/commit/3916265)) - on create webpack plugin hook ([56e974a](https://github.com/pedronauck/docz/commit/56e974a)) - remove react & react-dom from dependencies [#924](https://github.com/pedronauck/docz/issues/924) ([faf4288](https://github.com/pedronauck/docz/commit/faf4288)) - some typescript adjustments ([4ba6eaf](https://github.com/pedronauck/docz/commit/4ba6eaf)) - **gatsby-theme-docz:** prisms theme by themeConfig ([c0b5c34](https://github.com/pedronauck/docz/commit/c0b5c34)) - eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) - **gatsby-theme-docz:** entry not in context ([e582221](https://github.com/pedronauck/docz/commit/e582221)) ### Features - **gatsby-theme-docz:** add blockquote styles ([b9f11a1](https://github.com/pedronauck/docz/commit/b9f11a1)) - **gatsby-theme-docz:** add custom logo support ([dec4b2b](https://github.com/pedronauck/docz/commit/dec4b2b)) - **gatsby-theme-docz:** add iframe and re-resizable on playground ([6922717](https://github.com/pedronauck/docz/commit/6922717)) - **gatsby-theme-docz:** add new Pre component ([a6be6a1](https://github.com/pedronauck/docz/commit/a6be6a1)) - **gatsby-theme-docz:** add new Props component ([8eb780d](https://github.com/pedronauck/docz/commit/8eb780d)) - **gatsby-theme-docz:** add showLiveError on Playground ([e593897](https://github.com/pedronauck/docz/commit/e593897)) - **gatsby-theme-docz:** add some improvements ([03d9fec](https://github.com/pedronauck/docz/commit/03d9fec)) - **gatsby-theme-docz:** improve code highlight ([d265444](https://github.com/pedronauck/docz/commit/d265444)) - **gatsby-theme-docz:** improve documentation ([80b35f8](https://github.com/pedronauck/docz/commit/80b35f8)) - a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) - adapt core plugins to gatsby hooks ([4caa47a](https://github.com/pedronauck/docz/commit/4caa47a)) - add main package improvements ([8c8005d](https://github.com/pedronauck/docz/commit/8c8005d)) - add markdown parsing on props description ([1087539](https://github.com/pedronauck/docz/commit/1087539)) - add new Playground component ([7bf03b2](https://github.com/pedronauck/docz/commit/7bf03b2)) - add new theme sidebar ([a01d100](https://github.com/pedronauck/docz/commit/a01d100)) - add typescript support (need fix) ([13947f9](https://github.com/pedronauck/docz/commit/13947f9)) - docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) - dynamic src and root path ([c071556](https://github.com/pedronauck/docz/commit/c071556)) - some playground improvements ([afa00df](https://github.com/pedronauck/docz/commit/afa00df)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package gatsby-theme-docz # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) ### Bug Fixes - **docz-core:** prevent watch in production ([d673262](https://github.com/pedronauck/docz/commit/d673262)) ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package gatsby-theme-docz ## [1.0.3](https://github.com/pedronauck/docz/compare/v1.0.2...v1.0.3) (2019-04-15) **Note:** Version bump only for package gatsby-theme-docz ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package gatsby-theme-docz ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package gatsby-theme-docz # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) ### Bug Fixes - **docz:** crash using suspense ([315f7ad](https://github.com/pedronauck/docz/commit/315f7ad)) # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) **Note:** Version bump only for package gatsby-theme-docz # [1.0.0-rc.3](https://github.com/pedronauck/docz/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2019-03-21) ### Bug Fixes - **gatsby-theme-docz:** menu field on entry source node ([05457f2](https://github.com/pedronauck/docz/commit/05457f2)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package gatsby-theme-docz # [1.0.0-alpha.1](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2019-03-19) ### Bug Fixes - bump internal versions ([1658aaf](https://github.com/pedronauck/docz/commit/1658aaf)) # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes - **gatsby-theme-docz:** add null fields for entries ([b0409a8](https://github.com/pedronauck/docz/commit/b0409a8)) - **gatsby-theme-docz:** add specific nodes for entries ([26f7f90](https://github.com/pedronauck/docz/commit/26f7f90)) - **gatsby-theme-docz:** add ssr support for styled-components ([b490010](https://github.com/pedronauck/docz/commit/b490010)) - **gatsby-theme-docz:** check data before access ([8f8ed12](https://github.com/pedronauck/docz/commit/8f8ed12)) - **gatsby-theme-docz:** check entries before find on it ([8565128](https://github.com/pedronauck/docz/commit/8565128)) - **gatsby-theme-docz:** create pages hook ([2f5765e](https://github.com/pedronauck/docz/commit/2f5765e)) - **gatsby-theme-docz:** hot reload ([bf4e440](https://github.com/pedronauck/docz/commit/bf4e440)) - **gatsby-theme-docz:** readme typo ([9e3314a](https://github.com/pedronauck/docz/commit/9e3314a)) - **gatsby-theme-docz:** throws false for json stringify ([289ca75](https://github.com/pedronauck/docz/commit/289ca75)) - define right internal dependencies version ([30a91b4](https://github.com/pedronauck/docz/commit/30a91b4)) - gatsby theme fixes ([dcc5f19](https://github.com/pedronauck/docz/commit/dcc5f19)) - **gatsby-theme-docz:** use options from gatsby-config ([#665](https://github.com/pedronauck/docz/issues/665)) ([c694bdf](https://github.com/pedronauck/docz/commit/c694bdf)) - some general adjustments ([0c61f64](https://github.com/pedronauck/docz/commit/0c61f64)) - **gatsby-theme-docz:** use createPages instead of createPagesStatefully ([37b73c6](https://github.com/pedronauck/docz/commit/37b73c6)) ### Features - **gatsby-theme-docz:** add custom theme support ([fdfddcb](https://github.com/pedronauck/docz/commit/fdfddcb)) - **gatsby-theme-docz:** add wrapper support ([a99d62f](https://github.com/pedronauck/docz/commit/a99d62f)) - add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) - add playground component ([cde6511](https://github.com/pedronauck/docz/commit/cde6511)) ================================================ FILE: core/gatsby-theme-docz/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/gatsby-theme-docz/README.md ================================================ # gatsby-theme-docz ![](https://cdn-std.dprcdn.net/files/acc_649651/opUCiu) The official Gatsby theme for Docz. ## Installation ```sh yarn add gatsby gatsby-theme-docz react react-dom ``` ## Usage ```js // gatsby-config.js module.exports = { plugins: ['gatsby-theme-docz'], } ``` ### Configuration Set your config by using `doczrc.js` file ([see all available](https://www.docz.site/docs/project-configuration)) or if you want to set some defaults for your theme, use `options` on plugin definition: ```js // gatsby-config.js module.exports = { plugins: [ { resolve: 'gatsby-theme-docz', options: { /* your custom options */ }, }, ], } ``` ### Dark Mode To set the dark version as default, just set your `doczrc.js` like that: ```js // doczrc.js export default { themeConfig: { mode: 'dark', }, } ``` ### Customizing components Components shadowing is one of the best things included in the new Gatsby theme feature, with it is possible to replace theme files just by creating your own file following a file naming convention. Example: If you're using our `gatsby-theme-docz` which has a `Header` component located at `src/components/Header/index.js` you can override the component by creating `src/gatsby-theme-docz/components/Header/index.js`. Cool right? ### Adding your logo So, now that you know about how component shadowing works on Gatsby themes, if you don't want to override the entire `
` component but just change your logo inside it, your can shadow the `` component used in the header just by creating your own at `src/gatsby-theme-docz/components/Logo/index.js` ```js // src/gatsby-theme-docz/components/Logo/index.js import React from 'react' import logo from './logo.svg' export const Logo = () => That's my logo ``` Easy, right? ### Creating your own Docz theme One of the coolest thing of Docz is that you can create your own theme if you want from scratch and use all benefits of it. The oldest way to acomplish that is by using the `theme` property inside the `doczrc.js` file. Now, if you want to create your own theme, just create a file located at `src/gatsby-theme-docz/index.js` ```js import React from 'react' import { theme, useConfig, ComponentsProvider } from 'docz' import { ThemeProvider } from '@emotion/react' import baseComponents from 'gatsby-theme-docz/src/components' import { Menu } from './MyBeautifulMenu' const componentsMap = { ...baseComponents, /* your custom components */, } const Theme = ({ children }) => { const config = useConfig() return ( {children} ) } const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` ### Wrapping the entire app Sometime you need to wrap your entire application in order to add some `Provider` or just to load some script. You can do this easily inside our theme by creating a file located at `src/gatsby-theme-docz/wrapper.js` ```js // src/gatsby-theme-docz/index.js import React from 'react' export default ({ children }) => (

My custom wrapper

{children}
) ``` ## Theme UI integrated As default theme system we are using the [Theme-UI](https://theme-ui.com/), it's a library for build consistent, themeable React apps based on constraint-based design principles. You can modify our based theme creating your own style, combining these modifications with the component shadowing and creating a totally different documentation. Check our [base theme object](https://github.com/pedronauck/docz/blob/feat/gatsby/core/gatsby-theme-docz/src/theme/index.js) to see the properties. To create your own theme definition use the `doczrc.js` and set your properties in the `themeConfig` like that: ```js // doczrc.js export default { themeConfig: { colors: { header: { bg: 'tomato', }, }, }, } ``` Or, to create your own theme it's easy, just create this file in the root of your project: `src/gatsby-theme-docz/theme/index.js`. ```js import baseTheme from 'gatsby-theme-docz/src/theme' import { merge } from 'lodash/fp' export default merge(baseTheme, { colors: { header: { bg: 'tomato', }, }, }) ``` ### Changing code highlight Both code highlights shortcodes and the `` component are using [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) to highlight the code. If you want to modify and use another PrismJS theme, you can do that just passing a `prismTheme` property for your theme. ```js // doczrc.js import myCustomPrismTheme from './my-prism-theme' export default { themeConfig: { prismTheme: myCustomPrismTheme, }, } ``` Or you want to have different themes for `light` and `dark` color mode, you can change the `prism` default property like that: ```js // doczrc.js import customLightTheme from './my-light-theme' import customDarkTheme from './my-dark-theme' export default { themeConfig: { prism: { light: customLightTheme, dark: customDarkTheme, }, }, } ``` ### Adding component shortcodes You can add shortcodes to your docs site which can be used throughout your docs pages by extending the components passed to MDXProvider. You can do this by using component shadowing and creating the following file in the root of your project: `src/gatsby-theme-docz/components/index.js`. #### Example `components.js` ```js import baseComponents from 'gatsby-theme-documentation/src/components' import MyCustomH1 from '../components/my-custom-h1' export default { ...baseComponents, h1: MyCustomH1, } ``` ## Getting data Using our Gatsby Theme you can enjoy all our hooks to get data for your pages and also get data from Gatsby. So, you can create isolated pages on Gatsby using gatsby pages and get data from Docz or maybe pass data for your Docz documents using source from gatsby. Imagine, that you have your home page inside `/pages` and you want to show all documents parsed from Docz. You can easy get this by doing: ```js import React from 'react' import { useDocs } from 'docz' const Home = () => { const docs = useDocs() return
{/* my coolest home */}
} export default Home ``` Or you can have a mdx document inside Docz that has data from Gatsby too: ```markdown --- name: MyDoc --- import { MyComponentWithSomeData } from './my-component-with-data' ``` Cool right? ================================================ FILE: core/gatsby-theme-docz/gatsby-browser.js ================================================ import './src/index.css' ================================================ FILE: core/gatsby-theme-docz/gatsby-config.js ================================================ const path = require('path') const { getDoczConfig } = require('./lib/utils/parseConfig') const getRemarkPlugins = () => { let plugins = [] try { plugins = [ [require('remark-frontmatter'), { type: 'yaml', marker: '-' }], require('remark-docz'), ] } catch (err) { plugins = [] } return plugins } const getRehypePlugins = () => { let plugins = [] try { plugins = [require('rehype-docz'), require('rehype-slug')] } catch (err) { plugins = [] } return plugins } const getGatsbyRemarkPlugins = () => { return [] } module.exports = opts => { const config = getDoczConfig(opts) const mdPlugins = getRemarkPlugins() const hastPlugins = getRehypePlugins() const gatsbyRemarkPlugins = getGatsbyRemarkPlugins() return { plugins: [ { resolve: `gatsby-source-filesystem`, options: { ignore: [ `${config.paths.docz}/**/*`, `${config.paths.root}/.git/**/*`, // gatsby cache `${config.paths.root}/.cache/**/*`, // static assets with gatsby site setup `${config.paths.root}/public/**/*`, // ignore node_modules unless user explicitly asks for them to be included config.src.indexOf('node_modules') === -1 ? `${config.paths.root}/node_modules/**/*` : `${config.paths.root}/node_modules/.cache/**/*`, ], path: path.resolve( config.paths.root, config.gatsbyRoot !== null ? config.gatsbyRoot : config.src ), }, }, { resolve: 'gatsby-plugin-mdx', options: { extensions: config.mdxExtensions, remarkPlugins: config && config.mdPlugins ? config.mdPlugins.concat(mdPlugins) : mdPlugins, rehypePlugins: config && config.hastPlugins ? config.hastPlugins.concat(hastPlugins) : hastPlugins, gatsbyRemarkPlugins: config && config.gatsbyRemarkPlugins ? config.gatsbyRemarkPlugins.concat(gatsbyRemarkPlugins) : gatsbyRemarkPlugins, defaultLayouts: { default: path.join(__dirname, 'src/base/Layout.js'), }, }, }, { resolve: 'gatsby-plugin-catch-links', }, { resolve: 'gatsby-plugin-react-helmet-async', }, { resolve: 'gatsby-plugin-root-import', }, { resolve: 'gatsby-plugin-emotion', }, { resolve: 'gatsby-plugin-alias-imports', options: { alias: { '~components': path.resolve(__dirname, 'src/components'), '~styles': path.resolve(__dirname, 'src/styles'), '~theme': path.resolve(__dirname, 'src/theme'), '~utils': path.resolve(__dirname, 'src/utils'), }, }, }, { resolve: 'gatsby-plugin-compile-es6-packages', options: { modules: ['docz', 'docz-core', 'gatsby-theme-docz'], }, }, ], } } ================================================ FILE: core/gatsby-theme-docz/gatsby-node.js ================================================ exports.createPagesStatefully = require('./lib/createPagesStatefully') exports.onCreateBabelConfig = require('./lib/onCreateBabelConfig') exports.onCreateDevServer = require('./lib/onCreateDevServer') exports.onCreateWebpackConfig = require('./lib/onCreateWebpackConfig') exports.onPreBuild = require('./lib/sourceNodes') exports.onPostBuild = require('./lib/sourceNodes') exports.sourceNodes = require('./lib/sourceNodes') ================================================ FILE: core/gatsby-theme-docz/gatsby-ssr.js ================================================ import './src/index.css' ================================================ FILE: core/gatsby-theme-docz/index.js ================================================ // noop ================================================ FILE: core/gatsby-theme-docz/lib/createPagesStatefully.js ================================================ const { get } = require('lodash/fp') const { parseConfig } = require('docz-core') const ENTRIES_QUERY = ` { allDoczEntries{ edges{ node{ id filepath fullpath route slug name menu headings { slug depth value } } } } } ` module.exports = async ({ graphql, actions }, opts = {}) => { return graphql(ENTRIES_QUERY).then(async ({ data, errors }) => { const hasErrors = errors && errors.length > 0 const entries = get('allDoczEntries.edges', data) if (!entries || entries.length === 0 || hasErrors) return const defaultEntry = entries.find(({ node: entry }) => entry.route === '/') if (defaultEntry === undefined) { const config = await parseConfig(opts) // Create a default entry unless specifically denied by config const shouldNotCreateRootRoute = Boolean(config.noRootRoute) if (shouldNotCreateRootRoute === false) { // Set the first found entry as the default entry const createdDefaultEntry = { node: { ...entries[0].node, route: '/', }, } entries.unshift(createdDefaultEntry) } } entries.forEach(({ node: entry }) => { if (!entry) return actions.createPage({ component: entry.fullpath, path: entry.route, context: { entry, }, }) }) }) } ================================================ FILE: core/gatsby-theme-docz/lib/onCreateBabelConfig.js ================================================ const { Plugin, parseConfig } = require('docz-core') module.exports = async (params, opts = {}) => { const config = await parseConfig(opts) const run = Plugin.runPluginsMethod(config.plugins) const { paths } = config const { actions, stage } = params actions.setBabelPlugin({ name: 'babel-plugin-export-metadata', options: { root: paths.getRootDir(config), }, }) run('onCreateBabelConfig', params, stage === 'develop') } ================================================ FILE: core/gatsby-theme-docz/lib/onCreateDevServer.js ================================================ const { Plugin, parseConfig } = require('docz-core') module.exports = async (params, opts = {}) => { const config = await parseConfig(opts) const run = Plugin.runPluginsMethod(config.plugins) const { stage } = params run('onCreateDevServer', params, stage === 'develop') } ================================================ FILE: core/gatsby-theme-docz/lib/onCreateWebpackConfig.js ================================================ const { Plugin, parseConfig } = require('docz-core') module.exports = async (params, opts) => { const { stage, actions, getConfig } = params const args = await parseConfig(opts) const run = Plugin.runPluginsMethod(args.plugins) const config = getConfig() if (args.typescript) { actions.setWebpackConfig({ resolve: { extensions: config.resolve.extensions.concat(['.ts', '.tsx']), }, }) } run('onCreateWebpackConfig', params, stage === 'develop', args, config) } ================================================ FILE: core/gatsby-theme-docz/lib/onPostBuild.js ================================================ const { Plugin, parseConfig } = require('docz-core') module.exports = async (params, opts = {}) => { const config = await parseConfig(opts) Plugin.runPluginsMethod(config.plugins)('onPreBuild') } ================================================ FILE: core/gatsby-theme-docz/lib/onPreBuild.js ================================================ const { Plugin, parseConfig } = require('docz-core') module.exports = async (params, opts = {}) => { const config = await parseConfig(opts) Plugin.runPluginsMethod(config.plugins)('onPreBuild') } ================================================ FILE: core/gatsby-theme-docz/lib/sourceNodes.js ================================================ const crypto = require('crypto') const fs = require('fs-extra') const { Entries, DataServer, states } = require('docz-core') const { parseConfig } = require('./utils/parseConfig') const NODE_ENV = process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV const IS_DEV = NODE_ENV === 'development' const digest = str => crypto .createHash('md5') .update(str) .digest('hex') module.exports = async ({ actions, createNodeId }, opts) => { const { createNode } = actions const config = await parseConfig(opts) const entries = new Entries(config) const dataServer = new DataServer() if (config.propsParser) dataServer.register([states.props(config, IS_DEV)]) dataServer.register([ states.config(config, IS_DEV), states.entries(entries, config, IS_DEV), ]) try { await dataServer.start() } catch (err) { console.error('Failed to process data server') console.error(err) dataServer.close() process.exit(1) } const createDbNode = async () => { const db = await fs.readJSON(config.paths.db, { throws: false }) const contentDigest = digest(JSON.stringify(db || {})) createNode({ id: createNodeId('docz-db'), db: JSON.stringify(db || {}), children: [], internal: { contentDigest, type: 'DoczDb', }, }) } const createEntriesNodes = async () => { const map = await entries.get() const values = Object.entries(map) const contentDigest = digest(JSON.stringify(values)) values.forEach(([, entry]) => { if (!entry) return null createNode({ ...entry, children: [], internal: { contentDigest, type: `DoczEntries`, }, }) }) } const createNodes = async () => { await createDbNode() await createEntriesNodes() } await createNodes() dataServer.onStateChange(createNodes) } ================================================ FILE: core/gatsby-theme-docz/lib/utils/parseConfig.js ================================================ const { setArgs, parseConfig, getBaseConfig } = require('docz-core') const yargs = require('yargs') const getDoczConfig = opts => { const { argv } = setArgs(yargs) return getBaseConfig(argv, opts) } exports.parseConfig = async opts => parseConfig(getDoczConfig(opts)) exports.getDoczConfig = getDoczConfig ================================================ FILE: core/gatsby-theme-docz/package.json ================================================ { "name": "gatsby-theme-docz", "version": "2.4.0", "description": "Gatsby theme created to use Docz", "license": "MIT", "author": "Pedro Nauck (pedronauck@gmail.com)", "keywords": [ "gatsby", "gatsby-theme", "docz" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/gatsby-theme-docz" }, "scripts": { "dev": "echo noop", "fix": "yarn lint --fix", "lint": "eslint . --ext .js", "precommit": "lint-staged" }, "dependencies": { "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "@loadable/component": "^5.10.2", "@mdx-js/mdx": "^1.1.0", "@mdx-js/react": "^1.0.27", "@theme-ui/typography": "^0.2.5", "babel-plugin-export-metadata": "^2.4.0", "copy-text-to-clipboard": "^2.1.0", "fs-extra": "^8.1.0", "gatsby": "^2.13.27", "gatsby-plugin-alias-imports": "^1.0.5", "gatsby-plugin-catch-links": "^2.3.0", "gatsby-plugin-compile-es6-packages": "^2.0.0", "gatsby-plugin-emotion": "^4.1.2", "gatsby-plugin-mdx": "^1.0.13", "gatsby-plugin-react-helmet-async": "^1.0.5", "gatsby-plugin-root-import": "^2.0.5", "gatsby-source-filesystem": "^2.1.35", "lodash": "^4.17.14", "mdx-utils": "^0.2.0", "prism-react-renderer": "^1.0.2", "prop-types": "^15.7.2", "re-resizable": "^6.1.0", "react-feather": "^2.0.3", "react-frame-component": "^4.1.1", "react-helmet-async": "^1.0.4", "react-live": "^2.2.1", "react-resize-detector": "^4.2.1", "rehype-docz": "^2.4.0", "rehype-slug": "^2.0.3", "remark-docz": "^2.4.0", "remark-frontmatter": "^1.3.2", "theme-ui": "^0.2.38", "to-style": "^1.3.3", "typography-theme-moraga": "^0.16.19", "yargs": "^13.3.0" }, "peerDependencies": { "docz": ">=2.0.0", "react": "^16.8.0 || ^17.0.2", "react-dom": "^16.8.0 || ^17.0.2" }, "gitHead": "74932cd67112bacd1e29780a202d466acdd79535" } ================================================ FILE: core/gatsby-theme-docz/src/base/Layout.js ================================================ import React from 'react' import PropTypes from 'prop-types' import { useComponents } from 'docz' import { propEq, get } from 'lodash/fp' import { MDXProvider } from '@mdx-js/react' import { useDbQuery } from '../hooks/useDbQuery' import Wrapper from '../wrapper' import Theme from '../index' import SEO from './Seo' const Route = ({ children, entry, isTransclusion, ...defaultProps }) => { const components = useComponents() const NotFound = components.notFound const Layout = components.layout const props = { ...defaultProps, doc: entry } if (!entry && !isTransclusion) return return isTransclusion ? ( children ) : ( {children} ) } const findEntry = (db, ctx) => { const isIndex = ctx && ctx.frontmatter && ctx.frontmatter.route === '/' const eqIndex = propEq('value.route', '/') if (ctx && !ctx.entry && isIndex) return db.entries.find(eqIndex) const filepath = get('entry.filepath', ctx) return db.entries.find(propEq('value.filepath', filepath)) } const includesTransclusion = (db, props) => { const { entries } = db const filepath = get('_frontmatter.__filemeta.filename', props) return ( !props.pageContext && entries.includes(entries.find(propEq('value.filepath', filepath))) ) } const Layout = ({ children, ...defaultProps }) => { const { pageContext: ctx } = defaultProps const db = useDbQuery() const entry = findEntry(db, ctx) const isTransclusion = includesTransclusion(db, defaultProps) return ( <> {entry && } {children} ) } Layout.propTypes = { color: PropTypes.string, children: PropTypes.node.isRequired, } export default Layout ================================================ FILE: core/gatsby-theme-docz/src/base/Seo.js ================================================ import React from 'react' import PropTypes from 'prop-types' import { Helmet } from 'react-helmet-async' import { useDbQuery } from '../hooks/useDbQuery' const SEO = ({ description, lang, meta, keywords, title: initialTitle }) => { const db = useDbQuery() const title = initialTitle || db.config.title const metaDescription = description || db.config.description return ( 0 ? { name: `keywords`, content: keywords.join(`, `), } : [] ) .concat(meta)} /> ) } SEO.defaultProps = { lang: `en`, meta: [], keywords: [], } SEO.propTypes = { description: PropTypes.string, lang: PropTypes.string, meta: PropTypes.array, keywords: PropTypes.arrayOf(PropTypes.string), title: PropTypes.string.isRequired, } export default SEO ================================================ FILE: core/gatsby-theme-docz/src/components/Code/index.js ================================================ /** @jsx jsx */ /* eslint react/jsx-key: 0 */ import Highlight, { defaultProps } from 'prism-react-renderer' import { jsx, Styled } from 'theme-ui' import { usePrismTheme } from '~utils/theme' export const Code = ({ children, className: outerClassName }) => { const [language] = outerClassName ? outerClassName.replace(/language-/, '').split(' ') : ['text'] const theme = usePrismTheme() return ( {({ className, style, tokens, getLineProps, getTokenProps }) => ( {tokens.map((line, i) => (
{line.map((token, key) => ( ))}
))}
)}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/Code/styles.js ================================================ export const editor = { borderRadius: 'radius', border: t => `1px solid ${t.colors.border}`, fontFamily: 'monospace', } ================================================ FILE: core/gatsby-theme-docz/src/components/Header/index.js ================================================ /** @jsx jsx */ import { jsx, Box, Flex, useColorMode } from 'theme-ui' import { useConfig, useCurrentDoc } from 'docz' import * as styles from './styles' import { Edit, Menu, Sun, Github } from '../Icons' import { Logo } from '../Logo' export const Header = props => { const { onOpen } = props const { repository, themeConfig: { showDarkModeSwitch, showMarkdownEditButton }, } = useConfig() const { edit = true, ...doc } = useCurrentDoc() const [colorMode, setColorMode] = useColorMode() const toggleColorMode = () => { setColorMode(colorMode === 'light' ? 'dark' : 'light') } return (
{repository && ( )} {showDarkModeSwitch && ( )} {showMarkdownEditButton && edit && doc.link && ( Edit page )}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/Header/styles.js ================================================ import * as mixins from '~utils/mixins' import { media } from '~theme/breakpoints' export const wrapper = { bg: 'header.bg', position: 'relative', zIndex: 1, borderBottom: t => `1px solid ${t.colors.border}`, } export const innerContainer = { ...mixins.centerAlign, px: 4, position: 'relative', justifyContent: 'space-between', height: 80, } export const menuIcon = { display: 'none', position: 'absolute', top: 'calc(100% + 15px)', left: 30, [media.tablet]: { display: 'block', }, } export const menuButton = { ...mixins.ghostButton, color: 'header.text', opacity: 0.5, cursor: 'pointer', } export const headerButton = { ...mixins.centerAlign, outline: 'none', p: '12px', border: 'none', borderRadius: 9999, bg: 'header.button.bg', color: 'header.button.color', fontSize: 0, fontWeight: 600, cursor: 'pointer', } export const editButton = { ...mixins.centerAlign, position: 'absolute', bottom: -40, right: 30, bg: 'transparent', color: 'muted', fontSize: 1, textDecoration: 'none', borderRadius: 'radius', } ================================================ FILE: core/gatsby-theme-docz/src/components/Headings/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' const heading = Tag => { const Component = props => { return !!props.id ? ( {props.children} ) : ( ) } Component.displayName = Tag return Component } export const h2 = heading('h2') export const h3 = heading('h3') export const h4 = heading('h4') export const h5 = heading('h5') export const h6 = heading('h6') ================================================ FILE: core/gatsby-theme-docz/src/components/Icons/index.js ================================================ export { default as ChevronDown } from 'react-feather/dist/icons/chevron-down' export { default as ChevronUp } from 'react-feather/dist/icons/chevron-up' export { default as Clipboard } from 'react-feather/dist/icons/clipboard' export { default as Code } from 'react-feather/dist/icons/code' export { default as Edit } from 'react-feather/dist/icons/edit-2' export { default as Github } from 'react-feather/dist/icons/github' export { default as Menu } from 'react-feather/dist/icons/menu' export { default as Search } from 'react-feather/dist/icons/search' export { default as Sun } from 'react-feather/dist/icons/sun' ================================================ FILE: core/gatsby-theme-docz/src/components/Layout/index.js ================================================ /** @jsx jsx */ import { useRef, useState } from 'react' import { jsx, Layout as BaseLayout, Main } from 'theme-ui' import { Global } from '@emotion/react' import global from '~theme/global' import { Header } from '../Header' import { Sidebar } from '../Sidebar' import { MainContainer } from '../MainContainer' import * as styles from './styles' export const Layout = ({ children }) => { const [open, setOpen] = useState(false) const nav = useRef() return ( div': { flex: '1 1 auto' } }} data-testid="layout">
setOpen(s => !s)} />
setOpen(true)} onBlur={() => setOpen(false)} onClick={() => setOpen(false)} /> {children}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/Layout/styles.js ================================================ import { media } from '~theme/breakpoints' export const main = { display: 'flex', flexDirection: 'column', minHeight: '100vh', } export const wrapper = { py: 0, flex: 1, display: 'grid', gridTemplateColumns: '250px minmax(0, 1fr)', minHeight: '100vh', [media.tablet]: { display: 'block', }, } ================================================ FILE: core/gatsby-theme-docz/src/components/Logo/index.js ================================================ /** @jsx jsx */ import { jsx, Flex } from 'theme-ui' import { Link, useConfig } from 'docz' import * as styles from './styles' export const Logo = () => { const config = useConfig() return ( {config.title} ) } ================================================ FILE: core/gatsby-theme-docz/src/components/Logo/styles.js ================================================ export const logo = { letterSpacing: '-0.02em', fontWeight: 600, fontSize: 4, } export const link = { fontWeight: 600, color: 'header.text', textDecoration: 'none', ':hover': { color: 'primary', }, } ================================================ FILE: core/gatsby-theme-docz/src/components/MainContainer/index.js ================================================ /** @jsx jsx */ import { jsx, Container } from 'theme-ui' import * as styles from './styles' export const MainContainer = ({ children, ...rest }) => { return ( {children} ) } ================================================ FILE: core/gatsby-theme-docz/src/components/MainContainer/styles.js ================================================ import { media } from '~theme/breakpoints' export const container = { backgroundColor: 'background', position: 'relative', maxWidth: 960, py: 5, px: 4, variant: 'styles.Container', [media.tablet]: { py: 4, px: 4, pt: 5, }, } ================================================ FILE: core/gatsby-theme-docz/src/components/NavGroup/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' import { useEffect, useState, useRef } from 'react' import { useCurrentDoc } from 'docz' import * as styles from './styles' import { NavLink } from '../NavLink' import { ChevronDown } from '../Icons' export const NavGroup = ({ item, sidebarRef }) => { const currentDoc = useCurrentDoc() const currentDocRef = useRef() const { name, menu } = item const [subheadingsVisible, setShowsubheadings] = useState( currentDoc.menu === name ) const toggleSubheadings = () => setShowsubheadings(!subheadingsVisible) useEffect(() => { if (sidebarRef.current && currentDocRef.current) { sidebarRef.current.scrollTo(0, currentDocRef.current.offsetTop) } }, []) return (
{item.name}
{menu && subheadingsVisible && menu.map(menu => { if (currentDoc.route === menu.route) { return ( {menu.name} ) } return ( {menu.name} ) })}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/NavGroup/styles.js ================================================ export const wrapper = { my: 3, } export const sublinkWrapper = { ml: 2, } export const title = { mb: 1, fontSize: 2, fontWeight: 500, color: 'sidebar.navGroup', cursor: 'pointer', display: 'flex', justifyContent: 'space-between', alignItems: 'center', } export const chevron = ({ active }) => ({ ml: 1, flexShrink: 0, alignSelf: 'baseline', transform: `rotateX(${active ? 180 : 0}deg)`, transformOrigin: 'center', transition: 'transform .3s ease-in-out', }) ================================================ FILE: core/gatsby-theme-docz/src/components/NavLink/index.js ================================================ /** @jsx jsx */ import { Fragment, forwardRef } from 'react' import { jsx } from 'theme-ui' import { Link } from 'gatsby' import { useDocs, useCurrentDoc } from 'docz' import { get } from 'lodash/fp' import * as styles from './styles' const getHeadings = (route, docs) => { const doc = docs.find(doc => doc.route === route) const headings = get('headings', doc) return headings ? headings.filter(heading => heading.depth === 2) : [] } const getCurrentHash = () => { if (typeof window === 'undefined') { return '' } return window.location ? decodeURI(window.location.hash) : '' } export const NavLink = forwardRef(function NavLink({ item, ...props }, ref) { const docs = useDocs() const current = useCurrentDoc() if (item.hidden) { return null } const to = item.route const headings = docs && getHeadings(to, docs) const isCurrent = item.route === current.route const showHeadings = isCurrent && headings && headings.length > 0 const currentHash = getCurrentHash() return ( {showHeadings && headings.map(heading => ( {heading.value} ))} ) }) ================================================ FILE: core/gatsby-theme-docz/src/components/NavLink/styles.js ================================================ export const link = { my: 2, display: 'block', color: 'sidebar.navGroup', textDecoration: 'none', fontSize: 2, '&.active': { color: 'sidebar.navLinkActive', }, } export const smallLink = { ...link, ml: 3, fontSize: 1, position: 'relative', color: 'sidebar.tocLink', '&.active': { color: 'sidebar.tocLinkActive', }, '&.active::before': { content: '""', position: 'absolute', display: 'block', top: '2px', left: -2, height: '1rem', backgroundColor: 'primary', transition: 'width 200ms ease 0s', width: '2px', borderRadius: 1, }, } ================================================ FILE: core/gatsby-theme-docz/src/components/NavSearch/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' import * as styles from './styles' import { Search } from '../Icons' export const NavSearch = props => { return (
) } ================================================ FILE: core/gatsby-theme-docz/src/components/NavSearch/styles.js ================================================ export const wrapper = { mb: 3, display: 'inline-flex', alignItems: 'center', } export const input = { outline: 'none', background: 'none', border: 'none', color: 'text', fontSize: 1, } export const icon = { color: 'border', mr: 2, } ================================================ FILE: core/gatsby-theme-docz/src/components/Playground/Wrapper.js ================================================ /** @jsx jsx */ import { useState } from 'react' import { jsx } from 'theme-ui' import { useConfig } from 'docz' import Iframe from 'react-frame-component' import ReactResizeDetector from 'react-resize-detector' import * as styles from './styles' const CLEAR_PADDING = `` const INITIAL_IFRAME_CONTENT = ` ${CLEAR_PADDING}
` const IframeWrapper = ({ children, style }) => { const [containerHeight, setHeight] = useState() return ( ) } const NormalWrapper = ({ children, style }) => { return (
{children}
) } export const Wrapper = ({ children, content, useScoping, showingCode }) => { const { themeConfig: { useScopingInPlayground }, } = useConfig() const Element = useScoping || useScopingInPlayground ? IframeWrapper : NormalWrapper return ( {children} ) } ================================================ FILE: core/gatsby-theme-docz/src/components/Playground/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' import { useState } from 'react' import { useConfig } from 'docz' import { LiveProvider, LiveError, LivePreview, LiveEditor } from 'react-live' import { Resizable } from 're-resizable' import copy from 'copy-text-to-clipboard' import { Wrapper } from './Wrapper' import { usePrismTheme } from '~utils/theme' import * as styles from './styles' import * as Icons from '../Icons' const getResizableProps = (width, setWidth) => ({ minWidth: 260, maxWidth: '100%', size: { width: width, height: 'auto', }, style: { margin: 0, marginRight: 'auto', }, enable: { top: false, right: true, bottom: false, left: false, topRight: false, bottomRight: false, bottomLeft: false, topLeft: false, }, onResizeStop: (e, direction, ref) => { setWidth(ref.style.width) }, }) const transformCode = code => { if (code.startsWith('()') || code.startsWith('class')) return code return `${code}` } export const Playground = ({ code, scope, language, useScoping = false }) => { const { themeConfig: { showPlaygroundEditor, showLiveError, showLivePreview }, } = useConfig() // Makes sure scope is only given on mount to avoid infinite re-render on hot reloads const [scopeOnMount] = useState(scope) const theme = usePrismTheme() const [showingCode, setShowingCode] = useState(showPlaygroundEditor) const [width, setWidth] = useState('100%') const resizableProps = getResizableProps(width, setWidth) const copyCode = () => copy(code) const toggleCode = () => setShowingCode(s => !s) return (
{showLivePreview && ( )}
{showingCode && (
)} {showLiveError && ( )}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/Playground/styles.js ================================================ import * as mixins from '~utils/mixins' export const editor = theme => ({ p: 2, background: theme.plain.backgroundColor, borderTop: 0, fontFamily: 'monospace', fontSize: 18, '* > textarea:focus': { outline: 'none', }, borderRadius: 'inherit', }) export const error = { m: 0, py: 2, px: 3, bg: '#FF4757', fontSize: 1, color: 'white', whiteSpace: 'pre-wrap', } export const previewWrapper = { position: 'relative', } export const wrapper = () => ({ height: 'auto', display: 'block', minHeight: '100%', width: 'calc(100% - 2px)', bg: 'playground.bg', }) export const wrapperBorder = (content, showingCode) => { let borderRadius = 4 if (showingCode) { borderRadius = content === 'preview' ? '4px 4px 0 0' : '0 0 4px 4px' } return { border: t => `1px solid ${t.colors.playground.border}`, borderTop: content === 'editor' ? 0 : undefined, borderRadius, } } export const preview = { margin: 0, padding: '20px', } export const buttons = { zIndex: 9, display: 'flex', position: 'absolute', bottom: -20, right: 4, } export const button = { ...mixins.ghostButton, display: 'flex', alignItems: 'center', py: 1, p: 2, bg: 'border', color: 'muted', borderRadius: '0 0 3px 3px', '& ~ &': { ml: 1, }, } export const link = { py: 0, ml: 1, height: 22, } ================================================ FILE: core/gatsby-theme-docz/src/components/Pre/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' export const Pre = ({ children }) =>
{children}
================================================ FILE: core/gatsby-theme-docz/src/components/Pre/styles.js ================================================ export const wrapper = { position: 'relative', my: 4, } export const language = { py: 1, px: 2, position: 'absolute', bottom: 0, right: 0, fontSize: 1, color: 'muted', } ================================================ FILE: core/gatsby-theme-docz/src/components/Props/index.js ================================================ /** @jsx jsx */ import { useState } from 'react' import { jsx } from 'theme-ui' import { ChevronDown, ChevronUp } from '../Icons' import * as styles from './styles' export const getDefaultValue = ({ defaultValue, type, flowType }) => { const propType = flowType ? flowType : type if (!defaultValue || !defaultValue.value) return null if (defaultValue.value === "''") { return '[Empty string]' } if (propType && propType.name === 'string') { return defaultValue.value.replace(/\'/g, '"') } if (typeof defaultValue.value === 'object' && defaultValue.value.toString) { return defaultValue.value.toString() } return defaultValue.value } export const Prop = ({ propName, prop, getPropType, isToggle }) => { const [showing, setShowing] = useState(isToggle || false) if (!prop.type && !prop.flowType) return null const toggle = () => setShowing(s => !s) return (
{propName}
{getPropType(prop)}
{prop.defaultValue && (
{getDefaultValue(prop)}
)}
{prop.required && (
required
)} {prop.description && ( )}
{showing && prop.description && (
{prop.description}
)}
) } export const Props = ({ props, getPropType, isToggle }) => { const entries = Object.entries(props) return (
{entries.map(([key, prop]) => ( ))}
) } ================================================ FILE: core/gatsby-theme-docz/src/components/Props/styles.js ================================================ import { breakpoints } from '~theme/breakpoints' import * as mixins from '~utils/mixins' export const container = { mt: 3, mb: 4, border: t => `1px solid ${t.colors.border}`, borderRadius: 'radius', overflow: 'hidden', bg: 'props.bg', color: 'props.text', fontSize: 3, } export const content = { position: 'relative', display: 'flex', flexDirection: 'column', [`@media (min-width: ${breakpoints.tablet}px)`]: { flexWrap: 'nowrap', flexDirection: 'row', }, } export const line = { pt: 2, '& + &': { borderTop: t => `1px solid ${t.colors.border}`, }, } const column = { minWidth: 0, pb: 2, px: 3, '& ~ &': { bg: 'red', }, } export const propName = { ...column, color: 'props.highlight', } export const propType = { ...column, color: 'props.text', } export const defaultValue = { ...column, color: 'props.defaultValue', } export const right = { display: 'flex', alignItems: 'center', justifyContent: 'flex-end', px: 3, flex: 1, [`@media (max-width: ${breakpoints.tablet}px)`]: { position: 'absolute', top: 0, right: 0, }, } export const propRequired = { color: 'props.text', fontSize: 1, opacity: 0.5, } export const openDescBtn = { ...mixins.ghostButton, mt: 0, ml: 3, color: 'props.defaultValue', } export const description = { fontSize: 2, m: 0, py: 2, px: 3, borderTop: t => `1px solid ${t.colors.border}`, color: 'props.descriptionText', bg: 'props.descriptionBg', } ================================================ FILE: core/gatsby-theme-docz/src/components/Sidebar/index.js ================================================ /** @jsx jsx */ import { Fragment, forwardRef, useState, useRef, useEffect } from 'react' import { Global } from '@emotion/react' import { jsx, Box } from 'theme-ui' import { useMenus, useCurrentDoc } from 'docz' import * as styles from './styles' import { NavSearch } from '../NavSearch' import { NavLink } from '../NavLink' import { NavGroup } from '../NavGroup' export const Sidebar = forwardRef(function Sidebar(props, ref) { const [query, setQuery] = useState('') const menus = useMenus({ query }) const currentDoc = useCurrentDoc() const currentDocRef = useRef() const handleChange = ev => { setQuery(ev.target.value) } useEffect(() => { if (ref.current && currentDocRef.current) { ref.current.scrollTo(0, currentDocRef.current.offsetTop) } }, []) return ( {props.open && } {menus && menus.map(menu => { if (!menu.route) return if (menu.route === currentDoc.route) { return ( {menu.name} ) } return ( {menu.name} ) })} ) }) ================================================ FILE: core/gatsby-theme-docz/src/components/Sidebar/styles.js ================================================ import { media } from '~theme/breakpoints' export const global = { body: { overflow: 'hidden', }, } const HEADER_HEIGHT = 81 export const overlay = ({ open }) => ({ zIndex: 999, position: 'fixed', top: HEADER_HEIGHT, right: 0, bottom: 0, left: 0, background: 'rgba(0,0,0,0.6)', transition: 'all .2s ease-out', visibility: open ? 'visible' : 'hidden', opacity: open ? 1 : 0, }) export const wrapper = ({ open }) => ({ py: 4, px: 4, flexDirection: 'column', position: 'sticky', top: 0, zIndex: 1, minWidth: 0, maxHeight: '100vh', borderRight: t => `1px solid ${t.colors.border}`, overflow: 'auto', WebkitOverflowScrolling: 'touch', bg: 'sidebar.bg', [media.tablet]: { zIndex: 9999, display: 'block', position: 'fixed', top: HEADER_HEIGHT, left: 0, bottom: 0, width: 256, px: 4, bg: 'background', transition: 'transform .2s ease-out', transform: open ? 'translateX(0)' : 'translateX(-100%)', }, }) ================================================ FILE: core/gatsby-theme-docz/src/components/index.js ================================================ import * as headings from './Headings' import { Code } from './Code' import { Layout } from './Layout' import { Playground } from './Playground' import { Pre } from './Pre' import { Props } from './Props' export default { ...headings, code: Code, playground: Playground, pre: Pre, layout: Layout, props: Props, } ================================================ FILE: core/gatsby-theme-docz/src/hooks/useDbQuery.js ================================================ import { useStaticQuery, graphql } from 'gatsby' export const useDbQuery = () => { try { const data = useStaticQuery(graphql` query { doczDb { id db } } `) return JSON.parse(data.doczDb.db) } catch (err) { console.error(err) console.error('Error when parsing docz database') return {} } } ================================================ FILE: core/gatsby-theme-docz/src/index.css ================================================ @import url('https://fonts.googleapis.com/css?family=Inconsolata&display=swap'); @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap'); ================================================ FILE: core/gatsby-theme-docz/src/index.js ================================================ /** @jsx jsx */ import { jsx } from 'theme-ui' import { theme, useConfig, ComponentsProvider } from 'docz' import { Styled, ThemeProvider } from 'theme-ui' import defaultTheme from '~theme' import components from '~components' const Theme = ({ children }) => { const config = useConfig() return ( {children} ) } export default theme(defaultTheme)(Theme) ================================================ FILE: core/gatsby-theme-docz/src/theme/breakpoints.js ================================================ const em = px => `${px / 16}em` const mountMedia = val => `@media screen and (max-width: ${em(val)})` export const breakpoints = { mobile: 630, tablet: 920, desktop: 1120, } export const media = { mobile: mountMedia(breakpoints.mobile), tablet: mountMedia(breakpoints.tablet), desktop: mountMedia(breakpoints.desktop), } ================================================ FILE: core/gatsby-theme-docz/src/theme/colors.js ================================================ export const white = '#FFFFFF' export const grayUltraLight = '#FCFBFA' export const grayExtraLight = '#F5F6F7' export const grayLight = '#CED4DE' export const gray = '#67788a' export const grayDark = '#2D3747' export const grayExtraDark = '#1D2330' export const dark = '#13161F' export const blueLight = '#e9f2fa' export const blue = '#0B5FFF' export const skyBlue = '#1FB6FF' export const negative = '#EB4D4B' ================================================ FILE: core/gatsby-theme-docz/src/theme/global.js ================================================ export default { body: { margin: 0, padding: 0, }, '.icon-link': { display: 'none', }, '.with-overlay': { overflow: 'hidden', }, } ================================================ FILE: core/gatsby-theme-docz/src/theme/index.js ================================================ import moraga from 'typography-theme-moraga' import { toTheme } from '@theme-ui/typography' import { merge } from 'lodash/fp' import * as modes from './modes' import prism from './prism' import styles from './styles' moraga.headerWeight = 700 const typography = toTheme(moraga) export default merge(typography, { initialColorMode: 'light', // Show errors above playground editor showLiveError: true, // Show preview of the code inside playground showLivePreview: true, // Show editor when a playground is rendered showPlaygroundEditor: true, // Show dark/light mode switch toggle in header showDarkModeSwitch: true, // Display edit this page button on every page showMarkdownEditButton: true, // Wrap the playground editor and preview in iframes to avoid style/script collisions useScopingInPlayground: false, colors: { ...modes.light, modes: { dark: modes.dark, }, }, fonts: { monospace: 'Inconsolata', }, fontSizes: [12, 14, 16, 20, 24, 32, 48, 64], fontWeights: { body: 400, heading: 700, bold: 700, }, lineHeights: { body: 1.5, heading: 1.125, }, letterSpacings: { body: 'normal', caps: '0.2em', }, space: [0, 4, 8, 16, 32, 48, 64, 80, 100], radii: { square: 0, radius: 4, rounded: 10, }, styles, prism, }) ================================================ FILE: core/gatsby-theme-docz/src/theme/modes.js ================================================ import * as colors from './colors' import prismDark from './prism/dark' import prismLight from './prism/light' export const light = { ...colors, primary: colors.blue, text: colors.grayDark, muted: colors.gray, link: colors.blue, background: colors.white, border: colors.grayLight, sidebar: { bg: colors.white, navGroup: colors.grayDark, navLink: colors.grayDark, navLinkActive: colors.blue, tocLink: colors.gray, tocLinkActive: colors.grayExtraDark, }, header: { bg: colors.grayExtraLight, text: colors.grayDark, border: colors.grayLight, button: { bg: colors.blue, color: colors.white, }, }, props: { bg: colors.grayUltraLight, text: colors.grayDark, highlight: colors.blue, defaultValue: colors.gray, descriptionText: colors.grayDark, descriptionBg: colors.white, }, playground: { bg: colors.white, border: colors.grayLight, }, blockquote: { bg: colors.grayExtraLight, border: colors.grayLight, color: colors.gray, }, prism: { ...prismLight, }, } export const dark = { ...colors, primary: colors.skyBlue, text: colors.grayExtraLight, muted: colors.gray, link: colors.skyBlue, background: colors.grayExtraDark, border: colors.grayDark, sidebar: { bg: colors.grayExtraDark, navGroup: colors.gray, navLink: colors.grayLight, navLinkActive: colors.skyBlue, tocLink: colors.gray, tocLinkActive: colors.grayLight, }, header: { bg: colors.dark, text: colors.grayLight, border: colors.grayDark, button: { bg: colors.skyBlue, color: colors.white, }, }, props: { bg: colors.dark, text: colors.gray, highlight: colors.skyBlue, defaultValue: colors.grayDark, descriptionText: colors.gray, descriptionBg: colors.grayExtraDark, }, playground: { bg: colors.dark, border: colors.grayDark, }, blockquote: { bg: colors.grayDark, border: colors.gray, color: colors.gray, }, prism: { ...prismDark, }, } ================================================ FILE: core/gatsby-theme-docz/src/theme/prism/dark.js ================================================ export default { plain: { fontFamily: 'Inconsolata', color: '#d6deeb', backgroundColor: '#13161F', }, styles: [ { types: ['changed'], style: { color: 'rgb(162, 191, 252)', fontStyle: 'italic', }, }, { types: ['deleted'], style: { color: 'rgba(239, 83, 80, 0.56)', fontStyle: 'italic', }, }, { types: ['inserted', 'attr-name'], style: { color: 'rgb(173, 219, 103)', fontStyle: 'italic', }, }, { types: ['comment'], style: { color: 'rgb(99, 119, 119)', fontStyle: 'italic', }, }, { types: ['string', 'url'], style: { color: 'rgb(173, 219, 103)', }, }, { types: ['variable'], style: { color: 'rgb(214, 222, 235)', }, }, { types: ['number'], style: { color: 'rgb(247, 140, 108)', }, }, { types: ['builtin', 'char', 'constant', 'function'], style: { color: 'rgb(130, 170, 255)', }, }, { // This was manually added after the auto-generation // so that punctuations are not italicised types: ['punctuation'], style: { color: 'rgb(199, 146, 234)', }, }, { types: ['selector', 'doctype'], style: { color: 'rgb(199, 146, 234)', fontStyle: 'italic', }, }, { types: ['class-name'], style: { color: 'rgb(255, 203, 139)', }, }, { types: ['tag', 'operator', 'keyword'], style: { color: 'rgb(127, 219, 202)', }, }, { types: ['boolean'], style: { color: 'rgb(255, 88, 116)', }, }, { types: ['property'], style: { color: 'rgb(128, 203, 196)', }, }, { types: ['namespace'], style: { color: 'rgb(178, 204, 214)', }, }, ], } ================================================ FILE: core/gatsby-theme-docz/src/theme/prism/index.js ================================================ import dark from './dark' import light from './light' export default { dark, light, } ================================================ FILE: core/gatsby-theme-docz/src/theme/prism/light.js ================================================ export default { plain: { fontFamily: 'Inconsolata', color: '#393A34', backgroundColor: '#f6f8fa', }, styles: [ { types: ['comment', 'prolog', 'doctype', 'cdata'], style: { color: '#999988', fontStyle: 'italic', }, }, { types: ['namespace'], style: { opacity: 0.7, }, }, { types: ['string', 'attr-value'], style: { color: '#e3116c', }, }, { types: ['punctuation', 'operator'], style: { color: '#393A34', }, }, { types: [ 'entity', 'url', 'symbol', 'number', 'boolean', 'variable', 'constant', 'property', 'regex', 'inserted', ], style: { color: '#36acaa', }, }, { types: ['atrule', 'keyword', 'attr-name', 'selector'], style: { color: '#00a4db', }, }, { types: ['function', 'deleted', 'tag'], style: { color: '#d73a49', }, }, { types: ['function-variable'], style: { color: '#6f42c1', }, }, { types: ['tag', 'selector', 'keyword'], style: { color: '#00009f', }, }, ], } ================================================ FILE: core/gatsby-theme-docz/src/theme/styles.js ================================================ const styles = { Container: { p: 4, maxWidth: 1280, }, root: { fontSize: 3, color: 'text', bg: 'background', }, a: { color: 'primary', textDecoration: 'none', '&:hover': { color: 'secondary', textDecoration: 'underline', }, }, h1: { fontSize: 6, }, h2: { fontSize: 5, }, h3: { fontSize: 4, }, h4: { fontSize: 3, }, h5: { fontSize: 2, }, h6: { fontSize: 1, }, li: { marginBottom: 1, }, blockquote: { my: 4, mx: 0, py: 3, px: 4, bg: 'blockquote.bg', borderLeft: t => `5px solid ${t.colors.blockquote.border}`, color: 'blockquote.color', fontStyle: 'italic', '> p': { m: 0, }, }, code: { fontFamily: 'monospace', }, inlineCode: { fontFamily: 'monospace', }, pre: { my: 4, p: 3, variant: 'prism', textAlign: 'left', fontFamily: 'monospace', borderRadius: 'radius', }, table: { width: '100%', my: 4, borderCollapse: 'separate', borderSpacing: 0, [['th', 'td']]: { textAlign: 'left', py: '4px', pr: '4px', pl: 0, borderColor: 'muted', borderBottomStyle: 'solid', }, }, th: { verticalAlign: 'bottom', borderBottomWidth: '2px', }, td: { verticalAlign: 'top', borderBottomWidth: '1px', }, hr: { border: 0, borderBottom: t => `1px solid ${t.colors.border}`, }, } export default styles ================================================ FILE: core/gatsby-theme-docz/src/utils/mixins.js ================================================ export const centerAlign = { display: 'flex', alignItems: 'center', justifyContent: 'center', } export const ghostButton = { p: 0, outline: 'none', background: 'transparent', border: 'none', ':hover': { cursor: 'pointer', }, } ================================================ FILE: core/gatsby-theme-docz/src/utils/theme.js ================================================ import { useThemeUI } from 'theme-ui' import { get, pipe, defaultTo } from 'lodash/fp' export const themeProp = str => props => { return get(`theme.${str}`, props) } export const usePrismTheme = () => { const { theme, colorMode } = useThemeUI() const getTheme = pipe( get('prismTheme'), defaultTo(get(`prism.${colorMode}`, theme)) ) return getTheme(theme) } ================================================ FILE: core/gatsby-theme-docz/src/wrapper.js ================================================ import React from 'react' const Wrapper = ({ children }) => <>{children} export default Wrapper ================================================ FILE: core/rehype-docz/.eslintignore ================================================ dist ================================================ FILE: core/rehype-docz/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: core/rehype-docz/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: core/rehype-docz/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package rehype-docz # [2.3.0-alpha.2](https://github.com/doczjs/docz/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2019-12-14) ### Features * **rehype-docz:** add mdx exports to Playground scope ([d902e2a](https://github.com/doczjs/docz/commit/d902e2a)), closes [#1247](https://github.com/doczjs/docz/issues/1247) # [2.3.0-alpha.1](https://github.com/doczjs/docz/compare/v2.3.0-alpha.0...v2.3.0-alpha.1) (2019-12-13) **Note:** Version bump only for package rehype-docz # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package rehype-docz # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) ### Features * a lot of improvements ([64f75da](https://github.com/pedronauck/docz/commit/64f75da)) * add new Playground component ([7bf03b2](https://github.com/pedronauck/docz/commit/7bf03b2)) * some playground improvements ([afa00df](https://github.com/pedronauck/docz/commit/afa00df)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package rehype-docz # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package rehype-docz ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package rehype-docz ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package rehype-docz ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package rehype-docz # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package rehype-docz # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes * remove modularized lodash packages ([d81c568](https://github.com/pedronauck/docz/commit/d81c568)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package rehype-docz # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * **rehype-docz:** update tests ([548f940](https://github.com/pedronauck/docz/commit/548f940)) * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) ## [0.13.6](https://github.com/pedronauck/docz/compare/v0.13.5...v0.13.6) (2018-12-26) **Note:** Version bump only for package rehype-docz ## [0.13.5](https://github.com/pedronauck/docz/compare/v0.13.4...v0.13.5) (2018-12-19) ### Bug Fixes * **docz-utils:** escape code for playground ([3fc4187](https://github.com/pedronauck/docz/commit/3fc4187)) ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) **Note:** Version bump only for package rehype-docz # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes * **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) **Note:** Version bump only for package rehype-docz ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) **Note:** Version bump only for package rehype-docz ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) **Note:** Version bump only for package rehype-docz ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) ### Bug Fixes * **rehype-docz:** scope for playground ([677a785](https://github.com/pedronauck/docz/commit/677a785)) ## [0.12.12](https://github.com/pedronauck/docz/compare/v0.12.11...v0.12.12) (2018-11-16) **Note:** Version bump only for package rehype-docz ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) **Note:** Version bump only for package rehype-docz ## [0.12.9](https://github.com/pedronauck/docz/compare/v0.12.8...v0.12.9) (2018-11-01) **Note:** Version bump only for package rehype-docz ## [0.12.8](https://github.com/pedronauck/docz/compare/v0.12.7...v0.12.8) (2018-10-31) **Note:** Version bump only for package rehype-docz ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) ### Features * add support to disable codesandbox ([be94b0e](https://github.com/pedronauck/docz/commit/be94b0e)) # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) **Note:** Version bump only for package rehype-docz ## [0.10.3](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.3) (2018-08-16) **Note:** Version bump only for package rehype-docz # [0.10.0](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.0) (2018-08-13) ### Bug Fixes * **rehype-docz:** add props on playground scope ([ee4b6c0](https://github.com/pedronauck/docz/commit/ee4b6c0)) * **rehype-docz:** allow ticks and backticks inside playground ([#203](https://github.com/pedronauck/docz/issues/203)) ([fa4ff40](https://github.com/pedronauck/docz/commit/fa4ff40)) ### Features * allow edit code inside playground ([#205](https://github.com/pedronauck/docz/issues/205)) ([4f948f7](https://github.com/pedronauck/docz/commit/4f948f7)) ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) **Note:** Version bump only for package rehype-docz ## [0.9.4-beta.1](https://github.com/pedronauck/docz/compare/v0.9.4-beta.0...v0.9.4-beta.1) (2018-08-04) **Note:** Version bump only for package rehype-docz # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) **Note:** Version bump only for package rehype-docz # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) **Note:** Version bump only for package rehype-docz # [0.8.0](https://github.com/pedronauck/docz/compare/v0.7.1...v0.8.0) (2018-07-28) **Note:** Version bump only for package rehype-docz # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) ### Features * **docz:** add rawCode for Playground ([70d4735](https://github.com/pedronauck/docz/commit/70d4735)) * **docz-theme-default:** add resize bar for fullscreen playground ([392009f](https://github.com/pedronauck/docz/commit/392009f)) ================================================ FILE: core/rehype-docz/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/rehype-docz/README.md ================================================ ## rehype-docz This is an internal docz package containing the [rehype](https://github.com/rehypejs/rehype) plugin used by docz. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: core/rehype-docz/jest.config.js ================================================ module.exports = { preset: 'ts-jest', testEnvironment: 'node', testMatch: ['**/?(*.)+(spec|test).ts?(x)'], } ================================================ FILE: core/rehype-docz/package.json ================================================ { "name": "rehype-docz", "version": "2.4.0", "description": "Rehype plugin used by docz", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "files": [ "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/rehype-docz" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged", "test": "jest" }, "dependencies": { "brace": "^0.11.1", "docz-utils": "^2.4.0", "hast-util-to-string": "^1.0.2", "jsx-ast-utils": "^2.2.1", "lodash": "^4.17.14", "react-ace": "^7.0.2", "unist-util-is": "^3.0.0" } } ================================================ FILE: core/rehype-docz/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: './src/index.ts', }) ================================================ FILE: core/rehype-docz/src/__snapshots__/index.test.ts.snap ================================================ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`adding custom props on 1`] = ` "/* @jsx mdx */ import { Playground } from 'docz' const makeShortcode = name => function MDXDefaultShortcode(props) { console.warn(\\"Component \\" + name + \\" was not imported, exported, or provided by MDXProvider as global scope\\") return
}; const layoutProps = { }; const MDXLayout = \\"wrapper\\" export default function MDXContent({ components, ...props }) { return {\\\\n const foo = \\\\'foo\\\\'\\\\n return
{foo}
\\\\n}'} __scope={{ props, Playground }} mdxType=\\"Playground\\"> {() => { const foo = 'foo'; return
{foo}
; }}
; } ; MDXContent.isMDXComponent = true;" `; exports[`adding custom props on 2`] = ` "/* @jsx mdx */ import { Playground } from 'docz' const makeShortcode = name => function MDXDefaultShortcode(props) { console.warn(\\"Component \\" + name + \\" was not imported, exported, or provided by MDXProvider as global scope\\") return
}; const layoutProps = { }; const MDXLayout = \\"wrapper\\" export default function MDXContent({ components, ...props }) { return {\\\\n const foo = \\\\'foo\\\\'\\\\n return
{foo}
\\\\n}'} __scope={{ props, Playground }} mdxType=\\"Playground\\"> {() => { const foo = 'foo'; return
{foo}
; }}
; } ; MDXContent.isMDXComponent = true;" `; ================================================ FILE: core/rehype-docz/src/index.test.ts ================================================ import mdx from '@mdx-js/mdx' import remarkDocz from 'remark-docz' import plugin from './' const content = ` import { Playground } from 'docz' {() => { const foo = 'foo' return (
{foo}
) }}
` test('adding custom props on ', async () => { const result = await mdx(content, { remarkPlugins: [remarkDocz], rehypePlugins: [[plugin, { root: __dirname }]], }) expect(result).toMatch('__position={0}') expect(result).toMatchSnapshot() expect(result).toMatchSnapshot() }) ================================================ FILE: core/rehype-docz/src/index.ts ================================================ import flatten from 'lodash/flatten' import nodeToString from 'hast-util-to-string' import { format } from 'docz-utils/lib/format' import { componentName, sanitizeCode, removeTags } from 'docz-utils/lib/jsx' import { getImportsVariables } from 'docz-utils/lib/imports' import { getExportsVariables } from 'docz-utils/lib/exports' const isPlayground = (name: string) => { return name === 'Playground' } const addComponentsProps = (scopes: string[]) => async ( node: any, idx: number ) => { const name = componentName(node.value) const tagOpen = new RegExp(`^\\<${name}`) if (isPlayground(name)) { const formatted = await format(nodeToString(node)) const code = formatted.slice(1, Infinity) const scope = `{props,${scopes.join(',')}}` const child = sanitizeCode(removeTags(code)) node.value = node.value.replace( tagOpen, `<${name} __position={${idx}} __code={'${child}'} __scope={${scope}}` ) } } export interface PluginOpts { root: string } export default () => (tree: any) => { const importNodes = tree.children.filter((n: any) => n.type === 'import') const exportNodes = tree.children.filter((n: any) => n.type === 'export') const importedScopes = flatten(importNodes.map(getImportsVariables)) const exportedScopes = flatten(exportNodes.map(getExportsVariables)) // filter added to avoid throwing if an unexpected type is exported const scopes: string[] = [...importedScopes, ...exportedScopes].filter( Boolean ) const nodes = tree.children .filter((node: any) => node.type === 'jsx') .map(addComponentsProps(scopes)) return Promise.all(nodes).then(() => tree) } ================================================ FILE: core/rehype-docz/src/types.d.ts ================================================ declare module 'hast-util-to-string' declare module '@mdx-js/mdx' ================================================ FILE: core/rehype-docz/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "dist", "rootDir": "src", "declaration": true, "types": ["node", "jest"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: core/remark-docz/.eslintignore ================================================ dist ================================================ FILE: core/remark-docz/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: core/remark-docz/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: core/remark-docz/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package remark-docz # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * **remark-docz:** fix alias in the src of a mdx's image [#897](https://github.com/pedronauck/docz/issues/897) ([058732d](https://github.com/pedronauck/docz/commit/058732d)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) ### Features * resolve markdown images ([#851](https://github.com/pedronauck/docz/issues/851)) ([0fb41c8](https://github.com/pedronauck/docz/commit/0fb41c8)) # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package remark-docz ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package remark-docz ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package remark-docz ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package remark-docz # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package remark-docz # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * **remark-docz:** visit correct nodes ([d5e243d](https://github.com/pedronauck/docz/commit/d5e243d)) * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) **Note:** Version bump only for package remark-docz # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes * **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) **Note:** Version bump only for package remark-docz ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) ### Bug Fixes * some typings warnings ([4afb87b](https://github.com/pedronauck/docz/commit/4afb87b)) # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) **Note:** Version bump only for package remark-docz ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) **Note:** Version bump only for package remark-docz ## [0.9.4-beta.1](https://github.com/pedronauck/docz/compare/v0.9.4-beta.0...v0.9.4-beta.1) (2018-08-04) **Note:** Version bump only for package remark-docz # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) **Note:** Version bump only for package remark-docz # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) **Note:** Version bump only for package remark-docz # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) **Note:** Version bump only for package remark-docz ================================================ FILE: core/remark-docz/LICENSE.md ================================================ MIT License Copyright (c) 2018 Pedro Nauck 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: core/remark-docz/README.md ================================================ ## remark-docz This is an internal docz package containing the [remark](https://github.com/remarkjs/remark) plugin used by docz. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: core/remark-docz/jest.config.js ================================================ module.exports = { preset: 'ts-jest', testEnvironment: 'node', testMatch: ['**/?(*.)+(spec|test).ts?(x)'], } ================================================ FILE: core/remark-docz/package.json ================================================ { "name": "remark-docz", "version": "2.4.0", "description": "Remark plugin used by docz", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "files": [ "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "core/remark-docz" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged", "test": "jest" }, "dependencies": { "@babel/generator": "^7.5.5", "@babel/types": "^7.5.5", "unist-util-remove": "^1.0.3", "unist-util-visit": "^1.4.1" } } ================================================ FILE: core/remark-docz/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: './src/index.ts', }) ================================================ FILE: core/remark-docz/src/__snapshots__/index.test.ts.snap ================================================ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`rendering children as function 1`] = ` "/* @jsx mdx */ import { Playground } from 'docz' const makeShortcode = name => function MDXDefaultShortcode(props) { console.warn(\\"Component \\" + name + \\" was not imported, exported, or provided by MDXProvider as global scope\\") return
}; const layoutProps = { }; const MDXLayout = \\"wrapper\\" export default function MDXContent({ components, ...props }) { return {() => { const foo = 'foo'; return
{foo}
; }}
; } ; MDXContent.isMDXComponent = true;" `; ================================================ FILE: core/remark-docz/src/index.test.ts ================================================ import mdx from '@mdx-js/mdx' import plugin from './' const content = ` import { Playground } from 'docz' {() => { const foo = 'foo' return (
{foo}
) }}
` test('rendering children as function', async () => { const result = await mdx(content, { remarkPlugins: [plugin] }) expect(result).toMatchSnapshot() }) ================================================ FILE: core/remark-docz/src/index.ts ================================================ import * as url from 'url' import generate from '@babel/generator' import t from '@babel/types' import visit from 'unist-util-visit' import remove from 'unist-util-remove' // TODO: create types // match component name by regexp const componentName = (value: any) => { const match = value.match(/^\<\\?(\w+)/) return match && match[1] } // iterate in a reverse way to merge values then delete the unused node const valuesFromNodes = (tree: any) => (first: number, last: number) => { const values = [] if (first !== last) { for (let i = last; i >= first; i--) { const found = tree.children[i] if (found.children && found.children.length > 0) { values.push(...found.children.map((child: any) => child.value)) } if (found.value && found.value.length > 0) { values.push(found.value) } if (i !== first) remove(tree, found) } } return values } const mergeNodeWithoutCloseTag = (tree: any, node: any, idx: any) => { if (!node.value || typeof node.value !== 'string') return // parse component name and create two regexp to check open and close tag const component = componentName(node.value) const tagOpen = new RegExp(`^\\<${component}`) const tagClose = new RegExp(`\\<\\/${component}\\>$`) const hasOpenTag = (val: any) => tagOpen.test(val) const hasCloseTag = (val: any) => tagClose.test(val) const hasJustCloseTag = (val: any) => val && !hasOpenTag(val) && hasCloseTag(val) // return default value is has open and close tag if (!component || (hasOpenTag(node.value) && hasCloseTag(node.value))) { return } // when some node has just the open tag // find node index with equivalent close tag const tagCloseIdx = tree.children.findIndex(({ value, children }: any) => { if (children) return children.some((c: any) => hasJustCloseTag(c.value)) return hasJustCloseTag(value) }) if (tagCloseIdx > -1 && tagCloseIdx !== idx) { // merge all values from node open tag until node with the close tag const mergeUntilCloseTag = valuesFromNodes(tree) const values = mergeUntilCloseTag(idx, tagCloseIdx) node.value = values.reverse().join('\n') } } const createImgSrc = (src: string) => { const parsed = url.parse(src) if (parsed.protocol) { return t.stringLiteral(src) } let { pathname } = parsed as { pathname: string } if (!/^(?:\.[./]+|@)/.test(pathname)) { pathname = `./${pathname}` } return t.jsxExpressionContainer( t.callExpression(t.identifier('require'), [t.stringLiteral(pathname)]) ) } const imageToJsx = (node: any): string => generate( t.jsxOpeningElement( t.jsxIdentifier('img'), [ t.jsxAttribute(t.jsxIdentifier('alt'), t.stringLiteral(node.alt)), t.jsxAttribute(t.jsxIdentifier('src'), createImgSrc(node.url)), ], true ) ).code // turns `html` nodes into `jsx` nodes export default () => (tree: any) => { visit(tree, 'image', (node: any): void => { // check if a node has just open tag node.type = 'jsx' node.value = imageToJsx(node) }) visit(tree, 'jsx', (node: any, idx: any): void => { // check if a node has just open tag mergeNodeWithoutCloseTag(tree, node, idx) }) } ================================================ FILE: core/remark-docz/src/types.d.ts ================================================ declare module 'unist-util-visit' declare module 'unist-util-remove' declare module '@mdx-js/mdx' ================================================ FILE: core/remark-docz/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "dist", "rootDir": "src", "declaration": true, "types": ["node", "jest"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: dev-env/basic/.eslintrc ================================================ // Empty file to disable gatsby linting accordingly to https://www.gatsbyjs.com/docs/how-to/custom-configuration/eslint/#disabling-eslint. // Since the monorepo is already in charge of linting. ================================================ FILE: dev-env/basic/.gitignore ================================================ .docz node_modules src/last-change-timestamp.js ================================================ FILE: dev-env/basic/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **dev-env/basic:** building and running development ([#1646](https://github.com/doczjs/docz/issues/1646)) ([7baaaf2](https://github.com/doczjs/docz/commit/7baaaf2)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) ================================================ FILE: dev-env/basic/README.md ================================================ # Docz development environment Runs a simple docz app that watches and reloads when any core package is changed ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ================================================ FILE: dev-env/basic/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: dev-env/basic/package.json ================================================ { "name": "dev-env-basic", "private": true, "version": "2.4.0", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "2.3.3-alpha.0", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: dev-env/basic/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: dev-env/basic/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: dev-env/basic/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/.eslintrc ================================================ { "extends": ["docz-js"], "overrides": [ { "files": "*.{ts,tsx}", "extends": ["docz-ts"] } ] } ================================================ FILE: examples/basic/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/basic/README.md ================================================ # Basic Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-basic # or yarn create docz-app docz-app-basic ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/basic mv basic docz-basic-example cd docz-basic-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/basic/package.json ================================================ { "name": "docz-example-basic", "version": "2.0.0", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "examples/basic" }, "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/basic/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/basic/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/basic/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/create-react-app/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* .docz ================================================ FILE: examples/create-react-app/README.md ================================================ # create-react-app docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-cra --example create-react-app # or yarn create docz-app docz-app-cra --example create-react-app ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/create-react-app mv create-react-app docz-cra-example cd docz-cra-example ``` ## Setup ```sh yarn # npm i ``` ## Run docz ```sh yarn docz # npm run dev ``` ## Build docz website ```sh yarn docz:build # npm run dev ``` ## Serve docz website ```sh yarn docz:serve ``` This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting ### Analyzing the Bundle Size This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size ### Making a Progressive Web App This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app ### Advanced Configuration This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration ### Deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment ### `npm run build` fails to minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify ================================================ FILE: examples/create-react-app/package.json ================================================ { "name": "docz-example-create-react-app", "version": "2.0.0-rc.43", "private": true, "dependencies": { "docz": "latest", "react": "^16.11.0", "react-dom": "^16.11.0", "react-scripts": "^3.2.0" }, "scripts": { "dev": "docz dev", "docz:build": "docz build", "docz:serve": "docz serve", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: examples/create-react-app/public/index.html ================================================ React App
================================================ FILE: examples/create-react-app/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: examples/create-react-app/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * ================================================ FILE: examples/create-react-app/src/App.css ================================================ .App { text-align: center; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; pointer-events: none; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: examples/create-react-app/src/App.js ================================================ import React from 'react' import logo from './logo.svg' import './App.css' function App() { return (
logo

Edit src/App.js and save to reload.

Learn React
) } export default App ================================================ FILE: examples/create-react-app/src/App.test.js ================================================ import React from 'react' import ReactDOM from 'react-dom' import App from './App' it('renders without crashing', () => { const div = document.createElement('div') ReactDOM.render(, div) ReactDOM.unmountComponentAtNode(div) }) ================================================ FILE: examples/create-react-app/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/create-react-app/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/create-react-app/src/index.css ================================================ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: examples/create-react-app/src/index.js ================================================ import React from 'react' import ReactDOM from 'react-dom' import './index.css' import App from './App' import * as serviceWorker from './serviceWorker' ReactDOM.render(, document.getElementById('root')) // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister() ================================================ FILE: examples/create-react-app/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/create-react-app/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ) export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href) if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js` if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config) // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA' ) }) } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config) } }) } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing if (installingWorker == null) { return } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' ) // Execute callback if (config && config.onUpdate) { config.onUpdate(registration) } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.') // Execute callback if (config && config.onSuccess) { config.onSuccess(registration) } } } } } }) .catch(error => { console.error('Error during service worker registration:', error) }) } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type') if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload() }) }) } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config) } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ) }) } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister() }) } } ================================================ FILE: examples/create-react-app-ts/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* .docz ================================================ FILE: examples/create-react-app-ts/README.md ================================================ # create-react-app with Docz and TypeScript example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-cra --example create-react-app-ts # or yarn create docz-app docz-app-cra --example create-react-app-ts ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/cra mv cra docz-cra-example cd docz-cra-example ``` ## Setup ```sh yarn # npm i ``` ## Run docz ```sh yarn docz # npm run dev ``` ## Build docz website ```sh yarn docz:build # npm run dev ``` ## Serve docz website ```sh yarn docz:serve ``` This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: examples/create-react-app-ts/doczrc.js ================================================ export default { typescript: true, } ================================================ FILE: examples/create-react-app-ts/package.json ================================================ { "name": "create-react-app-ts", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/react": "^16.9.0", "@types/react-dom": "^16.9.0", "docz": "^2.2.0", "react": "^16.12.0", "react-dom": "^16.12.0", "react-scripts": "3.3.1", "typescript": "~3.7.2" }, "scripts": { "docz": "docz dev --port 1337", "docz:build": "docz build", "docz:serve": "docz serve", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: examples/create-react-app-ts/public/index.html ================================================ React App
================================================ FILE: examples/create-react-app-ts/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: examples/create-react-app-ts/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * ================================================ FILE: examples/create-react-app-ts/src/App.css ================================================ .App { text-align: center; } .App-logo { height: 40vmin; pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .App-logo { animation: App-logo-spin infinite 20s linear; } } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: examples/create-react-app-ts/src/App.test.tsx ================================================ import React from 'react'; import { render } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { const { getByText } = render(); const linkElement = getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); }); ================================================ FILE: examples/create-react-app-ts/src/App.tsx ================================================ import React from 'react'; import logo from './logo.svg'; import './App.css'; const App = () => { return (
logo

Edit src/App.tsx and save to reload.

Learn React
); } export default App; ================================================ FILE: examples/create-react-app-ts/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/create-react-app-ts/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/create-react-app-ts/src/index.css ================================================ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } ================================================ FILE: examples/create-react-app-ts/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/create-react-app-ts/src/index.tsx ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render(, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: examples/create-react-app-ts/src/react-app-env.d.ts ================================================ /// ================================================ FILE: examples/create-react-app-ts/src/serviceWorker.ts ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.0/8 are considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); type Config = { onSuccess?: (registration: ServiceWorkerRegistration) => void; onUpdate?: (registration: ServiceWorkerRegistration) => void; }; export function register(config?: Config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL( process.env.PUBLIC_URL, window.location.href ); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl: string, config?: Config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl: string, config?: Config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl, { headers: { 'Service-Worker': 'script' } }) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: examples/create-react-app-ts/src/setupTests.ts ================================================ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom/extend-expect'; ================================================ FILE: examples/create-react-app-ts/tsconfig.json ================================================ { "compilerOptions": { "target": "es5", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react" }, "include": [ "src" ] } ================================================ FILE: examples/custom-base-path/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/custom-base-path/README.md ================================================ # Custom base path docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-custom-base-path --example custom-base-path # or yarn create docz-app docz-app-custom-base-path -- example custom-base-path ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/custom-base-path mv basic docz-custom-base-path-example cd docz-custom-base-path-example ``` ## Notes `base` is added to doczrc and mapped to gatsby's `prefixPaths` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/custom-base-path/doczrc.js ================================================ export default { base: '/base-path/', } ================================================ FILE: examples/custom-base-path/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/custom-base-path/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/custom-base-path/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/custom-base-path/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/custom-config-location/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/custom-config-location/README.md ================================================ # Docz with custom config location example ## Using `create-docz-app` ```sh npx create-docz-app docz-app --example custom-config-location # or yarn create docz-app docz-app --example custom-config-location ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/custom-config-location mv custom-config-location docz-custom-config-location-example cd docz-custom-config-location-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn docz dev --config src/doczrc.js # or yarn dev ``` ## Build ```sh yarn docz build --config src/doczrc.js # or yarn build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/custom-config-location/package.json ================================================ { "name": "docz-example-custom-config-location", "private": true, "version": "2.0.0", "license": "MIT", "scripts": { "dev": "docz dev --config src/doczrc.js", "build": "docz build --config src/doczrc.js", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/custom-config-location/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/custom-config-location/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/custom-config-location/src/doczrc.js ================================================ export default { menu: ['Getting Started', 'ComponentsA', 'ABD'], title: 'My Documentation Title', } ================================================ FILE: examples/custom-config-location/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/flow/.babelrc ================================================ { "presets": ["@babel/preset-flow"] } ================================================ FILE: examples/flow/.flowconfig ================================================ [ignore] /node_modules/** [libs] ./flow-typed ================================================ FILE: examples/flow/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/flow/README.md ================================================ # Flow Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-flow --example flow # or yarn create docz-app docz-app-flow --example flow ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/flow mv flow docz-flow-example cd docz-flow-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/flow/gatsby-node.js ================================================ exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPreset({ name: `@babel/preset-flow`, }) } ================================================ FILE: examples/flow/package.json ================================================ { "name": "docz-example-flow", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", ".babelrc", ".flowconfig", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" }, "devDependencies": { "@babel/preset-flow": "^7.0.0", "flow-bin": "^0.102.0", "flow-typed": "^2.6.0" } } ================================================ FILE: examples/flow/src/components/Alert.jsx ================================================ // @flow import React from 'react' import styled from '@emotion/styled' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } type Kind = 'info' | 'positive' | 'negative' | 'warning' type AlertProps = { /** * Set this to change alert kind */ kind: Kind, } const AlertStyled = styled('div')` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` export const Alert = ({ kind = 'info', ...props }: AlertProps) => ( ) ================================================ FILE: examples/flow/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from "docz"; import { Alert } from "./Alert"; # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/flow/src/components/Button.jsx ================================================ // @flow import React from 'react' import styled from '@emotion/styled' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = outline => (bg, color) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } const kinds = outline => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } const getScale = ({ scale = 'normal' }) => scales[scale] const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] const ButtonStyled = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` type ButtonProps = { scale: 'small' | 'normal' | 'big', kind: 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray', outline: boolean, children: Node, } export const Button = ({ scale = 'normal', kind = 'primary', outline = false, children, }: ButtonProps) => ( {children} ) ================================================ FILE: examples/flow/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/flow/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/gatsby/.gitignore ================================================ .docz/ # gatsby files .cache/ public # dependencies node_modules ================================================ FILE: examples/gatsby/README.md ================================================ # Docz Gatsby Example This example shows you how you can use docz as a [Gatsby Theme](https://www.gatsbyjs.org/blog/2018-11-11-introducing-gatsby-themes/) inside your project. ## Using `create-docz-app` ```sh npx create-docz-app docz-app-gatsby --example gatsby # or yarn create docz-app docz-app-gatsby --example gatsby ``` ## Download ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/gatsby mv gatsby docz-gatsby-example cd docz-gatsby-example ``` ## Setup ```sh yarn # npm i ``` ## Start developing ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/gatsby/doczrc.js ================================================ export default { menu: ['Home', 'Components'], } ================================================ FILE: examples/gatsby/gatsby-config.js ================================================ module.exports = { plugins: [ 'gatsby-theme-docz', `gatsby-transformer-sharp`, // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // `gatsby-plugin-offline`, ], } ================================================ FILE: examples/gatsby/package.json ================================================ { "name": "docz-example-gatsby", "private": true, "description": "Example of how to integrate docz with gatsby as a theme", "version": "2.0.0-rc.41", "keywords": [ "gatsby", "docz" ], "license": "MIT", "bugs": { "url": "https://github.com/pedronauck/docz/issues" }, "repository": { "type": "git", "url": "https://github.com/pedronauck/docz.git" }, "scripts": { "dev": "gatsby develop", "build": "gatsby build", "serve": "gatsby serve" }, "dependencies": { "docz": "^2.0.0-rc.76", "gatsby": "^2.13.73", "gatsby-plugin-offline": "^2.2.7", "gatsby-plugin-sharp": "^2.2.18", "gatsby-theme-docz": "latest", "gatsby-transformer-sharp": "^2.2.7", "prop-types": "^15.7.2", "react": "^16.9.0", "react-dom": "^16.9.0", "react-helmet-async": "^1.0.4" } } ================================================ FILE: examples/gatsby/src/components/Alert.jsx ================================================ import React from 'react' import styled from '@emotion/styled' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = styled.div` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` export const Alert = props => Alert.propTypes = { /** `info`, `positive`, `negative`, or `warning` */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/gatsby/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some messages ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/gatsby/src/components/Button.jsx ================================================ import React from 'react' import styled from '@emotion/styled' import t from 'prop-types' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = outline => (bg, color) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } const kinds = outline => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } const getScale = ({ scale = 'normal' }) => scales[scale] const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] const ButtonStyled = styled.button` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` export const Button = ({ children, ...props }) => ( {children} ) Button.propTypes = { scales: t.oneOf(['small', 'normal', 'big']), kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), outline: t.bool, } Button.defaultProps = { scales: 'normal', kind: 'primary', outline: false, } ================================================ FILE: examples/gatsby/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button' # Button Button make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/gatsby/src/pages/404.js ================================================ import React from 'react' const NotFoundPage = () => ( <>

NOT FOUND

You just hit a route that doesn't exist... the sadness.

) export default NotFoundPage ================================================ FILE: examples/gatsby/src/pages/index.mdx ================================================ --- name: Home route: / --- # Home Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/images/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/images/README.md ================================================ # Docz with images example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-images --example images # or yarn create docz-app docz-app-images --example images ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/images mv images docz-images-example cd docz-images-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/images/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/images/package.json ================================================ { "private": true, "name": "docz-example-images", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/images/src/index.jsx ================================================ import React from 'react' export default function Image() { return } ================================================ FILE: examples/images/src/index.mdx ================================================ --- name: Getting Started route: / --- # Tux Tux is a penguin character and the official brand character of the Linux kernel.[1] Originally created as an entry to a Linux logo competition, Tux is the most commonly used icon for Linux, although different Linux distributions depict Tux in various styles. The character is used in many other Linux programs and as a general symbol of Linux. An image of Tux can be resolved directly in markdown ![Tux](../public/tux.png) It can also be resolved using explicit relative paths ![Tux](../public/tux.png) Images may also link to external URLs. For example, the following image is downloaded from Wikipedia ![Tux original](https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png) To link to your images from your components add a `public` directory and store in it your images. Then, in your code, link to your image (tux.png) by pointing to `/public`, for example : ```jsx ``` You can also customise the public folder to be anything you want by changing the `public` field in your `doczrc.js` file. import Image from './index.jsx' ================================================ FILE: examples/less/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/less/README.md ================================================ # less Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-less --example less # or yarn create docz-app docz-app-less --example less ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/less mv less docz-less-example cd docz-less-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/less/doczrc.js ================================================ export default { title: 'Docz Less', menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/less/gatsby-config.js ================================================ module.exports = { plugins: ['gatsby-plugin-less'], } ================================================ FILE: examples/less/package.json ================================================ { "private": true, "name": "docz-example-less", "version": "2.0.0-rc.52", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "latest", "gatsby-plugin-less": "3.0.9", "less": "3.10.3", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/less/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' import './Alert.less' export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/less/src/components/Alert.less ================================================ .Alert { padding: 1rem; margin: 1rem; border-radius: 0.25rem; } ================================================ FILE: examples/less/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/less/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/logo-in-sidebar/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/logo-in-sidebar/README.md ================================================ # Logo In Sidebar Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-logo-in-sidebar --example logo-in-sidebar # or yarn create docz-app docz-app-logo-in-sidebar --example logo-in-sidebar ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/logo-in-sidebar mv logo-in-sidebar docz-logo-in-sidebar-example cd docz-logo-in-sidebar-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/logo-in-sidebar/package.json ================================================ { "name": "docz-example-logo-in-sidebar", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "next", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/logo-in-sidebar/src/components/Alert.jsx ================================================ import React from "react"; import t from "prop-types"; const kinds = { info: "#5352ED", positive: "#2ED573", negative: "#FF4757", warning: "#FFA502" }; export const Alert = ({ children, kind, ...rest }) => (
{children}
); Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(["info", "positive", "negative", "warning"]) }; Alert.defaultProps = { kind: "info" }; ================================================ FILE: examples/logo-in-sidebar/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/logo-in-sidebar/src/gatsby-theme-docz/components/Header/index.js ================================================ export const Header = () => { return null; }; ================================================ FILE: examples/logo-in-sidebar/src/gatsby-theme-docz/components/Sidebar/index.js ================================================ /** @jsx jsx */ import { Fragment, forwardRef, useState, useRef, useEffect } from 'react' import { Global } from "@emotion/react"; import { jsx, Box } from "theme-ui"; import { useMenus, useCurrentDoc } from "docz"; import * as styles from 'gatsby-theme-docz/src/components/Sidebar/styles' import { NavSearch } from 'gatsby-theme-docz/src/components/NavSearch' import { NavLink } from 'gatsby-theme-docz/src/components/NavLink' import { NavGroup } from 'gatsby-theme-docz/src/components/NavGroup' export const Sidebar = forwardRef(function Sidebar(props, ref) { const [query, setQuery] = useState('') const menus = useMenus({ query }) const currentDoc = useCurrentDoc() const currentDocRef = useRef() const handleChange = ev => { setQuery(ev.target.value) } useEffect(() => { if (ref.current && currentDocRef.current) { ref.current.scrollTo(0, currentDocRef.current.offsetTop) } }, []) return ( {props.open && } {menus && menus.map(menu => { if (!menu.route) return if (menu.route === currentDoc.route) { return ( {menu.name} ) } return ( {menu.name} ) })} ) }) ================================================ FILE: examples/logo-in-sidebar/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/material-ui/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/material-ui/README.md ================================================ # Docz example with material-ui ## Using `create-docz-app` ```sh npx create-docz-app docz-app-basic --example material-ui # or yarn create docz-app docz-app-basic --example material-ui ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/material-ui mv material-ui docz-material-ui-example cd docz-material-ui-example ``` ## Setup In package.json : ```diff - "//postinstall": "patch-package" + "postinstall": "patch-package" ``` ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/material-ui/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/material-ui/home.mdx ================================================ --- name: Hello world route: / --- # Hello world Hello, I'm a mdx file! import Button from "@material-ui/core/Button"; import {Playground} from 'docz' ### Material UI Button ================================================ FILE: examples/material-ui/package.json ================================================ { "name": "docz-example-material-ui", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "@material-ui/core": "^4.4.0", "docz": "latest", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/monorepo/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo/README.md ================================================ # Docz Gatsby Mono Repo Example This example shows you how you can use docz at the root of your monorepo. ## Using `create-docz-app` ```sh npx create-docz-app docz-app-monorepo --example monorepo # or yarn create docz-app docz-app-monorepo --example monorepo ``` ## Download ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/monorepo mv monorepo docz-monorepo-example cd docz-monorepo-example ``` ## Setup ```sh yarn # npm i ``` ## Start developing ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ================================================ FILE: examples/monorepo/lerna.json ================================================ { "lerna": "3.16.4", "packages": ["packages/*"], "version": "1.0.0" } ================================================ FILE: examples/monorepo/package.json ================================================ { "private": true, "workspaces": [ "packages/*" ], "name": "docz-gatsby-monorepo", "version": "2.0.0-rc.41", "description": "", "main": "index.js", "scripts": { "build": "yarn docz build", "dev": "yarn docz dev", "serve": "yarn docz serve" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "lerna": "^3.16.4" }, "dependencies": { "docz": "2.0.0-rc.52", "react": "^16.10.1", "react-dom": "^16.10.1" } } ================================================ FILE: examples/monorepo/packages/basic/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo/packages/basic/README.md ================================================ # Basic Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-basic # or yarn create docz-app docz-app-basic ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/basic mv basic docz-basic-example cd docz-basic-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/monorepo/packages/basic/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "universal-console": "^0.1.3" } } ================================================ FILE: examples/monorepo/packages/basic/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/monorepo/packages/basic/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/monorepo/packages/basic/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/monorepo-package/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo-package/README.md ================================================ # Docz Gatsby Mono Repo Example This example shows you how you can use docz inside individual packages in a monorepo. ## Using `create-docz-app` ```sh npx create-docz-app docz-app-monorepo --example monorepo-package # or yarn create docz-app docz-app-monorepo --example monorepo-package ``` ## Download ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/monorepo-package mv monorepo-package docz-monorepo-example cd docz-monorepo-example ``` ## Setup ```sh yarn # npm i ``` ## Start developing ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ================================================ FILE: examples/monorepo-package/lerna.json ================================================ { "lerna": "3.16.4", "packages": ["packages/*"], "version": "1.0.0" } ================================================ FILE: examples/monorepo-package/package.json ================================================ { "private": true, "workspaces": [ "packages/*" ], "name": "docz-gatsby-monorepo", "version": "2.0.0-rc.41", "description": "", "main": "index.js", "scripts": { "build": "cd packages/basic && yarn build", "dev": "cd packages/basic && yarn dev", "serve": "cd packages/basic && yarn serve" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "lerna": "^3.16.4" }, "dependencies": {} } ================================================ FILE: examples/monorepo-package/packages/basic/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo-package/packages/basic/README.md ================================================ # Basic Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-basic # or yarn create docz-app docz-app-basic ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/basic mv basic docz-basic-example cd docz-basic-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/monorepo-package/packages/basic/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/monorepo-package/packages/basic/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "universal-console": "^0.1.3" } } ================================================ FILE: examples/monorepo-package/packages/basic/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/monorepo-package/packages/basic/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/monorepo-package/packages/basic/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/monorepo-separate-docs/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo-separate-docs/README.md ================================================ # Docz Monorepo with Separate Docs Package Example This example shows how to use docz in a monorepo package to document other peer packages. The `Alert` component in `packages/alert` is documented by the `packages/docs` `docz` package. ## Using `create-docz-app` ```sh npx create-docz-app docz-app-monorepo-separate-docs --example monorepo-separate-docs # or yarn create docz-app docz-app-monorepo-separate-docs --example monorepo-separate-docs ``` ## Download ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/monorepo-separate-docs mv monorepo-separate-docs docz-monorepo-separate-docs-example cd docz-monorepo-separate-docs-example ``` ## Notes In `docs/doczrc.js` : - `docgenConfig.searchPath` is set to `packages/` - The `filterComponents` function passed to docz allows the index.js file to be processed in `packages/alert/index.js` ## Setup ```sh yarn # npm i ``` ## Start developing ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/monorepo-separate-docs/lerna.json ================================================ { "lerna": "3.16.4", "packages": ["packages/*"], "version": "1.0.0" } ================================================ FILE: examples/monorepo-separate-docs/package.json ================================================ { "private": true, "workspaces": { "packages": [ "packages/*" ] }, "name": "docz-gatsby-monorepo-separate-docs-package", "version": "2.0.0-rc.58", "description": "", "main": "index.js", "scripts": { "build": "cd packages/docs && yarn run build", "dev": "cd packages/docs && yarn run dev", "serve": "cd packages/docs && yarn run serve" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "lerna": "^3.16.4" }, "dependencies": {} } ================================================ FILE: examples/monorepo-separate-docs/packages/alert/README.md ================================================ # Alert component Usage is documented in `packages/docs`. ## Setup ```sh yarn # npm i ``` ## Develop ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/monorepo-separate-docs/packages/alert/example/index.html ================================================ Playground
================================================ FILE: examples/monorepo-separate-docs/packages/alert/example/index.js ================================================ import React from 'react' import ReactDOM from 'react-dom' import Alert from '../index' const App = () => Hello ReactDOM.render(, document.getElementById('root')) ================================================ FILE: examples/monorepo-separate-docs/packages/alert/index.js ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } export default Alert ================================================ FILE: examples/monorepo-separate-docs/packages/alert/package.json ================================================ { "name": "alert", "version": "1.0.0", "main": "index.js", "license": "MIT", "scripts": { "dev": "parcel example/index.html", "start": "npm run dev" }, "dependencies": { "react": "^16.10.2", "react-dom": "^16.10.2" }, "devDependencies": { "parcel": "^1.12.4" } } ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/.gitignore ================================================ .rts2_cache_* ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/README.md ================================================ # Alert TypeScript Component Usage is documented in `packages/docs`. ## Setup ```sh yarn # npm i ``` ## Develop ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/example/index.html ================================================ Playground
================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/example/index.js ================================================ import React from 'react' import ReactDOM from 'react-dom' import Alert from '../' const App = () => Hello ReactDOM.render(, document.getElementById('root')) ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/package.json ================================================ { "name": "alert-ts", "version": "1.0.0", "source": "src/index.tsx", "main": "dist/index.js", "module": "dist/index.mjs", "unpkg": "dist/index.umd.js", "scripts": { "build": "microbundle", "dev": "yarn microbundle && concurrently \"yarn microbundle watch\" \"yarn parcel example/index.html --open\"" }, "license": "MIT", "dependencies": { "react": "^16.10.2", "react-dom": "^16.10.2" }, "files": [ "dist/*" ], "devDependencies": { "concurrently": "^5.0.0", "microbundle": "^0.11.0", "parcel": "^1.12.4" } } ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/src/index.tsx ================================================ import React, { FC } from 'react' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } type Kind = keyof typeof kinds interface Props { kind: Kind } const AlertStyled: FC = ({ children, kind, ...rest }) => (
{children}
) const Alert: FC = props => Alert.defaultProps = { kind: 'info', } export default Alert ================================================ FILE: examples/monorepo-separate-docs/packages/alert-ts/tsconfig.json ================================================ { "compilerOptions": { "target": "es5", "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, "declaration": true, "sourceMap": true, "rootDir": "./", "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "baseUrl": "./", "paths": { "*": ["src/*", "node_modules/*"] }, "jsx": "react", "esModuleInterop": true } } ================================================ FILE: examples/monorepo-separate-docs/packages/docs/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/monorepo-separate-docs/packages/docs/README.md ================================================ # Monorepo Docs This package uses `mdx` and `docz` to document the other packages in the monorepo. ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/monorepo-separate-docs/packages/docs/doczrc.js ================================================ export default { typescript: true, docgenConfig: { searchPath: '../', }, filterComponents: files => { return files.filter( filepath => /\/[A-Z]\w*\.(js|jsx|ts|tsx)$/.test(filepath) || filepath.includes('/alert/index.js') || filepath.includes('/alert-ts/src/index.tsx') ) }, } ================================================ FILE: examples/monorepo-separate-docs/packages/docs/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "alert": "1.0.0", "alert-ts": "1.0.0", "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "universal-console": "^0.1.3" } } ================================================ FILE: examples/monorepo-separate-docs/packages/docs/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import Alert from 'alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/monorepo-separate-docs/packages/docs/src/index.mdx ================================================ --- name: Getting Started route: / --- import Alert from 'alert' import { Props } from 'docz' ## Alert Hello import AlertTS from 'alert-ts/src/' ## Alert TypeScript Hello ================================================ FILE: examples/monorepo-separate-docs/packages/docs/tsconfig.json ================================================ { "include": ["../alert-ts/src/"], "compilerOptions": { "target": "es5", "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, "declaration": true, "sourceMap": true, "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", "esModuleInterop": true } } ================================================ FILE: examples/now/.gitignore ================================================ public node_modules .docz ================================================ FILE: examples/now/README.md ================================================ # Docz Now Deployment example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-now --example now # or yarn create docz-app docz-app-now --example now ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/now mv now docz-example-now docz-example-now ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ## Deploy ```sh yarn deploy ``` Note that by default `docz` generates the output site in `.docz/public` to change that add a `dest` field to your `doczrc.js` with the path you want to generate the code in. ================================================ FILE: examples/now/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/now/now.json ================================================ { "builds": [{ "src": ".docz/public/**", "use": "@now/static" }], "routes": [{ "src": "/(.*)", "dest": ".docz/public/$1" }] } ================================================ FILE: examples/now/package.json ================================================ { "private": true, "name": "docz-example-now", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "//": "temporary hack below fixed with next docz version. Used for running docz on CI", "dev:once": "npx kill-port 3000 && (npm run dev &) && npx wait-on http-get://localhost:3000 && npx kill-port 3000", "build": "npm run dev:once && docz build", "deploy": "npm run build && now" }, "dependencies": { "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" }, "devDependencies": { "now": "^16.1.2" } } ================================================ FILE: examples/now/src/components/Alert.jsx ================================================ import React from 'react' import styled from '@emotion/styled' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = styled('div')` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/now/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/now/src/components/Button.jsx ================================================ import React from 'react' import styled from '@emotion/styled' import t from 'prop-types' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = outline => (bg, color) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } const kinds = outline => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } const getScale = ({ scale = 'normal' }) => scales[scale] const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] const ButtonStyled = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` export const Button = ({ children, ...props }) => ( {children} ) Button.propTypes = { /** * This is a pretty good description for this prop * Button type. Learn more about `type` attribute [at MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */ type: t.oneOf(['button', 'submit', 'reset']), /** * This is a __pretty good__ description for this prop */ scales: t.oneOf(['small', 'normal', 'big']), kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), outline: t.bool.isRequired, } Button.defaultProps = { scales: 'normal', kind: 'primary', outline: false, } ================================================ FILE: examples/now/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/now/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/react-native/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/react-native/README.md ================================================ ## Docz React Native Use your React Native components inside docz > We will use [react-native-web](https://github.com/necolas/react-native-web) to make this integration possible. > So you might face some issues if you use other react-native modules. > Usually, many react-native modules have a web alternative, make sure to alias them too. ## Installation These packages are required to use React Native with docz: ```bash $ yarn add react-native-web react-art ``` Then alias `react-native` to `react-native-web` ```js // gatsby-node.js exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { alias: { 'react-native': 'react-native-web', }, }, }) } ``` ================================================ FILE: examples/react-native/doczrc.js ================================================ export default { title: 'React Native', } ================================================ FILE: examples/react-native/gatsby-node.js ================================================ exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { alias: { 'react-native': 'react-native-web', }, }, }) } ================================================ FILE: examples/react-native/package.json ================================================ { "private": true, "name": "docz-example-react-native", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-art": "^16.8.6", "react-dom": "^16.8.6", "react-native-web": "^0.11.7" }, "devDependencies": { "@babel/core": "^7.5.5" } } ================================================ FILE: examples/react-native/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' import { View, Text } from 'react-native' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => ( {children} ) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/react-native/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/react-native/src/index.mdx ================================================ --- name: Getting Started route: / order: 1 --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/react-router/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/react-router/README.md ================================================ # Basic Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-react-router --example react-router # or yarn create docz-app docz-app-react-router --example react-router ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/react-router mv react-router docz-react-router-example cd docz-react-router-example ``` ## Description A simple docz demo with react router. Note the file in `src/gatsby-theme-docz/wrapper.js`. It wraps the page with a Router to allow the usage of things like `Route` and `Link` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/react-router/package.json ================================================ { "name": "docz-example-react-router", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "react-router-dom": "^5.0.1" } } ================================================ FILE: examples/react-router/src/components/Alert.jsx ================================================ import React from "react"; import t from "prop-types"; import { Link } from "react-router-dom"; const kinds = { info: "#5352ED", positive: "#2ED573", negative: "#FF4757", warning: "#FFA502" }; const AlertStyledWithLink = ({ children, kind, ...rest }) => (
{children}
); export const Alert = props => ; Alert.propTypes = { kind: t.oneOf(["info", "positive", "negative", "warning"]) }; Alert.defaultProps = { kind: "info" }; ================================================ FILE: examples/react-router/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/react-router/src/gatsby-theme-docz/wrapper.js ================================================ import React from 'react' import { MemoryRouter } from 'react-router-dom' // eslint-disable-next-line react/display-name export default ({ children }) => { return {children} } ================================================ FILE: examples/react-router/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/sass/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/sass/README.md ================================================ # Sass Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-sass --example sass # or yarn create docz-app docz-app-sass --example sass ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/sass mv sass docz-sass-example cd docz-sass-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/sass/doczrc.js ================================================ export default { title: 'Docz Sass', menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/sass/gatsby-config.js ================================================ module.exports = { plugins: ['gatsby-plugin-sass'], } ================================================ FILE: examples/sass/package.json ================================================ { "private": true, "name": "docz-example-sass", "version": "2.0.0-rc.52", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "latest", "gatsby-plugin-sass": "2.1.17", "node-sass": "4.12.0", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/sass/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' import './Alert.scss' export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/sass/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/sass/src/components/Alert.scss ================================================ .Alert { padding: 1rem; margin: 1rem; border-radius: 0.25rem; } ================================================ FILE: examples/sass/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/shadowed-playground/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/shadowed-playground/README.md ================================================ # Shadowed Playground Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-shadowed-playground # or yarn create docz-app docz-app-shadowed-playground ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/shadowed-playground mv shadowed-playground docz-shadowed-playground-example cd docz-shadowed-playground-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/shadowed-playground/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/shadowed-playground/package.json ================================================ { "name": "docz-example-shadowed-playground", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/shadowed-playground/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/shadowed-playground/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/shadowed-playground/src/gatsby-theme-docz/components/Playground/index.js ================================================ import React from 'react' import { Playground as OriginalPlayground } from 'gatsby-theme-docz/src/components/Playground/index' export const Playground = props => { return (
) } ================================================ FILE: examples/shadowed-playground/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/styled-components/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/styled-components/README.md ================================================ # Docz Styled Components Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-styled-docz --example styled-components # or yarn create docz-app docz-app-styled-docz --example styled-components ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/styled-components mv styled-components docz-example-styled-docz ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ## Deploy ```sh yarn deploy ``` Note that by default `docz` generates the output site in `.docz/public` to change that add a `dest` field to your `doczrc.js` with the path you want to generate the code in. ================================================ FILE: examples/styled-components/package.json ================================================ { "private": true, "name": "docz-example-styled-components", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "next", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "styled-components": "^4.3.2" } } ================================================ FILE: examples/styled-components/src/components/Alert.jsx ================================================ import React from 'react' import styled from 'styled-components' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = styled('div')` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/styled-components/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/styled-components/src/components/Button.jsx ================================================ import React from 'react' import styled from 'styled-components' import t from 'prop-types' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = outline => (bg, color) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } const kinds = outline => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } const getScale = ({ scale = 'normal' }) => scales[scale] const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] export const Button = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` Button.propTypes = { scales: t.oneOf(['small', 'normal', 'big']), kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), outline: t.bool, } Button.defaultProps = { scales: 'normal', kind: 'primary', outline: false, } ================================================ FILE: examples/styled-components/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/styled-components/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/stylus/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/stylus/README.md ================================================ # stylus Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-stylus --example stylus # or yarn create docz-app docz-app-stylus --example stylus ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/stylus mv stylus docz-stylus-example cd docz-stylus-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/stylus/doczrc.js ================================================ export default { title: 'Docz Stylus', menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/stylus/gatsby-config.js ================================================ module.exports = { plugins: ['gatsby-plugin-stylus'], } ================================================ FILE: examples/stylus/package.json ================================================ { "private": true, "name": "docz-example-stylus", "version": "2.0.0-rc.52", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "latest", "gatsby-plugin-stylus": "2.1.11", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/stylus/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' import './Alert.styl' export const Alert = ({ children, kind, ...rest }) => ( // space used after alert in order to have kind remain as a separate name
{children}
) Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/stylus/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/stylus/src/components/Alert.styl ================================================ .Alert { padding: .5rem margin: 1rem border-radius: 0.25rem background-color: white &.info { color: white background-color: #5352ED } &.positive { background-color: #2ED573 } &.negative { background-color: #FF4757 } &.warning { background-color: #FFA502 } } ================================================ FILE: examples/stylus/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/typescript/README.md ================================================ # Typescript Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-typescript --example typescript # or yarn create docz-app docz-app-typescript --example typescript ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/typescript mv typescript docz-typescript-example cd docz-typescript-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ================================================ FILE: examples/typescript/doczrc.js ================================================ export default { typescript: true, } ================================================ FILE: examples/typescript/package.json ================================================ { "private": true, "name": "docz-example-typescript", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "tsconfig.json", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "docz": "latest", "react": "^16.8.6", "react-dom": "^16.8.6" }, "devDependencies": { "@types/react": "^16.8.23", "@types/react-dom": "^16.8.4" } } ================================================ FILE: examples/typescript/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert.tsx' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/typescript/src/components/Alert.tsx ================================================ import React, { FC } from 'react' export type Kind = 'info' | 'positive' | 'negative' | 'warning' export type KindMap = Record const kinds: KindMap = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export interface AlertProps { /** * Set this to change alert kind * @default info */ kind: 'info' | 'positive' | 'negative' | 'warning' } export const Alert: FC = ({ children, kind, ...rest }) => (
{children}
) ================================================ FILE: examples/typescript/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button.tsx' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/typescript/src/components/Button.tsx ================================================ import React, { FC } from 'react' import styled from '@emotion/styled' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = (outline: boolean) => (bg: string, color: string) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } type Kind = 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray' type Kinds = Record const kinds = (outline: boolean): Kinds => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } export interface ButtonProps { scale: 'small' | 'normal' | 'big'; kind: 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray'; outline: boolean; } const getScale = ({ scale = 'normal' }: ButtonProps) => scales[scale] const getKind = ({ kind = 'primary', outline = false }: ButtonProps) => kinds(outline)[kind] const ButtonStyled = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` export const Button: FC = ({ children, ...props }) => ( {children} ) ================================================ FILE: examples/typescript/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/typescript/tsconfig.json ================================================ { "compilerOptions": { "target": "es2015", "moduleResolution": "node", "strict": true, "resolveJsonModule": true, "esModuleInterop": true, "skipLibCheck": false, "noEmit": true, "jsx": "react" } } ================================================ FILE: examples/webpack-alias/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/webpack-alias/README.md ================================================ # Docz example with webpack aliases ## Using `create-docz-app` ```sh npx create-docz-app docz-app-webpack-alias --example webpack-alias # or yarn create docz-app docz-app-webpack-alias --example webpack-alias ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/webpack-alias mv webpack-alias docz-webpack-alias-example cd docz-webpack-alias-example ``` ## Notes To configure the webpack config we add a `gatsby-node.js` file and export `onCreateWebpackConfig`. More info here : https://www.gatsbyjs.org/docs/add-custom-webpack-config/ For this example, files inside `./src/` can be accessed with an absolute path. For example instead of doing `import A from './src/components/Alert` you can do `import A from 'components/Alert'`. Another alias is set in place to map files in `./src/components/` to `@`. For example instead of doing `import A from './src/components/Alert` you can do `import A from '@/Alert'`. ```js // gatsby-node.js const path = require('path') exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { // Note the '..' in the path because the docz gatsby project lives in the `.docz` directory modules: [path.resolve(__dirname, '../src'), 'node_modules'], alias: { '@': path.resolve(__dirname, '../src/components/'), }, }, }) } ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/webpack-alias/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/webpack-alias/gatsby-node.js ================================================ const path = require('path') exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { modules: [path.resolve(__dirname, '../src'), 'node_modules'], alias: { '@': path.resolve(__dirname, '../src/components/'), }, }, }) } ================================================ FILE: examples/webpack-alias/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/webpack-alias/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => export default Alert Alert.propTypes = { /** * Used to set the color of the alert */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/webpack-alias/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' // import Alert from 'components/Alert' import Alert from '@/Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/webpack-alias/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-algolia-search/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-algolia-search/README.md ================================================ # Docz with Algolia Search example - [Using `create-docz-app`](#using-create-docz-app) - [Download manually](#download-manually) - [Setup](#setup) - [Add your Algolia Credentials](#add-your-algolia-credentials) - [Send Data Parsed from your MDX Files to Algolia](#send-data-parsed-from-your-mdx-files-to-algolia) - [Run](#run) - [Build](#build) - [Serve built app](#serve-built-app) - [Credits](#credits) ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-algolia-search --example with-algolia-search # or yarn create docz-app docz-app-with-algolia-search --example with-algolia-search ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-algolia-search mv with-algolia-search docz-with-algolia-search-example cd docz-with-algolia-search-example ``` ## Setup ### Add your Algolia Credentials Start by adding your Algolia credentials to a .env file, which you shouldn't commit. If you track this in your file, and especially if the site is open source, you will leak your admin API key. This would mean anyone is able to change anything on your Algolia index. Rename .env.example to .env and fill in the values with your algolia keys that you can find here : https://www.algolia.com/api-keys ```sh # // .env.example # rename this file to .env and supply the values listed below # warning: variables prexifed with GATSBY_ will be made available to client-side code # be careful not to expose sensitive data (in this case your Algolia admin key ALGOLIA_ADMIN_KEY) GATSBY_ALGOLIA_INDEX_NAME=insertValue GATSBY_ALGOLIA_APP_ID=insertValue GATSBY_ALGOLIA_SEARCH_KEY=insertValue ALGOLIA_ADMIN_KEY=insertValue ``` ```sh yarn # npm i ``` ## Send Data Parsed from your MDX Files to Algolia Data is sent to Algolia only when you build your site. Run the build command ```sh yarn build ``` Now, if you open your algolia dashboard you should see a new index with the name you provided for `ALGOLIA_INDEX_NAME` in your .env file ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ## Credits The excellent tutorial on integrating Algolia with Gatsby : https://www.gatsbyjs.org/docs/adding-search-with-algolia/ was a huge help in preparing this example. The UI components are heavily inspired by the ones provided there. If you want to learn more about integrating Algolia make sure to read it ! ================================================ FILE: examples/with-algolia-search/gatsby-config.js ================================================ require('dotenv').config() const get = require('lodash/get') const merge = require('lodash/merge') const query = ` { allMdx { edges { node { excerpt(pruneLength: 5000) } } } allDoczEntries { edges { node { objectID: id filepath route name } } } } ` // List of attributes to snippet, with an optional maximum number of words to snippet. const settings = { attributesToSnippet: [`excerpt:20`] } const queries = [ { query: query, transformer: gqlResponse => { const allMdx = get(gqlResponse, 'data.allMdx.edges', []).map( ({ node }) => node ) const allDoczEntries = get( gqlResponse, 'data.allDoczEntries.edges', [] ).map(({ node }) => node) const records = merge(allMdx, allDoczEntries) return records }, settings, }, ] module.exports = { plugins: [ { resolve: `gatsby-plugin-algolia`, options: { appId: process.env.GATSBY_ALGOLIA_APP_ID, apiKey: process.env.ALGOLIA_ADMIN_KEY, indexName: process.env.GATSBY_ALGOLIA_INDEX_NAME, queries, chunkSize: 10000, // default: 1000 }, }, ], } ================================================ FILE: examples/with-algolia-search/package.json ================================================ { "name": "docz-with-algolia-example", "private": true, "version": "2.0.0", "license": "MIT", "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "algoliasearch": "^3.35.1", "docz": "latest", "dotenv": "^8.2.0", "gatsby-plugin-algolia": "^0.5.0", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0", "react-instantsearch-dom": "^6.0.0", "styled-components": "^4.4.1", "styled-icons": "^9.0.1" } } ================================================ FILE: examples/with-algolia-search/src/docs/customizing/add-favicon-and-metadata.mdx ================================================ --- name: Add Favicon and Metadata route: /docs/add-favicon-and-metadata parent: Documentation menu: Customizing --- # Add favicon and metadata Adding metadata to your site is done by configuring Gatsby in combination with [`react-helmet-async`](https://github.com/staylor/react-helmet-async) [**source @ gatsby**](https://www.gatsbyjs.org/docs/add-page-metadata/). > Please note that we're referencing `react-helmet-async`, and not `react-helmet`. This is because of [this issue](https://github.com/nfl/react-helmet/issues/426). `react-helmet-async` is an API-compatible fork, so you shouldn't need to do anything except importing from a different package. ### Shadowing the Wrapper-component The metadata is set up in a file called `wrapper.js` which lives in docz theme package: `gatsby-theme-docz`. To override it we need to [Shadow the component](https://www.gatsbyjs.org/blog/2019-04-29-component-shadowing/), which means that we need to create a copy of the file with the "same" file path and name in our own `src`-directory. 1. Create a file called `wrapper.js` in `src/gatsby-theme-docz`. Then path is important. 2. Paste the following content and edit it to your liking ```js import React from 'react' import { Helmet } from 'react-helmet-async' const Wrapper = ({ children }) => <> My Shadow! {children} export default Wrapper ``` If you rebuild your site now it should use this component as a wrapper instead of the themes component. ================================================ FILE: examples/with-algolia-search/src/docs/customizing/component-shadowing.mdx ================================================ --- name: Component Shadowing route: /docs/component-shadowing parent: Documentation menu: Customizing --- # Component Shadowing All components that comes with the standard theme `gatsby-theme-docz` can be [**shadowed**](https://www.gatsbyjs.org/blog/2019-04-29-component-shadowing/). This means that you can supply your own component that will shadow/override the themes component. This is done by placing a component with the same name as the themes component in the "same filepath" as the original component. For example if you want to shadow the `Logo`-component you would have to have the following structure in your folder: ``` your-site └── src └── gatsby-theme-docz └── components └── Logo └──index.js ``` If it has the matching folder structure and name the theme component will be shadowed and you can freely edit. ================================================ FILE: examples/with-algolia-search/src/docs/customizing/creating-your-themes.mdx ================================================ --- name: Creating your themes route: /docs/creating-your-themes parent: Documentation menu: Customizing --- # Creating your themes One of the main features of Docz is that it allows you to create your own theme from scratch and just use the data parsed from Docz. We provide a bunch of components that can help you create your own theme with little effort. Let's assume we have the following project structure : ``` pages/ hello-world.mdx src/ gatsby-theme-docz/ index.js ui/ Page.js doczrc.js package.json ``` The previous way of customizing docz in v0 and v1 was to use the `theme` property inside the `doczrc.js` file. With v2, we leverage GatsbyJS theme shadowing to override any and all files of the theme. For example, to create a new theme wrapper and override some styles, we create a file located at `src/gatsby-theme-docz/index.js` that shadows [gatsby-theme-docz/src/index.js](https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/index.js) and provide a new theme container implementation as shown below. ## Creating your theme component Create your theme component that takes in `children` as props and export it as default while using the [`theme()`](/docs/components-api) high order component as an enhancer. ```js // src/gatsby-theme-docz/index.js import React from 'react' import { theme } from 'docz' const Theme = ({ children }) =>
{children}
export default theme()(Theme) ``` > It's required to "pass down" the `children` property inside your theme component in order to render Docz routes properly. If you create something like the above example you won't have anything too useful to show. To customize your documentation make sure to check the [gatsby-docz-theme](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz/src) source code to decide which modules you want to override. ## Default theme configuration Each theme has its own default `themeConfig` object that allows you to override any part of the default theme found [here](https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/theme/index.js). The `themeConfig` allows you to customize fonts, colors, spaces, styles properties and other project global variables. ```js // src/gatsby-theme-docz/index.js import React from 'react' import { theme } from 'docz' const Theme = ({ children }) =>
{children}
const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` By default, Docz will use [this object](https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/theme/index.js) as the default configuration and merge it with the `themeConfig` setting in the project configuration. You can then use the `useConfig` hook to do a lot of things, like use css-in-js theming or retrieve props from your `themeConfig` in a deep rendered component. ```js // src/gatsby-theme-docz/index.js import React from 'react' import { theme, useConfig } from 'docz' import { ThemeProvider } from 'theme-ui' const Theme = () => { const config = useConfig() return (
My theme
) } const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` ## Providing Components As explained in the components API section, the `` is the component responsible for providing components to MDX and Docz to render your markdown files with. With these components passed to the provider, you can change how your mdx file will be rendered and alter default behaviors and styles. ```js // src/gatsby-theme-docz/index.js import React from 'react' import { theme, useConfig, ComponentsProvider } from 'docz' import { ThemeProvider } from 'theme-ui' import * as components from './ui' const map = { page: components.Page, notFound: components.NotFound, render: components.Render, h1: components.H1, h2: components.H2, h3: components.H3, h4: components.H4, h5: components.H5, h6: components.H6, ul: components.List, loading: components.Loading, table: components.Table, pre: components.Pre, inlineCode: components.Code, } const Theme = ({ children }) => { const config = useConfig() return ( {children} ) } const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` This is powerful because it pushes you to think about your site as a set of base components and to create a default style for each one that will be used in all your documents while keeping your code DRY. ## Getting data from documents By now you should have a working site. But with the code above you will only see a single page without any link or information about the rest of your documents. Having a way to navigate your documentation is essential in your documentation site. Let's create a `Menu` component by using the `useMenus` hook and the `` component. The hook will give you information about all the menus' information parsed by Docz and the component will provide a way to navigate between them. An example `Menu` component is shown below : ```js // src/Menu.js import React from 'react' import { useMenus, Link } from 'docz' export const Menu = () => { const menus = useMenus() return (
    {menus.map(menu => (
  • {menu.name}
  • ))}
) } ``` This will create a fully functional navigation menu to your documentation and you can then use the `` component inside your theme: ```js // src/gatsby-theme-docz/index.js import React from 'react' import { theme, useConfig, ComponentsProvider } from 'docz' import { ThemeProvider } from 'theme-ui' import { Menu } from './Menu' import * as components from './my-components' const map = { page: components.Page, notFound: components.NotFound, render: components.Render, h1: components.H1, h2: components.H2, h3: components.H3, h4: components.H4, h5: components.H5, h6: components.H6, ul: components.List, loading: components.Loading, table: components.Table, pre: components.Pre, inlineCode: components.Code, } const Theme = ({ children }) => { const config = useConfig() return ( {children} ) } const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` You can also use this component to create other things like a search component, link to custom pages or whatever else you would like. ## Using documents settings Another interesting thing that you can do when you're creating your own theme is to use the `componentMap`'s `` component to customize the document preview depending on each document's settings. Each document can have its own settings defined in the header of the `.mdx` file. The `Page` component receives a prop called `doc` that contains the settings data. You can use this data to build your own variations of the rendered pages. For example, suppose that you'd like to add a hero image to some documents and leave others unchanged. You could do that by providing a `hero` property to your document, and then if that property is defined you would render a hero, else you would show the document as is. Your markdown would look something like this : ```markdown --- name: Hello world hero: /my/hero/img.png --- # Hello world This is a page! ``` And your `Page` component would look like the following : ```js // src/ui/Page.js import React from 'react' import MyCoolHero from './MyCoolHero' export const Page = ({ doc, children }) => (
{doc.hero && } {children}
) ``` Armed with this knowledge, you can create many variations of your documents based on the data provided in your MDX. ## Examples To see an example of a theme, you can check the [source code](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz/src) of `gatsby-theme-docz`. ================================================ FILE: examples/with-algolia-search/src/docs/customizing/customizing-webpack-config.mdx ================================================ --- name: Customizing Webpack Config route: /docs/customizing-webpack-config parent: Documentation menu: Customizing --- # Customizing docz's Webpack Configuration Let's assume we want to configure an alias so that instead of importing files from `../../components/Alert` we import from `@/components/Alert`. And another alias to allow us to replace relative paths like `import A from './src/components/Alert` with an absolute path `import A from 'components/Alert'` To configure the webpack config we add a `gatsby-node.js` file at the root of the project and export `onCreateWebpackConfig` like we would normally do in a Gatsby app. You can read more about configuring webpack with Gatsby [here](https://www.gatsbyjs.org/docs/add-custom-webpack-config/), see a small example below and a full working example [here](https://github.com/doczjs/docz/tree/master/examples/webpack-alias) : ```js // gatsby-node.js const path = require('path') exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { // ⚠ Note the '..' in the path because the docz gatsby project lives in the `.docz` directory modules: [path.resolve(__dirname, '../src'), 'node_modules'], alias: { '@': path.resolve(__dirname, '../src/components/'), }, }, }) } ``` ================================================ FILE: examples/with-algolia-search/src/docs/customizing/gatsby-theme.mdx ================================================ --- name: Gatsby Theme route: /docs/gatsby-theme parent: Documentation menu: Customizing --- # Gatsby Theme If you want to use Docz in a Gatsby application, you can use `gatsby-theme-docz`. Gatsby themes is one of the coolest features of all time in Gatsby. With the introduction of theming in Gatsby, it's easier than ever to get started building a Gatsby site. Shared functionality, data sourcing, and design can all be prepackaged as a Gatsby Theme that's an NPM install away. Our theme has all components and algorithms used to render your documentation website, with it we can explore a lot of Gatsby features and put all this things together in order to create a really useful documentation website. With `gatsby-theme-docz` you can get the full power of docz in your existing Gatsby app. If you're not sure what a Gatsby theme is, please read [the official docs](https://www.gatsbyjs.org/docs/themes/introduction/) ## How to use First, install some packages: ``` yarn add gatsby gatsby-theme-docz@next docz@next react react-dom ``` Then set the `gatsby-theme-docz` in the `plugins` option inside your `gatsby-config.js` ```js // gatsby-config.js module.exports = { plugins: ['gatsby-theme-docz'], } ``` Then, add some `.mdx` in your project: ```markdown --- name: Hello world route: / --- # Hello world Hello, I'm a mdx file! ``` Now just run gatsby in development mode: ```bash $ yarn gatsby develop ``` If everything works, you should see something like this: ![Theme preview](https://cdn-std.dprcdn.net/files/acc_649651/Y825GV) ## Configuration Set your config by using `doczrc.js` file ([see all available](https://www.docz.site/docs/project-configuration)) or if you want to set some defaults for your theme, use `options` in the plugin definition: ```js // gatsby-config.js module.exports = { plugins: [ { resolve: 'gatsby-theme-docz', options: { /* your custom options */ }, }, ], } ``` > We highly recommend that you set your configuration using `doczrc.js` because of live reload that will change in real time your project settings, if you set your configs using the theme definition you will need to reset your dev server in order to see your changes. ## Dark Mode To set the dark version as default, just set your `doczrc.js` like that: ```js // doczrc.js export default { themeConfig: { mode: 'dark', }, } ``` ## Customizing components Components shadowing is one of the best things included in the new Gatsby theme feature, with it, it is possible to replace theme files just by creating your own file following a file naming convention. Example: If you're using our `gatsby-theme-docz` which has a `Header` component located at `src/components/Header/index.js` you can override the component by creating `src/gatsby-theme-docz/components/Header/index.js`. Cool right? ## Adding your logo So, now that you know about how component shadowing works on Gatsby themes, if you don't want to override the entire `
` component but just change your logo inside it, your can shadow the `` component used in the header just by creating your own at `src/gatsby-theme-docz/components/Logo/index.js` ```js // src/gatsby-theme-docz/components/Logo/index.js import React from 'react' import logo from './logo.svg' export const Logo = () => That's my logo ``` Easy, right? ## Creating your own Docz theme One of the coolest thing of Docz is that you can create your own theme if you want from scratch and keep all docz's benefits. Previously, this was accomplished by using the `theme` property inside the `doczrc.js` file. Starting from v2, if you want to create your own theme, just create a file located at `src/gatsby-theme-docz/index.js` ```js import React from 'react' import { theme, useConfig, ComponentsProvider } from 'docz' import { ThemeProvider } from 'theme-ui' import baseComponents from 'gatsby-theme-docz/src/components' import { Menu } from './MyBeautifulMenu' const componentsMap = { ...baseComponents, /* your custom components */, } const Theme = ({ children }) => { const config = useConfig() return ( {children} ) } const themeConfig = { colors: { primary: 'tomato', secondary: 'khaki', gray: 'lightslategray', }, } export default theme(themeConfig)(Theme) ``` More info about [here](/docs/creating-your-themes) ## Wrapping the entire app Sometime you need to wrap your entire application in order to add some `Provider` or just to load some script. You can do this easily inside our theme by creating a file located at `src/gatsby-theme-docz/wrapper.js` ```js // src/gatsby-theme-docz/index.js import React from 'react' export default ({ children }) => (

My custom wrapper

{children}
) ``` ## Theme UI integrated Docz's code uses [Theme-UI](https://theme-ui.com/) as the default theme system. [Theme-UI](https://theme-ui.com/) is a library for building consistent, themeable React apps based on constraint-based design principles. You can modify the default theme and create your own style by combining these modifications with component shadowing. Check our [base theme object](https://github.com/pedronauck/docz/blob/feat/gatsby/core/gatsby-theme-docz/src/theme/index.js) to see the properties. To create your own theme definition use the `doczrc.js` and set your properties in the `themeConfig` like that: ```js // doczrc.js export default { themeConfig: { colors: { header: { bg: 'tomato', }, }, }, } ``` Or, to create your own theme, just create this file in the root of your project: `src/gatsby-theme-docz/theme/index.js`. ```js import baseTheme from 'gatsby-theme-docz/src/theme' import { merge } from 'lodash/fp' export default merge(baseTheme, { colors: { header: { bg: 'tomato', }, }, }) ``` ## Changing code highlight Both code highlights shortcodes and the `` component use [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) to highlight the code. If you want to modify and use another PrismJS theme, you can do that just passing a `prismTheme` property for your theme. ```js // doczrc.js import myCustomPrismTheme from './my-prism-theme' export default { themeConfig: { prismTheme: myCustomPrismTheme, }, } ``` Or you want to have different themes for `light` and `dark` color mode, you can change the `prism` default property like that: ```js // doczrc.js import customLightTheme from './my-light-theme' import customDarkTheme from './my-dark-theme' export default { themeConfig: { prism: { light: customLightTheme, dark: customDarkTheme, }, }, } ``` ## Adding component shortcodes You can add shortcodes to your docs site which can be used throughout your docs pages by extending the components passed to MDXProvider. You can do this by using component shadowing and creating the following file in the root of your project: `src/gatsby-theme-docz/components/index.js`. ### Example `components.js` ```js import baseComponents from 'gatsby-theme-documentation/src/components' import MyCustomH1 from '../components/my-custom-h1' export default { ...baseComponents, h1: MyCustomH1, } ``` ## Getting data Using our Gatsby Theme you can use all Gatsby hooks to get data for your pages and from Gatsby. So, you can create isolated pages on Gatsby using gatsby pages and get data from Docz or maybe pass data for your Docz documents using source from gatsby. Imagine, that you have your home page inside `/pages` and you want to show all documents parsed from Docz. You can get this by doing: ```js import React from 'react' import { useDocs } from 'docz' const Home = () => { const docs = useDocs() return
{/* my coolest home */}
} export default Home ``` Or you can have a mdx document inside Docz that has data from Gatsby too: ```markdown --- name: MyDoc --- import { MyComponentWithSomeData } from './my-component-with-data' ``` Cool right? ================================================ FILE: examples/with-algolia-search/src/docs/customizing/powered-by-gatsby.mdx ================================================ --- name: Powered by Gatsby route: /docs/powered-by-gatsby parent: Documentation menu: Customizing --- # Powered by Gatsby [Gatsby](https://gatsbyjs.org) is a blazing fast modern site generator for React and one of the greatest modern tools of the new frontend era. It has a huge ecosystem and community around it and a very talented team behind it. Starting from v2, docz's core is entirely built around Gatsby, this is the biggest change in the project since its creation and one of the best things that we could make for the tool. Using Gatsby as bundler behind the scenes gives you a lot of benefits like : * Stay focused on creating features instead of worrying about bundler management * Static and optimized builds by default * Fast dev-experience and better workflow * Huge ecosystem of tools, plugins and community * Better and easy way to customize things inside Docz ## Gatsby API and Hooks Gatsby has an extensive [API for developers](https://www.gatsbyjs.org/docs/api-reference/) and a lot of hooks and lifecycle methods that you can use in order to customize your build process. You can hook into it in a lot of ways and all of these hooks and properties are available when you use docz. > Check [the Gatsby API reference](https://www.gatsbyjs.org/docs/api-reference/) here. If you want to use any of those Gatsby configurations file inside your Docz project, create it in the root and docz will do the rest. If you want to make some changes to your webpack configuration, you can use the `onCreateWebpackConfig` hook by exporting a function from the `gatsby-node.js` file. For example to create aliases or change how your modules are resolved, you can do something like the below example : ```js // gatsby-node.js const path = require('path') exports.onCreateWebpackConfig = args => { args.actions.setWebpackConfig({ resolve: { modules: [path.resolve(__dirname, '../src'), 'node_modules'], alias: { '@': path.resolve(__dirname, '../src/components/'), }, }, }) } ``` > ⚠ Note the '..' in the path because the docz gatsby project lives in the `.docz` directory Or if you want to change your Babel configuration you can use the `onCreateBabelConfig` hook for this: ```js // gatsby-node.js exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPlugin({ name: `@emotion/babel-plugin`, options: { sourceMap: true, }, }) } ``` You can use these hooks and actions to modify or get information about your bundler process. ================================================ FILE: examples/with-algolia-search/src/docs/general/built-in-components.mdx ================================================ --- name: Built-in components route: /docs/built-in-components parent: Documentation menu: General --- # Built-in components Docz has built-in components that help you document your code. Using the power of components and their parsed ASTs ([Abstract Syntax Trees](https://en.wikipedia.org/wiki/Abstract_syntax_tree)) we can do a lot of things, like render your components, create tables with content describing them, generate documentation from your code, define custom getters by traversing your files and many other things. The sky is the limit here! ## Playground Component With the `` component, you can render your component inside a live-editable playground and directly see the output of the code used: ```markdown --- name: Button route: / --- import { Playground } from 'docz' import { Button } from './Button' # Button ## Basic usage ``` ![Page showing two buttons and their code inside an editable playground](https://cdn-std.dprcdn.net/files/acc_649651/hrRpoR) As you can see, `` renders your components, and right below them displays an editable version of the code used. This can be very useful to test and develop your components in a good environment while also documenting them. Note that you can edit the code below the components from your browser and see the changes you make be reflected live above it! ## Component Props One of the most important things when documenting a component is to know which props it expects. However, keeping a good properties documentation for your component can be difficult and error-prone, because you need to write the props specification and maintain the original props definition separately. This makes it hard to keep them both in sync ! Docz offers a solution to this problem called the `` component. It's a component that automatically gets the props definitions of your component and displays them in a neat table along with their default value and an optional description. In addition to supporting parsing `prop-types` in JS code, it works nicely with Flow and Typescript. ```markdown --- name: Button route: / --- import { Playground, Props } from 'docz' import { Button } from './' # Button ## Basic usage ``` The Button component must have some annotation describing its props. For non flow or typescript users this can be achieved with [`prop-types`](https://www.npmjs.com/package/prop-types) ```jsx import React from 'react' import t from 'prop-types' const Button = ({ children, kind }) => { // We use the kind prop to determine the button's class return } Button.propTypes = { /** * This is a pretty good description for this prop. */ kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), } Button.defaultProps = { kind: 'primary', } export Button ``` If you have used `prop-types` like described above, you should see a list of properties in a nicely formatted table: ![Table describing Button's props ](https://cdn-std.dprcdn.net/files/acc_649651/KEm5mH) The same can be achieved in typescript by adding comments to the props interface of your component: ```jsx import React from 'react' interface ButtonProps { /** * This is a pretty good description for this prop. */ kind: 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray' } ``` You can read a more in-depth guide about our built-in components in [**Components API**](/docs/components-api). And if you prefer to dive deeper into MDX document settings you can head over to [**Document Settings**](/docs/document-settings) ================================================ FILE: examples/with-algolia-search/src/docs/general/deploying-your-docs.mdx ================================================ --- name: Deploying your docs route: /docs/deploying-your-docs parent: Documentation menu: General --- # Building your site Now that you know about writing your docs, let's talk about how you can build and deploy your documentation. The first thing that you need to do is run the build script created in your `package.json`: ```bash $ yarn docz:build ``` If everything goes well, this command will generate all static files for you in the `.docz/dist` folder and you will see something like this in your terminal: ![Preview](https://cdn-std.dprcdn.net/files/acc_649651/qIFhkT) With your static files in hand, you can deploy your documentation wherever you want just like you do with any static site. ## Changing build folder You can change the build destination folder by changing the `dest` prop on your project configuration: ```js // doczrc.js export default { dest: '/my-dist-folder', } ``` ## Changing base folder If you are using something like [GitHub Pages](https://pages.github.com/) chances are that you are not deploying your site directly under the root of your user. For example if you have a `docz`-repository on your GitHub the URL for deploying that repository will be `https://your-username.github.io/docz`. You can specify in which subdirectory your files will be deployed with the `base`-property of `doczrc.js`. ```js // doczrc.js export default { base: '/docz', } ``` ## Using Netlify If you understand nothing about deploys, we highly recommend that you use the service we're using to host this website that you're seeing, called [Netlify](http://netlify.com/). Netlify is a really fantastic and easy tool that allows you to deploy your application in an automatic way by running the deploy on every push from a branch in seconds. First, after login or create a new account on Netlify, just create a _New site from git_: ![Preview](https://cdn-std.dprcdn.net/files/acc_649651/YTCDFn) Connect your Git service and pick some repository: ![Preview](https://cdn-std.dprcdn.net/files/acc_649651/cc2g4u) After that, just fill settings like below, passing your build command and the destination folder: ![Preview](https://cdn-std.dprcdn.net/files/acc_649651/3uvA9J) Finally, add a file `netlify.toml` to your project's root folder with the following contents: ```toml # COMMENT: This a rule for Single Page Applications as Docz site is one [[redirects]] from = "/*" to = "/" status = 200 ``` That's all. Now you have your documentation hosted on a domain with a quick and easy deploy process configured. ================================================ FILE: examples/with-algolia-search/src/docs/general/document-settings.mdx ================================================ --- name: Document settings route: /docs/document-settings parent: Documentation menu: General --- # Document settings Document settings provide a way to enrich documents with metadata used to generate your documentation site. They are defined at the top of the `.mdx` file, use YAML and can be used to customize your pages by passing this data to your theme. Every document has **three** main properties that can be overriden : ```markdown --- name: My Document route: /custom-route menu: Documents --- ``` - `name` The name of your document, used as the title of the page - `route *(optional)*` The route or path to your document's generated page. e.g. /docs/my-component > If you don't pass any here, docz will create a slug using the filepath of your file as route. e.g. /src-components-my-components/ - `menu *(optional)*` The menu within which your document is contained. It allows you to group documents into a single menu by changing this prop. ## Custom properties The built in properties are for docz but docz is extensible and you can create your own themes which could need different properties. Custom properties can be set in the document settings and they will automatically be parsed. For example you could define a property called `fullpage` to define whether your document is a page with `100%` width or not: ``` --- name: My Document fullpage: true --- ``` You could then use this property when overriding or creating a theme as shown in [**Creating your themes: Using documents settings**](/docz/creating-your-themes#using-documents-settings) ================================================ FILE: examples/with-algolia-search/src/docs/general/getting-started.mdx ================================================ --- name: Getting started route: / parent: Documentation menu: General --- # Getting Started ## Start a New Project Use create-docz-app to quickly get started : ```sh npx create-docz-app my-docz-app # or yarn create docz-app my-docz-app --example typescript ``` Make sure to check out [docz's `examples` directory](https://github.com/doczjs/docz/tree/master/examples) for the full list of supported examples. ## Add Docz to an Existing Project > Make sure you have `react` and `react-dom` with versions `>= 16.8.0` installed as dependencies. Start by adding **Docz** as a dependency : ```sh yarn add docz@next # react react-dom ``` or ```sh npm add docz@next # react react-dom ``` After installing Docz in your project, you may find it convenient to add three scripts to your `package.json` to run, build and serve your Docz website. Note that this is an **optional step** : ```json { "name": "next-gen-documentation", "scripts": { "docz:dev": "docz dev", "docz:build": "docz build", "docz:serve": "docz build && docz serve" }, "dependencies": { "docz": "latest", "react": "16.8.0", "react-dom": "16.8.0" } } ``` You can now spin up your dev server by running: ```bash yarn docz:dev # or yarn docz dev ``` or ```bash npm run docz:dev ``` ## Develop With your dev server up, you can start writing your documentation. Docz uses the [**MDX**](https://mdxjs.com/) format that allows you to seamlessly write JSX inside your markdown files. > Note that you **don't need to follow any file architecture or convention**. > You can just create your `.mdx` files and put them **anywhere in your project**. With that in mind, let's create our first `.mdx` and give it a name and a route: ```markdown --- name: Hello world route: / --- # Hello world Hello, I'm a mdx file! ``` With your first `.mdx` document created, you can open your browser and visit `localhost:3000` to see something like this: ![Preview](https://cdn-std.dprcdn.net/files/acc_649651/Y825GV) We cover more of what you can do with _MDX_ in the [**Writing MDX**](/docs/writing-mdx) page. ## Build `yarn docz build` will generate a static site for your site in `.docz/dist/`. You can try it out with `yarn docz serve` or by serving the generated site with your favorite static file server (e.g. `npx serve .docz/dist`). You can have `yarn docz build` emit to a different directory by providing a path to the `dest` field in your doczrc.js or from the command line : `yarn docz build --dest docs-site-directory`. ## Deploy The output of docz consists of static assets only. This allows you to deploy your generated `docz` site with any static site hosting provider you'd like. Start by building your site with `yarn docz build`, if you haven't provided a `dest` flag to your config then you will find your generated files in `.docz/dist` that you can copy to your server to deploy your site. ## Examples You can check the complete list of docz examples [here](https://github.com/doczjs/docz/tree/master/examples). ## Migration Guide This documentation is about **Docz v2**. If you need to migrate your Docz project, please read the [**Migration Guide**](/docs/migration-guide). If you are looking for documentation for v1 you can find it [**here**](https://docz-v1.surge.sh/). ================================================ FILE: examples/with-algolia-search/src/docs/general/introduction.mdx ================================================ --- name: Introduction route: /docs/introduction parent: Documentation menu: General --- # Introduction Documenting code is one of the most important and time-heavy processes when developing software. A lot of time is spent on building and maintaining custom documentation sites. **Docz** was created to solve this problem. Docz enables you to quickly create live-reloading, seo-friendly, production-ready documentation sites with MDX and customize the look, feel and behavior when required by leveraging GatsbyJS and Gatsby theme shadowing. ## Principles We started by looking over the options available when you want to create your design system or document your project. We borrowed the best ideas from each and came up with the following guiding principles : - **Zero config and easy to learn.** Avoid unnecessary build steps with confusing setups. - **Blazing fast.** Built with performance in mind from the start. - **Easy to customize.** Create something that will be easy to use and customize. - **MDX based.** Use the best standard for writing documentation. Now that you know the core principles of Docz. Let's [get started](/docs/getting-started)! ================================================ FILE: examples/with-algolia-search/src/docs/general/usage-in-monorepo.mdx ================================================ --- name: Usage in monorepo route: /docs/usage-in-monorepo parent: Documentation menu: General --- # Implementing in monorepo When installing Docz in a monorepo environment you might need some extra steps to get everything working correctly. Let's say we have a lerna monorepo with workspaces defined as: `packages/**/*`, in a folder structure it would look like this: ``` packages/ ├─ components/ └─ portal/ └─ package.json ``` Docz and `@foo/component` would be a dependency in `portal/package.json`. As Docz copies over this `package.json` to `portal/.docz/package.json` you might run into `error There are more than one workspace with name "@foo/portal"`. In order to fix this add a couple lines to your `portal/package.json`: ``` // portal.package.json { "private": true, "workspaces": [ // needed to resolve @foo/components in portal/package.json "../../packages/**/*", // needed to resolve @foo/components in portal/.docz/package.json "../../../packages/**/*" ] } ``` You might need to tweak these paths to match your monorepo structure. ================================================ FILE: examples/with-algolia-search/src/docs/general/usage-with-css-preprocessors.mdx ================================================ --- name: Usage with CSS Preprocessors route: /docs/usage-with-css-preprocessors parent: Documentation menu: General --- # Using docz with CSS Preprocessors Most configuration is from version 2 handled by Gatsby, and CSS preprocessing is no exception. Gatsby uses a range of [**Plugins**](https://www.gatsbyjs.org/plugins/) to handle things like `sass`, `less` and `postcss`. Gatsby supports CSS Modules out of the box. These plugins are added by adding a `gatsby-config.js` in your project root or modifying an existing one. For example if you want to add support for `sass` you would do the following: 1. Install [`node-sass`](https://github.com/sass/node-sass) and [`gatsby-plugin-sass`](https://www.gatsbyjs.org/packages/gatsby-plugin-sass/) ```bash # npm npm install --save node-sass gatsby-plugin-sass # yarn yarn add node-sass gatsby-plugin-sass ``` 2. Add the plugin to your `gatsby-config.js` ```js //gatsby-config.js module.exports = { plugins: ['gatsby-plugin-sass'] } ``` You should now be able to use `sass` in your components! ================================================ FILE: examples/with-algolia-search/src/docs/general/usage-with-typescript.mdx ================================================ --- name: Usage with TypeScript route: /docs/usage-with-typescript parent: Documentation menu: General --- # Using docz with Typescript To use docz with TypeScript codebase you need to add `typescript: true` to your `doczrc.js`, the rest will be setup by _docz_. ```js export default { typescript: true, } ``` # Documenting Props in TypeScript As mentioned in [**Built-in components**](/docs/built-in-components) the ``-component is used to automatically document your components props assuming you have the correct comments on your components like below. ```js interface ButtonProps { /** * A description of the prop that you seem fit :) */ kind: 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray'; } ``` The typescript parser can be a bit fussy sometimes (and we are working on it) so if your typescript-files are not being found you may have to write out the full path with the file ending. If this doesn't do the trick you can try checking if using `default` exports or `named` exports are the problem. ```js import { Props } from 'docz' import Button from './Button.tsx' // Button Props ; ``` # Advanced configuration If you have particular needs or need to control exactly which files are being picked up or if you want to tap into the parser that creates the documentation there are two properties on the `doczrc.js` that you can use: `filterComponents` and `docgenConfig` (some use cases explained [here](https://github.com/doczjs/docz/issues/827)) ```js export default { filterComponents: files => //This overrides the default filtering of components files.filter(filepath => /[\w-]+.(?:j|t)sx?$/.test(filepath)), } ``` ================================================ FILE: examples/with-algolia-search/src/docs/general/writing-mdx.mdx ================================================ --- name: Writing MDX route: /docs/writing-mdx parent: Documentation menu: General --- # Writing MDX MDX is an authorable format that lets you seamlessly use JSX in your Markdown documents. You can import components, like interactive charts and embed them within your content. This makes writing long-form content with components a blast. More details about MDX in the [Official website.](https://mdxjs.com/) ## Working with components For now, you only need to know that with MDX you can use your components inside markdown. But how? Let's take a look at how we can improve our `.mdx` file created previously by importing and using a component inside it. The example below assumes we have an exported component named `Button` in a file named `Button.jsx`/`Button.tsx` located in the same folder as the `.mdx` file we are editing. ```mdx --- name: Hello world --- import { Button } from './Button' # Hello world Hello, I'm still a mdx file, but now I have a button component ! ``` And, if you do have a `Button` component to import, you'll see something like this: ![Documentation site showing a rendered button along with Markdown](https://cdn-std.dprcdn.net/files/acc_649651/Fgbg4F) With MDX you can mix _React Components_ or _html-elements_ with regular markdown allowing you to either document your own components _or_ create helper components that make documentation easier. **Docz** comes with some helper components that will help you document your components faster, these are covered in [**Built-in components**](/docs/built-in-components). ================================================ FILE: examples/with-algolia-search/src/docs/references/components-api.mdx ================================================ --- name: Components & Hooks API route: /docs/components-api parent: Documentation menu: References --- # Components & Hooks API > ### Note > > By default, these components and hooks only work inside a Docz theme, because they rely on a lot of data fetched by docz at build-time. --- ## `` Use this provider to pass your components to MDX and they will be used when converting your markdown to html. ```js import React from 'react' import { ComponentsProvider, theme } from 'docz' import MyCoolSidebar from './my-cool-sidebar' import * as components from './my-component-list' const map = { page: components.Page, h1: components.H1, h2: components.H2, pre: components.Pre, } const Theme = theme(({ children }) => (
{children}
)) ``` ### Properties - **components:** `ComponentsMap`
This map is responsible to render components inside your compiled `.mdx` ### Type Definitions ```ts interface ComponentsMap { loading?: CT layout?: CT notFound?: CT> playground?: PlaygroundComponent h1?: CT | string h2?: CT | string h3?: CT | string h4?: CT | string h5?: CT | string h6?: CT | string span?: CT | string a?: CT | string ul?: CT | string table?: CT | string pre?: CT | string code?: CT | string inlineCode?: CT | string [key: string]: any } interface ComponentsProviderProps = { components: ComponentsMap } export const ComponentsProvider: React.FC ``` --- ## `` Used to render your component inside a playground and show an editable version of your code inside it. ### Properties `none` ### Type Definitions ```ts interface PlaygroundProps { children: React.ReactNode | () => React.ReactNode | React.ReactNode[] } ``` --- ## `` Component that takes a component and generates a table of properties based on your properties definitions. ```markdown --- name: MyComponent --- import { Props } from 'docz' import MyComponent from './MyComponent' ``` ### Descriptions You can add descriptions for your props by adding a comment on the line above the prop. > Note: Description comments must be in the format `/** Description */`. ```js MyComponent.propTypes = { /** The description for myProp */ myProp: PropTypes.string, } ``` ### Properties - **of:** `React.ComponentType` --- ## `useComponents` Hook responsible for accessing the components map passed as a prop to the `` of your theme. ```js import { useComponents } from 'docz' const App = () => { const components = useComponents() return /* ... */ } ``` ### Params `none` ### Return - components: `ComponentsMap` --- ## `useDocs` Use this hook to get the list of all parsed documents. It can be useful when you want to create something like a menu or a list. ```js import { useDocs, Link } from 'docz' const App = () => { const docs = useDocs() return ( {docs.map(doc => ( {doc.name} ))} ) } ``` ### Params `none` ### Return - docs: `Docs[]`
All documents parsed by docz ### Typings Definitions ```ts interface Docs { id: string filepath: string link: string | null slug: string name: string route: string menu: string | null headings: Heading[] [key: string]: any } export function useDocs(): Docs[] ``` --- ## `useMenus` This hook will return the menu built by Docz using your documents. Use this to quickly get your menus or use `useDocs` if you want the documents ordered in the order of your project configuration. ```js import { useMenus } from 'docz' const App = () => { const menus = useMenus() return /* ... */ } ``` ### Params - **options**: `Object` - `query: String` Use `query` to filter menu results. The query is matched against the menu headers, not page content. ### Return - **menus:** `MenuItem[]` ### Type Definitions ```ts export interface MenuItem { id: string name: string route?: string href?: string menu?: MenuItem[] order?: number parent?: string } export function useMenus(opts: UseMenuOpts): MenuItem[] ``` --- ## `useConfig` Retrieve the project config object passed on your project configuration. By default, Docz merges your `themeConfig` object with the default theme config of each theme. ```js import React from 'react' import { useConfig } from 'docz' const MyDeepComponentInsideMyTheme = () => { const config = useConfig() return /* ... */ } ``` ### Properties `none` ### Return - **config:** `Config` ### Type Definitions ```ts export type ThemeConfig = Record export interface Config { title: string description: string themeConfig: ThemeConfig menu: MenuItem[] version: string | null repository: string | null native: boolean separator: string codeSandbox: boolean linkComponent?: React.ComponentType } export function useConfig(): Config ``` --- ## `theme()` If you want to create your custom theme you need to use the `theme()` function. It's a Higher Order Component that receives a `config` property as the first parameter and returns a function that receives your theme component as a parameter: ```js import React from 'react' import { theme, DocPreview } from 'docz' const Theme = () => (
) const themeConfig = { /* ... */ } export default theme(themeConfig)(Theme) ``` ### Type Definitions ```ts import { ComponentType, ReactNode } from 'react' interface ThemeConfig { [key: string]: any } function theme(config: ThemeConfig): (Component: ComponentType) => ReactNode ``` ================================================ FILE: examples/with-algolia-search/src/docs/references/creating-plugins.mdx ================================================ --- name: Creating Plugins route: /docs/creating-plugins parent: Documentation menu: References --- # Creating Plugins Plugins give you the ability to modify Docz processes, default configurations and create hooks for build and render. This is a perfect place to integrate Docz with other tools. To create a plugin you just need to use the `createPlugin` method from [docz-core](https://github.com/pedronauck/docz/tree/master/packages/docz-core) ```js import { createPlugin } from 'docz-core' const myPlugin = () => createPlugin({ setConfig: (config) => /* ... */, onCreateBabelConfig: (args) => /* ... */, onCreateDevServer: (args) => /* ... */, onCreateWebpackConfig: (args) => /* ... */, modifyFiles: (files, args) => /* ... */, modifyEntry: (args) => /* ... */, onPreBuild: () => /* ... */, onPostBuild: () => /* ... */, }) ``` ## `setConfig` Use to modify or create custom project configurations. #### Params - **config:** Default [configuration object](http://localhost:3000/docs/project-configuration) #### Return - `Config` --- ## `onCreateWebpackConfig` Let plugins extend/mutate the site’s webpack configuration. See also the documentation for [setWebpackConfig](). #### Params `stage {string}` The current build stage. One of ‘develop’, ‘develop-html’, ‘build-javascript’, or ‘build-html’ `getConfig {function}` Returns the current webpack config `rules {object}` A set of preconfigured webpack config rules `loaders {object}` A set of preconfigured webpack config loaders `plugins {object}` A set of preconfigured webpack config plugins `actions {object}` #### Example ```js exports.onCreateWebpackConfig = ({ stage, getConfig, rules, loaders, actions }) => { actions.setWebpackConfig({ module: { rules: [ { test: 'my-css', use: [loaders.style(), loaders.css()] }, ], }, }); } ``` --- ## `onCreateBabelConfig` Use to modify babelrc configuration #### Params `stage {string}` The current build stage. One of ‘develop’, ‘develop-html’, ‘build-javascript’, or ‘build-html’ `getConfig {function}` Returns the current webpack config `rules {object}` A set of preconfigured webpack config rules `loaders {object}` A set of preconfigured webpack config loaders `plugins {object}` A set of preconfigured webpack config plugins `actions {object}` #### Example ```js exports.onCreateBabelConfig = ({ stage, getConfig, rules, loaders, actions }) => { actions.setBabelPlugin({ name: `@emotion/babel-plugin`, options: { sourceMap: true, }, }) } ``` --- ## `modifyFiles` Use to modify mdx files before parsing #### Params - **files:** Files parsed by Docz - **args:** The Docz config object merged with argv #### Return - `string[]` #### Types definitions ```ts export type ModifyFiles = (files: string[], args: Config) => string[] ``` --- ## `modifyEntry` Use to modify files entry after created #### Params - **entry:** files entry by Docz - **args:** The Docz config object merged with argv #### Return - `Entry` #### Types definitions ```ts export type ModifyEntry = (entry: Entry, args: Config) => Entry ``` --- ## `onCreateDevServer` Run when gatsby develop server is started, its useful to add proxy and middleware to the dev server app #### Params - `app {Express}` The Express app used to run the dev server #### Example ```js exports.onCreateDevServer = ({ app }) => { app.get('/hello', function (req, res) { res.send('hello world') }) } ``` --- ## `onPreBuild` Method triggered before the build process #### Params - **config:** Default bundler configuration object #### Return - `void` #### Type definitions ```ts type OnPreBuild = (config: C) => void ``` --- ## `onPostBuild` Method triggered after the build process #### Params - **config:** Default bundler configuration object #### Return - `void` #### Type definitions ```ts type onPostBuild = (config: C) => void ``` ================================================ FILE: examples/with-algolia-search/src/docs/references/mdx-plugins.mdx ================================================ --- name: MDX Plugins route: /docs/mdx-plugins parent: Documentation menu: References --- # Using MDX Plugins Since MDX uses the [remark](https://github.com/remarkjs/remark)/[rehype](https://github.com/rehypejs/rehype) ecosystems, you can use plugins to modify your documents' AST on different stages of the process in order to make your documentation better. Set `mdPlugins` for remark plugins and `hastPlugins` for rehype plugins inside your configuration file. ```js import images from 'remark-images' import emoji from 'remark-emoji' export default { mdPlugins: [images, emoji], } ``` ================================================ FILE: examples/with-algolia-search/src/docs/references/migration-guide.mdx ================================================ --- name: Migration Guide route: /docs/migration-guide parent: Documentation menu: References --- # Migration Guide The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes to our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version. It’s not a big deal, but you will need to follow this guide in order to get Docz running properly on your project after the upgrade. ## Gatsby as default bundler The biggest change in the new v2 is that our core is now entirely built using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on building new features instead of handling a lot of bundlers issues (our biggest bottleneck) and leverage the entire Gatsby ecosystem. So, in order to refactor our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system. ### List of removed properties from `doczrc.js` * **`websocketHost`** ▶︎ _no longer need_ * **`websocketPort`** ︎︎︎▶︎ _no longer need_ * **`wrapper`** ▶︎ _removed_ * **`theme`** ▶︎ _removed_ * **`indexHtml`** ▶︎ _removed_ * **`codeSandbox`** ▶︎ _removed_ * **`onCreateWebpackChain`** ▶︎ _removed_ * **`modifyBundlerConfig`** ▶︎ use Gatsby [`onCreateWebpackConfig`](https://www.gatsbyjs.org/docs/node-apis/#onCreateWebpackConfig) hook * **`modifyBabelRc`** ▶︎ use Gatsby [`onCreateBabelConfig`](https://www.gatsbyjs.org/docs/node-apis/#onCreateBabelConfig) hook ## New hooks for plugins The `createPlugin` method also changed in order to fit with Gatsby now. ### List of removed/changed properties from `createPlugin()` * **`modifyBundlerConfig`** ▶︎ `onCreateWebpackConfig` * **`modifyBabelRc`** ▶︎ `onCreateBabelConfig` * **`onCreateApp`** ▶︎ `onCreateDevServer` * **`onPreCreateApp`** ▶︎ _removed_ * **`onServerListening`** ▶︎ _removed_ * **`onPreRender`** ▶︎ _removed_ * **`onPostRender`** ▶︎ _removed_ > All methods that changed now are using the same API as Gatsby hooks. > You can have more details about then [here](https://www.gatsbyjs.org/docs/node-apis). ## `docz-theme-default` removed Make sure to remove `docz-theme-default` from your dependencies when migrating : ```sh yarn remove docz-theme-default # npm uninstall docz-theme-default ``` The main reason that made us change our core to use Gatsby is that they have added a feature called themes. In the last major version we launched our own Gatsby theme `gatsby-theme-docz` and this was a huge step forward because we can now use Docz inside a Gatsby project and bring a lot of new possibilities when creating documentation. One of the best benefits of Gatsby themes is a feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people very often ask, for example: “I want just to change the head in the Docz theme”. In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` to your project. Check [here](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz#customizing-components) for more information about customizing the Gatsby theme. ### Code highlight with PrismJS In the last version of Docz we used Codemirror to highlight code inside `` and code blocks. Starting from v2 docz uses [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI. Check [here](https://github.com/FormidableLabs/prism-react-renderer) for more information. ### New `themeConfig` properties Another great thing launched in the newest version is the integration with [Theme UI](https://theme-ui.com). Theme UI is a library for building consistent, themeable React apps based on constraint-based design principles. So, in order to integrate it with our new theme, a lot of changes have been made inside the `themeConfig` object. ## `theme` property removed The property used to define your Docz theme inside the `doczrc.js` was removed. But you can still create and use your own theme from scratch if you want. If you want to use your own theme, just create a file called `src/gatsby-theme-docz/index.js` in order to use component shadowing and replace it with your new theme. ```js // src/gatsby-theme-docz/index.js import React from 'react' import Theme from './my-custom-theme' export default (props) => ``` Check [here](https://www.docz.site/docs/creating-themes) for more information about how to create themes. ## `wrapper` property removed The same thing happened here for the oldest `wrapper` property. Now you can wrap your entire application by just creating a file called `src/gatsby-theme-docz/wrapper.js` ```js // src/gatsby-theme-docz/index.js import React from 'react' export default ({ children }) => (

My custom wrapper

{children}
) ``` ## CSS preprocessors managed by gatsby CSS preprocessors and modules were handled by [`docz-plugin-css`](https://github.com/doczjs/docz-plugin-css) which hooked into the bundler config to add different loader support via webpack. With the change to gatsby, css preprocessors like `sass` can be handled by gatsby via [Plugins](https://www.gatsbyjs.org/plugins/) These plugins are added by adding a `gatsby-config.js` in your project root or modifying an existing one. For example if you want to add support for `sass` you would do the following: 1. Install [`node-sass`](https://github.com/sass/node-sass) and [`gatsby-plugin-sass`](https://www.gatsbyjs.org/packages/gatsby-plugin-sass/) ```bash # npm npm install --save node-sass gatsby-plugin-sass # yarn yarn add node-sass gatsby-plugin-sass ``` 2. Add the plugin to your `gatsby-config.js` ```js //gatsby-config.js module.exports = { plugins: ['gatsby-plugin-sass'] } ``` ## Examples Make sure to check out [docz's `examples` directory](https://github.com/doczjs/docz/tree/master/examples) for the full list of supported examples. ================================================ FILE: examples/with-algolia-search/src/docs/references/project-configuration.mdx ================================================ --- name: Project Configuration route: /docs/project-configuration parent: Documentation menu: References --- # Project Configuration The project configuration is used when you need to define some specific customizations on your project. Like use plugins, chose themes, set project title, and other things. To customize your project configuration you can use `doczrc.js` following this reference. ## Env file You can also create a `.env` file or use an existing `.env` file. You can then define customizations via `DOCZ_`. ## CLI arguments You can also pass customizations as arguments to the `docz dev` command: `docz dev --typescript --port=4838` ## Basic config ### base - Type: `string` - Default: `process.env.DOCZ_BASE || '/'` The base URL of the site will be deployed at. You will need to set this if you plan to deploy your site under a subpath, for example, GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/, the base should be set to `/bar/`. > It should always start and end with a slash. The base is automatically prepended to all URLs that start with `/` in other options, so you only need to specify it once. ### src - Type: `string` - Default: `process.env.DOCZ_SOURCE || './'` Define the source folder of **your components**. Only the files in this folder will be parsed. Every file out of this folder will not be found. > ### Tips and tricks > > If you want to boost performance, you can limit the amount of files parsed by passing your source folder here! ### files - Type: `string` or `Array` - Default: `process.env.DOCZ_FILES || '**/*.{md,markdown,mdx}'` Glob pattern used to find your files. By default, Docz finds all files inside the source folder that have a `.mdx` extension. [As of v0.10](https://github.com/pedronauck/docz/releases/tag/v0.10.0), you can customize it to resolve other filetypes: ```js // doczrc.js export default { files: '**/*.{md,markdown,mdx}' // or files: ['**/*.{md,markdown,mdx}'] } ``` You can be more specific if you want and change this glob to find other rules. > It is important to keep the `.mdx` extension in this string if you specify it ### ignore - Type: `string[]` - Default: `['readme.md', 'changelog.md', 'code_of_conduct.md', 'contributing.md', 'license.md'],` Option used to ignore files to be parsed by docz. ### dest - Type: `string` - Default: `process.env.DOCZ_DEST || '.docz/dist'` Specify the output directory for `docz build` ### title - Type: `string` - Default: `process.env.DOCZ_TITLE || name as defined in package.json` The title for your site. This will be the prefix for all page titles and displayed in the sidebar in the default theme. ### description - Type: `string` - Default: `process.env.DOCZ_DESCRIPTION || description as defined in package.json` The description for the site. It will be rendered as a `` tag in the page HTML. ### typescript - Type: `boolean` - Default: `process.env.DOCZ_TYPESCRIPT || false` This option is used if you need to import Typescript components inside your `.mdx` files. ### propsParser - Type: `boolean` - Default: `process.env.DOCZ_PROPS_PARSER || true` To be able to use the `` component and parse properties of your components, we need to run a lot of processes that have some costs on the build process. If you need to disable this process to improve performance, you can set this property to `false`. ### config - Type: `String` - Default: `'docz.json | .doczrc | doczrc.json |doczrc.js | docz.config.js | docz.config.json'` Use this option to change the filepath of Docz config file. ### public - Type: `string` - Default: `/public` Option used to set a public folder of your project ```js export default { public: '/public' } ``` Then you can get assets from your folder: ``` // my-file.mdx # Hello ![placeholder image](/public/some-image.png) ``` ### debug - Type: `boolean` - Default: `process.env.DEBUG || false` Use this setting to debug your application and remove all progress bar from bundler. ### editBranch - Type: `string` - Default: `master` Branch used to edit your document when clicking on Github button. ### host - Type: `string` - Default: `process.env.DOCZ_HOST || '127.0.0.1'` Specify the host to use for the dev server. ### port - Type: `number` - Alias: `p` - Default: `process.env.DOCZ_PORT || 3000` Specify the port to use for the dev server. ## Theming ### theme > This property was removed in the v2 > > Get more information about how to use it [here](https://www.docz.site/docs/migration-guide#theme-property-removed) ### wrapper > This property was removed in the v2. > > Get more information about how to use it [here](https://www.docz.site/docs/migration-guide#wrapper-property-removed) ### themeConfig - Type: `Object` - Default: `{}` This is the config that you can use to customize your theme. By default, each theme has its own `themeConfig` that you can modify, so this object may vary according to each theme. You can see the theme config of default theme [here](https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/theme/index.js) ## Build pipeline ### menu - Type: `Array[]` - Default: `null` Use this option to specify the order of your documents in the menu. You can pass a simple string or if you want to order a nested menu you can pass an object with the name of your document and the `menu` order of it. ```js export default { menu: [ 'Getting Started', { name: 'Components', menu: ['Alert', 'Button'] } ] } ``` ### plugins - Type: `Array` - Default: `[]` Specify an array of plugins that you want to use. ### mdPlugins - Type: `Array` - Default: `[]` Array of [remark plugins](https://github.com/remarkjs/remark/blob/master/doc/plugins.md) to manipulate the MDXAST ### hastPlugins - Type: `Array` - Default: `[]` Array of [rehype plugins](https://github.com/rehypejs/rehype/blob/master/doc/plugins.md) to manipulate the MDXHAST ### onCreateWebpackChain > This property was removed in v2. Use Gatsby hooks instead. > > More info about it [here](https://www.docz.site/docs/powered-by-gatsby) ### modifyBundlerConfig > This property was removed in v2. Use Gatsby hooks instead. > > More info about it [here](https://www.docz.site/docs/powered-by-gatsby) ### modifyBabelRc > This property was removed in v2. Use Gatsby hooks instead. > > More info about it [here](https://www.docz.site/docs/powered-by-gatsby) ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/components/Header/Search/Input.js ================================================ import React from 'react' import { connectSearchBox } from 'react-instantsearch-dom' import { SearchIcon, Form, Input } from './primitives' import { Search } from 'gatsby-theme-docz/src/components/Icons' import * as styles from 'gatsby-theme-docz/src/components/NavSearch/styles' export default connectSearchBox(({ refine, ...rest }) => (
refine(e.target.value)} {...rest} /> {/* */} )) ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/components/Header/Search/hitComps.js ================================================ import React from 'react' import { Highlight, Snippet } from 'react-instantsearch-dom' import { Link } from 'gatsby' export const PageHit = clickHandler => ({ hit }) => (

{' '}

) ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/components/Header/Search/index.js ================================================ import React, { useState, useEffect, createRef } from 'react' import { InstantSearch, Index, Hits, connectStateResults, } from 'react-instantsearch-dom' import algoliasearch from 'algoliasearch/lite' import * as styles from 'gatsby-theme-docz/src/components/NavSearch/styles' import { Root, HitsWrapper, PoweredBy } from './primitives' import Input from './Input' import * as hitComps from './hitComps' const Results = connectStateResults( ({ searchState: state, searchResults: res, children }) => res && res.nbHits > 0 ? children : `No results for '${state.query}'` ) const Stats = connectStateResults( ({ searchResults: res }) => res && res.nbHits > 0 && `${res.nbHits} result${res.nbHits > 1 ? `s` : ``}` ) const useClickOutside = (ref, handler, events) => { if (!events) events = [`mousedown`, `touchstart`] const detectClickOutside = event => !ref.current.contains(event.target) && handler() useEffect(() => { for (const event of events) document.addEventListener(event, detectClickOutside) return () => { for (const event of events) document.removeEventListener(event, detectClickOutside) } }) } const indices = [ { name: process.env.GATSBY_ALGOLIA_INDEX_NAME, title: `docz algolia example`, hitComp: `PageHit`, }, ] export const NavSearch = ({ collapse, hitsAsGrid }) => { const ref = createRef() const [query, setQuery] = useState(``) const [focus, setFocus] = useState(false) const searchClient = algoliasearch( process.env.GATSBY_ALGOLIA_APP_ID, process.env.GATSBY_ALGOLIA_SEARCH_KEY ) useClickOutside(ref, () => setFocus(false)) return ( setQuery(query)} >
setFocus(true)} {...{ collapse, focus }} /> 0 && focus} asGrid={hitsAsGrid}> {indices.map(({ name, title, hitComp }) => (

{title}

setFocus(false))} />
))}
) } export default NavSearch ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/components/Header/Search/primitives.js ================================================ import React from 'react' import styled, { css } from 'styled-components' import { Search } from 'gatsby-theme-docz/src/components/Icons' import { Algolia } from 'styled-icons/fa-brands/Algolia' export const Root = styled.div` position: relative; display: grid; grid-gap: 1em; ` export const SearchIcon = styled(Search)` width: 1em; pointer-events: none; color: #2d3747; ` const focus = css` background: white; color: ${props => props.theme.darkBlue}; cursor: text; width: 5em; + ${SearchIcon} { color: ${props => props.theme.darkBlue}; margin: 0.3em; } ` const collapse = css` width: 0; cursor: pointer; color: ${props => props.theme.lightBlue}; + ${SearchIcon} { color: white; } ${props => props.focus && focus} margin-left: ${props => (props.focus ? `-1.6em` : `-1em`)}; padding-left: ${props => (props.focus ? `1.6em` : `1em`)}; ::placeholder { color: ${props => props.theme.gray}; } ` const expand = css` background: ${props => props.theme.veryLightGray}; width: 20em; margin-left: -1.6em; padding-left: 1.6em; + ${SearchIcon} { margin: 0.3em; } ` export const Input = styled.input` outline: none; border: none; font-size: 1em; background: transparent; transition: ${props => props.theme.shortTrans}; border-radius: ${props => props.theme.smallBorderRadius}; ${props => (props.collapse ? collapse : expand)}; ` export const Form = styled.form` display: flex; flex-direction: row-reverse; align-items: center; ` export const HitsWrapper = styled.div` display: ${props => (props.show ? `grid` : `none`)}; max-height: 80vh; overflow: scroll; z-index: 2; -webkit-overflow-scrolling: touch; position: absolute; top: calc(100% + 0.5em); width: 80vw; max-width: 20em; box-shadow: 0 0 5px 0; padding: 0.7em 1em 0.4em; background: white; border-radius: ${props => props.theme.smallBorderRadius}; > * + * { padding-top: 1em !important; border-top: 2px solid ${props => props.theme.darkGray}; } li + li { margin-top: 0.7em; padding-top: 0.7em; border-top: 1px solid ${props => props.theme.lightGray}; } * { margin-top: 0; padding: 0; } ul { list-style: none; } mark { color: ${props => props.theme.lightBlue}; background: ${props => props.theme.darkBlue}; } header { display: flex; justify-content: space-between; margin-bottom: 0.3em; h3 { color: white; background: ${props => props.theme.gray}; padding: 0.1em 0.4em; border-radius: ${props => props.theme.smallBorderRadius}; } } h3 { margin: 0 0 0.5em; } h4 { margin-bottom: 0.3em; } ` const PoweredBySpan = styled.span` font-size: 0.6em; text-align: end; padding: 0; ` export const PoweredBy = () => ( Powered by{` `} Algolia ) ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/components/Header/index.js ================================================ /** @jsx jsx */ import { jsx, Box, Flex, useColorMode } from 'theme-ui' import { useConfig, useCurrentDoc } from 'docz' import * as styles from 'gatsby-theme-docz/src/components/Header/styles' import { Edit, Menu, Sun, Github } from 'gatsby-theme-docz/src/components/Icons' import { Logo } from 'gatsby-theme-docz/src/components/Logo' import Search from './Search/' export const Header = props => { const { onOpen } = props const { repository, themeConfig: { showDarkModeSwitch, showMarkdownEditButton }, } = useConfig() const { edit = true, ...doc } = useCurrentDoc() const [colorMode, setColorMode] = useColorMode() const toggleColorMode = () => { setColorMode(colorMode === 'light' ? 'dark' : 'light') } return (
{repository && ( )} {showDarkModeSwitch && ( )} {showMarkdownEditButton && edit && doc.link && ( Edit page )}
) } ================================================ FILE: examples/with-algolia-search/src/gatsby-theme-docz/wrapper.js ================================================ import React from 'react' import { Helmet } from 'react-helmet-async' const Wrapper = ({ children, doc }) => { return ( <> {doc.value.name} {children} ) } export default Wrapper ================================================ FILE: examples/with-custom-404-page/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-custom-404-page/README.md ================================================ # Docz with custom 404 page example To add a custom 404 pages, add a `404.js` file in `src/pages/404.js`. You can use a different directory instead of `src` by pointing the themesDir config to another folder. In development mode Gatsby shows you a custom 404 to help you debug. To preview your own build the app, serve it and visit a URL that doesn't exist. ```sh npm run docz build && npm run docz serve # then visit http://localhost:3000/i-do-not-exist ``` ## Using `create-docz-app` ```sh npx create-docz-app --example with-custom-404-page docz-app-basic # or yarn create docz-app docz-app-basic --example with-custom-404-page ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-custom-404-page mv with-custom-404-page docz-with-custom-404-page-example cd docz-with-custom-404-page-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-custom-404-page/package.json ================================================ { "name": "with-custom-404-page", "version": "2.0.0", "license": "MIT", "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "^2.3.2-alpha.0", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/with-custom-404-page/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-custom-404-page/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-custom-404-page/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-custom-404-page/src/pages/404.js ================================================ import React from 'react' const NotFoundPage = () => (

Oups 🙈

You just hit a route that doesn‘t exist... 👀

) export default NotFoundPage ================================================ FILE: examples/with-custom-docz-theme/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-custom-docz-theme/README.md ================================================ # Using and Creating a Custom Docz Theme example ## Creating a docz theme For this example we want to write a theme that wraps every page with a div that has padding and a pink background-color. You can make a theme that does as much or as little as you wish. We start by creating the directory `gatsby-theme-docz-pink`. Inside we're going to shadow gatsby-theme-docz. To do that we create a folder : `src/gatsby-theme-docz`, the component in particular we want to shadow is located in src/gatsby-theme-docz/wrapper.js. ```jsx import React from 'react' import OriginalWrapper from 'gatsby-theme-docz/src/wrapper' const Wrapper = ({ children, doc }) => { return (
{children}
) } export default Wrapper ``` The component doesn't do much, it imports the original wrapper and wraps it in a styled div. Next, we add a `package.json` to `gatsby-theme-docz-pink` : ```json { "name": "gatsby-theme-docz-pink", "version": "1.0.0", "main": "index.js", "license": "MIT" } ``` And since we're saying that main is `index.js` we create an empty file called index.js at the root of the package in order for the bundler to know the package exists ```js // noop ``` And that's it our theme is ready to be distributed and consumed. You can publish it to npm or host it in a git repo and install it with your favorite package manager ## Consuming a docz theme If the theme is published to npm we start by adding the theme as a project dependency ``` yarn add gatsby-theme-docz-pink ``` > In this example we'll copy `gatsby-theme-docz-pink` to `node_modules/gatsby-theme-docz-pink` : `cp -r gatsby-theme-docz-pink/ node_modules/gatsby-theme-docz-pink` Then create a gatsby-config.js file at the root of your project and in it we declare that we want to use `gatsby-theme-docz-pink` and we tell webpack to compile it because it uses JSX which is not valid JS : ```js // gatsby-config.js module.exports = { plugins: [ 'gatsby-theme-docz-pink', { resolve: 'gatsby-plugin-compile-es6-packages', options: { modules: ['gatsby-theme-docz-pink'], }, }, ], } ``` If you run `yarn docz dev` you should see the theme take effect. ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-custom-docz-theme # or yarn create docz-app docz-app-with-custom-docz-theme ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-custom-docz-theme mv with-custom-docz-theme docz-with-custom-docz-theme-example cd docz-with-custom-docz-theme-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-custom-docz-theme/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/with-custom-docz-theme/gatsby-config.js ================================================ module.exports = { plugins: [ 'gatsby-theme-docz-pink', { resolve: 'gatsby-plugin-compile-es6-packages', options: { modules: ['gatsby-theme-docz-pink'], }, }, ], } ================================================ FILE: examples/with-custom-docz-theme/gatsby-theme-docz-pink/index.js ================================================ // noop ================================================ FILE: examples/with-custom-docz-theme/gatsby-theme-docz-pink/package.json ================================================ { "name": "gatsby-theme-docz-title", "version": "1.0.0", "main": "index.js", "license": "MIT" } ================================================ FILE: examples/with-custom-docz-theme/gatsby-theme-docz-pink/src/gatsby-theme-docz/wrapper.js ================================================ import React from 'react' import OriginalWrapper from 'gatsby-theme-docz/src/wrapper' const Wrapper = ({ children, doc }) => { return (
{children}
) } export default Wrapper ================================================ FILE: examples/with-custom-docz-theme/package.json ================================================ { "name": "docz-example-with-custom-docz-theme", "private": true, "version": "2.0.0", "license": "MIT", "scripts": { "install:theme": "cp -r gatsby-theme-docz-pink/ node_modules/gatsby-theme-docz-pink", "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/with-custom-docz-theme/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-custom-docz-theme/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-custom-docz-theme/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-custom-links/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-custom-links/README.md ================================================ # Docz with Custom Links Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-custom-links --example with-custom-links # or yarn create docz-app docz-app-with-custom-links --example with-custom-links ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-custom-links mv with-custom-links docz-with-custom-links-example cd docz-with-custom-links-example ``` ## Notes A new component `a` was added and passed to the MDXProvider by shadowing `gatsby-theme-docz/components/index.js` and adding a custom implementation. ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-custom-links/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/with-custom-links/src/gatsby-theme-docz/components/index.js ================================================ import React from 'react' import * as headings from 'gatsby-theme-docz/src/components/Headings' import { Code } from 'gatsby-theme-docz/src/components/Code' import { Layout } from 'gatsby-theme-docz/src/components/Layout' import { Playground } from 'gatsby-theme-docz/src/components/Playground' import { Pre } from 'gatsby-theme-docz/src/components/Pre' import { Props } from 'gatsby-theme-docz/src/components/Props' const a = props => props.href.startsWith('http://') || props.href.startsWith('https://') ? ( {props.children} ) : ( {props.children} ) export default { ...headings, code: Code, a, playground: Playground, pre: Pre, layout: Layout, props: Props, } ================================================ FILE: examples/with-custom-links/src/index.mdx ================================================ --- name: Getting Started route: / --- import { Playground } from 'docz' import { useState } from 'react' # Getting Started [Link that opens in new tab](https://duckduckgo.com) {() => { const [toggle, setToggle] = useState(true) return ( ) }} ================================================ FILE: examples/with-decorators/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-decorators/README.md ================================================ # Docz with Decorators Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-decorators --example with-decorators # or yarn create docz-app docz-app-with-decorators --example with-decorators ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-decorators mv with-decorators docz-with-decorators-example cd docz-with-decorators-example ``` ## Notes To add decorator support, we create a `gatsby-node.js` in the root directory and inside configure babel to understand decorators : ```js exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPlugin({ name: `@babel/plugin-proposal-decorators`, options: { legacy: true }, }) } ``` And add `@babel/plugin-proposal-decorators` as a dev dependency ```sh yarn add -D @babel/plugin-proposal-decorators ``` And last we set "compilerOptions.experimentalDecorators" to true in jsconfig.json ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-decorators/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/with-decorators/gatsby-node.js ================================================ exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPlugin({ name: `@babel/plugin-proposal-decorators`, options: { legacy: true }, }) } ================================================ FILE: examples/with-decorators/jsconfig.json ================================================ { "compilerOptions": { "experimentalDecorators": true } } ================================================ FILE: examples/with-decorators/package.json ================================================ { "name": "docz-example-with-decorators", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" }, "devDependencies": { "@babel/plugin-proposal-decorators": "^7.7.4" } } ================================================ FILE: examples/with-decorators/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-decorators/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-decorators/src/index.js ================================================ @annotation class MyClass {} function annotation(target) { target.annotated = "yes it's annotated" } export default MyClass ================================================ FILE: examples/with-decorators/src/index.mdx ================================================ --- name: Getting Started route: / --- import MyClass from './index.js'

MyClass.annotated : {MyClass.annotated}

# Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-env-variables/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-env-variables/README.md ================================================ # Docz With Env Variables Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-env-variables # or yarn create docz-app docz-app-with-env-variables ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-env-variables mv with-env-variables docz-with-env-variables-example cd docz-with-env-variables-example ``` ## Notes Environment variables are defined in `gatsby-node.js` by changing the webpack config (process.env.FOO, process.env.PROD) or in .env.* and then imported using `dotenv` in `gatsby-config.js` (process.env.GATSBY_API_URL). ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-env-variables/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/with-env-variables/gatsby-config.js ================================================ require('dotenv').config({ path: `.env.development`, }) ================================================ FILE: examples/with-env-variables/gatsby-node.js ================================================ exports.onCreateWebpackConfig = ({ plugins, actions }) => { const { setWebpackConfig } = actions setWebpackConfig({ plugins: [ plugins.define({ 'process.env.FOO': JSON.stringify('BAR'), 'process.env.PROD': JSON.stringify(true), }), ], }) } ================================================ FILE: examples/with-env-variables/package.json ================================================ { "name": "docz-example-basic", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/with-env-variables/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (

{process.env.PROD ? 'PROD' : 'NOT PROD'}

{process.env.FOO}

{process.env.GATSBY_API_URL}

{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-env-variables/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-env-variables/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-favicon-and-metadata/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-favicon-and-metadata/README.md ================================================ # With Favicon & Metadata Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-favicon-and-metadata --example with-favicon-and-metadata # or yarn create docz-app docz-app-with-favicon-and-metadata --example with-favicon-and-metadata ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-favicon-and-metadata mv with-favicon-and-metadata docz-with-favicon-and-metadata-example cd docz-with-favicon-and-metadata-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-favicon-and-metadata/package.json ================================================ { "name": "docz-example-with-favicon-and-metadata", "private": true, "version": "2.0.0", "license": "MIT", "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "next", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/with-favicon-and-metadata/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-favicon-and-metadata/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-favicon-and-metadata/src/gatsby-theme-docz/wrapper.js ================================================ import React from 'react' import { Helmet } from 'react-helmet-async' const Wrapper = ({ children, doc }) => { return ( <> {doc.value.name} {children} ) } export default Wrapper ================================================ FILE: examples/with-favicon-and-metadata/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-gatsby-remark-vscode/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-gatsby-remark-vscode/README.md ================================================ # Gatsby Remark VSCode with Docz [What is gatsby-remark-vscode ?](https://github.com/andrewbranch/gatsby-remark-vscode) ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-gatsby-remark-vscode # or yarn create docz-app docz-app-with-gatsby-remark-vscode ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-gatsby-remark-vscode mv with-gatsby-remark-vscode docz-with-gatsby-remark-vscode-example cd docz-with-gatsby-remark-vscode-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ## Tutorial There are two kinds of code blocks in docz. The first is embedded in the markdown ( \`\`\`js \`\`\` ) and the other used with the Playground component ( ```jsx {/* this code is editable by the user */} ``` ). For the one in the playground you won't be able to use gatsby-remark-vscode plugin because it's editable and rendered on the client. For the second you should be able to add gatsby-remark-vscode : 1. Install gatsby-remark-vscode : `yarn add gatsby-remark-vscode` 2. In your `doczrc.js` file add : ```js gatsbyRemarkPlugins: [ { resolve: 'gatsby-remark-vscode', // OPTIONAL options: {}, }, ] ``` 3. By now your site should be broken, you still need to tell docz not to try to render code blocks with prism (to leave it to gatsby-remark-vscode). To do that you will need to remove the pre and code components passed down to the MDXProvider by creating a file `src/gatsby-theme-docz/components/index.js` (original can be found [here](https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/components/index.js)) and add to it : ```js import * as headings from 'gatsby-theme-docz/src/components/Headings' import { Layout } from 'gatsby-theme-docz/src/components/Layout' import { Playground } from 'gatsby-theme-docz/src/components/Playground' import { Props } from 'gatsby-theme-docz/src/components/Props' export default { ...headings, playground: Playground, layout: Layout, props: Props, } ``` Then run yarn docz dev and you should see your code block rendered using `gatsby-remark-vscode` 🎉 . ================================================ FILE: examples/with-gatsby-remark-vscode/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], gatsbyRemarkPlugins: [ { resolve: 'gatsby-remark-vscode', // OPTIONAL options: {}, }, ], } ================================================ FILE: examples/with-gatsby-remark-vscode/package.json ================================================ { "name": "docz-example-gatsby-remark-vscode", "private": true, "version": "2.0.0", "license": "MIT", "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "gatsby-remark-vscode": "^1.4.0", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/with-gatsby-remark-vscode/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-gatsby-remark-vscode/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # JS ```js const a = "abc"; const b = "bca"; console.log(`${a}-${b}`) ``` # JSX ```jsx Some message Some message Some message Some message ``` # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-gatsby-remark-vscode/src/gatsby-theme-docz/components/index.js ================================================ import * as headings from 'gatsby-theme-docz/src/components/Headings' import { Layout } from 'gatsby-theme-docz/src/components/Layout' import { Playground } from 'gatsby-theme-docz/src/components/Playground' import { Props } from 'gatsby-theme-docz/src/components/Props' export default { ...headings, playground: Playground, layout: Layout, props: Props, } ================================================ FILE: examples/with-gatsby-remark-vscode/src/index.mdx ================================================ --- name: Getting Started route: / --- import { Playground, Props } from 'docz' import { Alert } from './components/Alert' ## JS ```js const a = "abc"; const b = "bca"; console.log(`${a}-${b}`) ``` ## JSX ```jsx Some message Some message Some message Some message ``` ## TypeScript ```ts import React, { FC } from 'react' export type Kind = 'info' | 'positive' | 'negative' | 'warning' export type KindMap = Record const kinds: KindMap = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export interface AlertProps { /** * Set this to change alert kind * @default info */ kind: 'info' | 'positive' | 'negative' | 'warning' } export const Alert: FC = ({ kind, ...props }) => (
) ``` ### Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ### Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-styled-components-and-scoping/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-styled-components-and-scoping/README.md ================================================ # Docz Styled Components Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-styled-docz --example with-styled-components-and-scoping # or yarn create docz-app docz-app-styled-docz --example with-styled-components-and-scoping ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-styled-components-and-scoping mv with-styled-components-and-scoping docz-example-styled-docz ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ## Deploy ```sh yarn deploy ``` Note that by default `docz` generates the output site in `.docz/public` to change that add a `dest` field to your `doczrc.js` with the path you want to generate the code in. ================================================ FILE: examples/with-styled-components-and-scoping/doczrc.js ================================================ export default { themeConfig: { useScopingInPlayground: true, }, } ================================================ FILE: examples/with-styled-components-and-scoping/package.json ================================================ { "private": true, "name": "docz-example-styled-components-with-scoping", "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", "react-frame-component": "^4.1.1", "styled-components": "^4.3.2" } } ================================================ FILE: examples/with-styled-components-and-scoping/src/components/Alert.jsx ================================================ import React from 'react' import styled from 'styled-components' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = styled('div')` padding: 15px 20px; background: white; border-radius: 3px; color: white; background: ${({ kind = 'info' }) => kinds[kind]}; ` export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-styled-components-and-scoping/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-styled-components-and-scoping/src/components/Button.jsx ================================================ import React from 'react' import styled from 'styled-components' import t from 'prop-types' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = outline => (bg, color) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } const kinds = outline => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } const getScale = ({ scale = 'normal' }) => scales[scale] const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] const ButtonStyled = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` export const Button = ({ children, ...props }) => ( {children} ) Button.propTypes = { scales: t.oneOf(['small', 'normal', 'big']), kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), outline: t.bool, } Button.defaultProps = { scales: 'normal', kind: 'primary', outline: false, } ================================================ FILE: examples/with-styled-components-and-scoping/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/with-styled-components-and-scoping/src/gatsby-theme-docz/components/Playground/IframeWrapper.js ================================================ /** @jsx jsx */ import { Fragment } from 'react' import { jsx } from 'theme-ui' import Iframe, { FrameContextConsumer } from 'react-frame-component' import { StyleSheetManager } from 'styled-components' import * as styles from 'gatsby-theme-docz/src/components/Playground/styles' const CLEAR_PADDING = `` const INITIAL_IFRAME_CONTENT = ` ${CLEAR_PADDING}
` export const IframeWrapper = ({ children, height, style = {} }) => { return ( ) } ================================================ FILE: examples/with-styled-components-and-scoping/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-themes-dir/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-themes-dir/README.md ================================================ # With themesDir Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-themes-dir # or yarn create docz-app docz-app-with-themes-dir ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-themes-dir mv with-themes-dir docz-with-themes-dir-example cd docz-with-themes-dir-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-themes-dir/doczrc.js ================================================ export default { themesDir: 'theme', menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/with-themes-dir/package.json ================================================ { "name": "docz-example-with-themes-dir", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "theme/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6" } } ================================================ FILE: examples/with-themes-dir/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } const AlertStyled = ({ children, kind, ...rest }) => (
{children}
) export const Alert = props => Alert.propTypes = { kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/with-themes-dir/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-themes-dir/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-themes-dir/theme/gatsby-theme-docz/components/Logo/index.js ================================================ /** @jsx jsx */ import { jsx, Flex } from 'theme-ui' import { Link, useConfig } from 'docz' import * as styles from './styles' export const Logo = () => { const config = useConfig() return ( {config.title.toUpperCase()} ) } ================================================ FILE: examples/with-themes-dir/theme/gatsby-theme-docz/components/Logo/styles.js ================================================ export const logo = { letterSpacing: '-0.02em', fontWeight: 600, fontSize: 4, } export const link = { fontWeight: 600, color: 'header.text', textDecoration: 'none', ':hover': { color: 'primary', }, } ================================================ FILE: examples/with-typescript-decorators/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/with-typescript-decorators/README.md ================================================ # Docz with Decorators and TypeScript Example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-with-typescript-decorators --example with-typescript-decorators # or yarn create docz-app docz-app-with-typescript-decorators --example with-typescript-decorators ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/with-typescript-decorators mv with-typescript-decorators docz-with-typescript-decorators-example cd docz-with-typescript-decorators-example ``` ## Notes To add decorator support, we create a `gatsby-node.js` in the root directory and inside configure babel to understand decorators : ```js exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPlugin({ name: `@babel/plugin-proposal-decorators`, options: { legacy: true }, }) } ``` And add `@babel/plugin-proposal-decorators` as a dev dependency ```sh yarn add -D @babel/plugin-proposal-decorators ``` And last we set "compilerOptions.experimentalDecorators" to true in tsconfig.json ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/with-typescript-decorators/doczrc.js ================================================ export default { typescript: true, } ================================================ FILE: examples/with-typescript-decorators/gatsby-node.js ================================================ exports.onCreateBabelConfig = ({ actions }) => { actions.setBabelPlugin({ name: `@babel/plugin-proposal-decorators`, options: { legacy: true }, }) } ================================================ FILE: examples/with-typescript-decorators/package.json ================================================ { "name": "docz-example-with-decorators", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" }, "devDependencies": { "@babel/plugin-proposal-decorators": "^7.7.4", "typescript": "^3.7.2" } } ================================================ FILE: examples/with-typescript-decorators/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Playground, Props } from 'docz' import { Alert } from './Alert.tsx' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/with-typescript-decorators/src/components/Alert.tsx ================================================ import React, { FC } from 'react' export type Kind = 'info' | 'positive' | 'negative' | 'warning' export type KindMap = Record const kinds: KindMap = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export interface AlertProps { /** * Set this to change alert kind * @default info */ kind: 'info' | 'positive' | 'negative' | 'warning' } export const Alert: FC = ({ children, kind, ...rest }) => (
{children}
) ================================================ FILE: examples/with-typescript-decorators/src/components/Button.mdx ================================================ --- name: Button menu: Components --- import { Playground, Props } from 'docz' import { Button } from './Button.tsx' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. ### Best practices - Group buttons logically into sets based on usage and importance. - Ensure that button actions are clear and consistent. - The main action of a group set can be a primary button. - Select a single button variation and do not mix them. ## Properties ## Basic usage ## With different sizes ## With different colors ## Outlined ================================================ FILE: examples/with-typescript-decorators/src/components/Button.tsx ================================================ import React, { FC } from 'react' import styled from '@emotion/styled' const scales = { small: ` padding: 5px 10px; font-size: 14px; `, normal: ` padding: 10px 20px; font-size: 16px; `, big: ` padding: 20px 30px; font-size: 18px; `, } const kind = (outline: boolean) => (bg: string, color: string) => { const boxShadowColor = outline ? bg : 'transparent' const backgroundColor = outline ? 'transparent' : bg return ` background: ${backgroundColor}; box-shadow: inset 0 0 0 1px ${boxShadowColor}; color: ${outline ? bg : color}; transition: all .3s; &:hover { box-shadow: inset 0 0 0 1000px ${boxShadowColor}; color: ${color}; } ` } type Kind = 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray' type Kinds = Record const kinds = (outline: boolean): Kinds => { const get = kind(outline) return { primary: get('#1FB6FF', 'white'), secondary: get('#5352ED', 'white'), cancel: get('#FF4949', 'white'), dark: get('#273444', 'white'), gray: get('#8492A6', 'white'), } } export interface ButtonProps { scale: 'small' | 'normal' | 'big' kind: 'primary' | 'secondary' | 'cancel' | 'dark' | 'gray' outline: boolean } const getScale = ({ scale = 'normal' }: ButtonProps) => scales[scale] const getKind = ({ kind = 'primary', outline = false }: ButtonProps) => kinds(outline)[kind] const ButtonStyled = styled('button')` ${getKind}; ${getScale}; cursor: pointer; margin: 3px 5px; border: none; border-radius: 3px; ` export const Button: FC = ({ children, ...props }) => ( {children} ) ================================================ FILE: examples/with-typescript-decorators/src/index.mdx ================================================ --- name: Getting Started route: / --- import MyClass from './index'

MyClass.annotated : {MyClass.annotated}

# Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: examples/with-typescript-decorators/src/index.ts ================================================ @annotation class MyClass { static annotated?: string } function annotation(target: typeof MyClass) { target.annotated = "yes it's annotated" } export default MyClass ================================================ FILE: examples/with-typescript-decorators/tsconfig.json ================================================ { "compilerOptions": { "experimentalDecorators": true, "target": "es2015", "moduleResolution": "node", "strict": true, "resolveJsonModule": true, "esModuleInterop": true, "skipLibCheck": false, "noEmit": true, "jsx": "react" } } ================================================ FILE: examples/wrapped-playground/.gitignore ================================================ .docz node_modules ================================================ FILE: examples/wrapped-playground/README.md ================================================ # Wrapped Playground Docz example ## Using `create-docz-app` ```sh npx create-docz-app docz-app-wrapped-playground # or yarn create docz-app docz-app-wrapped-playground ``` ## Download manually ```sh curl https://codeload.github.com/doczjs/docz/tar.gz/main | tar -xz --strip=2 docz-main/examples/wrapped-playground mv wrapped-playground docz-wrapped-playground-example cd docz-wrapped-playground-example ``` ## Setup ```sh yarn # npm i ``` ## Run ```sh yarn dev # npm run dev ``` ## Build ```sh yarn build # npm run build ``` ## Serve built app ```sh yarn serve # npm run serve ``` ================================================ FILE: examples/wrapped-playground/doczrc.js ================================================ export default { menu: ['Getting Started', 'Components'], } ================================================ FILE: examples/wrapped-playground/package.json ================================================ { "name": "docz-example-wrapped-playground", "private": true, "version": "2.0.0-rc.41", "license": "MIT", "files": [ "src/", "doczrc.js", "package.json" ], "scripts": { "dev": "docz dev", "build": "docz build", "serve": "docz serve" }, "dependencies": { "docz": "latest", "prop-types": "^15.7.2", "react": "^16.11.0", "react-dom": "^16.11.0" } } ================================================ FILE: examples/wrapped-playground/src/Playground.jsx ================================================ import React from 'react' import { Playground } from 'docz' export default props => { return (
) } ================================================ FILE: examples/wrapped-playground/src/components/Alert.jsx ================================================ import React from 'react' import t from 'prop-types' const kinds = { info: '#5352ED', positive: '#2ED573', negative: '#FF4757', warning: '#FFA502', } export const Alert = ({ children, kind, ...rest }) => (
{children}
) Alert.propTypes = { /** * The kind prop is used to set the alert's background color */ kind: t.oneOf(['info', 'positive', 'negative', 'warning']), } Alert.defaultProps = { kind: 'info', } ================================================ FILE: examples/wrapped-playground/src/components/Alert.mdx ================================================ --- name: Alert menu: Components --- import { Props } from 'docz' import Playground from '../Playground' import { Alert } from './Alert' # Alert ## Properties ## Basic usage Some message ## Using different kinds Some message Some message Some message Some message ================================================ FILE: examples/wrapped-playground/src/index.mdx ================================================ --- name: Getting Started route: / --- # Getting Started Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: - **It’s consistent**. The way components are built and managed follows a predictable pattern. - **It’s self-contained**. Your design system is treated as a standalone dependency. - **It’s reusable**. You’ve built components so they can be reused in many contexts. - **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. - **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. ## Consistency Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system. ================================================ FILE: lerna.json ================================================ { "lerna": "3.1.3", "packages": [ "core/**/*", "other-packages/**/*" ], "version": "2.4.0", "npmClient": "yarn", "useWorkspaces": true } ================================================ FILE: other-packages/babel-plugin-export-metadata/.eslintrc.js ================================================ module.exports = { extends: 'docz-js', } ================================================ FILE: other-packages/babel-plugin-export-metadata/.lintstagedrc ================================================ { "*.js": ["yarn fix", "git add"] } ================================================ FILE: other-packages/babel-plugin-export-metadata/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **babel-plugin-export-metadata:** fix `hasOwnProperty` method call ([#1581](https://github.com/doczjs/docz/issues/1581)) ([9067ffb](https://github.com/doczjs/docz/commit/9067ffb)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **babel-plugin-export-metadata:** fix `hasOwnProperty` method call ([#1581](https://github.com/doczjs/docz/issues/1581)) ([9067ffb](https://github.com/doczjs/docz/commit/9067ffb)) * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.0](https://github.com/doczjs/docz/compare/v2.3.0-alpha.14...v2.3.0) (2020-04-02) **Note:** Version bump only for package babel-plugin-export-metadata # [2.3.0-alpha.14](https://github.com/doczjs/docz/compare/v2.3.0-alpha.13...v2.3.0-alpha.14) (2020-03-31) ### Bug Fixes * **babel-plugin-export-metadata:** add case for export default… ([#1417](https://github.com/doczjs/docz/issues/1417)) ([31ebd08](https://github.com/doczjs/docz/commit/31ebd08)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package babel-plugin-export-metadata # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * **babel-plugin-export-metadata:** fix root relative path ([eccbac4](https://github.com/pedronauck/docz/commit/eccbac4)) * **babel-plugin-export-metadata:** transform to Unix slash ([#825](https://github.com/pedronauck/docz/issues/825)) ([#829](https://github.com/pedronauck/docz/issues/829)) ([f823cc6](https://github.com/pedronauck/docz/commit/f823cc6)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * **babel-plugin-export-metadata:** disable enumerable for __filemeta ([38d10fc](https://github.com/pedronauck/docz/commit/38d10fc)) ### Features * dynamic src and root path ([c071556](https://github.com/pedronauck/docz/commit/c071556)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) ### Features * **docz-core:** add config not use specifiers ([#849](https://github.com/pedronauck/docz/issues/849)) ([d8595a9](https://github.com/pedronauck/docz/commit/d8595a9)) # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package babel-plugin-export-metadata ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) ### Bug Fixes * **babel-plugin-export-metadata:** avoid adding __filemeta to non-extensible objects ([#798](https://github.com/pedronauck/docz/issues/798)) ([794ebc4](https://github.com/pedronauck/docz/commit/794ebc4)) * **babel-plugin-export-metadata:** re-export causes meta error ([#805](https://github.com/pedronauck/docz/issues/805)) ([9401676](https://github.com/pedronauck/docz/commit/9401676)) ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package babel-plugin-export-metadata ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) ### Bug Fixes * **babel-plugin-export-metadata:** fix re-export default ([#790](https://github.com/pedronauck/docz/issues/790)) ([#791](https://github.com/pedronauck/docz/issues/791)) ([89b3928](https://github.com/pedronauck/docz/commit/89b3928)) # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) ### Bug Fixes * **babel-plugin-export-metadata:** remove cache folders from parse ([2978a26](https://github.com/pedronauck/docz/commit/2978a26)) # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) ### Bug Fixes * get component filename relative (fix [#706](https://github.com/pedronauck/docz/issues/706)) ([84b23ea](https://github.com/pedronauck/docz/commit/84b23ea)) # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package babel-plugin-export-metadata # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * **babel-plugin-export-metadata:** update snapshot test ([6ca7b87](https://github.com/pedronauck/docz/commit/6ca7b87)) * prop types parser ([a3cc319](https://github.com/pedronauck/docz/commit/a3cc319)) * **babel-plugin-export-metadata:** just define pro non-primitive types ([ed78a13](https://github.com/pedronauck/docz/commit/ed78a13)) * **babel-plugin-export-metadata:** prettier fix script ([3a34b72](https://github.com/pedronauck/docz/commit/3a34b72)) * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) * docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) ================================================ FILE: other-packages/babel-plugin-export-metadata/README.md ================================================ ## babel-plugin-export-metadata This is an internal docz babel plugin used to add file metadata for function declarations. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: other-packages/babel-plugin-export-metadata/jest.config.js ================================================ module.exports = { testEnvironment: 'node', } ================================================ FILE: other-packages/babel-plugin-export-metadata/package.json ================================================ { "name": "babel-plugin-export-metadata", "version": "2.4.0", "description": "Add file metadata for function declarations", "license": "MIT", "author": { "name": "Marcelo Piva", "email": "m.pivaa@gmail.com" }, "contributors": [ { "name": "Pedro Nauck", "email": "pedronauck@gmail.com" } ], "main": "src/index.js", "files": [ "src/", "package.json" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "other-packages/babel-plugin-export-metadata" }, "scripts": { "fix": "yarn lint --fix", "lint": "eslint . --ext .js", "precommit": "lint-staged", "test": "jest" }, "dependencies": { "@babel/cli": "^7.5.5", "@babel/core": "^7.5.5", "@babel/preset-env": "^7.5.5", "@babel/template": "^7.4.4", "babel-core": "7.0.0-bridge.0", "lodash": "^4.17.14" } } ================================================ FILE: other-packages/babel-plugin-export-metadata/src/index.js ================================================ const path = require('path') const { default: template } = require('@babel/template') const { get } = require('lodash') const buildFileMeta = template(` if ( typeof ID !== 'undefined' && ID && ID === Object(ID) && Object.isExtensible(ID) && !Object.prototype.hasOwnProperty.call(ID, '__filemeta') ) { Object.defineProperty(ID, '__filemeta', { configurable: true, value: { name: NAME, filename: FILENAME } }); } `) const replaceExportDefault = template(` import NAME from 'SOURCE' export default NAME `) const replaceExportDefaultCall = template(` const NAME = DECLARATION export default NAME `) const getFilename = state => { const rootDir = get(state, 'opts.root', process.cwd()) const filename = get(state, 'file.opts.filename') let filepath = filename && path.relative(rootDir, filename) if (process.platform === 'win32') filepath = filepath.split('\\').join('/') return filepath } const findPathToInsert = path => path.parent.type === 'Program' && path.insertAfter ? path : findPathToInsert(path.parentPath) const addFileMetaProperties = (t, path, filename, name) => { if (!filename || !name) { return } const pathToInsert = findPathToInsert(path) const newNode = buildFileMeta({ ID: t.identifier(name), NAME: t.stringLiteral(name), FILENAME: t.stringLiteral(filename), }) pathToInsert.insertAfter(newNode) } const renameDefaultAddFileMetaProperties = (t, path, filename, name) => { if (!filename || !name) { return } const sourceValue = get(path, 'node.source.value') const localeName = get(path, 'node.specifiers[0].local.name') const pathToInsert = findPathToInsert(path) const fallbackName = localeName === 'default' ? '__DOCZ_DUMMY_EXPORT_DEFAULT' : localeName // replace const nameExport = replaceExportDefault({ NAME: fallbackName, SOURCE: sourceValue, }) pathToInsert.replaceWithMultiple(nameExport) } const replaceDefaultCallAddFileMetaProperties = (t, path, filename) => { if (!filename) { return } const declaration = get(path, 'node.declaration') const pathToInsert = findPathToInsert(path) const fallbackName = '__DOCZ_DUMMY_EXPORT_DEFAULT' // replace const nameExport = replaceExportDefaultCall({ NAME: fallbackName, DECLARATION: declaration, }) const [declPath] = pathToInsert.replaceWithMultiple(nameExport) path.scope.registerDeclaration(declPath) } const insertNodeExport = t => (path, state) => { const filename = getFilename(state) if (/(\.cache|\.docz).+/.test(filename)) return const name = get(path, 'node.declaration.id.name') const declarations = get(path, 'node.declaration.declarations') const specifiers = get(path, 'node.specifiers') if (name) { addFileMetaProperties(t, path, filename, name) } else if (declarations) { for (declaration of declarations) { const declarationName = get(declaration, 'id.name') addFileMetaProperties(t, path, filename, declarationName) } } else if (specifiers && !state.opts.notUseSpecifiers) { for (specifier of specifiers) { const localName = get(specifier, 'local.name') const exportedName = get(specifier, 'exported.name') const source = get(path, 'node.source') if (source && exportedName === 'default') { // case for: export default from './a.js'. `default` is a keyword, rename it renameDefaultAddFileMetaProperties(t, path, filename, 'default') } else { // if there is `path.source`, the specifier is imported from another module. Then use its exportedName const specifierName = source ? exportedName : localName addFileMetaProperties(t, path, filename, specifierName) } } } } const insertNodeExportDefault = t => (path, state) => { const filename = getFilename(state) if (/(\.cache|\.docz).+/.test(filename)) return const declaration = get(path, 'node.declaration', {}) if (/Function|Class|Identifier/.test(declaration.type)) { const name = declaration.name || get(declaration, 'id.name') addFileMetaProperties(t, path, filename, name) return } switch (declaration.type) { case 'ObjectExpression': { const { properties } = declaration for (property of properties) { const name = get(property, 'key.name') addFileMetaProperties(t, path, filename, name) } break } case 'ArrayExpression': { const { elements } = declaration for (element of elements) { const name = element.name addFileMetaProperties(t, path, filename, name) } break } case 'CallExpression': { // case for: export default React.memo(Component). replaceDefaultCallAddFileMetaProperties(t, path, filename) break } } } module.exports = function({ types: t }) { const insertExport = insertNodeExport(t) const insertExportDefault = insertNodeExportDefault(t) return { visitor: { ExportNamedDeclaration: insertExport, ExportDefaultDeclaration: insertExportDefault, }, } } ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/__snapshots__/index.test.js.snap ================================================ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`export-metadata export default works with Array expression 1`] = ` "/* ExportDefaultDeclaration with Array expression */ let foo5 = 5; let bar5 = () => {}; export default [foo5, bar5]; if (typeof bar5 !== 'undefined' && bar5 && bar5 === Object(bar5) && Object.isExtensible(bar5) && !Object.prototype.hasOwnProperty.call(bar5, '__filemeta')) { Object.defineProperty(bar5, '__filemeta', { configurable: true, value: { name: \\"bar5\\", filename: \\"tests/fixtures/export-default/with-arr-expression.js\\" } }); } if (typeof foo5 !== 'undefined' && foo5 && foo5 === Object(foo5) && Object.isExtensible(foo5) && !Object.prototype.hasOwnProperty.call(foo5, '__filemeta')) { Object.defineProperty(foo5, '__filemeta', { configurable: true, value: { name: \\"foo5\\", filename: \\"tests/fixtures/export-default/with-arr-expression.js\\" } }); }" `; exports[`export-metadata export default works with Call expression 1`] = ` "/* ExportDefaultDeclaration with Call expression */ const foo = v => v; const __DOCZ_DUMMY_EXPORT_DEFAULT = foo(5); export default __DOCZ_DUMMY_EXPORT_DEFAULT; if (typeof __DOCZ_DUMMY_EXPORT_DEFAULT !== 'undefined' && __DOCZ_DUMMY_EXPORT_DEFAULT && __DOCZ_DUMMY_EXPORT_DEFAULT === Object(__DOCZ_DUMMY_EXPORT_DEFAULT) && Object.isExtensible(__DOCZ_DUMMY_EXPORT_DEFAULT) && !Object.prototype.hasOwnProperty.call(__DOCZ_DUMMY_EXPORT_DEFAULT, '__filemeta')) { Object.defineProperty(__DOCZ_DUMMY_EXPORT_DEFAULT, '__filemeta', { configurable: true, value: { name: \\"__DOCZ_DUMMY_EXPORT_DEFAULT\\", filename: \\"tests/fixtures/export-default/with-identifier.js\\" } }); }" `; exports[`export-metadata export default works with Class declaration 1`] = ` "/* ExportDefaultDeclaration with Class declaration */ export default class Bar6 {} if (typeof Bar6 !== 'undefined' && Bar6 && Bar6 === Object(Bar6) && Object.isExtensible(Bar6) && !Object.prototype.hasOwnProperty.call(Bar6, '__filemeta')) { Object.defineProperty(Bar6, '__filemeta', { configurable: true, value: { name: \\"Bar6\\", filename: \\"tests/fixtures/export-default/with-class-declaration.js\\" } }); }" `; exports[`export-metadata export default works with Function declaration 1`] = ` "/* ExportDefaultDeclaration with Function declaration */ export default function foo6() {} if (typeof foo6 !== 'undefined' && foo6 && foo6 === Object(foo6) && Object.isExtensible(foo6) && !Object.prototype.hasOwnProperty.call(foo6, '__filemeta')) { Object.defineProperty(foo6, '__filemeta', { configurable: true, value: { name: \\"foo6\\", filename: \\"tests/fixtures/export-default/with-func-declaration.js\\" } }); }" `; exports[`export-metadata export default works with Identifier 1`] = ` "/* ExportDefaultDeclaration with Identifier */ let foo3 = 5; export default foo3; if (typeof foo3 !== 'undefined' && foo3 && foo3 === Object(foo3) && Object.isExtensible(foo3) && !Object.prototype.hasOwnProperty.call(foo3, '__filemeta')) { Object.defineProperty(foo3, '__filemeta', { configurable: true, value: { name: \\"foo3\\", filename: \\"tests/fixtures/export-default/with-identifier.js\\" } }); }" `; exports[`export-metadata export default works with Object expression 1`] = ` "/* ExportDefaultDeclaration with Object expression */ export default { foo4: 5, bar4: () => {} }; if (typeof bar4 !== 'undefined' && bar4 && bar4 === Object(bar4) && Object.isExtensible(bar4) && !Object.prototype.hasOwnProperty.call(bar4, '__filemeta')) { Object.defineProperty(bar4, '__filemeta', { configurable: true, value: { name: \\"bar4\\", filename: \\"tests/fixtures/export-default/with-obj-expression.js\\" } }); } if (typeof foo4 !== 'undefined' && foo4 && foo4 === Object(foo4) && Object.isExtensible(foo4) && !Object.prototype.hasOwnProperty.call(foo4, '__filemeta')) { Object.defineProperty(foo4, '__filemeta', { configurable: true, value: { name: \\"foo4\\", filename: \\"tests/fixtures/export-default/with-obj-expression.js\\" } }); }" `; exports[`export-metadata export named works 1`] = ` "/* ExportNamedDeclaration with Specifiers */ let foo = 5; let bar = () => {}; let baz = 'baz'; export { foo as default, bar as foobar, baz }; /* ExportNamedDeclaration with Variable declarations */ if (typeof baz !== 'undefined' && baz && baz === Object(baz) && Object.isExtensible(baz) && !Object.prototype.hasOwnProperty.call(baz, '__filemeta')) { Object.defineProperty(baz, '__filemeta', { configurable: true, value: { name: \\"baz\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } if (typeof bar !== 'undefined' && bar && bar === Object(bar) && Object.isExtensible(bar) && !Object.prototype.hasOwnProperty.call(bar, '__filemeta')) { Object.defineProperty(bar, '__filemeta', { configurable: true, value: { name: \\"bar\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } if (typeof foo !== 'undefined' && foo && foo === Object(foo) && Object.isExtensible(foo) && !Object.prototype.hasOwnProperty.call(foo, '__filemeta')) { Object.defineProperty(foo, '__filemeta', { configurable: true, value: { name: \\"foo\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } export let foo1 = 5, bar1 = () => {}; /* ExportNamedDeclaration with Function and Class declarations */ if (typeof bar1 !== 'undefined' && bar1 && bar1 === Object(bar1) && Object.isExtensible(bar1) && !Object.prototype.hasOwnProperty.call(bar1, '__filemeta')) { Object.defineProperty(bar1, '__filemeta', { configurable: true, value: { name: \\"bar1\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } if (typeof foo1 !== 'undefined' && foo1 && foo1 === Object(foo1) && Object.isExtensible(foo1) && !Object.prototype.hasOwnProperty.call(foo1, '__filemeta')) { Object.defineProperty(foo1, '__filemeta', { configurable: true, value: { name: \\"foo1\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } export function foo2() {} if (typeof foo2 !== 'undefined' && foo2 && foo2 === Object(foo2) && Object.isExtensible(foo2) && !Object.prototype.hasOwnProperty.call(foo2, '__filemeta')) { Object.defineProperty(foo2, '__filemeta', { configurable: true, value: { name: \\"foo2\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); } export class Bar2 {} if (typeof Bar2 !== 'undefined' && Bar2 && Bar2 === Object(Bar2) && Object.isExtensible(Bar2) && !Object.prototype.hasOwnProperty.call(Bar2, '__filemeta')) { Object.defineProperty(Bar2, '__filemeta', { configurable: true, value: { name: \\"Bar2\\", filename: \\"tests/fixtures/export-named/index.js\\" } }); }" `; exports[`export-metadata re-export re export default 1`] = ` "/* Re-export */ import __DOCZ_DUMMY_EXPORT_DEFAULT from \\"../assets/a\\"; export default __DOCZ_DUMMY_EXPORT_DEFAULT; if (typeof __DOCZ_DUMMY_EXPORT_DEFAULT !== 'undefined' && __DOCZ_DUMMY_EXPORT_DEFAULT && __DOCZ_DUMMY_EXPORT_DEFAULT === Object(__DOCZ_DUMMY_EXPORT_DEFAULT) && Object.isExtensible(__DOCZ_DUMMY_EXPORT_DEFAULT) && !Object.prototype.hasOwnProperty.call(__DOCZ_DUMMY_EXPORT_DEFAULT, '__filemeta')) { Object.defineProperty(__DOCZ_DUMMY_EXPORT_DEFAULT, '__filemeta', { configurable: true, value: { name: \\"__DOCZ_DUMMY_EXPORT_DEFAULT\\", filename: \\"tests/fixtures/re-export/re-export-default.js\\" } }); }" `; exports[`export-metadata re-export re export default to name 1`] = ` "/* Re-export */ export { default as aDefault } from '../assets/a'; if (typeof aDefault !== 'undefined' && aDefault && aDefault === Object(aDefault) && Object.isExtensible(aDefault) && !Object.prototype.hasOwnProperty.call(aDefault, '__filemeta')) { Object.defineProperty(aDefault, '__filemeta', { configurable: true, value: { name: \\"aDefault\\", filename: \\"tests/fixtures/re-export/re-export-rename1.js\\" } }); }" `; exports[`export-metadata re-export re export name 1`] = ` "/* Re-export */ export { a } from '../assets/a'; if (typeof a !== 'undefined' && a && a === Object(a) && Object.isExtensible(a) && !Object.prototype.hasOwnProperty.call(a, '__filemeta')) { Object.defineProperty(a, '__filemeta', { configurable: true, value: { name: \\"a\\", filename: \\"tests/fixtures/re-export/re-export.js\\" } }); }" `; exports[`export-metadata re-export re export name to default 1`] = ` "/* Re-export */ import a from \\"../assets/a\\"; export default a; if (typeof a !== 'undefined' && a && a === Object(a) && Object.isExtensible(a) && !Object.prototype.hasOwnProperty.call(a, '__filemeta')) { Object.defineProperty(a, '__filemeta', { configurable: true, value: { name: \\"a\\", filename: \\"tests/fixtures/re-export/re-export-rename2.js\\" } }); }" `; exports[`export-metadata re-export re export name to name 1`] = ` "/* Re-export */ export { a as aa } from '../assets/a'; if (typeof aa !== 'undefined' && aa && aa === Object(aa) && Object.isExtensible(aa) && !Object.prototype.hasOwnProperty.call(aa, '__filemeta')) { Object.defineProperty(aa, '__filemeta', { configurable: true, value: { name: \\"aa\\", filename: \\"tests/fixtures/re-export/re-export-rename3.js\\" } }); }" `; exports[`export-metadata re-export re-export default 1`] = `""`; ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/assets/a.js ================================================ const a = 1 const ____a = 2 export { a } export default ____a ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-arr-expression.js ================================================ /* ExportDefaultDeclaration with Array expression */ let foo5 = 5 let bar5 = () => {} export default [foo5, bar5] ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-call-expression.js ================================================ /* ExportDefaultDeclaration with Call expression */ const foo = v => v export default foo(5) ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-class-declaration.js ================================================ /* ExportDefaultDeclaration with Class declaration */ export default class Bar6 {} ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-func-declaration.js ================================================ /* ExportDefaultDeclaration with Function declaration */ export default function foo6() {} ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-identifier.js ================================================ /* ExportDefaultDeclaration with Identifier */ let foo3 = 5 export default foo3 ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-default/with-obj-expression.js ================================================ /* ExportDefaultDeclaration with Object expression */ export default { foo4: 5, bar4: () => {} } ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/export-named/index.js ================================================ /* ExportNamedDeclaration with Specifiers */ let foo = 5 let bar = () => {} let baz = 'baz' export { foo as default, bar as foobar, baz } /* ExportNamedDeclaration with Variable declarations */ export let foo1 = 5, bar1 = () => {} /* ExportNamedDeclaration with Function and Class declarations */ export function foo2() {} export class Bar2 {} ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export-default.js ================================================ /* Re-export */ export { default } from '../assets/a' ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export-multi.js ================================================ /* Re-export */ import aDefault, { a } from '../assets/a' export { a } export default aDefault ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export-rename1.js ================================================ /* Re-export */ export { default as aDefault } from '../assets/a' ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export-rename2.js ================================================ /* Re-export */ export { a as default } from '../assets/a' ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export-rename3.js ================================================ /* Re-export */ export { a as aa } from '../assets/a' ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/fixtures/re-export/re-export.js ================================================ /* Re-export */ export { a } from '../assets/a' ================================================ FILE: other-packages/babel-plugin-export-metadata/tests/index.test.js ================================================ const { transformSync } = require('@babel/core') const fs = require('fs') const path = require('path') const plugin = require('../src') const exportNamedFixture = path.resolve( './tests/fixtures/export-named/index.js' ) const exportDefaultFixtures = { withArrExpression: path.resolve( './tests/fixtures/export-default/with-arr-expression.js' ), withClassDeclaration: path.resolve( './tests/fixtures/export-default/with-class-declaration.js' ), withFuncDeclaration: path.resolve( './tests/fixtures/export-default/with-func-declaration.js' ), withIdentifier: path.resolve( './tests/fixtures/export-default/with-identifier.js' ), withObjExpression: path.resolve( './tests/fixtures/export-default/with-obj-expression.js' ), withCallExpression: path.resolve( './tests/fixtures/export-default/with-call-expression.js' ), } const reExportsFixtures = { reExportName: path.resolve( path.resolve('./tests/fixtures/re-export/re-export.js') ), reExportDefault: path.resolve( path.resolve('./tests/fixtures/re-export/re-export-default.js') ), reExportDefaultToName: path.resolve( path.resolve('./tests/fixtures/re-export/re-export-rename1.js') ), reExportNameToDefault: path.resolve( path.resolve('./tests/fixtures/re-export/re-export-rename2.js') ), reExportNameToName: path.resolve( path.resolve('./tests/fixtures/re-export/re-export-rename3.js') ), } const getCodeFromFilePath = paths => Object.keys(paths).reduce( (acc, key) => ({ ...acc, [key]: fs.readFileSync(paths[key]).toString(), }), {} ) const exportDefaultCode = getCodeFromFilePath(exportDefaultFixtures) const exportNamedCode = fs.readFileSync(exportNamedFixture).toString() const reExportCode = getCodeFromFilePath(reExportsFixtures) describe('export-metadata', () => { describe('re-export', () => { it('re-export default', () => { const result = transformSync(exportDefaultFixtures.reExportName, { plugins: [plugin], filename: exportNamedFixture.reExportName, }) expect(result.code).toMatchSnapshot() }) }) describe('export default', () => { it('works with Array expression', () => { const result = transformSync(exportDefaultCode.withArrExpression, { plugins: [plugin], filename: exportDefaultFixtures.withArrExpression, }) expect(result.code).toMatchSnapshot() }) it('works with Object expression', () => { const result = transformSync(exportDefaultCode.withObjExpression, { plugins: [plugin], filename: exportDefaultFixtures.withObjExpression, }) expect(result.code).toMatchSnapshot() }) it('works with Class declaration', () => { const result = transformSync(exportDefaultCode.withClassDeclaration, { plugins: [plugin], filename: exportDefaultFixtures.withClassDeclaration, }) expect(result.code).toMatchSnapshot() }) it('works with Function declaration', () => { const result = transformSync(exportDefaultCode.withFuncDeclaration, { plugins: [plugin], filename: exportDefaultFixtures.withFuncDeclaration, }) expect(result.code).toMatchSnapshot() }) it('works with Identifier', () => { const result = transformSync(exportDefaultCode.withIdentifier, { plugins: [plugin], filename: exportDefaultFixtures.withIdentifier, }) expect(result.code).toMatchSnapshot() }) it('works with Call expression', () => { const result = transformSync(exportDefaultCode.withCallExpression, { plugins: [plugin], filename: exportDefaultFixtures.withIdentifier, }) expect(result.code).toMatchSnapshot() }) }) describe('export named', () => { it('works', () => { const result = transformSync(exportNamedCode, { plugins: [plugin], filename: exportNamedFixture, }) expect(result.code).toMatchSnapshot() }) }) describe('re-export', () => { it('re export name', () => { const result = transformSync(reExportCode.reExportName, { plugins: [plugin], filename: reExportsFixtures.reExportName, }) expect(result.code).toMatchSnapshot() }) it('re export default', () => { const result = transformSync(reExportCode.reExportDefault, { plugins: [plugin], filename: reExportsFixtures.reExportDefault, }) expect(result.code).toMatchSnapshot() }) it('re export name to default', () => { const result = transformSync(reExportCode.reExportNameToDefault, { plugins: [plugin], filename: reExportsFixtures.reExportNameToDefault, }) expect(result.code).toMatchSnapshot() }) it('re export default to name', () => { const result = transformSync(reExportCode.reExportDefaultToName, { plugins: [plugin], filename: reExportsFixtures.reExportDefaultToName, }) expect(result.code).toMatchSnapshot() }) it('re export name to name', () => { const result = transformSync(reExportCode.reExportNameToName, { plugins: [plugin], filename: reExportsFixtures.reExportNameToName, }) expect(result.code).toMatchSnapshot() }) }) }) ================================================ FILE: other-packages/e2e-tests/.testcaferc.json ================================================ { "clientScripts": [ "../../node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js" ] } ================================================ FILE: other-packages/e2e-tests/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.2.0](https://github.com/doczjs/docz/compare/v2.2.0-alpha.8...v2.2.0) (2019-12-11) **Note:** Version bump only for package e2e-tests ================================================ FILE: other-packages/e2e-tests/__tests__/test.ts ================================================ import { Selector } from 'testcafe' const getByTestId = async (testId: string) => { return await Selector(`[data-testid=${testId}]`) } fixture`Renders a valid app`.page`http://localhost:3000/` test('Renders the right layout and nav', async t => { const layout = await getByTestId('layout') await t.expect(layout.exists).eql(true) const header = await getByTestId('header') await t.expect(header.exists).eql(true) const sidebar = await getByTestId('sidebar') await t.expect(sidebar.exists).eql(true) const logo = await getByTestId('logo') await t.expect(logo.exists).eql(true) const navGroup = await getByTestId('nav-group') await t.expect(navGroup.exists).eql(true) await t.navigateTo('/src-components-alert') const playground = await getByTestId('playground') await t.expect(playground.count).eql(2) const livePreview = await getByTestId('live-preview') await t.expect(livePreview.count).eql(2) const liveEditor = await getByTestId('live-editor') await t.expect(liveEditor.count).eql(2) }) test('Render props', async t => { await t.navigateTo('/src-components-alert') const prop = await getByTestId('prop') await t.expect(prop.exists).eql(true) await t.expect(prop.count).eql(1) }) ================================================ FILE: other-packages/e2e-tests/helpers.js ================================================ const fs = require('fs-extra') const path = require('path') const updatePackageJson = async (pathToSource, reducer = v => v) => { console.log(`Modifying package.json in ${pathToSource}`) const pathToPackageJson = path.join(`${pathToSource}`, 'package.json') await fs.copyFile( pathToPackageJson, path.join(`${pathToSource}`, 'package.backup.json') ) const packageJson = await fs.readJson(pathToPackageJson) const newPackageJson = reducer(packageJson) await fs.writeJson(pathToPackageJson, newPackageJson, { spaces: 2 }) } const revertPackageJson = async pathToSource => { const pathToPackageJson = path.join(`${pathToSource}`, 'package.json') const pathToBackup = path.join(`${pathToSource}`, 'package.backup.json') await fs.move(pathToBackup, pathToPackageJson, { overwrite: true }) } module.exports = { updatePackageJson, revertPackageJson } ================================================ FILE: other-packages/e2e-tests/index.js ================================================ const execa = require('execa') const path = require('path') const waitOn = require('wait-on') const kill = require('kill-port') const fs = require('fs-extra') const tmp = require('tmp') const set = require('lodash/set') const get = require('lodash/get') const { updatePackageJson, revertPackageJson } = require('./helpers') const VERDACCIO_PORT = 4873 const LOCAL_REGISTRY = `http://localhost:${VERDACCIO_PORT}` const REMOTE_REGISTRY = `https://registry.npmjs.org/` const tmpPath = tmp.dirSync({ unsafeCleanup: true, mode: 0o100777 }).name const rootPath = path.join(__dirname, '../../') const e2eTestsPath = __dirname const paths = { doczCore: path.join(rootPath, 'core/docz-core'), docz: path.join(rootPath, 'core/docz'), doczGatsbyTheme: path.join(rootPath, 'core/gatsby-theme-docz'), // doczUtils: '../../core/docz-utils', // rehypeDocz: '../../core/rehype-docz', // remarkDocz: '../../core/remark-docz', } const examples = { basic: { path: path.join(rootPath, 'examples/basic'), tmp: path.join(tmpPath, 'examples/basic'), }, gatsby: { path: path.join(rootPath, 'examples/gatsby'), tmp: path.join(tmpPath, 'examples/gatsby'), }, 'monorepo-package': { path: path.join(rootPath, 'examples/monorepo-package'), tmp: path.join(tmpPath, 'examples/monorepo-package'), tmpDoczPackageJson: path.join( tmpPath, 'examples/monorepo-package/packages/basic' ), }, typescript: { path: path.join(rootPath, 'examples/typescript'), tmp: path.join(tmpPath, 'examples/typescript'), }, 'custom-config-location': { path: path.join(rootPath, 'examples/custom-config-location'), tmp: path.join(tmpPath, 'examples/custom-config-location'), }, } const startLocalRegistry = async () => { console.log('Running npx verdaccio') runCommand(`npx verdaccio ${e2eTestsPath}/verdaccio.yaml`) console.log('Waiting for Verdaccio to boot') await waitOn({ resources: [LOCAL_REGISTRY] }) await runCommand(`npm set registry ${LOCAL_REGISTRY}`) await runCommand(`yarn config set registry ${LOCAL_REGISTRY}`) } const stopLocalRegistry = async () => { await runCommand(`npm set registry ${REMOTE_REGISTRY}`) await runCommand(`yarn config set registry ${REMOTE_REGISTRY}`) } const runCommand = ( command, { cwd = rootPath, stdio = 'inherit', detached = false } = { cwd: rootPath, stdio: 'inherit', detached: false, } ) => { const [binary, ...rest] = command.split(' ') return execa(binary, rest, { cwd, stdio, detached }) } const installNodeModules = async (packagePath, cacheKey = '') => { const cachePath = path.join(rootPath, `.e2e-tests-cache`, cacheKey) const freshModulesPath = path.join(packagePath, 'node_modules') const hasCache = await fs.pathExists(cachePath) if (hasCache) { console.log( `Using node_modules cache in ${cachePath} for node_modules of ${cacheKey}`, { cachePath, freshModulesPath, } ) await fs.remove(freshModulesPath) await fs.copy(cachePath, freshModulesPath) } else { console.log( `Couldnt find node_modules cache at ${cachePath} for node_modules of ${cacheKey}` ) await runCommand(`yarn install`, { cwd: packagePath }) await fs.copy(freshModulesPath, cachePath) } } const setupLocalRegistry = async () => { await startLocalRegistry() await updatePackageJson(paths.doczGatsbyTheme, packageJson => { set(packageJson, 'version', `0.0.${Date.now()}`) return packageJson }) await updatePackageJson(paths.docz, packageJson => { set(packageJson, 'version', `0.0.${Date.now()}`) return setDoczVersionToCI(packageJson) }) await updatePackageJson(paths.doczCore, packageJson => { set(packageJson, 'version', `0.0.${Date.now()}`) return packageJson }) // Generate the right .npmrc file in the folders to be published await runCommand( `npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r ${LOCAL_REGISTRY}`, { cwd: paths.doczGatsbyTheme } ) await runCommand( `npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r ${LOCAL_REGISTRY}`, { cwd: paths.docz } ) await runCommand( `npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r ${LOCAL_REGISTRY}`, { cwd: paths.doczCore } ) await runCommand(`npm publish --tag ci`, { cwd: paths.doczGatsbyTheme }) console.log('Published gatsby') await runCommand(`npm publish --tag ci`, { cwd: paths.docz }) console.log('Published docz') await runCommand(`npm publish --tag ci`, { cwd: paths.doczCore }) console.log('Published core') } const setDoczVersionToCI = packageJson => { if (get(packageJson, 'dependencies.gatsby-theme-docz', false)) { set(packageJson, 'dependencies.gatsby-theme-docz', 'ci') } if (get(packageJson, 'dependencies.docz', false)) { set(packageJson, 'dependencies.docz', 'ci') } if (get(packageJson, 'dependencies.docz-core', false)) { set(packageJson, 'dependencies.docz-core', 'ci') } return packageJson } const runTests = async () => { console.log(`Preparing tmp examples dir.`) let PORT = 3000 for (let exampleName in examples) { console.log(`🕕 Running ${exampleName} test`) const example = examples[exampleName] await fs.ensureDir(`${tmpPath}/examples/${exampleName}`) console.log() console.log(`Copying ${exampleName} example to a temporary directory.`) console.log(`Source : ${example.path}`) console.log(`Destination : ${example.tmp}`) console.log() await fs.copy(example.path, example.tmp) console.log(`Copied ${exampleName} example to a temporary directory.`) console.log(`Modifying package.json in ${example.tmp}`) await updatePackageJson(example.tmp, pack => { return setDoczVersionToCI(pack) }) if ('tmpDoczPackageJson' in example) { await updatePackageJson(example.tmpDoczPackageJson, pack => { return setDoczVersionToCI(pack) }) } console.log({ example }) console.log(`Installing modules in tmp directory`) await installNodeModules(example.tmp, exampleName) // await runCommand(`yarn build`, example.tmp) const command = runCommand(`yarn dev --port ${PORT}`, { cwd: example.tmp }) await waitOn({ resources: [`http://localhost:${PORT}`] }) console.log('Ready. Starting e2e tests') await runCommand('yarn run testcafe:ci', { cwd: e2eTestsPath }) command.kill('SIGTERM', { forceKillAfterTimeout: 2000, }) await kill(3000, 'tcp') console.log(`✅ Ran ${exampleName} test successfully`) } await fs.remove(tmpPath) console.log('done') return } const cleanup = async () => { console.log('Cleaning up') await stopLocalRegistry() await revertPackageJson(paths.doczGatsbyTheme) await revertPackageJson(paths.docz) await revertPackageJson(paths.doczCore) } ;(async () => { await setupLocalRegistry() await runTests() await cleanup() console.log('Exiting process') process.exit(0) })() ================================================ FILE: other-packages/e2e-tests/package.json ================================================ { "name": "e2e-tests", "version": "2.2.0", "private": true, "description": "", "main": "index.js", "scripts": { "test:ci": "node index.js", "testcafe:ci": "testcafe \"chrome:headless\" __tests__/*", "testcafe:dev": "testcafe chrome __tests__/* --live" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "docz": "^1.2.0", "execa": "^2.0.4", "fs-extra": "^8.1.0", "lodash": "^4.17.15", "tmp": "^0.1.0" }, "devDependencies": { "@testing-library/testcafe": "^2.1.1", "kill-port": "^1.5.1", "testcafe": "^1.4.1", "wait-on": "^3.3.0" } } ================================================ FILE: other-packages/e2e-tests/testing-library.js ================================================ const test = (name, fn) => { console.log('>', name) fn() } const assert = (condition, description) => { if (condition) { console.log('✔️', description) } else { console.assert(condition, description) } } ================================================ FILE: other-packages/e2e-tests/verdaccio.yaml ================================================ # # This is based on verdaccio's default config file. It allows all users # to do anything, so don't use it on production systems. # # Look here for more config file examples: # https://github.com/verdaccio/verdaccio/tree/master/conf # # path to a directory with all packages storage: ./storage auth: htpasswd: file: ./htpasswd # Maximum amount of users allowed to register, defaults to "+inf". # You can set this to -1 to disable registration. #max_users: 1000 # a list of other known repositories we can talk to uplinks: npmjs: url: https://registry.npmjs.org/ max_fails: 40 maxage: 30m timeout: 60s agent_options: keepAlive: true maxSockets: 40 maxFreeSockets: 10 packages: '@*/*': # scoped packages access: $all publish: $all proxy: npmjs '**': # allow all users (including non-authenticated users) to read and # publish all packages # # you can specify usernames/groupnames (depending on your auth plugin) # and three keywords: "$all", "$anonymous", "$authenticated" access: $all # allow all known users to publish packages # (anyone can register by default, remember?) publish: $all # if package is not available locally, proxy requests to 'npmjs' registry proxy: npmjs # log settings logs: - { type: stdout, format: pretty, level: warn } #- {type: file, path: verdaccio.log, level: info} # See https://github.com/verdaccio/verdaccio/issues/301 server: keepAliveTimeout: 0 ================================================ FILE: other-packages/eslint-config-docz-js/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package eslint-config-docz-js # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * no-undef eslint rule ([125c5cf](https://github.com/pedronauck/docz/commit/125c5cf)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package eslint-config-docz # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package eslint-config-docz ================================================ FILE: other-packages/eslint-config-docz-js/README.md ================================================ ## eslint-config-docz-js This is an internal docz eslint config used in docz JS modules. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: other-packages/eslint-config-docz-js/index.js ================================================ module.exports = { extends: [ 'plugin:react/recommended', 'plugin:mdx/recommended', 'plugin:prettier/recommended', ], rules: { 'no-unused-vars': [ 'error', { vars: 'all', args: 'after-used', ignoreRestSiblings: false, argsIgnorePattern: '^_', }, ], 'comma-dangle': ['error', 'always-multiline', { functions: 'never' }], 'no-mixed-operators': 'error', 'no-console': 'off', 'react/prop-types': 'off', }, parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { jsx: true, }, }, settings: { react: { version: 'detect', }, }, } ================================================ FILE: other-packages/eslint-config-docz-js/package.json ================================================ { "name": "eslint-config-docz-js", "version": "2.4.0", "description": "Eslint config of Docz for Javascript", "license": "MIT", "author": { "name": "Pedro Nauck", "email": "pedronauck@gmail.com" }, "main": "index.js", "files": [ "index.js", "package.json" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "other-packages/eslint-config-docz-js" }, "scripts": { "fix": "run-s fix:*", "fix:prettier": "prettier \"**/*.js\" --write" }, "dependencies": { "babel-eslint": "^10.0.2", "eslint": "^6.5.1", "eslint-config-prettier": "^5.0.0", "eslint-plugin-mdx": "^1.6.1", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react": "^7.13.0" } } ================================================ FILE: other-packages/eslint-config-docz-ts/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) * add functions never to eslint rule ([#1487](https://github.com/doczjs/docz/issues/1487)) ([becd589](https://github.com/doczjs/docz/commit/becd589)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package eslint-config-docz-ts # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * no-undef eslint rule ([125c5cf](https://github.com/pedronauck/docz/commit/125c5cf)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package eslint-config-docz # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package eslint-config-docz ================================================ FILE: other-packages/eslint-config-docz-ts/README.md ================================================ ## eslint-config-docz-ts This is an internal docz eslint config used in docz TS modules. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: other-packages/eslint-config-docz-ts/index.js ================================================ module.exports = { extends: [ 'plugin:react/recommended', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended', 'plugin:mdx/recommended', 'prettier/@typescript-eslint', ], rules: { 'comma-dangle': ['error', 'always-multiline', { functions: 'never' }], 'no-mixed-operators': 'error', 'no-console': 'off', 'react/prop-types': 'off', '@typescript-eslint/no-unused-vars': [ 'error', { vars: 'all', args: 'after-used', ignoreRestSiblings: false, argsIgnorePattern: '^_', }, ], '@typescript-eslint/indent': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-member-accessibility': 'off', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/no-object-literal-type-assertion': 'off', '@typescript-eslint/no-parameter-properties': 'off', }, parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { jsx: true, }, }, settings: { react: { version: 'detect', }, }, } ================================================ FILE: other-packages/eslint-config-docz-ts/package.json ================================================ { "name": "eslint-config-docz-ts", "version": "2.4.0", "description": "Eslint config of Docz for Typescript", "license": "MIT", "author": { "name": "Pedro Nauck", "email": "pedronauck@gmail.com" }, "main": "index.js", "files": [ "index.js", "package.json" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "other-packages/eslint-config-docz-ts" }, "scripts": { "fix": "run-s fix:*", "fix:prettier": "prettier \"**/*.js\" --write" }, "dependencies": { "@typescript-eslint/eslint-plugin": "^1.12.0", "@typescript-eslint/parser": "^1.12.0", "eslint": "^6.5.1", "eslint-config-prettier": "^5.0.0", "eslint-plugin-mdx": "^1.6.1", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react": "^7.13.0" } } ================================================ FILE: other-packages/load-cfg/.eslintignore ================================================ dist ================================================ FILE: other-packages/load-cfg/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: other-packages/load-cfg/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: other-packages/load-cfg/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package load-cfg # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) ### Features * docz running using gatsby under the hood ([10ffd48](https://github.com/pedronauck/docz/commit/10ffd48)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package load-cfg # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package load-cfg ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package load-cfg ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package load-cfg ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package load-cfg # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package load-cfg # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) **Note:** Version bump only for package load-cfg # [1.0.0-beta.0](https://github.com/pedronauck/docz/compare/v1.0.0-alpha.1...v1.0.0-beta.0) (2019-03-19) **Note:** Version bump only for package load-cfg # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * immutable merge with lodash ([2fe94d4](https://github.com/pedronauck/docz/commit/2fe94d4)) * **load-cfg:** merge default config on load ([d3b4bc6](https://github.com/pedronauck/docz/commit/d3b4bc6)) * use lodash merge instead of deepmerge ([18ac37b](https://github.com/pedronauck/docz/commit/18ac37b)) * **load-cfg:** use babel register in order to require using es6 ([7ad3b64](https://github.com/pedronauck/docz/commit/7ad3b64)) * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) ## [0.13.3](https://github.com/pedronauck/docz/compare/v0.13.2...v0.13.3) (2018-12-17) **Note:** Version bump only for package load-cfg # [0.13.0](https://github.com/pedronauck/docz/compare/v0.12.17...v0.13.0) (2018-12-17) ### Bug Fixes * **docz-core:** use webpack-dev-server instead of webpack-serve ([4157e05](https://github.com/pedronauck/docz/commit/4157e05)) ## [0.12.16](https://github.com/pedronauck/docz/compare/v0.12.15...v0.12.16) (2018-12-13) **Note:** Version bump only for package load-cfg ## [0.12.15](https://github.com/pedronauck/docz/compare/v0.12.14...v0.12.15) (2018-12-04) **Note:** Version bump only for package load-cfg ## [0.12.14](https://github.com/pedronauck/docz/compare/v0.12.13...v0.12.14) (2018-12-04) ### Bug Fixes * some typings warnings ([4afb87b](https://github.com/pedronauck/docz/commit/4afb87b)) ## [0.12.13](https://github.com/pedronauck/docz/compare/v0.12.12...v0.12.13) (2018-11-23) **Note:** Version bump only for package load-cfg ## [0.12.10](https://github.com/pedronauck/docz/compare/v0.12.9...v0.12.10) (2018-11-15) **Note:** Version bump only for package load-cfg ## [0.12.6](https://github.com/pedronauck/docz/compare/v0.12.5...v0.12.6) (2018-10-30) **Note:** Version bump only for package load-cfg ## [0.11.1](https://github.com/pedronauck/docz/compare/v0.11.0...v0.11.1) (2018-09-07) **Note:** Version bump only for package load-cfg # [0.11.0](https://github.com/pedronauck/docz/compare/v0.10.3...v0.11.0) (2018-09-02) ### Bug Fixes * **load-cfg:** use fs-extra to read json sync instead of JSON.parse ([04d1e1a](https://github.com/pedronauck/docz/commit/04d1e1a)) ## [0.10.3](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.3) (2018-08-16) **Note:** Version bump only for package load-cfg # [0.10.0](https://github.com/pedronauck/docz/compare/v0.9.6...v0.10.0) (2018-08-13) ### Features * **docz-core:** add htmlContext and mini-html-webpack-plugin ([4b6ec0f](https://github.com/pedronauck/docz/commit/4b6ec0f)) ## [0.9.4](https://github.com/pedronauck/docz/compare/v0.9.4-beta.1...v0.9.4) (2018-08-04) **Note:** Version bump only for package load-cfg ## [0.9.4-beta.1](https://github.com/pedronauck/docz/compare/v0.9.4-beta.0...v0.9.4-beta.1) (2018-08-04) **Note:** Version bump only for package load-cfg # [0.9.0](https://github.com/pedronauck/docz/compare/v0.9.0-beta.1...v0.9.0) (2018-08-02) ### Bug Fixes * **docz:** using context for imports to prevent disposed hmr ([b37284c](https://github.com/pedronauck/docz/commit/b37284c)) # [0.9.0-beta.0](https://github.com/pedronauck/docz/compare/v0.8.0...v0.9.0-beta.0) (2018-08-01) **Note:** Version bump only for package load-cfg # [0.7.0](https://github.com/pedronauck/docz/compare/v0.6.2...v0.7.0) (2018-07-23) **Note:** Version bump only for package load-cfg # [0.6.0](https://github.com/pedronauck/docz/compare/v0.5.9...v0.6.0) (2018-07-19) **Note:** Version bump only for package load-cfg ## [0.5.9](https://github.com/pedronauck/docz/compare/v0.5.8...v0.5.9) (2018-07-16) **Note:** Version bump only for package load-cfg ## [0.5.6](https://github.com/pedronauck/docz/compare/v0.5.5...v0.5.6) (2018-07-11) **Note:** Version bump only for package load-cfg ## [0.5.4](https://github.com/pedronauck/docz/compare/v0.5.3...v0.5.4) (2018-07-07) **Note:** Version bump only for package load-cfg ## [0.5.1](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.1) (2018-07-03) **Note:** Version bump only for package load-cfg # [0.5.0](https://github.com/pedronauck/docz/compare/v0.3.4...v0.5.0) (2018-07-03) **Note:** Version bump only for package load-cfg ## [0.3.4](https://github.com/pedronauck/docz/compare/v0.3.3...v0.3.4) (2018-06-26) **Note:** Version bump only for package load-cfg ## [0.3.3](https://github.com/pedronauck/docz/compare/v0.3.2...v0.3.3) (2018-06-26) ### Bug Fixes * **docz-core:** copy templates files for dist ([#88](https://github.com/pedronauck/docz/issues/88)) ([5e4b98d](https://github.com/pedronauck/docz/commit/5e4b98d)) ## [0.2.8](https://github.com/pedronauck/docz/compare/v0.2.7...v0.2.8) (2018-06-21) **Note:** Version bump only for package load-cfg # [0.2.0](https://github.com/pedronauck/docz/compare/v0.2.0-beta.2...v0.2.0) (2018-06-11) **Note:** Version bump only for package load-cfg ## [0.1.2-beta.1](https://github.com/doczjs/docz/compare/v0.1.2-beta.0...v0.1.2-beta.1) (2018-06-09) **Note:** Version bump only for package load-cfg ## [0.1.2-beta.0](https://github.com/doczjs/docz/compare/v0.1.1...v0.1.2-beta.0) (2018-06-02) **Note:** Version bump only for package load-cfg ## [0.1.1-beta.5](https://github.com/doczjs/docz/compare/v0.1.1-beta.4...v0.1.1-beta.5) (2018-06-01) ### Bug Fixes * **load-cfg:** add namedExports options ([d36194d](https://github.com/doczjs/docz/commit/d36194d)) ### Features * **load-cfg:** add esm module loader ([12a7610](https://github.com/doczjs/docz/commit/12a7610)) # 0.1.0 (2018-05-29) ### Features * **docz-core:** add support for load custom themes ([ade98ce](https://github.com/doczjs/docz/commit/ade98ce)) * **load-cfg:** add script as package ([11e409c](https://github.com/doczjs/docz/commit/11e409c)) * **load-cfg:** set cache to require file ([c49fc64](https://github.com/doczjs/docz/commit/c49fc64)) ================================================ FILE: other-packages/load-cfg/README.md ================================================ ## load-cfg This is an internal docz package used to load the docz config from a project into memory. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: other-packages/load-cfg/package.json ================================================ { "name": "load-cfg", "version": "2.4.0", "description": "Method that can load project configurations based", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "files": [ "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "other-packages/load-cfg" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged" }, "dependencies": { "@babel/core": "^7.5.5", "@babel/preset-env": "^7.5.5", "@babel/register": "^7.5.5", "find-up": "^4.1.0", "fs-extra": "^8.1.0", "lodash": "^4.17.14" } } ================================================ FILE: other-packages/load-cfg/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: './src/index.ts', }) ================================================ FILE: other-packages/load-cfg/src/index.ts ================================================ import * as fs from 'fs-extra' import * as path from 'path' import * as findup from 'find-up' import { merge } from 'lodash/fp' export const loadFile = (filepath: string, noCache?: boolean) => { require('@babel/register')({ cache: !noCache, presets: [['@babel/preset-env', { modules: 'commonjs' }]], }) let file if (noCache && filepath) { delete require.cache[path.resolve(filepath)] } try { const isJS = path.extname(filepath) === '.js' if (isJS) { const required = require(filepath) file = required.default || required } else { file = fs.readJsonSync(filepath, { encoding: 'utf-8' }) } } catch (err) { console.warn('There was an error loading your config:\n') console.warn(err) } return file } export const finds = (name: string): string[] => [ `${name}.json`, `.${name}rc`, `${name}rc.js`, `${name}rc.json`, `${name}.config.js`, `${name}.config.json`, ] export function load( name: string, defaultConfig: C, noCache?: boolean, deep?: boolean ): C { const filepath = findup.sync(finds(name)) const file = filepath ? loadFile(filepath, noCache) : {} return defaultConfig ? deep ? merge(defaultConfig, file) : { ...defaultConfig, ...file } : file } export function loadFrom( filePath: string, defaultConfig: C, noCache?: boolean, deep?: boolean ): C { const file = loadFile(filePath, noCache) return defaultConfig ? deep ? merge(defaultConfig, file) : { ...defaultConfig, ...file } : file } ================================================ FILE: other-packages/load-cfg/src/types.d.ts ================================================ declare module 'esm' ================================================ FILE: other-packages/load-cfg/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "dist", "rootDir": "src", "declaration": true, "types": ["node"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: other-packages/react-docgen-actual-name-handler/.eslintignore ================================================ dist ================================================ FILE: other-packages/react-docgen-actual-name-handler/.eslintrc.js ================================================ module.exports = { extends: 'docz-ts', } ================================================ FILE: other-packages/react-docgen-actual-name-handler/.lintstagedrc ================================================ { "*.{ts,tsx}": ["yarn fix", "git add"] } ================================================ FILE: other-packages/react-docgen-actual-name-handler/CHANGELOG.md ================================================ # Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [2.4.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.4.0) (2022-02-11) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.3.3-alpha.0](https://github.com/doczjs/docz/compare/v2.3.2-alpha.0...v2.3.3-alpha.0) (2021-09-10) ### Bug Fixes * **docz:** dependency issues ([#1647](https://github.com/doczjs/docz/issues/1647)) ([5bdca48](https://github.com/doczjs/docz/commit/5bdca48)) # [2.1.0](https://github.com/doczjs/docz/compare/v2.0.0-rc.77...v2.1.0) (2019-11-27) **Note:** Version bump only for package react-docgen-actual-name-handler # [2.0.0-rc.1](https://github.com/pedronauck/docz/compare/v1.2.0...v2.0.0-rc.1) (2019-07-18) ### Bug Fixes * bump version ([a346b59](https://github.com/pedronauck/docz/commit/a346b59)) * eslint configs ([280981f](https://github.com/pedronauck/docz/commit/280981f)) * packages rollup config ([534d7bf](https://github.com/pedronauck/docz/commit/534d7bf)) # [1.2.0](https://github.com/pedronauck/docz/compare/v1.1.0...v1.2.0) (2019-05-08) **Note:** Version bump only for package react-docgen-actual-name-handler # [1.1.0](https://github.com/pedronauck/docz/compare/v1.0.4...v1.1.0) (2019-05-01) **Note:** Version bump only for package react-docgen-actual-name-handler ## [1.0.4](https://github.com/pedronauck/docz/compare/v1.0.3...v1.0.4) (2019-04-18) **Note:** Version bump only for package react-docgen-actual-name-handler ## [1.0.2](https://github.com/pedronauck/docz/compare/v1.0.1...v1.0.2) (2019-04-15) **Note:** Version bump only for package react-docgen-actual-name-handler ## [1.0.1](https://github.com/pedronauck/docz/compare/v1.0.0...v1.0.1) (2019-04-14) **Note:** Version bump only for package react-docgen-actual-name-handler # [1.0.0](https://github.com/pedronauck/docz/compare/v1.0.0-rc.8...v1.0.0) (2019-04-11) **Note:** Version bump only for package react-docgen-actual-name-handler # [1.0.0-rc.4](https://github.com/pedronauck/docz/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2019-03-29) **Note:** Version bump only for package react-docgen-actual-name-handler # [1.0.0-alpha.0](https://github.com/pedronauck/docz/compare/v0.13.5...v1.0.0-alpha.0) (2019-03-19) ### Bug Fixes * use custom rollup config to build instead of libundler ([ee42a5a](https://github.com/pedronauck/docz/commit/ee42a5a)) ### Features * add initial gatsby integration ([#630](https://github.com/pedronauck/docz/issues/630)) ([70d40cc](https://github.com/pedronauck/docz/commit/70d40cc)), closes [#609](https://github.com/pedronauck/docz/issues/609) * docgen refactoring ([#545](https://github.com/pedronauck/docz/issues/545)) ([85499a8](https://github.com/pedronauck/docz/commit/85499a8)) ================================================ FILE: other-packages/react-docgen-actual-name-handler/README.md ================================================ ## react-docgen-actual-name-handler This is an internal docz [react-docgen](https://github.com/reactjs/react-docgen) [handler](https://github.com/reactjs/react-docgen#handlers) used to set `actualName` on React components. Unless you're looking to contribute to docz, you probably don't care about this package and are looking for [the docz package documentation](https://github.com/doczjs/docz). ================================================ FILE: other-packages/react-docgen-actual-name-handler/package.json ================================================ { "name": "react-docgen-actual-name-handler", "version": "2.4.0", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", "files": [ "dist/", "package.json", "README.md" ], "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git", "directory": "other-packages/react-docgen-actual-name-handler" }, "scripts": { "dev": "cross-env NODE_ENV=development yarn build -w", "build": "cross-env NODE_ENV=production rollup -c", "fix": "yarn lint --fix", "lint": "eslint . --ext mdx,ts,tsx", "precommit": "lint-staged" }, "dependencies": { "react-docgen": "^4.1.1", "recast": "^0.18.1" } } ================================================ FILE: other-packages/react-docgen-actual-name-handler/rollup.config.js ================================================ import { config } from 'docz-rollup' export default config({ input: './src/index.ts', }) ================================================ FILE: other-packages/react-docgen-actual-name-handler/src/index.ts ================================================ import { utils } from 'react-docgen' import * as recast from 'recast' const { getNameOrValue, resolveFunctionDefinitionToReturnValue } = utils const { types: { namedTypes: types }, } = recast export default function actualNameHandler(documentation: any, path: any): any { // Function and class declarations need special treatment. The name of the // function / class is the displayName if ( types.ClassDeclaration.check(path.node) || types.FunctionDeclaration.check(path.node) ) { documentation.set('actualName', getNameOrValue(path.get('id'))) } else if ( types.ArrowFunctionExpression.check(path.node) || types.FunctionExpression.check(path.node) ) { if (types.VariableDeclarator.check(path.parentPath.node)) { documentation.set('actualName', getNameOrValue(path.parentPath.get('id'))) } else if (types.AssignmentExpression.check(path.parentPath.node)) { documentation.set( 'actualName', getNameOrValue(path.parentPath.get('left')) ) } } else if ( // React.createClass() or createReactClass() types.CallExpression.check(path.parentPath.node) && types.VariableDeclarator.check(path.parentPath.parentPath.parentPath.node) ) { documentation.set( 'actualName', getNameOrValue(path.parentPath.parentPath.parentPath.get('id')) ) } else { // Could not find an actual name documentation.set('actualName', '') } return // If display name is defined as a getter we get a function expression as // value. In that case we try to determine the value from the return // statement. let displayNamePath if (types.FunctionExpression.check(displayNamePath.node)) { displayNamePath = resolveFunctionDefinitionToReturnValue(displayNamePath) } if (!displayNamePath || !types.Literal.check(displayNamePath.node)) return documentation.set('actualName', displayNamePath.node.value) } ================================================ FILE: other-packages/react-docgen-actual-name-handler/src/types.d.ts ================================================ declare module 'recast' declare module 'react-docgen' ================================================ FILE: other-packages/react-docgen-actual-name-handler/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", "outDir": "dist", "rootDir": "src", "declaration": true, "types": ["node"], "typeRoots": ["../../node_modules/@types", "node_modules/@types"] }, "include": ["src/**/*", "src/types.d.ts"], "exclude": ["node_modules/**"] } ================================================ FILE: package.json ================================================ { "private": true, "license": "MIT", "author": { "name": "Pedro Nauck", "email": "pedronauck@gmail.com", "url": "https://github.com/pedronauck" }, "homepage": "https://docz.site", "bugs": { "url": "https://github.com/doczjs/docz/issues" }, "repository": { "type": "git", "url": "https://github.com/doczjs/docz.git" }, "scripts": { "clean": "lerna clean", "bs": "lerna bootstrap", "dev": "yarn packages:build && lerna run dev --parallel --scope={dev-env-*,docz,docz-core,gatsby-theme-docz,rehype-docz,remark-docz}", "examples:lint": "eslint examples --ext js,mdx,ts,tsx", "packages": "run-s packages:*", "packages:fix": "lerna run --parallel fix && echo", "packages:lint": "lerna run --parallel lint", "packages:build": "lerna run build --ignore={docz-example-*,dev-env-*}", "packages:test": "lerna run test --stream --ignore={docz-example-*,dev-env-*}", "prerelease": "yarn run packages", "release": "lerna publish --conventional-commits", "release:next": "yarn run packages && lerna publish --conventional-commits --conventional-prerelease --dist-tag=next --exact", "promote:next": "lerna publish --conventional-commits --conventional-graduate", "release:beta": "yarn release --dist-tag=beta --preid=beta", "release:canary": "yarn release --force-publish=\"*\" --canary --exact --npm-client npm", "precommit": "lint-staged", "commit": "git-cz", "contributors:add": "all-contributors add", "contributors:generate": "all-contributors generate" }, "lint-staged": { "*.{js,jsx,ts,tsx,md,mdx}": [ "yarn packages", "git add" ] }, "devDependencies": { "@babel/core": "^7.5.5", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/preset-typescript": "^7.3.3", "@commitlint/cli": "^8.2.0", "@commitlint/config-conventional": "^8.2.0", "@commitlint/config-lerna-scopes": "^8.2.0", "@mdx-js/mdx": "^1.1.0", "@types/cross-spawn": "^6.0.0", "@types/find-up": "^4.0.0", "@types/fs-extra": "^8.0.0", "@types/jest": "^24.0.15", "@types/lodash": "^4.14.136", "@types/node": "^12.6.8", "@types/pascal-case": "^1.1.2", "@types/prettier": "^1.16.4", "@types/reach__router": "^1.2.4", "@types/react-dom": "^16.8.4", "@types/react": "^16.8.23", "@types/resolve": "^0.0.8", "@types/shelljs": "^0.8.5", "@types/signale": "^1.2.1", "@types/wait-on": "^3.2.0", "all-contributors-cli": "^6.8.0", "babel-eslint": "^10.0.3", "babel-jest": "^24.8.0", "babel-plugin-lodash": "^3.3.4", "babel-preset-react-app": "^9.1.2", "commitizen": "^3.1.2", "cross-env": "^5.2.1", "docz-rollup": "^2.1.0", "eslint-config-docz-js": "^2.1.0", "eslint-config-docz-ts": "^2.1.0", "eslint-plugin-react": "^7.16.0", "eslint": "^6.5.1", "husky": "^3.0.0", "jest": "^24.9.0", "lerna": "^3.15.0", "lint-staged": "^9.2.0", "npm-run-all": "^4.1.5", "prettier": "^1.18.2", "remark-docz": "^2.1.0", "rollup": "^1.17.0", "trash-cli": "^3.0.0", "trash": "^6.0.0", "ts-jest": "^24.0.2", "typescript": "^3.5.3" }, "workspaces": { "packages": [ "core/*", "other-packages/*", "dev-env/*" ], "nohoist": [ "examples/*" ] } } ================================================ FILE: tsconfig.json ================================================ { "compileOnSave": false, "compilerOptions": { "target": "es2017", "module": "es2015", "moduleResolution": "node", "inlineSourceMap": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "jsx": "react", "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "traceResolution": false, "listEmittedFiles": false, "listFiles": false, "pretty": true, "lib": ["es2017", "dom"] } }