Commit graph

1604 commits

Author SHA1 Message Date
Sébastien Lorber
dc4664b489
feat: details/summary theme / MDX component (#5216)
* Details component

* polish arrow animation

* fix text selection bug

* fix some edge cases + polish

* example of overriding baseClassName

* Move Details component to theme-common

* make component work even when JS is disabled or failed to load

* update arrow transform

* Details component: better handling of no-JS fallback mode: avoid delaying arrow navigation when JS (see review)

* prefix css vars with --docusaurus

* improve css arrow styling

* slightly change details/summary design

* better md doc + include quotes and details in doc
2021-07-27 18:45:12 +02:00
Alexey Pyltsyn
798f634007
chore(v2): update Infima to alpha 28 (#5222) 2021-07-27 16:09:20 +02:00
Alexey Pyltsyn
938e5a906f
refactor(v2): update Russian translation (#5224)
* refactor(v2): update Russian translation

* Wording
2021-07-27 16:00:11 +02:00
Massoud Maboudi
6f366f4b45
refactor(v2): improved Farsi default translations (#5217)
* improved the Farsi translation

* removed the __description lines

* removed the __description lines

* improved the translation
2021-07-27 10:50:31 +02:00
Sébastien Lorber
8621ae2910
fix: upgrade Docsearch to avoid layout shift (#5214)
* upgrade algolia docsearch

* alpha 39
2021-07-24 18:40:09 +02:00
Sébastien Lorber
a7a5ea3466
refactor: make code block shadows consistent with new admonitions (#5215) 2021-07-23 18:11:40 +02:00
Sébastien Lorber
083037d7a5
refactor: redesign admonitions/callouts/quotes (#5193)
* prepare admonitions redesign

* Docusaurus admonition cleanup

* cover more edge cases in Docusaurus admonitions page: interleaving code blocks and links

* cover more edge cases in Docusaurus admonitions page: interleaving code blocks and links

* update Infima with new alerts
2021-07-23 17:10:38 +02:00
Joshua Chen
24156efcfb
feat: docs plugin options sidebarCollapsible + sidebarCollapsed (#5203)
* Add prop

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add `collapsible` option to sidebar item

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add eslint-ignore

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Move new page

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Allow in autogenerated

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix tests

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Move config options to plugin-docs

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Make non-collapsible items always expanded

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* docs versioning cli should receive a single options object

* Update cli.test.ts

* revert validateCategoryMetadataFile change

* remove theme usage of themeConfig.sidebarCollapsible

* better handling of sidebar item category inconsistencies + add warning message

* Update snapshot

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Handle plugin option inconsistencies

* improve doc for new sidebarCollapsible doc options

* remove warning in fixSidebarItemInconsistencies as it will be annoyed for versioned sites, as "collapsed" is already persisted in sidebar json files

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-07-23 14:24:36 +02:00
Sébastien Lorber
700a82aefe
feat: multiple playground choices (#5207)
* poc of using netlify functions for playground redirections

* push

* cleanup

* restore files

* fix netlify functions?

* fix netlify functions?

* implement serverless functions for playgrounds with persistent cookie

* move new.docusaurus.io to monorepo packages

* move new.docusaurus.io to monorepo packages

* lockfile

* push

* catch-all redirect

* Translate/Interpolate: add better error message if not used correctly

* Add /docs/playground page

* Add some additional doc
2021-07-22 21:10:36 +02:00
Michel Weststrate
ddc0f46b73
fix: cli upgrade helper fail when no package.dependencies (#5204)
* Fix handling of empty `dependencies` section. 

In Flipper, https://github.com/facebook/flipper/blob/master/website/package.json,  all our dependencies live in `devDependecies` of our `package.json`. As a result `dependencies` is not set, causing a crash when running `yarn start`:

```
/Users/mweststrate/fbsource/xplat/sonar/website/node_modules/@docusaurus/core/bin/docusaurus.js:50
  const siteDocusaurusPackagesForUpdate = Object.keys(sitePkg.dependencies)
                                                 ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Object.<anonymous> (/Users/mweststrate/fbsource/xplat/sonar/website/node_modules/@docusaurus/core/bin/docusaurus.js:50:50)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Setting `"dependencies": {}`, works as work around, but this patch fixes the crash, and makes sure the deps are upgraded as well if they live in `devDependencies` instead of `dependencies`.

* formatting fix
2021-07-22 16:13:57 +02:00
Sébastien Lorber
4d06f26c1f
fix(v2): Fix MDX docs being considered as partials when siteDir match the _ prefix convention (#5199)
* Add _ to dogfood docs folder to cover against edge case

* Fix edge case with MDX partials when site / content dir contains a _ prefix

* add globUtils tests

* proper dogfooding folder re-organization, all content plugins being used

* refactor dogfooding folder + expose /tests page index

* fix page plugin ignoring options.routeBasePath
2021-07-21 14:13:51 +02:00
Alexey Pyltsyn
12cea5eefe
refactor(v2): increase content area if blog sidebar is off (#5171)
* refactor(v2): increase content area if blog sidebar is off

* Replace render prop with children to simplicity sake

* Revert to previous layout
2021-07-20 14:11:08 +02:00
Alexey Pyltsyn
88de3a5106
fix(v2): wrap dropdown item to missing li element + remove extra attributes (#5179)
* fix(v2): wrap dropdown item to li element

* Remove extra attrs

* Fix types

* Exclude type/position from parent component

* Fix for positon

* Avoid cloneElement

* Update packages/docusaurus-theme-classic/src/theme/NavbarItem/index.tsx

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
2021-07-19 19:17:45 +02:00
Alexey Pyltsyn
44225a3df9
fix(v2): pass all props to CodeBlock component (#5183) 2021-07-16 14:55:19 +02:00
Alexey Pyltsyn
54e4b02666
fix(v2): add base URL to content attribute of head tags PWA (#5185) 2021-07-16 11:56:00 +02:00
Joshua Chen
633c2f60dd
fix(v2): Fix type for navlink label (#5176)
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
2021-07-15 15:40:39 +02:00
Alexey Pyltsyn
f7b5e90390
refactor(v2): automatically add base URL to PWA head tags (#5169)
* refactor(v2): automatically add base URL to PWA head tags

* Add baseUrl only if necessary
2021-07-15 15:38:14 +02:00
Sébastien Lorber
8bdb3da233
feat(v2): generalize usage of _ prefix convention to exclude content files/folders (#5173)
* create a swizzleWarning partial for shared text

* Generalize usage of _ prefix convention to exclude content files/folders

* add api doc

* MDX loader should not expect metadata/frontmatter on MDX partial files
2021-07-15 13:21:41 +02:00
Sébastien Lorber
0851e0e5bf
fix(v2): hide mobile collapsible doc toc if no headings (#5172) 2021-07-15 09:51:23 +02:00
Sébastien Lorber
818fb3956b
refactor(v2): mobile dropdown navbar: expand when subitem become active (#5168) 2021-07-14 19:42:47 +02:00
Joshua Chen
007e901354
feat(v2): allow any type of NavbarItem to be passed in a navbar dropdown (#5072)
* Initial work

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* More elegant `eslint-disable`

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix typing

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Allow doc links in dropdown

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Allow more dropdowns to use linklike items

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Finalize

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Dogfood

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Disallow nested dropdowns

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Better typing

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Complete type fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Use flatmap

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Patch

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Test

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Try fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Style change

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Revert (to test)

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Hmmm

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* I know what's wrong

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Does this work?

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Nope

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Wrong class name

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Pass prop to render dropdown item differently

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* This looks better

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Tests passed

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Separate dropdown from default

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Pourquois?

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Better prop typing

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Make code simpler

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* There's some extra className

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Test

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* More test

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* A-ha!

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Test again?

* Add backward compatibility

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Incorporate my type fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Resolve conflict

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* minor refactor

* minor refactors

* allow usage of ES2019 in browser code

* revert NavLink rename

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-07-14 18:19:08 +02:00
Sébastien Lorber
677e53d4db
perf(v2): lazy collapsibles, reduce html output and build times (#5136)
* Allow collapsible to be lazy

* cleanup comments

* CollapsibleLazy little bug
2021-07-14 16:18:52 +02:00
Sébastien Lorber
d3764f77fe
fix(v2): revert webpack.resolve.symlinks = false (#5164)
* WathcOptions should work even if Webpack does not resolve symlinks

* re-enable webpack resolve.symlinks = true

* Use symlinked folder as source
2021-07-13 20:11:08 +02:00
Sébastien Lorber
f33cd079c2
fix(v2): Fix Collapsible hydration layout shift (#5159) 2021-07-13 17:31:26 +02:00
Alexey Pyltsyn
fa9b0cd9c1
fix(v2): disable default behavior when click on collapsible item (#5161) 2021-07-13 17:13:07 +02:00
Sébastien Lorber
12faed89db
fix(v2): Fix navbar mobile sidebar secondary menu bugs + refactor navbar (#5157) 2021-07-13 13:01:06 +02:00
Alexey Pyltsyn
45a87a1479
fix(v2): improve work of useCollapsible hook with multiple clicks (#5146) 2021-07-13 10:17:50 +02:00
Pranab Das
0fdb6836ad
refactor(v2): Hindi translation for semantic doc sidebar (#5154) 2021-07-13 10:10:29 +02:00
Alexey Pyltsyn
dd035088c6
refactor(v2): use Collapsible for mobile nav items (#5145) 2021-07-13 10:00:00 +02:00
nirtamir2
bb4ce1a54b
refactor(v2): Update Hebrew translations (#5138) 2021-07-12 20:04:59 +02:00
Pranab Das
1a3557b917
refactor(v2): bn translation improvements for semantic doc sidebar (#5140) 2021-07-12 19:58:19 +02:00
Joshua Chen
be695aa0e9
feat(v2): complete Chinese code translations (#5139)
* feat(v2): complete Chinese code translations

* Complete zh-Hant translation

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
2021-07-12 19:42:03 +02:00
Forresst
3e5a832590
fix(v2): add missing french translations for mobile (#5151) 2021-07-12 19:40:07 +02:00
Clément Vannicatte
7babfe0363
chore(v2): update @docsearch/react (#5135) 2021-07-09 17:52:59 +02:00
Alexey Pyltsyn
9536ef900d
feat(v2): redesign mobile UX: inline TOC + doc sidebar in main menu (#4273)
* feat(v2): mobile TOC

* Bug fixes and various improvements

* Redesign

* extract TOCCollapsible component

* TS improvements

* Assign sidebar name directly to the doc route => no need for either permalinkToSidebar or GlobalData

* revert changes to useWindowSize, fix FOUC issues

* extract DocSidebarDesktop component

* remove now useless menu infima classes

* TOCHeadings => rename + remove unused onClick prop

* Extract DocSidebarItem

* minor renaming

* replace GlobalData usage by a React teleport system to render in the navbar mobile sidebar menu directly from the DocPage component

* useWindowSize => simulate SSR size in dev to make FOUC issues more obvious

* fix remaining sidebar layout shift

* update docs snapshots

* remove unused code translations

* remove unused code translations

* fix minor update-code-translations bug

* Add more build-size paths to watch

* Restyle back button

* Add  missing`menu` class

* extract useShallowMemoizedObject

* fix routes tests + better routes formatting

* use Translate api for labels

* use Translate api for labels

* Update translations

* Improve dark mode support for back button

* Merge branch 'master' into lex111/inline-color-code

# Conflicts:
#	packages/core/dist/css/default-dark/default-dark-rtl.min.css
#	packages/core/dist/css/default-dark/default-dark.min.css
#	packages/core/dist/css/default/default-rtl.min.css
#	packages/core/dist/css/default/default.min.css

* replace useCollapse by new useCollapsible

* Cleanup and use clean-btn for TOCCollapsible button

* Make TOC links clickable over full width

* Cleanup

* fix uncollapsible sidebar that can be collapsed + create <Collapsible> component

* dependency array typo

* rollback sidebars community commit typo

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-07-09 16:50:38 +02:00
Sébastien Lorber
f03479f69e
test(v2): dogfooding: add huge sidebar for testing purposes (#5130)
* dogfoog: add huge sidebar for testing purposes

* Add standalone doc + build-size tracking
2021-07-08 20:26:55 +02:00
Sébastien Lorber
dc9f104ccc
fix(v2): remove webpackConfig.resolve.symlinks: true (#5126)
* remove webpackConfig.resolve.symlinks: true

* Add docs-test docs plugin instance to validate using a symlink folder as docs source is possible

* comment

* useful comments
2021-07-08 18:59:56 +02:00
Sébastien Lorber
7b2723717c
fix(v2): fix d.ts lint error (#5129) 2021-07-08 18:17:53 +02:00
Christian Flach
0acbbc3d38
fix(v2): Invalid type definition for injectHtmlTags (#5124)
This was likely a typo, and resulted in the following error when using Typescript strict mode:

node_modules/@docusaurus/types/src/index.d.ts(250,14): error TS7031: Binding element 'Content' implicitly has an 'any' type.
2021-07-08 13:09:55 +02:00
Marçal Junior
f316ff5cd1
refactor(v2): pt-BR: improve semantic doc sidebar and tags (#5118) 2021-07-07 19:48:38 +02:00
Alexey Pyltsyn
237d1a31f5
fix(v2): introduce useCollapsible to fix collapsible animation perf issues (#5116)
* fix(v2): avoid slowdown transition with huge sidebar items

* move useCollapsible to theme-common

* @docusaurus/theme-classic => watch mode should include type-checking

* refactor useCollapsible => encapsulate more behavior / state / ref inside it, making code simpler for component using it

* useCollapseAnimation => animate DOM properties directly instead of using React inline styles => optimize perf from 4 render per click to 1 render per click

* add missing items in deps array

* rename ref to collapsibleRef

* lint

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-07-07 18:50:13 +02:00
Sébastien Lorber
fbdeefcac6
fix(v2): Fix update-notifier not run at first and not notifying consistently (#5110)
* Fix update-notifier issues

* update for notifier disabled
2021-07-01 15:37:54 +02:00
Sébastien Lorber
d65cc9d23f
fix(v2): fix SkipToContent programmatic focus when updating querystring (#5104) 2021-06-30 19:37:40 +02:00
Sébastien Lorber
15a2b59f9f
fix(v2): fix redirect plugin when trailingSlash=false for .html extension (#5102)
* another redirect plugin fix when trailingSlash=false

* add comment
2021-06-30 17:22:51 +02:00
Sébastien Lorber
1ec2c95e3d
chore(v2): prepare v2.0.0-beta.3 release (#5098)
* beta.3

* publish guide

* publish guide

* v2.0.0-beta.3
2021-06-30 16:05:49 +02:00
Adam Uhlíř
823b020c34
fix(v2): classic theme - semantic correct anchors links (#5080)
* fix(v2): semantic correct anchors

* chore: ignore linting
2021-06-30 15:24:03 +02:00
Joshua Chen
c3127b65d1
fix(v2): fix typos in swizzle command (#5094)
* Fix typos in swizzle command

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Unnecessary comma

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
2021-06-30 15:20:26 +02:00
Sébastien Lorber
0f144213d6
fix(v2): fix useEffect infinite loop in blogOnly mode (#5097) 2021-06-30 12:50:06 +02:00
Sébastien Lorber
ab3821cb39
fix(v2): fix swizzle readComponent (#5095) 2021-06-30 12:20:57 +02:00
Alexey Pyltsyn
1cecd78f25
feat(v2): add icon to external footer links (#5092) 2021-06-30 10:54:26 +02:00