@cntyclub/ui-react 0.10.0 → 0.10.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/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/package.json +39 -19
- package/src/components/ui/badge.tsx +3 -3
- package/src/components/ui/markdown.tsx +82 -1
package/dist/index.js
CHANGED
|
@@ -1693,9 +1693,9 @@ var badgeVariants = cva(
|
|
|
1693
1693
|
pill: "rounded-full"
|
|
1694
1694
|
},
|
|
1695
1695
|
size: {
|
|
1696
|
-
default: "h-5.5 min-w-5.5 px-[calc(--spacing(
|
|
1697
|
-
lg: "h-6.5 min-w-6.5 px-[calc(--spacing(
|
|
1698
|
-
sm: "h-5 min-w-5 px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]"
|
|
1696
|
+
default: "h-5.5 min-w-5.5 px-[calc(--spacing(2)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs",
|
|
1697
|
+
lg: "h-6.5 min-w-6.5 px-[calc(--spacing(2.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm",
|
|
1698
|
+
sm: "h-5 min-w-5 px-[calc(--spacing(1.5)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]"
|
|
1699
1699
|
},
|
|
1700
1700
|
variant: {
|
|
1701
1701
|
default: "bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90",
|
|
@@ -5925,6 +5925,59 @@ function KbdGroup({ className, ...props }) {
|
|
|
5925
5925
|
}
|
|
5926
5926
|
);
|
|
5927
5927
|
}
|
|
5928
|
+
var LATEX_SYMBOLS = {
|
|
5929
|
+
times: "\xD7",
|
|
5930
|
+
cdot: "\xB7",
|
|
5931
|
+
div: "\xF7",
|
|
5932
|
+
approx: "\u2248",
|
|
5933
|
+
neq: "\u2260",
|
|
5934
|
+
ne: "\u2260",
|
|
5935
|
+
leq: "\u2264",
|
|
5936
|
+
le: "\u2264",
|
|
5937
|
+
geq: "\u2265",
|
|
5938
|
+
ge: "\u2265",
|
|
5939
|
+
pm: "\xB1",
|
|
5940
|
+
to: "\u2192",
|
|
5941
|
+
rightarrow: "\u2192",
|
|
5942
|
+
Rightarrow: "\u21D2",
|
|
5943
|
+
infty: "\u221E",
|
|
5944
|
+
cdots: "\u22EF",
|
|
5945
|
+
ldots: "\u2026",
|
|
5946
|
+
deg: "\xB0"
|
|
5947
|
+
};
|
|
5948
|
+
var wrapFracSide = (x) => {
|
|
5949
|
+
const t = x.trim();
|
|
5950
|
+
return /[+\-*/×÷·\s]/.test(t) ? `(${t})` : t;
|
|
5951
|
+
};
|
|
5952
|
+
function normalizeLatex(src) {
|
|
5953
|
+
if (!src.includes("\\") && !src.includes("$")) return src;
|
|
5954
|
+
let s = src;
|
|
5955
|
+
s = s.replace(/\$\$([\s\S]*?)\$\$/g, " $1 ");
|
|
5956
|
+
s = s.replace(/\$([^$\n]*\\[^$\n]*)\$/g, " $1 ");
|
|
5957
|
+
s = s.replace(/\\[()[\]]/g, " ");
|
|
5958
|
+
for (let i = 0; i < 3; i++) {
|
|
5959
|
+
const next = s.replace(
|
|
5960
|
+
/\\[dt]?frac\s*\{([^{}]*)\}\s*\{([^{}]*)\}/g,
|
|
5961
|
+
(_m, a, b) => `${wrapFracSide(a)}/${wrapFracSide(b)}`
|
|
5962
|
+
);
|
|
5963
|
+
if (next === s) break;
|
|
5964
|
+
s = next;
|
|
5965
|
+
}
|
|
5966
|
+
s = s.replace(/\\sqrt\s*\{([^{}]*)\}/g, "\u221A($1)");
|
|
5967
|
+
s = s.replace(/\\(?:text|mathrm|mathbf|mathit|operatorname)\s*\{([^{}]*)\}/g, "$1");
|
|
5968
|
+
s = s.replace(/\\([a-zA-Z]+)/g, (m, name) => LATEX_SYMBOLS[name] ?? m);
|
|
5969
|
+
s = s.replace(/\\(left|right)\b/g, "");
|
|
5970
|
+
s = s.replace(/\\([%$&#_{}])/g, "$1");
|
|
5971
|
+
s = s.replace(/\\[,;:!]/g, "");
|
|
5972
|
+
s = s.replace(/\\ /g, " ");
|
|
5973
|
+
s = s.replace(/\\([a-zA-Z]+)/g, "$1");
|
|
5974
|
+
for (let i = 0; i < 3; i++) {
|
|
5975
|
+
const next = s.replace(/\{([^{}]*)\}/g, "$1");
|
|
5976
|
+
if (next === s) break;
|
|
5977
|
+
s = next;
|
|
5978
|
+
}
|
|
5979
|
+
return s.replace(/[ \t]{2,}/g, " ");
|
|
5980
|
+
}
|
|
5928
5981
|
function Markdown({ children, className }) {
|
|
5929
5982
|
return /* @__PURE__ */ jsx(
|
|
5930
5983
|
"div",
|
|
@@ -5994,7 +6047,7 @@ function Markdown({ children, className }) {
|
|
|
5994
6047
|
},
|
|
5995
6048
|
remarkPlugins: [remarkGfm],
|
|
5996
6049
|
skipHtml: true,
|
|
5997
|
-
children
|
|
6050
|
+
children: normalizeLatex(children)
|
|
5998
6051
|
}
|
|
5999
6052
|
)
|
|
6000
6053
|
}
|