Skip to content

Commit

Permalink
properly fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Apr 8, 2022
1 parent 4f6fd78 commit 621000a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-classic/src/theme-classic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ declare module '@theme/ThemedImage' {
}

declare module '@theme/Details' {
import {Details, type DetailsProps} from '@docusaurus/theme-common';
import {Details, type DetailsProps} from '@docusaurus/theme-common/Details';

export interface Props extends DetailsProps {}
export default Details;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

import React from 'react';
import clsx from 'clsx';
import {Details as DetailsGeneric} from '@docusaurus/theme-common';
import {Details as DetailsGeneric} from '@docusaurus/theme-common/Details';
import type {Props} from '@theme/Details';
// Ensure that the default details style is properly overridden
import '@docusaurus/theme-common/lib/components/Details/styles.module.css';
import styles from './styles.module.css';

// Should we have a custom details/summary comp in Infima instead of reusing
Expand Down
14 changes: 14 additions & 0 deletions packages/docusaurus-theme-common/Details.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// `Details` is a separate export entry because of side-effects messing with CSS
// insertion order. See https://github.com/facebook/docusaurus/pull/7085.
// However, because TS doesn't recognize `exports` (also a problem in
// `content-docs`), we have to manually create a stub.

// eslint-disable-next-line import/named
export {Details, type DetailsProps} from './lib/components/Details';
7 changes: 6 additions & 1 deletion packages/docusaurus-theme-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"sideEffects": [
"lib/components/Details/*"
"lib/components/Details/*",
"*.css"
],
"exports": {
".": "./lib/index.js",
"./Details": "./lib/components/Details/index.js"
},
"scripts": {
"build": "node copyUntypedFiles.mjs && tsc",
"watch": "node copyUntypedFiles.mjs && tsc --watch"
Expand Down
2 changes: 0 additions & 2 deletions packages/docusaurus-theme-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ export {useLocationChange} from './utils/useLocationChange';

export {useCollapsible, Collapsible} from './components/Collapsible';

export {Details, type DetailsProps} from './components/Details';

export {
useDocsPreferredVersion,
useDocsPreferredVersionByPluginId,
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus-theme-common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"declarationMap": true,
"rootDir": "src",
"outDir": "lib"
}
},
"include": ["src"]
}

0 comments on commit 621000a

Please sign in to comment.