@docusaurus/theme-common 0.0.0-5483 → 0.0.0-5488
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type ComponentProps, type ReactElement } from 'react';
|
|
8
8
|
export type DetailsProps = {
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Summary is provided as props, optionally including the wrapping
|
|
11
|
+
* `<summary>` tag
|
|
12
|
+
*/
|
|
13
|
+
summary?: ReactElement | string;
|
|
11
14
|
} & ComponentProps<'details'>;
|
|
12
15
|
/**
|
|
13
16
|
* A mostly un-styled `<details>` element with smooth collapsing. Provides some
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAGZ,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AAoBf,MAAM,MAAM,YAAY,GAAG;IACzB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAGZ,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AAoBf,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;CACjC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAoE5B"}
|
|
@@ -34,6 +34,7 @@ export function Details({ summary, children, ...props }) {
|
|
|
34
34
|
// Use a separate state for the actual details prop, because it must be set
|
|
35
35
|
// only after animation completes, otherwise close animations won't work
|
|
36
36
|
const [open, setOpen] = useState(props.open);
|
|
37
|
+
const summaryElement = React.isValidElement(summary) ? (summary) : (<summary>{summary ?? 'Details'}</summary>);
|
|
37
38
|
return (
|
|
38
39
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
39
40
|
<details {...props} ref={detailsRef} open={open} data-collapsed={collapsed} className={clsx(styles.details, isBrowser && styles.isBrowser, props.className)} onMouseDown={(e) => {
|
|
@@ -60,8 +61,7 @@ export function Details({ summary, children, ...props }) {
|
|
|
60
61
|
// setOpen(false);
|
|
61
62
|
}
|
|
62
63
|
}}>
|
|
63
|
-
{
|
|
64
|
-
{summary ?? <summary>Details</summary>}
|
|
64
|
+
{summaryElement}
|
|
65
65
|
|
|
66
66
|
<Collapsible lazy={false} // Content might matter for SEO in this case
|
|
67
67
|
collapsed={collapsed} disableSSRStyle // Allows component to work fine even with JS disabled!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,SAAS,WAAW,CAAC,IAAwB;IAC3C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,SAAS,CAAC,IAAwB,EAAE,MAAmB;IAC9D,IAAI,CAAC,IAAI,EAA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IAAI,CAAC,CAAC;aACf;iBAAM;gBACL,YAAY,CAAC,IAAI,CAAC,CAAC;gBACnB,4CAA4C;gBAC5C,kBAAkB;aACnB;QACH,CAAC,CAAC,CACF;MAAA,CAAC,cAAc,CAEf;;MAAA,CAAC,WAAW,CACV,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,4CAA4C;KACzD,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,uDAAuD;KACvE,uBAAuB,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE;YACxC,YAAY,CAAC,YAAY,CAAC,CAAC;YAC3B,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC,CAAC,CACF;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAC5D;MAAA,EAAE,WAAW,CACf;IAAA,EAAE,OAAO,CAAC,CACX,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-common",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5488",
|
|
4
4
|
"description": "Common code for Docusaurus themes.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
34
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
35
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
36
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
37
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
38
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
+
"@docusaurus/mdx-loader": "0.0.0-5488",
|
|
34
|
+
"@docusaurus/module-type-aliases": "0.0.0-5488",
|
|
35
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5488",
|
|
36
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5488",
|
|
37
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5488",
|
|
38
|
+
"@docusaurus/utils": "0.0.0-5488",
|
|
39
39
|
"@types/history": "^4.7.11",
|
|
40
40
|
"@types/react": "*",
|
|
41
41
|
"@types/react-router-config": "*",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"utility-types": "^3.10.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@docusaurus/core": "0.0.0-
|
|
51
|
-
"@docusaurus/types": "0.0.0-
|
|
50
|
+
"@docusaurus/core": "0.0.0-5488",
|
|
51
|
+
"@docusaurus/types": "0.0.0-5488",
|
|
52
52
|
"fs-extra": "^11.1.0",
|
|
53
53
|
"lodash": "^4.17.21"
|
|
54
54
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=16.14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1cabce50d0e44edb26663525aefedf6a75ac2046"
|
|
63
63
|
}
|
|
@@ -31,8 +31,11 @@ function hasParent(node: HTMLElement | null, parent: HTMLElement): boolean {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type DetailsProps = {
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Summary is provided as props, optionally including the wrapping
|
|
36
|
+
* `<summary>` tag
|
|
37
|
+
*/
|
|
38
|
+
summary?: ReactElement | string;
|
|
36
39
|
} & ComponentProps<'details'>;
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -54,6 +57,12 @@ export function Details({
|
|
|
54
57
|
// only after animation completes, otherwise close animations won't work
|
|
55
58
|
const [open, setOpen] = useState(props.open);
|
|
56
59
|
|
|
60
|
+
const summaryElement = React.isValidElement(summary) ? (
|
|
61
|
+
summary
|
|
62
|
+
) : (
|
|
63
|
+
<summary>{summary ?? 'Details'}</summary>
|
|
64
|
+
);
|
|
65
|
+
|
|
57
66
|
return (
|
|
58
67
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
59
68
|
<details
|
|
@@ -91,8 +100,7 @@ export function Details({
|
|
|
91
100
|
// setOpen(false);
|
|
92
101
|
}
|
|
93
102
|
}}>
|
|
94
|
-
{
|
|
95
|
-
{summary ?? <summary>Details</summary>}
|
|
103
|
+
{summaryElement}
|
|
96
104
|
|
|
97
105
|
<Collapsible
|
|
98
106
|
lazy={false} // Content might matter for SEO in this case
|