@readme/markdown 10.2.8 → 10.2.10
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/README.md +5 -5
- package/components/Glossary/index.tsx +1 -1
- package/components/Tooltip/index.tsx +61 -0
- package/dist/components/Tooltip/index.d.ts +13 -0
- package/dist/main.js +52 -5
- package/dist/main.node.js +52 -5
- package/dist/main.node.js.map +1 -1
- package/package.json +1 -1
- package/dist/processor/compile/table.d.ts +0 -0
package/README.md
CHANGED
|
@@ -127,16 +127,16 @@ If you make changes to the docs or how the markdown is rendered, you may need to
|
|
|
127
127
|
|
|
128
128
|
### Linking Changes to Storybook
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
There's currently some `babel` issues that prevent `npm link`ing to our main repo. `npm link`ing does work with our storybook app.
|
|
131
|
+
|
|
132
|
+
**In this repo, run:**
|
|
131
133
|
|
|
132
134
|
```
|
|
133
135
|
npm link && npm run watch
|
|
134
136
|
```
|
|
135
137
|
|
|
136
|
-
In
|
|
138
|
+
**In the main app repo, run:**
|
|
137
139
|
|
|
138
140
|
```
|
|
139
|
-
npm link PATH_TO_LOCAL_MARKDOWN_REPO
|
|
141
|
+
npm link $PATH_TO_LOCAL_MARKDOWN_REPO
|
|
140
142
|
```
|
|
141
|
-
|
|
142
|
-
Will not work with the monorepo app due to `core-js` issues.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { GlossaryTerm } from '../../contexts/GlossaryTerms';
|
|
2
2
|
|
|
3
|
-
import Tooltip from '@tippyjs/react';
|
|
4
3
|
import React, { useContext } from 'react';
|
|
5
4
|
|
|
6
5
|
import GlossaryContext from '../../contexts/GlossaryTerms';
|
|
6
|
+
import Tooltip from '../Tooltip';
|
|
7
7
|
|
|
8
8
|
interface Props extends React.PropsWithChildren {
|
|
9
9
|
term?: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
package/dist/main.js
CHANGED
|
@@ -10847,14 +10847,61 @@ const Embed = ({ lazy = true, url, html, providerName, providerUrl, title, ifram
|
|
|
10847
10847
|
};
|
|
10848
10848
|
/* harmony default export */ const components_Embed = (Embed);
|
|
10849
10849
|
|
|
10850
|
-
// EXTERNAL MODULE: external "@tippyjs/react"
|
|
10851
|
-
var react_ = __webpack_require__(4189);
|
|
10852
|
-
var react_default = /*#__PURE__*/__webpack_require__.n(react_);
|
|
10853
10850
|
;// ./contexts/GlossaryTerms.ts
|
|
10854
10851
|
|
|
10855
10852
|
const GlossaryContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)([]);
|
|
10856
10853
|
/* harmony default export */ const GlossaryTerms = (GlossaryContext);
|
|
10857
10854
|
|
|
10855
|
+
// EXTERNAL MODULE: external "@tippyjs/react"
|
|
10856
|
+
var react_ = __webpack_require__(4189);
|
|
10857
|
+
var react_default = /*#__PURE__*/__webpack_require__.n(react_);
|
|
10858
|
+
;// ./components/Tooltip/index.tsx
|
|
10859
|
+
|
|
10860
|
+
|
|
10861
|
+
/**
|
|
10862
|
+
* A custom wrapper around `@tippyjs/react` that attaches a MutationObserver to
|
|
10863
|
+
* listen for changes of the trigger element's DOM tree.
|
|
10864
|
+
*
|
|
10865
|
+
* This is necessary for features like translation, where we initially render a
|
|
10866
|
+
* Glossary term in English but then replace it with the translated term, which
|
|
10867
|
+
* creates a stale Tippy reference.
|
|
10868
|
+
*/
|
|
10869
|
+
function Tooltip({ children, ...rest }) {
|
|
10870
|
+
const triggerRef = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useRef)(null);
|
|
10871
|
+
const [triggerTarget, setTriggerTarget] = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState)(null);
|
|
10872
|
+
const triggerId = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useMemo)(() => {
|
|
10873
|
+
return `tooltip-trigger-${crypto.randomUUID()}`;
|
|
10874
|
+
}, []);
|
|
10875
|
+
(0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
|
|
10876
|
+
if (!triggerRef.current?.parentElement)
|
|
10877
|
+
return () => { };
|
|
10878
|
+
const observer = new MutationObserver((records) => {
|
|
10879
|
+
records.forEach(record => {
|
|
10880
|
+
// was the node tree changed?
|
|
10881
|
+
if (record.type === 'childList') {
|
|
10882
|
+
record.addedNodes.forEach(node => {
|
|
10883
|
+
// was the node for the tooltip trigger replaced?
|
|
10884
|
+
if (node instanceof HTMLElement && node.id === triggerId) {
|
|
10885
|
+
// if it was, update our reference to it
|
|
10886
|
+
setTriggerTarget(node);
|
|
10887
|
+
}
|
|
10888
|
+
});
|
|
10889
|
+
}
|
|
10890
|
+
});
|
|
10891
|
+
});
|
|
10892
|
+
observer.observe(triggerRef.current.parentElement, {
|
|
10893
|
+
subtree: true,
|
|
10894
|
+
childList: true,
|
|
10895
|
+
});
|
|
10896
|
+
return () => observer.disconnect();
|
|
10897
|
+
}, [setTriggerTarget, triggerId, triggerTarget]);
|
|
10898
|
+
const getReferenceClientRect = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useMemo)(() => {
|
|
10899
|
+
return triggerTarget ? () => triggerTarget.getBoundingClientRect() : undefined;
|
|
10900
|
+
}, [triggerTarget]);
|
|
10901
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((react_default()), { getReferenceClientRect: getReferenceClientRect, triggerTarget: triggerTarget, ...rest },
|
|
10902
|
+
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", { ref: triggerRef, id: triggerId }, children)));
|
|
10903
|
+
}
|
|
10904
|
+
|
|
10858
10905
|
;// ./components/Glossary/index.tsx
|
|
10859
10906
|
|
|
10860
10907
|
|
|
@@ -10864,7 +10911,7 @@ const Glossary = ({ children, term: termProp, terms }) => {
|
|
|
10864
10911
|
const foundTerm = terms.find(i => term.toLowerCase() === i?.term?.toLowerCase());
|
|
10865
10912
|
if (!foundTerm)
|
|
10866
10913
|
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", null, term);
|
|
10867
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(
|
|
10914
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tooltip, { content: external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "GlossaryItem-tooltip-content" },
|
|
10868
10915
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("strong", { className: "GlossaryItem-term" }, foundTerm.term),
|
|
10869
10916
|
" - ",
|
|
10870
10917
|
foundTerm.definition), offset: [-5, 5], placement: "bottom-start" },
|
|
@@ -69559,7 +69606,7 @@ const visitor = (table, index, parent) => {
|
|
|
69559
69606
|
visit(cell, 'break', (_, breakIndex, breakParent) => {
|
|
69560
69607
|
breakParent.children.splice(breakIndex, 1, { type: 'text', value: '\n' });
|
|
69561
69608
|
});
|
|
69562
|
-
if (!phrasing(content) && content.type !== 'escape') {
|
|
69609
|
+
if (!(phrasing(content) || content.type === 'plain') && content.type !== 'escape') {
|
|
69563
69610
|
hasFlowContent = true;
|
|
69564
69611
|
return EXIT;
|
|
69565
69612
|
}
|
package/dist/main.node.js
CHANGED
|
@@ -16403,6 +16403,11 @@ const Embed = ({ lazy = true, url, html, providerName, providerUrl, title, ifram
|
|
|
16403
16403
|
};
|
|
16404
16404
|
/* harmony default export */ const components_Embed = (Embed);
|
|
16405
16405
|
|
|
16406
|
+
;// ./contexts/GlossaryTerms.ts
|
|
16407
|
+
|
|
16408
|
+
const GlossaryContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)([]);
|
|
16409
|
+
/* harmony default export */ const GlossaryTerms = (GlossaryContext);
|
|
16410
|
+
|
|
16406
16411
|
;// ./node_modules/@popperjs/core/lib/dom-utils/getWindow.js
|
|
16407
16412
|
function getWindow(node) {
|
|
16408
16413
|
if (node == null) {
|
|
@@ -21350,10 +21355,52 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy_esm));
|
|
|
21350
21355
|
|
|
21351
21356
|
//# sourceMappingURL=tippy-react.esm.js.map
|
|
21352
21357
|
|
|
21353
|
-
;// ./
|
|
21358
|
+
;// ./components/Tooltip/index.tsx
|
|
21354
21359
|
|
|
21355
|
-
|
|
21356
|
-
|
|
21360
|
+
|
|
21361
|
+
/**
|
|
21362
|
+
* A custom wrapper around `@tippyjs/react` that attaches a MutationObserver to
|
|
21363
|
+
* listen for changes of the trigger element's DOM tree.
|
|
21364
|
+
*
|
|
21365
|
+
* This is necessary for features like translation, where we initially render a
|
|
21366
|
+
* Glossary term in English but then replace it with the translated term, which
|
|
21367
|
+
* creates a stale Tippy reference.
|
|
21368
|
+
*/
|
|
21369
|
+
function Tooltip({ children, ...rest }) {
|
|
21370
|
+
const triggerRef = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useRef)(null);
|
|
21371
|
+
const [triggerTarget, setTriggerTarget] = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState)(null);
|
|
21372
|
+
const triggerId = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useMemo)(() => {
|
|
21373
|
+
return `tooltip-trigger-${crypto.randomUUID()}`;
|
|
21374
|
+
}, []);
|
|
21375
|
+
(0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
|
|
21376
|
+
if (!triggerRef.current?.parentElement)
|
|
21377
|
+
return () => { };
|
|
21378
|
+
const observer = new MutationObserver((records) => {
|
|
21379
|
+
records.forEach(record => {
|
|
21380
|
+
// was the node tree changed?
|
|
21381
|
+
if (record.type === 'childList') {
|
|
21382
|
+
record.addedNodes.forEach(node => {
|
|
21383
|
+
// was the node for the tooltip trigger replaced?
|
|
21384
|
+
if (node instanceof HTMLElement && node.id === triggerId) {
|
|
21385
|
+
// if it was, update our reference to it
|
|
21386
|
+
setTriggerTarget(node);
|
|
21387
|
+
}
|
|
21388
|
+
});
|
|
21389
|
+
}
|
|
21390
|
+
});
|
|
21391
|
+
});
|
|
21392
|
+
observer.observe(triggerRef.current.parentElement, {
|
|
21393
|
+
subtree: true,
|
|
21394
|
+
childList: true,
|
|
21395
|
+
});
|
|
21396
|
+
return () => observer.disconnect();
|
|
21397
|
+
}, [setTriggerTarget, triggerId, triggerTarget]);
|
|
21398
|
+
const getReferenceClientRect = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useMemo)(() => {
|
|
21399
|
+
return triggerTarget ? () => triggerTarget.getBoundingClientRect() : undefined;
|
|
21400
|
+
}, [triggerTarget]);
|
|
21401
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(tippy_react_esm, { getReferenceClientRect: getReferenceClientRect, triggerTarget: triggerTarget, ...rest },
|
|
21402
|
+
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", { ref: triggerRef, id: triggerId }, children)));
|
|
21403
|
+
}
|
|
21357
21404
|
|
|
21358
21405
|
;// ./components/Glossary/index.tsx
|
|
21359
21406
|
|
|
@@ -21364,7 +21411,7 @@ const Glossary = ({ children, term: termProp, terms }) => {
|
|
|
21364
21411
|
const foundTerm = terms.find(i => term.toLowerCase() === i?.term?.toLowerCase());
|
|
21365
21412
|
if (!foundTerm)
|
|
21366
21413
|
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", null, term);
|
|
21367
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(
|
|
21414
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tooltip, { content: external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "GlossaryItem-tooltip-content" },
|
|
21368
21415
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("strong", { className: "GlossaryItem-term" }, foundTerm.term),
|
|
21369
21416
|
" - ",
|
|
21370
21417
|
foundTerm.definition), offset: [-5, 5], placement: "bottom-start" },
|
|
@@ -87642,7 +87689,7 @@ const visitor = (table, index, parent) => {
|
|
|
87642
87689
|
visit(cell, 'break', (_, breakIndex, breakParent) => {
|
|
87643
87690
|
breakParent.children.splice(breakIndex, 1, { type: 'text', value: '\n' });
|
|
87644
87691
|
});
|
|
87645
|
-
if (!phrasing(content) && content.type !== 'escape') {
|
|
87692
|
+
if (!(phrasing(content) || content.type === 'plain') && content.type !== 'escape') {
|
|
87646
87693
|
hasFlowContent = true;
|
|
87647
87694
|
return EXIT;
|
|
87648
87695
|
}
|