myst-to-react 0.9.9 → 0.10.0

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.
@@ -16,7 +16,7 @@ export declare enum AdmonitionKind {
16
16
  }
17
17
  type Color = 'blue' | 'green' | 'yellow' | 'red';
18
18
  export declare const AdmonitionTitle: NodeRenderer<AdmonitionTitleSpec>;
19
- export declare function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, }: {
19
+ export declare function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, open, }: {
20
20
  title?: React.ReactNode;
21
21
  color?: Color;
22
22
  kind?: AdmonitionKind;
@@ -25,6 +25,7 @@ export declare function Admonition({ title, kind, color, simple, dropdown, child
25
25
  dropdown?: boolean;
26
26
  hideIcon?: boolean;
27
27
  className?: string;
28
+ open?: boolean;
28
29
  }): import("react/jsx-runtime").JSX.Element;
29
30
  export declare const AdmonitionRenderer: NodeRenderer<AdmonitionSpec>;
30
31
  declare const ADMONITION_RENDERERS: {
@@ -1 +1 @@
1
- {"version":3,"file":"admonitions.d.ts","sourceRoot":"","sources":["../src/admonitions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAC5B,eAAe,IAAI,mBAAmB,EACvC,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAsB1D,oBAAY,cAAc;IACxB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,OAAO,YAAY;CACpB;AAED,KAAK,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAyEjD,eAAO,MAAM,eAAe,EAA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,CAE7D,CAAC;AAmCF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,2CAuEA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAyB3D,CAAC;AAEF,QAAA,MAAM,oBAAoB;;;CAGzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -86,9 +86,9 @@ function AdmonitionIcon({ kind, className }) {
86
86
  export const AdmonitionTitle = ({ node }) => {
87
87
  return _jsx(MyST, { ast: node.children });
88
88
  };
89
- const WrapperElement = ({ dropdown, className, children, }) => {
89
+ const WrapperElement = ({ dropdown, className, children, open, }) => {
90
90
  if (dropdown)
91
- return _jsx("details", { className: className, children: children });
91
+ return (_jsx("details", { className: className, open: open, children: children }));
92
92
  return _jsx("aside", { className: className, children: children });
93
93
  };
94
94
  const HeaderElement = ({ dropdown, className, children, }) => {
@@ -96,8 +96,8 @@ const HeaderElement = ({ dropdown, className, children, }) => {
96
96
  return _jsx("summary", { className: className, children: children });
97
97
  return _jsx("div", { className: className, children: children });
98
98
  };
99
- export function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, }) {
100
- return (_jsxs(WrapperElement, { dropdown: dropdown, className: classNames('my-5 shadow-md dark:shadow-2xl dark:shadow-neutral-900', 'bg-gray-50/10 dark:bg-stone-800', 'overflow-hidden', {
99
+ export function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, open, }) {
100
+ return (_jsxs(WrapperElement, { dropdown: dropdown, open: open, className: classNames('my-5 shadow-md dark:shadow-2xl dark:shadow-neutral-900', 'bg-gray-50/10 dark:bg-stone-800', 'overflow-hidden', {
101
101
  'rounded border-l-4': !simple,
102
102
  'border-l-2': simple,
103
103
  'border-blue-500': !color || color === 'blue',
@@ -128,8 +128,9 @@ export const AdmonitionRenderer = ({ node }) => {
128
128
  const isDropdown = classes.includes('dropdown');
129
129
  const isSimple = classes.includes('simple');
130
130
  const hideIcon = node.icon === false;
131
+ const isOpen = node.open === true;
131
132
  const useTitle = (title === null || title === void 0 ? void 0 : title.type) === 'admonitionTitle';
132
- return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, simple: isSimple, hideIcon: hideIcon, className: classNames(classes), children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
133
+ return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, open: isOpen, simple: isSimple, hideIcon: hideIcon, className: classNames(classes), children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
133
134
  };
134
135
  const ADMONITION_RENDERERS = {
135
136
  admonition: AdmonitionRenderer,
package/dist/basic.js CHANGED
@@ -16,10 +16,10 @@ const BASIC_RENDERERS = {
16
16
  return (_jsx(_Fragment, { children: text.map((v, i) => (_jsxs(React.Fragment, { children: [v, i < text.length - 1 && _jsx("wbr", {})] }, i))) }));
17
17
  },
18
18
  span({ node }) {
19
- return (_jsx("span", { className: node.class, style: node.style, children: _jsx(MyST, { ast: node.children }) }));
19
+ return (_jsx("span", { className: node.class, style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
20
20
  },
21
21
  div({ node }) {
22
- return (_jsx("div", { className: node.class, style: node.style, children: _jsx(MyST, { ast: node.children }) }));
22
+ return (_jsx("div", { className: node.class, style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
23
23
  },
24
24
  delete({ node }) {
25
25
  return (_jsx("del", { children: _jsx(MyST, { ast: node.children }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myst-to-react",
3
- "version": "0.9.9",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@heroicons/react": "^2.0.18",
24
- "@myst-theme/providers": "^0.9.9",
24
+ "@myst-theme/providers": "^0.10.0",
25
25
  "@scienceicons/react": "^0.0.6",
26
26
  "@radix-ui/react-hover-card": "^1.0.6",
27
27
  "buffer": "^6.0.3",
28
28
  "classnames": "^2.3.2",
29
- "myst-common": "^1.4.4",
30
- "myst-config": "^1.4.4",
29
+ "myst-common": "^1.5.0",
30
+ "myst-config": "^1.5.0",
31
31
  "myst-spec": "^0.0.5",
32
32
  "nanoid": "^4.0.2",
33
33
  "react-syntax-highlighter": "^15.5.0",