clio-design-system 0.1.0 → 0.2.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.
package/dist/index.d.cts CHANGED
@@ -422,16 +422,20 @@ interface TextBlockProps extends Omit<HTMLAttributes<HTMLParagraphElement>, 'sty
422
422
  declare function TextBlock({ text, style, ...rest }: TextBlockProps): react.JSX.Element;
423
423
 
424
424
  interface EquationBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style'> {
425
- /** Raw TeX/LaTeX source real product renders via KaTeX (`<ka-tex>`). */
425
+ /** TeX/LaTeX source, rendered to typeset display math via bundled KaTeX. */
426
426
  tex: string;
427
427
  style?: CSSProperties;
428
428
  }
429
429
  /**
430
430
  * EquationBlock — display-math content block. Renders bare (no card shell).
431
- * The real product uses a `<ka-tex>` custom element backed by KaTeX; this
432
- * design-system stand-in renders the raw TeX in an italic serif style so
433
- * the layout/spacing is representative without a KaTeX runtime dependency.
434
- * Consumers should mount the actual `ka-tex` element (see readme.md).
431
+ *
432
+ * Renders `tex` to typeset display math via bundled KaTeX the consumer just
433
+ * passes a TeX string, no `<ka-tex>` element to register or mount. Invalid TeX
434
+ * renders inline as an error (never throws) so one bad equation can't crash a
435
+ * whole note.
436
+ *
437
+ * Requires the KaTeX stylesheet, which the design system's `styles.css` already
438
+ * imports — consumers importing `clio-design-system/styles.css` get it for free.
435
439
  */
436
440
  declare function EquationBlock({ tex, style, ...rest }: EquationBlockProps): react.JSX.Element;
437
441
 
package/dist/index.d.ts CHANGED
@@ -422,16 +422,20 @@ interface TextBlockProps extends Omit<HTMLAttributes<HTMLParagraphElement>, 'sty
422
422
  declare function TextBlock({ text, style, ...rest }: TextBlockProps): react.JSX.Element;
423
423
 
424
424
  interface EquationBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style'> {
425
- /** Raw TeX/LaTeX source real product renders via KaTeX (`<ka-tex>`). */
425
+ /** TeX/LaTeX source, rendered to typeset display math via bundled KaTeX. */
426
426
  tex: string;
427
427
  style?: CSSProperties;
428
428
  }
429
429
  /**
430
430
  * EquationBlock — display-math content block. Renders bare (no card shell).
431
- * The real product uses a `<ka-tex>` custom element backed by KaTeX; this
432
- * design-system stand-in renders the raw TeX in an italic serif style so
433
- * the layout/spacing is representative without a KaTeX runtime dependency.
434
- * Consumers should mount the actual `ka-tex` element (see readme.md).
431
+ *
432
+ * Renders `tex` to typeset display math via bundled KaTeX the consumer just
433
+ * passes a TeX string, no `<ka-tex>` element to register or mount. Invalid TeX
434
+ * renders inline as an error (never throws) so one bad equation can't crash a
435
+ * whole note.
436
+ *
437
+ * Requires the KaTeX stylesheet, which the design system's `styles.css` already
438
+ * imports — consumers importing `clio-design-system/styles.css` get it for free.
435
439
  */
436
440
  declare function EquationBlock({ tex, style, ...rest }: EquationBlockProps): react.JSX.Element;
437
441
 
package/dist/index.js CHANGED
@@ -1456,9 +1456,22 @@ function TextBlock({ text, style, ...rest }) {
1456
1456
  }
1457
1457
 
1458
1458
  // src/components/EquationBlock/EquationBlock.tsx
1459
+ import { useMemo } from "react";
1460
+ import katex from "katex";
1459
1461
  import { jsx as jsx24 } from "react/jsx-runtime";
1460
1462
  function EquationBlock({ tex, style, ...rest }) {
1461
- return /* @__PURE__ */ jsx24("div", { ...rest, style: { margin: "18px 0", textAlign: "center", padding: "10px 0", ...style }, children: /* @__PURE__ */ jsx24("span", { style: { fontFamily: "Georgia, serif", fontStyle: "italic", fontSize: "17px", color: "var(--color-text-primary)" }, children: tex }) });
1463
+ const html = useMemo(
1464
+ () => katex.renderToString(tex, { displayMode: true, throwOnError: false }),
1465
+ [tex]
1466
+ );
1467
+ return /* @__PURE__ */ jsx24(
1468
+ "div",
1469
+ {
1470
+ ...rest,
1471
+ style: { margin: "18px 0", textAlign: "center", padding: "10px 0", ...style },
1472
+ dangerouslySetInnerHTML: { __html: html }
1473
+ }
1474
+ );
1462
1475
  }
1463
1476
 
1464
1477
  // src/components/IntuitionCallout/IntuitionCallout.tsx