myst-to-react 0.14.1 → 0.14.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # myst-to-react
2
2
 
3
3
  [![myst-to-react on npm](https://img.shields.io/npm/v/myst-to-react.svg)](https://www.npmjs.com/package/myst-to-react)
4
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/curvenote/blob/main/LICENSE)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jupyter-book/myst-theme/blob/main/LICENSE)
5
5
 
6
6
  Convert a MyST AST to React.
@@ -10,7 +10,7 @@ export declare function scrollToElement(el: HTMLElement | null, { htmlId, scroll
10
10
  /** Update the URL fragment to this ID */
11
11
  htmlId?: string;
12
12
  } & HashLinkBehavior): void;
13
- export declare function HashLink({ id, kind, title, children, canSelectText, hover, className, hideInPopup, scrollBehavior, historyState, focusTarget, }: {
13
+ export declare function HashLink({ id, kind, title, children, canSelectText, hover, className, hideInPopup, scrollBehavior, historyState, focusTarget, noWidth, }: {
14
14
  id?: string;
15
15
  kind?: string;
16
16
  title?: string;
@@ -19,5 +19,7 @@ export declare function HashLink({ id, kind, title, children, canSelectText, hov
19
19
  canSelectText?: boolean;
20
20
  className?: string;
21
21
  hideInPopup?: boolean;
22
+ /** Ensures that when centered it doesn't take up space */
23
+ noWidth?: boolean;
22
24
  } & HashLinkBehavior): import("react/jsx-runtime").JSX.Element | null;
23
25
  //# sourceMappingURL=hashLink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hashLink.d.ts","sourceRoot":"","sources":["../src/hashLink.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IAC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yC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,gBAAqB,QAe1B;AAED,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,aAAqB,EACrB,KAAK,EACL,SAAyB,EACzB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GACR,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,gBAAgB,kDAoCnB"}
package/dist/hashLink.js CHANGED
@@ -27,7 +27,7 @@ export function scrollToElement(el, { htmlId = el === null || el === void 0 ? vo
27
27
  el.focus({ preventScroll: true });
28
28
  }
29
29
  }
30
- export function HashLink({ id, kind, title = `Link to this ${kind}`, children = '¶', canSelectText = false, hover, className = 'font-normal', hideInPopup, scrollBehavior, historyState, focusTarget, }) {
30
+ export function HashLink({ id, kind, title = `Link to this ${kind}`, children = '¶', canSelectText = false, hover, className = 'font-normal', hideInPopup, scrollBehavior, historyState, focusTarget, noWidth, }) {
31
31
  const { inCrossRef } = useXRefState();
32
32
  if (inCrossRef || !id) {
33
33
  // If we are in a cross-reference pop-out, either hide hash link
@@ -39,7 +39,7 @@ export function HashLink({ id, kind, title = `Link to this ${kind}`, children =
39
39
  const el = document.getElementById(id);
40
40
  scrollToElement(el, { scrollBehavior, historyState, focusTarget });
41
41
  };
42
- return (_jsx("a", { className: classNames('no-underline text-inherit hover:text-inherit', className, {
42
+ return (_jsx("a", { className: classNames('no-underline text-inherit hover:text-inherit', { 'inline-block w-0 px-0 translate-x-[10px]': noWidth === true }, className, {
43
43
  'select-none': !canSelectText,
44
44
  'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover === true,
45
45
  '[@media(hover:hover)]:transition-opacity [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:focus:opacity-100 [@media(hover:hover)]:group-hover:opacity-70': hover === 'desktop',
package/dist/heading.js CHANGED
@@ -6,7 +6,7 @@ import classNames from 'classnames';
6
6
  const Heading = ({ node, className }) => {
7
7
  const { enumerator, depth, key, identifier, html_id } = node;
8
8
  const id = html_id || identifier || key;
9
- const textContent = (_jsxs(_Fragment, { children: [enumerator && _jsx("span", { className: "mr-3 select-none", children: enumerator }), _jsx("span", { className: "heading-text", children: _jsx(MyST, { ast: node.children }) }), _jsx(HashLink, { id: id, kind: "Section", className: "px-2 font-normal", hover: true, hideInPopup: true })] }));
9
+ const textContent = (_jsxs(_Fragment, { children: [enumerator && _jsx("span", { className: "mr-3 select-none", children: enumerator }), _jsx("span", { className: "heading-text", children: _jsx(MyST, { ast: node.children }) }), _jsx(HashLink, { id: id, kind: "Section", className: "font-normal", hover: true, hideInPopup: true, noWidth: true })] }));
10
10
  // The `heading-text` class is picked up in the Outline to select without the enumerator and "#" link
11
11
  return e(`h${depth}`, {
12
12
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myst-to-react",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@heroicons/react": "^2.0.18",
24
- "@myst-theme/providers": "^0.14.1",
24
+ "@myst-theme/providers": "^0.14.2",
25
25
  "@scienceicons/react": "^0.0.11",
26
26
  "@radix-ui/react-hover-card": "^1.0.6",
27
27
  "buffer": "^6.0.3",