myst-to-react 0.9.5 → 0.9.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../src/footnotes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAqB1D,eAAO,MAAM,iBAAiB,EAAE,YAe/B,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAIvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../src/footnotes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAqB1D,eAAO,MAAM,iBAAiB,EAAE,YAoB/B,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAIvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
package/dist/footnotes.js CHANGED
@@ -8,11 +8,11 @@ function FootnoteDefinition({ identifier }) {
8
8
  var _a, _b;
9
9
  const references = useReferences();
10
10
  const node = (_b = (_a = references === null || references === void 0 ? void 0 : references.footnotes) === null || _a === void 0 ? void 0 : _a[identifier]) !== null && _b !== void 0 ? _b : select(`footnoteDefinition[identifier=${identifier}]`, references === null || references === void 0 ? void 0 : references.article);
11
- return (_jsx(XRefProvider, { children: _jsx("div", { className: "hover-document article w-[500px] sm:max-w-[500px] px-3", children: _jsx(MyST, { ast: node.children }) }) }));
11
+ return (_jsx(XRefProvider, { children: _jsx("div", { className: "hover-document article w-[500px] sm:max-w-[500px] px-3 text-sm", children: _jsx(MyST, { ast: node.children }) }) }));
12
12
  }
13
13
  export const FootnoteReference = ({ node }) => {
14
14
  var _a, _b;
15
- return (_jsx(HoverPopover, { openDelay: 0, card: _jsx(FootnoteDefinition, { identifier: node.identifier }), children: _jsx("span", { id: `fnref-${node.key}`, children: _jsx("sup", { className: "hover-link", children: _jsxs(HashLink, { id: `fn-${node.identifier}`, title: "Link to Footnote", scrollBehavior: "instant", children: ["[", (_b = (_a = node.enumerator) !== null && _a !== void 0 ? _a : node.number) !== null && _b !== void 0 ? _b : node.identifier, "]"] }) }) }) }));
15
+ return (_jsx(HoverPopover, { openDelay: 0, card: _jsx(FootnoteDefinition, { identifier: node.identifier }), children: _jsx("span", { id: `fnref-${node.key}`, children: _jsx("sup", { className: "hover-link", children: _jsxs(HashLink, { id: `fn-${node.identifier}`, title: "Link to Footnote", scrollBehavior: "instant", canSelectText: true, children: ["[", (_b = (_a = node.enumerator) !== null && _a !== void 0 ? _a : node.number) !== null && _b !== void 0 ? _b : node.identifier, "]"] }) }) }) }));
16
16
  };
17
17
  const FOOTNOTE_RENDERERS = {
18
18
  footnoteReference: FootnoteReference,
@@ -11,12 +11,13 @@ export declare function scrollToElement(el: HTMLElement | null, { htmlId, scroll
11
11
  /** Update the URL fragment to this ID */
12
12
  htmlId?: string;
13
13
  } & HashLinkBehavior): void;
14
- export declare function HashLink({ id, kind, title, children, hover, className, hideInPopup, scrollBehavior, historyState, focusTarget, }: {
14
+ export declare function HashLink({ id, kind, title, children, canSelectText, hover, className, hideInPopup, scrollBehavior, historyState, focusTarget, }: {
15
15
  id?: string;
16
16
  kind?: string;
17
17
  title?: string;
18
18
  hover?: boolean;
19
19
  children?: '#' | '¶' | React.ReactNode;
20
+ canSelectText?: boolean;
20
21
  className?: string;
21
22
  hideInPopup?: boolean;
22
23
  } & HashLinkBehavior): import("react/jsx-runtime").JSX.Element | null;
@@ -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;IACzC,gEA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ED,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,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,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;CACvB,GAAG,gBAAgB,kDA6BnB"}
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 = '¶', 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, }) {
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,8 @@ 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('select-none no-underline text-inherit hover:text-inherit', className, {
42
+ return (_jsx("a", { className: classNames('no-underline text-inherit hover:text-inherit', className, {
43
+ 'select-none': !canSelectText,
43
44
  'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover,
44
45
  'hover:underline': !hover,
45
46
  }), onClick: scroll, href: `#${id}`, title: title, "aria-label": title, children: children }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myst-to-react",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
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.9.5",
24
+ "@myst-theme/providers": "^0.9.7",
25
25
  "@scienceicons/react": "^0.0.6",
26
26
  "@radix-ui/react-hover-card": "^1.0.6",
27
27
  "buffer": "^6.0.3",