@readme/markdown 10.2.10 → 10.2.11
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.
- package/components/Cards/style.scss +1 -2
- package/components/Glossary/index.tsx +1 -1
- package/dist/10.node.js +1 -0
- package/dist/10.node.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +1440 -3414
- package/dist/main.node.js +330 -184
- package/dist/main.node.js.map +1 -1
- package/package.json +2 -2
- package/components/Tooltip/index.tsx +0 -61
- package/dist/components/Tooltip/index.d.ts +0 -13
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "10.2.
|
|
5
|
+
"version": "10.2.11",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"@readme/syntax-highlighter": "^14.1.0",
|
|
30
30
|
"@readme/variable": "^18.0.0",
|
|
31
31
|
"copy-to-clipboard": "^3.3.2",
|
|
32
|
-
"core-js": "^3.36.1",
|
|
33
32
|
"debug": "^4.3.4",
|
|
34
33
|
"emoji-regex": "^10.2.1",
|
|
35
34
|
"estree-util-value-to-estree": "^3.1.1",
|
|
@@ -105,6 +104,7 @@
|
|
|
105
104
|
"babel-loader": "^9.1.2",
|
|
106
105
|
"browserify-fs": "^1.0.0",
|
|
107
106
|
"codemirror": "^5.54.0",
|
|
107
|
+
"core-js": "^2.6.12",
|
|
108
108
|
"css-loader": "^7.1.2",
|
|
109
109
|
"eslint": "^8.37.0",
|
|
110
110
|
"hast-util-to-text": "^4.0.2",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import Tippy from '@tippyjs/react';
|
|
2
|
-
import React, { useEffect, useMemo, useRef, useState, type ComponentProps } from 'react';
|
|
3
|
-
|
|
4
|
-
type TooltipProps = ComponentProps<typeof Tippy>;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A custom wrapper around `@tippyjs/react` that attaches a MutationObserver to
|
|
8
|
-
* listen for changes of the trigger element's DOM tree.
|
|
9
|
-
*
|
|
10
|
-
* This is necessary for features like translation, where we initially render a
|
|
11
|
-
* Glossary term in English but then replace it with the translated term, which
|
|
12
|
-
* creates a stale Tippy reference.
|
|
13
|
-
*/
|
|
14
|
-
export default function Tooltip({ children, ...rest }: TooltipProps) {
|
|
15
|
-
const triggerRef = useRef<HTMLElement>(null);
|
|
16
|
-
const [triggerTarget, setTriggerTarget] = useState<HTMLElement|null>(null);
|
|
17
|
-
|
|
18
|
-
const triggerId = useMemo(() => {
|
|
19
|
-
return `tooltip-trigger-${crypto.randomUUID()}`;
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (!triggerRef.current?.parentElement) return () => {};
|
|
24
|
-
|
|
25
|
-
const observer = new MutationObserver((records: MutationRecord[]) => {
|
|
26
|
-
records.forEach(record => {
|
|
27
|
-
// was the node tree changed?
|
|
28
|
-
if (record.type === 'childList') {
|
|
29
|
-
record.addedNodes.forEach(node => {
|
|
30
|
-
// was the node for the tooltip trigger replaced?
|
|
31
|
-
if(node instanceof HTMLElement && node.id === triggerId) {
|
|
32
|
-
// if it was, update our reference to it
|
|
33
|
-
setTriggerTarget(node);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
observer.observe(triggerRef.current.parentElement, {
|
|
41
|
-
subtree: true,
|
|
42
|
-
childList: true,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return () => observer.disconnect();
|
|
46
|
-
}, [setTriggerTarget, triggerId, triggerTarget]);
|
|
47
|
-
|
|
48
|
-
const getReferenceClientRect = useMemo(() => {
|
|
49
|
-
return triggerTarget ? () => triggerTarget.getBoundingClientRect() : undefined;
|
|
50
|
-
}, [triggerTarget]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Tippy
|
|
54
|
-
getReferenceClientRect={getReferenceClientRect}
|
|
55
|
-
triggerTarget={triggerTarget}
|
|
56
|
-
{...rest}
|
|
57
|
-
>
|
|
58
|
-
<span ref={triggerRef} id={triggerId}>{children}</span>
|
|
59
|
-
</Tippy>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Tippy from '@tippyjs/react';
|
|
2
|
-
import React, { type ComponentProps } from 'react';
|
|
3
|
-
type TooltipProps = ComponentProps<typeof Tippy>;
|
|
4
|
-
/**
|
|
5
|
-
* A custom wrapper around `@tippyjs/react` that attaches a MutationObserver to
|
|
6
|
-
* listen for changes of the trigger element's DOM tree.
|
|
7
|
-
*
|
|
8
|
-
* This is necessary for features like translation, where we initially render a
|
|
9
|
-
* Glossary term in English but then replace it with the translated term, which
|
|
10
|
-
* creates a stale Tippy reference.
|
|
11
|
-
*/
|
|
12
|
-
export default function Tooltip({ children, ...rest }: TooltipProps): React.JSX.Element;
|
|
13
|
-
export {};
|