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/README.md +16 -0
- package/dist/index.cjs +30 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/styles/styles.css +3 -0
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
|
-
/**
|
|
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
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
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
|
-
|
|
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
|