@mantine/code-highlight 9.0.0-alpha.4 → 9.0.0-alpha.6
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/cjs/CodeHighlight/CodeHighlight.cjs +130 -169
- package/cjs/CodeHighlight/CodeHighlight.cjs.map +1 -1
- package/cjs/CodeHighlight/CodeHighlight.context.cjs +7 -10
- package/cjs/CodeHighlight/CodeHighlight.context.cjs.map +1 -1
- package/cjs/CodeHighlight/CodeHighlightControl/CodeHighlightControl.cjs +31 -40
- package/cjs/CodeHighlight/CodeHighlightControl/CodeHighlightControl.cjs.map +1 -1
- package/cjs/CodeHighlight/CopyCodeButton/CopyCodeButton.cjs +19 -26
- package/cjs/CodeHighlight/CopyCodeButton/CopyCodeButton.cjs.map +1 -1
- package/cjs/CodeHighlight/CopyCodeButton/CopyIcon.cjs +30 -28
- package/cjs/CodeHighlight/CopyCodeButton/CopyIcon.cjs.map +1 -1
- package/cjs/CodeHighlight/ExpandCodeButton/ExpandCodeButton.cjs +16 -24
- package/cjs/CodeHighlight/ExpandCodeButton/ExpandCodeButton.cjs.map +1 -1
- package/cjs/CodeHighlight/ExpandCodeButton/ExpandIcon.cjs +40 -35
- package/cjs/CodeHighlight/ExpandCodeButton/ExpandIcon.cjs.map +1 -1
- package/cjs/CodeHighlight/InlineCodeHighlight.cjs +38 -37
- package/cjs/CodeHighlight/InlineCodeHighlight.cjs.map +1 -1
- package/cjs/CodeHighlight.module.cjs +22 -0
- package/cjs/CodeHighlight.module.cjs.map +1 -0
- package/cjs/CodeHighlightProvider/CodeHighlightProvider.cjs +26 -27
- package/cjs/CodeHighlightProvider/CodeHighlightProvider.cjs.map +1 -1
- package/cjs/CodeHighlightProvider/adapters/highlight-js-adapter.cjs +12 -14
- package/cjs/CodeHighlightProvider/adapters/highlight-js-adapter.cjs.map +1 -1
- package/cjs/CodeHighlightProvider/adapters/plain-text-adapter.cjs +8 -7
- package/cjs/CodeHighlightProvider/adapters/plain-text-adapter.cjs.map +1 -1
- package/cjs/CodeHighlightProvider/adapters/shiki-adapter.cjs +34 -42
- package/cjs/CodeHighlightProvider/adapters/shiki-adapter.cjs.map +1 -1
- package/cjs/CodeHighlightProvider/adapters/shiki-themes.cjs +1131 -1234
- package/cjs/CodeHighlightProvider/adapters/shiki-themes.cjs.map +1 -1
- package/cjs/CodeHighlightTabs/CodeHighlightTabs.cjs +103 -134
- package/cjs/CodeHighlightTabs/CodeHighlightTabs.cjs.map +1 -1
- package/cjs/CodeHighlightTabs/FileIcon.cjs +18 -14
- package/cjs/CodeHighlightTabs/FileIcon.cjs.map +1 -1
- package/cjs/_virtual/_rolldown/runtime.cjs +24 -0
- package/cjs/index.cjs +21 -26
- package/esm/CodeHighlight/CodeHighlight.context.mjs +7 -8
- package/esm/CodeHighlight/CodeHighlight.context.mjs.map +1 -1
- package/esm/CodeHighlight/CodeHighlight.mjs +126 -161
- package/esm/CodeHighlight/CodeHighlight.mjs.map +1 -1
- package/esm/CodeHighlight/CodeHighlightControl/CodeHighlightControl.mjs +29 -37
- package/esm/CodeHighlight/CodeHighlightControl/CodeHighlightControl.mjs.map +1 -1
- package/esm/CodeHighlight/CopyCodeButton/CopyCodeButton.mjs +18 -24
- package/esm/CodeHighlight/CopyCodeButton/CopyCodeButton.mjs.map +1 -1
- package/esm/CodeHighlight/CopyCodeButton/CopyIcon.mjs +29 -26
- package/esm/CodeHighlight/CopyCodeButton/CopyIcon.mjs.map +1 -1
- package/esm/CodeHighlight/ExpandCodeButton/ExpandCodeButton.mjs +15 -22
- package/esm/CodeHighlight/ExpandCodeButton/ExpandCodeButton.mjs.map +1 -1
- package/esm/CodeHighlight/ExpandCodeButton/ExpandIcon.mjs +39 -33
- package/esm/CodeHighlight/ExpandCodeButton/ExpandIcon.mjs.map +1 -1
- package/esm/CodeHighlight/InlineCodeHighlight.mjs +36 -34
- package/esm/CodeHighlight/InlineCodeHighlight.mjs.map +1 -1
- package/esm/CodeHighlight.module.mjs +22 -0
- package/esm/CodeHighlight.module.mjs.map +1 -0
- package/esm/CodeHighlightProvider/CodeHighlightProvider.mjs +24 -23
- package/esm/CodeHighlightProvider/CodeHighlightProvider.mjs.map +1 -1
- package/esm/CodeHighlightProvider/adapters/highlight-js-adapter.mjs +12 -12
- package/esm/CodeHighlightProvider/adapters/highlight-js-adapter.mjs.map +1 -1
- package/esm/CodeHighlightProvider/adapters/plain-text-adapter.mjs +8 -5
- package/esm/CodeHighlightProvider/adapters/plain-text-adapter.mjs.map +1 -1
- package/esm/CodeHighlightProvider/adapters/shiki-adapter.mjs +34 -40
- package/esm/CodeHighlightProvider/adapters/shiki-adapter.mjs.map +1 -1
- package/esm/CodeHighlightProvider/adapters/shiki-themes.mjs +1131 -1232
- package/esm/CodeHighlightProvider/adapters/shiki-themes.mjs.map +1 -1
- package/esm/CodeHighlightTabs/CodeHighlightTabs.mjs +101 -131
- package/esm/CodeHighlightTabs/CodeHighlightTabs.mjs.map +1 -1
- package/esm/CodeHighlightTabs/FileIcon.mjs +17 -12
- package/esm/CodeHighlightTabs/FileIcon.mjs.map +1 -1
- package/esm/index.mjs +10 -10
- package/package.json +7 -7
- package/cjs/CodeHighlight.module.css.cjs +0 -7
- package/cjs/CodeHighlight.module.css.cjs.map +0 -1
- package/cjs/index.cjs.map +0 -1
- package/esm/CodeHighlight.module.css.mjs +0 -5
- package/esm/CodeHighlight.module.css.mjs.map +0 -1
- package/esm/index.mjs.map +0 -1
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlight/CopyCodeButton/CopyIcon.tsx
|
|
6
5
|
function CopyIcon({ copied, ...others }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
strokeWidth: "2",
|
|
10
|
+
stroke: "currentColor",
|
|
11
|
+
fill: "none",
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
...others,
|
|
15
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
16
|
+
stroke: "none",
|
|
17
|
+
d: "M0 0h24v24H0z",
|
|
18
|
+
fill: "none"
|
|
19
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12l5 5l10 -10" })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
21
|
+
stroke: "none",
|
|
22
|
+
d: "M0 0h24v24H0z",
|
|
23
|
+
fill: "none"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" }),
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
|
|
27
|
+
] })
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
CopyIcon.displayName = "@mantine/code-highlight/CopyIcon";
|
|
30
|
-
|
|
31
|
+
//#endregion
|
|
31
32
|
exports.CopyIcon = CopyIcon;
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=CopyIcon.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyIcon.cjs","sources":["../../../src/CodeHighlight/CopyCodeButton/CopyIcon.tsx"],"sourcesContent":["interface CopyIconProps extends React.ComponentProps<'svg'> {\n copied: boolean;\n}\n\nexport function CopyIcon({ copied, ...others }: CopyIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...others}\n >\n {copied ? (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M5 12l5 5l10 -10\" />\n </>\n ) : (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\" />\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\" />\n </>\n )}\n </svg>\n );\n}\n\nCopyIcon.displayName = '@mantine/code-highlight/CopyIcon';\n"],"
|
|
1
|
+
{"version":3,"file":"CopyIcon.cjs","names":[],"sources":["../../../src/CodeHighlight/CopyCodeButton/CopyIcon.tsx"],"sourcesContent":["interface CopyIconProps extends React.ComponentProps<'svg'> {\n copied: boolean;\n}\n\nexport function CopyIcon({ copied, ...others }: CopyIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...others}\n >\n {copied ? (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M5 12l5 5l10 -10\" />\n </>\n ) : (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\" />\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\" />\n </>\n )}\n </svg>\n );\n}\n\nCopyIcon.displayName = '@mantine/code-highlight/CopyIcon';\n"],"mappings":";;;;AAIA,SAAgB,SAAS,EAAE,QAAQ,GAAG,UAAyB;AAC7D,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,aAAY;EACZ,QAAO;EACP,MAAK;EACL,eAAc;EACd,gBAAe;EACf,GAAI;YAEH,SACC,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;GAAM,QAAO;GAAO,GAAE;GAAgB,MAAK;GAAS,CAAA,EACpD,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,oBAAqB,CAAA,CAC5B,EAAA,CAAA,GAEH,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA;GACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,QAAO;IAAO,GAAE;IAAgB,MAAK;IAAS,CAAA;GACpD,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,gFAAiF,CAAA;GACzF,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,gEAAiE,CAAA;GACxE,EAAA,CAAA;EAED,CAAA;;AAIV,SAAS,cAAc"}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
-
CodeHighlightControl.CodeHighlightControl,
|
|
16
|
-
{
|
|
17
|
-
onClick: () => onExpand(!expanded),
|
|
18
|
-
tooltipLabel: expanded ? collapseCodeLabel : expandCodeLabel,
|
|
19
|
-
"aria-label": expanded ? collapseCodeLabel : expandCodeLabel,
|
|
20
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ExpandIcon.ExpandIcon, { expanded })
|
|
21
|
-
}
|
|
22
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_CodeHighlightControl = require("../CodeHighlightControl/CodeHighlightControl.cjs");
|
|
4
|
+
const require_ExpandIcon = require("./ExpandIcon.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.tsx
|
|
7
|
+
function ExpandCodeButton({ expanded, onExpand, expandCodeLabel = "Expand code", collapseCodeLabel = "Collapse code" }) {
|
|
8
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeHighlightControl.CodeHighlightControl, {
|
|
9
|
+
onClick: () => onExpand(!expanded),
|
|
10
|
+
tooltipLabel: expanded ? collapseCodeLabel : expandCodeLabel,
|
|
11
|
+
"aria-label": expanded ? collapseCodeLabel : expandCodeLabel,
|
|
12
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExpandIcon.ExpandIcon, { expanded })
|
|
13
|
+
});
|
|
23
14
|
}
|
|
24
15
|
ExpandCodeButton.displayName = "@mantine/code-highlight/ExpandCodeButton";
|
|
25
|
-
|
|
16
|
+
//#endregion
|
|
26
17
|
exports.ExpandCodeButton = ExpandCodeButton;
|
|
27
|
-
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=ExpandCodeButton.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandCodeButton.cjs","sources":["../../../src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.tsx"],"sourcesContent":["import { CodeHighlightControl } from '../CodeHighlightControl/CodeHighlightControl';\nimport { ExpandIcon } from './ExpandIcon';\n\ninterface ExpandCodeButtonProps {\n expanded: boolean;\n onExpand: (value: boolean) => void;\n collapseCodeLabel?: string;\n expandCodeLabel?: string;\n}\n\nexport function ExpandCodeButton({\n expanded,\n onExpand,\n expandCodeLabel = 'Expand code',\n collapseCodeLabel = 'Collapse code',\n}: ExpandCodeButtonProps) {\n return (\n <CodeHighlightControl\n onClick={() => onExpand(!expanded)}\n tooltipLabel={expanded ? collapseCodeLabel : expandCodeLabel}\n aria-label={expanded ? collapseCodeLabel : expandCodeLabel}\n >\n <ExpandIcon expanded={expanded} />\n </CodeHighlightControl>\n );\n}\n\nExpandCodeButton.displayName = '@mantine/code-highlight/ExpandCodeButton';\n"],"
|
|
1
|
+
{"version":3,"file":"ExpandCodeButton.cjs","names":["CodeHighlightControl","ExpandIcon"],"sources":["../../../src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.tsx"],"sourcesContent":["import { CodeHighlightControl } from '../CodeHighlightControl/CodeHighlightControl';\nimport { ExpandIcon } from './ExpandIcon';\n\ninterface ExpandCodeButtonProps {\n expanded: boolean;\n onExpand: (value: boolean) => void;\n collapseCodeLabel?: string;\n expandCodeLabel?: string;\n}\n\nexport function ExpandCodeButton({\n expanded,\n onExpand,\n expandCodeLabel = 'Expand code',\n collapseCodeLabel = 'Collapse code',\n}: ExpandCodeButtonProps) {\n return (\n <CodeHighlightControl\n onClick={() => onExpand(!expanded)}\n tooltipLabel={expanded ? collapseCodeLabel : expandCodeLabel}\n aria-label={expanded ? collapseCodeLabel : expandCodeLabel}\n >\n <ExpandIcon expanded={expanded} />\n </CodeHighlightControl>\n );\n}\n\nExpandCodeButton.displayName = '@mantine/code-highlight/ExpandCodeButton';\n"],"mappings":";;;;;;AAUA,SAAgB,iBAAiB,EAC/B,UACA,UACA,kBAAkB,eAClB,oBAAoB,mBACI;AACxB,QACE,iBAAA,GAAA,kBAAA,KAACA,6BAAAA,sBAAD;EACE,eAAe,SAAS,CAAC,SAAS;EAClC,cAAc,WAAW,oBAAoB;EAC7C,cAAY,WAAW,oBAAoB;YAE3C,iBAAA,GAAA,kBAAA,KAACC,mBAAAA,YAAD,EAAsB,UAAY,CAAA;EACb,CAAA;;AAI3B,iBAAiB,cAAc"}
|
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlight/ExpandCodeButton/ExpandIcon.tsx
|
|
6
5
|
function ExpandIcon({ expanded, style, ...others }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
strokeWidth: "2",
|
|
10
|
+
stroke: "currentColor",
|
|
11
|
+
fill: "none",
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
...others,
|
|
15
|
+
children: expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
16
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
17
|
+
stroke: "none",
|
|
18
|
+
d: "M0 0h24v24H0z",
|
|
19
|
+
fill: "none"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 13v-8l-3 3m6 0l-3 -3" }),
|
|
22
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 17l1 0" }),
|
|
23
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 17l1 0" }),
|
|
24
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 17l1 0" }),
|
|
25
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 17l1 0" })
|
|
26
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
28
|
+
stroke: "none",
|
|
29
|
+
d: "M0 0h24v24H0z",
|
|
30
|
+
fill: "none"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 11v8l3 -3m-6 0l3 3" }),
|
|
33
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 7l1 0" }),
|
|
34
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 7l1 0" }),
|
|
35
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 7l1 0" }),
|
|
36
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 7l1 0" })
|
|
37
|
+
] })
|
|
38
|
+
});
|
|
35
39
|
}
|
|
36
40
|
ExpandIcon.displayName = "@mantine/code-highlight/ExpandIcon";
|
|
37
|
-
|
|
41
|
+
//#endregion
|
|
38
42
|
exports.ExpandIcon = ExpandIcon;
|
|
39
|
-
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=ExpandIcon.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandIcon.cjs","sources":["../../../src/CodeHighlight/ExpandCodeButton/ExpandIcon.tsx"],"sourcesContent":["interface ExpandIconProps extends React.ComponentProps<'svg'> {\n expanded: boolean;\n}\n\nexport function ExpandIcon({ expanded, style, ...others }: ExpandIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...others}\n >\n {expanded ? (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 13v-8l-3 3m6 0l-3 -3\" />\n <path d=\"M9 17l1 0\" />\n <path d=\"M14 17l1 0\" />\n <path d=\"M19 17l1 0\" />\n <path d=\"M4 17l1 0\" />\n </>\n ) : (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 11v8l3 -3m-6 0l3 3\" />\n <path d=\"M9 7l1 0\" />\n <path d=\"M14 7l1 0\" />\n <path d=\"M19 7l1 0\" />\n <path d=\"M4 7l1 0\" />\n </>\n )}\n </svg>\n );\n}\n\nExpandIcon.displayName = '@mantine/code-highlight/ExpandIcon';\n"],"
|
|
1
|
+
{"version":3,"file":"ExpandIcon.cjs","names":[],"sources":["../../../src/CodeHighlight/ExpandCodeButton/ExpandIcon.tsx"],"sourcesContent":["interface ExpandIconProps extends React.ComponentProps<'svg'> {\n expanded: boolean;\n}\n\nexport function ExpandIcon({ expanded, style, ...others }: ExpandIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...others}\n >\n {expanded ? (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 13v-8l-3 3m6 0l-3 -3\" />\n <path d=\"M9 17l1 0\" />\n <path d=\"M14 17l1 0\" />\n <path d=\"M19 17l1 0\" />\n <path d=\"M4 17l1 0\" />\n </>\n ) : (\n <>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 11v8l3 -3m-6 0l3 3\" />\n <path d=\"M9 7l1 0\" />\n <path d=\"M14 7l1 0\" />\n <path d=\"M19 7l1 0\" />\n <path d=\"M4 7l1 0\" />\n </>\n )}\n </svg>\n );\n}\n\nExpandIcon.displayName = '@mantine/code-highlight/ExpandIcon';\n"],"mappings":";;;;AAIA,SAAgB,WAAW,EAAE,UAAU,OAAO,GAAG,UAA2B;AAC1E,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,aAAY;EACZ,QAAO;EACP,MAAK;EACL,eAAc;EACd,gBAAe;EACf,GAAI;YAEH,WACC,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA;GACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,QAAO;IAAO,GAAE;IAAgB,MAAK;IAAS,CAAA;GACpD,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,4BAA6B,CAAA;GACrC,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,aAAc,CAAA;GACtB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,cAAe,CAAA;GACvB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,cAAe,CAAA;GACvB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,aAAc,CAAA;GACrB,EAAA,CAAA,GAEH,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA;GACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,QAAO;IAAO,GAAE;IAAgB,MAAK;IAAS,CAAA;GACpD,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,0BAA2B,CAAA;GACnC,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,YAAa,CAAA;GACrB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,aAAc,CAAA;GACtB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,aAAc,CAAA;GACtB,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,GAAE,YAAa,CAAA;GACpB,EAAA,CAAA;EAED,CAAA;;AAIV,WAAW,cAAc"}
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_CodeHighlight_module = require("../CodeHighlight.module.cjs");
|
|
4
|
+
const require_CodeHighlight = require("./CodeHighlight.cjs");
|
|
5
|
+
let _mantine_core = require("@mantine/core");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlight/InlineCodeHighlight.tsx
|
|
8
|
+
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { background, radius }) => ({ inlineCodeHighlight: {
|
|
9
|
+
"--ch-background": background ? (0, _mantine_core.getThemeColor)(background, theme) : void 0,
|
|
10
|
+
"--ch-radius": typeof radius !== "undefined" ? (0, _mantine_core.getRadius)(radius) : void 0
|
|
11
|
+
} }));
|
|
12
|
+
const InlineCodeHighlight = (0, _mantine_core.factory)((_props) => {
|
|
13
|
+
const props = (0, _mantine_core.useProps)("InlineCodeHighlight", null, _props);
|
|
14
|
+
const { classNames, className, style, styles, unstyled, vars, attributes, ref, ...others } = props;
|
|
15
|
+
const getStyles = (0, _mantine_core.useStyles)({
|
|
16
|
+
name: "InlineCodeHighlight",
|
|
17
|
+
classes: require_CodeHighlight_module.default,
|
|
18
|
+
props,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
classNames,
|
|
22
|
+
styles,
|
|
23
|
+
unstyled,
|
|
24
|
+
attributes,
|
|
25
|
+
vars,
|
|
26
|
+
varsResolver,
|
|
27
|
+
rootSelector: "inlineCodeHighlight"
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeHighlight.CodeHighlight, {
|
|
30
|
+
...others,
|
|
31
|
+
ref,
|
|
32
|
+
...getStyles("inlineCodeHighlight"),
|
|
33
|
+
__inline: true
|
|
34
|
+
});
|
|
35
35
|
});
|
|
36
36
|
InlineCodeHighlight.displayName = "@mantine/code-highlight/InlineCodeHighlight";
|
|
37
|
-
InlineCodeHighlight.classes =
|
|
37
|
+
InlineCodeHighlight.classes = require_CodeHighlight_module.default;
|
|
38
38
|
InlineCodeHighlight.varsResolver = varsResolver;
|
|
39
|
-
|
|
39
|
+
//#endregion
|
|
40
40
|
exports.InlineCodeHighlight = InlineCodeHighlight;
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=InlineCodeHighlight.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineCodeHighlight.cjs","sources":["../../src/CodeHighlight/InlineCodeHighlight.tsx"],"sourcesContent":["import {\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport
|
|
1
|
+
{"version":3,"file":"InlineCodeHighlight.cjs","names":["CodeHighlight","classes"],"sources":["../../src/CodeHighlight/InlineCodeHighlight.tsx"],"sourcesContent":["import {\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { CodeHighlight } from './CodeHighlight';\nimport classes from '../CodeHighlight.module.css';\n\nexport type InlineCodeHighlightStylesNames = 'inlineCodeHighlight';\nexport type InlineCodeHighlightCssVariables = {\n inlineCodeHighlight: '--ch-background' | '--ch-radius';\n};\n\nexport interface InlineCodeHighlightProps\n extends BoxProps, StylesApiProps<InlineCodeHighlightFactory>, ElementProps<'code'> {\n /** Code to highlight */\n code: string;\n\n /** Language of the code, used to determine syntax highlighting */\n language?: string;\n\n /** Controls background color of the code. By default, the value depends on color scheme. */\n background?: MantineColor;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius @default 'sm' */\n radius?: MantineRadius;\n\n /** Adds border to the root element @default false */\n withBorder?: boolean;\n}\n\nexport type InlineCodeHighlightFactory = Factory<{\n props: InlineCodeHighlightProps;\n ref: HTMLElement;\n stylesNames: InlineCodeHighlightStylesNames;\n vars: InlineCodeHighlightCssVariables;\n}>;\n\nconst varsResolver = createVarsResolver<InlineCodeHighlightFactory>(\n (theme, { background, radius }) => ({\n inlineCodeHighlight: {\n '--ch-background': background ? getThemeColor(background, theme) : undefined,\n '--ch-radius': typeof radius !== 'undefined' ? getRadius(radius) : undefined,\n },\n })\n);\n\nexport const InlineCodeHighlight = factory<InlineCodeHighlightFactory>((_props) => {\n const props = useProps('InlineCodeHighlight', null, _props);\n const { classNames, className, style, styles, unstyled, vars, attributes, ref, ...others } =\n props;\n\n const getStyles = useStyles<InlineCodeHighlightFactory>({\n name: 'InlineCodeHighlight',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'inlineCodeHighlight',\n });\n\n return (\n <CodeHighlight {...others} ref={ref as any} {...getStyles('inlineCodeHighlight')} __inline />\n );\n});\n\nInlineCodeHighlight.displayName = '@mantine/code-highlight/InlineCodeHighlight';\nInlineCodeHighlight.classes = classes;\nInlineCodeHighlight.varsResolver = varsResolver;\n"],"mappings":";;;;;;;AA+CA,MAAM,gBAAA,GAAA,cAAA,qBACH,OAAO,EAAE,YAAY,cAAc,EAClC,qBAAqB;CACnB,mBAAmB,cAAA,GAAA,cAAA,eAA2B,YAAY,MAAM,GAAG,KAAA;CACnE,eAAe,OAAO,WAAW,eAAA,GAAA,cAAA,WAAwB,OAAO,GAAG,KAAA;CACpE,EACF,EACF;AAED,MAAa,uBAAA,GAAA,cAAA,UAA2D,WAAW;CACjF,MAAM,SAAA,GAAA,cAAA,UAAiB,uBAAuB,MAAM,OAAO;CAC3D,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,UAAU,MAAM,YAAY,KAAK,GAAG,WAChF;CAEF,MAAM,aAAA,GAAA,cAAA,WAAkD;EACtD,MAAM;EACN,SAAA,6BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,eAAD;EAAe,GAAI;EAAa;EAAY,GAAI,UAAU,sBAAsB;EAAE,UAAA;EAAW,CAAA;EAE/F;AAEF,oBAAoB,cAAc;AAClC,oBAAoB,UAAUC,6BAAAA;AAC9B,oBAAoB,eAAe"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlight.module.css
|
|
3
|
+
var CodeHighlight_module_default = {
|
|
4
|
+
"root": "m_5cb1b9c8",
|
|
5
|
+
"codeHighlight": "m_e597c321",
|
|
6
|
+
"inlineCodeHighlight": "m_dfe9c588",
|
|
7
|
+
"pre": "m_2c47c4fd",
|
|
8
|
+
"code": "m_5caae6d3",
|
|
9
|
+
"controls": "m_be7e9c9c",
|
|
10
|
+
"control": "m_d498bab7",
|
|
11
|
+
"controlTooltip": "m_4c3d814c",
|
|
12
|
+
"scrollarea": "m_f744fd40",
|
|
13
|
+
"showCodeButton": "m_c9378bc2",
|
|
14
|
+
"file": "m_5cac2e62",
|
|
15
|
+
"fileIcon": "m_b46cddfb",
|
|
16
|
+
"filesScrollarea": "m_7b14120b",
|
|
17
|
+
"files": "m_38d99e51"
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.default = CodeHighlight_module_default;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=CodeHighlight.module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeHighlight.module.cjs","names":[],"sources":["../src/CodeHighlight.module.css"],"sourcesContent":[".root {\n position: relative;\n}\n\n.codeHighlight {\n position: relative;\n border-radius: var(--ch-radius, 0px);\n overflow: hidden;\n\n &:where([data-with-border]) {\n @mixin where-light {\n border: 1px solid var(--mantine-color-gray-2);\n }\n\n @mixin where-dark {\n border: 1px solid var(--mantine-color-dark-6);\n }\n\n &:where([data-code-color-scheme='dark']) {\n border: 1px solid var(--mantine-color-dark-6);\n }\n\n &:where([data-code-color-scheme='light']) {\n border: 1px solid var(--mantine-color-gray-2);\n }\n }\n\n @mixin where-light {\n --ch-background: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --ch-background: var(--mantine-color-dark-8);\n }\n}\n\n.inlineCodeHighlight {\n border-radius: var(--ch-radius, var(--mantine-radius-sm));\n overflow: hidden;\n background-color: var(--ch-background);\n font-size: 13px;\n padding: 3px 5px;\n\n &:where([data-with-border]) {\n @mixin where-light {\n border: 1px solid var(--mantine-color-gray-2);\n }\n\n @mixin where-dark {\n border: 1px solid var(--mantine-color-dark-6);\n }\n\n &:where([data-code-color-scheme='dark']) {\n border: 1px solid var(--mantine-color-dark-6);\n }\n\n &:where([data-code-color-scheme='light']) {\n border: 1px solid var(--mantine-color-gray-2);\n }\n }\n\n @mixin where-light {\n --ch-background: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --ch-background: var(--mantine-color-dark-8);\n }\n}\n\n.pre {\n --code-line-height: 1.7;\n\n display: block;\n margin: 0;\n\n &[data-with-offset] .code {\n padding-top: 50px;\n }\n}\n\n.code {\n display: block;\n padding: var(--mantine-spacing-xs) var(--mantine-spacing-md);\n background-color: var(--ch-background);\n font-size: 13px;\n line-height: var(--code-line-height, var(--mantine-line-height));\n font-family: var(--mantine-font-family-monospace);\n width: fit-content;\n min-width: 100%;\n\n &:where([data-inline]) {\n display: inline-block;\n padding: 3px 5px;\n background-color: var(--ch-background);\n }\n}\n\n.controls {\n position: absolute;\n top: 8px;\n right: 8px;\n z-index: 1;\n background-color: var(--ch-background);\n border-bottom-left-radius: var(--mantine-radius-md);\n\n &:where([data-with-offset]) {\n top: 12px;\n }\n}\n\n.control {\n color: var(--mantine-color-text);\n opacity: 0.5;\n\n @mixin hover {\n color: var(--mantine-color-bright);\n opacity: 1;\n }\n\n &:where([data-code-color-scheme='dark']) {\n color: var(--mantine-color-dark-0);\n\n @mixin hover {\n color: var(--mantine-color-white);\n }\n }\n\n &:where([data-code-color-scheme='light']) {\n color: var(--mantine-color-black);\n\n @mixin hover {\n color: var(--mantine-color-black);\n }\n }\n\n & :where(svg) {\n width: 18px;\n height: 18px;\n display: block;\n }\n}\n\n.controlTooltip {\n &:where([data-code-color-scheme='light']) {\n background-color: var(--mantine-color-gray-9);\n color: var(--mantine-color-white);\n }\n\n &:where([data-code-color-scheme='dark']) {\n background-color: var(--mantine-color-gray-2);\n color: var(--mantine-color-black);\n }\n}\n\n.scrollarea {\n &[data-collapsed] {\n max-height: var(--ch-max-height, 180px);\n overflow: hidden;\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 80px;\n pointer-events: none;\n background: linear-gradient(\n 0deg,\n var(--ch-background) 0%,\n var(--ch-background) 25%,\n transparent 100%\n );\n z-index: 1;\n }\n }\n}\n\n.showCodeButton {\n position: absolute;\n z-index: 2;\n bottom: 0;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n font-size: var(--mantine-font-size-sm);\n color: var(--mantine-color-anchor);\n width: 100%;\n text-align: center;\n padding-top: var(--mantine-spacing-xs);\n padding-bottom: var(--mantine-spacing-xs);\n white-space: nowrap;\n\n &[data-hidden] {\n display: none;\n }\n\n &:where([data-code-color-scheme='dark']) {\n color: var(--mantine-primary-color-5);\n }\n\n &:where([data-code-color-scheme='light']) {\n color: var(--mantine-primary-color-6);\n }\n}\n\n.file {\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-xs);\n gap: 7px;\n padding: 5px 9px;\n font-family: var(--mantine-font-family-monospace);\n font-weight: var(--mantine-font-weight-bold);\n line-height: 1;\n user-select: none;\n cursor: pointer;\n opacity: 0.8;\n border: 1px solid transparent;\n white-space: nowrap;\n margin: 0;\n border-radius: var(--mantine-radius-default);\n\n &:where([data-active]) {\n opacity: 1;\n }\n\n @mixin where-light {\n border-color: var(--mantine-color-gray-3);\n color: var(--mantine-color-gray-8);\n\n &:where([data-active]) {\n background-color: var(--mantine-color-white);\n color: var(--mantine-color-black);\n }\n }\n\n @mixin where-dark {\n border-color: var(--mantine-color-dark-4);\n color: var(--mantine-color-dark-0);\n\n &:where([data-active]) {\n background-color: var(--mantine-color-dark-5);\n color: var(--mantine-color-white);\n }\n }\n\n &:where([data-color-scheme='light']) {\n border-color: var(--mantine-color-gray-3);\n color: var(--mantine-color-gray-8);\n\n &:where([data-active]) {\n background-color: var(--mantine-color-white);\n color: var(--mantine-color-black);\n }\n }\n\n &:where([data-color-scheme='dark']) {\n border-color: var(--mantine-color-dark-4);\n color: var(--mantine-color-dark-0);\n\n &:where([data-active]) {\n background-color: var(--mantine-color-dark-5);\n color: var(--mantine-color-white);\n }\n }\n\n @mixin hover {\n opacity: 1;\n }\n\n &:where(:only-child) {\n cursor: default;\n }\n}\n\n.fileIcon {\n & :where(svg) {\n display: block;\n }\n}\n\n.filesScrollarea {\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n right: 70px;\n}\n\n.files {\n display: flex;\n padding: 12px 10px;\n padding-bottom: 0;\n gap: var(--mantine-spacing-xs);\n}\n"],"mappings":""}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
highlight: plainTextAdapter.plainTextAdapter.getHighlighter(null)
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_plain_text_adapter = require("./adapters/plain-text-adapter.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlightProvider/CodeHighlightProvider.tsx
|
|
7
|
+
const CodeHighlightContext = (0, react.createContext)({
|
|
8
|
+
adapter: require_plain_text_adapter.plainTextAdapter,
|
|
9
|
+
highlight: require_plain_text_adapter.plainTextAdapter.getHighlighter(null)
|
|
11
10
|
});
|
|
12
|
-
function CodeHighlightAdapterProvider({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
function CodeHighlightAdapterProvider({ adapter, children }) {
|
|
12
|
+
const [ctx, setCtx] = (0, react.useState)(null);
|
|
13
|
+
const highlight = (0, react.useMemo)(() => adapter.getHighlighter(ctx), [adapter, ctx]);
|
|
14
|
+
(0, react.useEffect)(() => {
|
|
15
|
+
if (adapter.loadContext) adapter.loadContext().then(setCtx);
|
|
16
|
+
}, [adapter]);
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeHighlightContext, {
|
|
18
|
+
value: {
|
|
19
|
+
adapter,
|
|
20
|
+
highlight
|
|
21
|
+
},
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
function useHighlight() {
|
|
26
|
-
|
|
27
|
-
return ctx?.highlight || plainTextAdapter.plainTextAdapter.getHighlighter(null);
|
|
26
|
+
return (0, react.use)(CodeHighlightContext)?.highlight || require_plain_text_adapter.plainTextAdapter.getHighlighter(null);
|
|
28
27
|
}
|
|
29
|
-
|
|
28
|
+
//#endregion
|
|
30
29
|
exports.CodeHighlightAdapterProvider = CodeHighlightAdapterProvider;
|
|
31
|
-
exports.CodeHighlightContext = CodeHighlightContext;
|
|
32
30
|
exports.useHighlight = useHighlight;
|
|
33
|
-
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=CodeHighlightProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeHighlightProvider.cjs","sources":["../../src/CodeHighlightProvider/CodeHighlightProvider.tsx"],"sourcesContent":["import { createContext, use, useEffect, useMemo, useState } from 'react';\nimport { plainTextAdapter } from './adapters/plain-text-adapter';\n\ninterface HighlighterInput {\n colorScheme: 'light' | 'dark' | (string & {});\n code: string;\n language?: string;\n}\n\ntype Highlighter = (input: HighlighterInput) => {\n /** Highlighted code (html markup) */\n highlightedCode: string;\n\n /** `true` if the code is represented with html string, `false` for plain text string */\n isHighlighted: boolean;\n\n /** Props to pass down to `<code>` tag */\n codeElementProps?: Record<string, any>;\n};\n\nexport interface CodeHighlightAdapter {\n loadContext?: () => Promise<any>;\n getHighlighter: (ctx: any) => Highlighter;\n}\n\ninterface CodeHighlightProviderContext {\n adapter: CodeHighlightAdapter;\n highlight: Highlighter;\n}\n\nexport const CodeHighlightContext = createContext<CodeHighlightProviderContext>({\n adapter: plainTextAdapter,\n highlight: plainTextAdapter.getHighlighter(null),\n});\n\nexport interface CodeHighlightAdapterProviderProps {\n adapter: CodeHighlightAdapter;\n children: React.ReactNode;\n}\n\nexport function CodeHighlightAdapterProvider({\n adapter,\n children,\n}: CodeHighlightAdapterProviderProps) {\n const [ctx, setCtx] = useState<any>(null);\n const highlight = useMemo(() => adapter.getHighlighter(ctx), [adapter, ctx]);\n\n useEffect(() => {\n if (adapter.loadContext) {\n adapter.loadContext().then(setCtx);\n }\n }, [adapter]);\n\n return <CodeHighlightContext value={{ adapter, highlight }}>{children}</CodeHighlightContext>;\n}\n\nexport function useHighlight() {\n const ctx = use(CodeHighlightContext);\n return ctx?.highlight || plainTextAdapter.getHighlighter(null);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"CodeHighlightProvider.cjs","names":["plainTextAdapter"],"sources":["../../src/CodeHighlightProvider/CodeHighlightProvider.tsx"],"sourcesContent":["import { createContext, use, useEffect, useMemo, useState } from 'react';\nimport { plainTextAdapter } from './adapters/plain-text-adapter';\n\ninterface HighlighterInput {\n colorScheme: 'light' | 'dark' | (string & {});\n code: string;\n language?: string;\n}\n\ntype Highlighter = (input: HighlighterInput) => {\n /** Highlighted code (html markup) */\n highlightedCode: string;\n\n /** `true` if the code is represented with html string, `false` for plain text string */\n isHighlighted: boolean;\n\n /** Props to pass down to `<code>` tag */\n codeElementProps?: Record<string, any>;\n};\n\nexport interface CodeHighlightAdapter {\n loadContext?: () => Promise<any>;\n getHighlighter: (ctx: any) => Highlighter;\n}\n\ninterface CodeHighlightProviderContext {\n adapter: CodeHighlightAdapter;\n highlight: Highlighter;\n}\n\nexport const CodeHighlightContext = createContext<CodeHighlightProviderContext>({\n adapter: plainTextAdapter,\n highlight: plainTextAdapter.getHighlighter(null),\n});\n\nexport interface CodeHighlightAdapterProviderProps {\n adapter: CodeHighlightAdapter;\n children: React.ReactNode;\n}\n\nexport function CodeHighlightAdapterProvider({\n adapter,\n children,\n}: CodeHighlightAdapterProviderProps) {\n const [ctx, setCtx] = useState<any>(null);\n const highlight = useMemo(() => adapter.getHighlighter(ctx), [adapter, ctx]);\n\n useEffect(() => {\n if (adapter.loadContext) {\n adapter.loadContext().then(setCtx);\n }\n }, [adapter]);\n\n return <CodeHighlightContext value={{ adapter, highlight }}>{children}</CodeHighlightContext>;\n}\n\nexport function useHighlight() {\n const ctx = use(CodeHighlightContext);\n return ctx?.highlight || plainTextAdapter.getHighlighter(null);\n}\n"],"mappings":";;;;;;AA8BA,MAAa,wBAAA,GAAA,MAAA,eAAmE;CAC9E,SAASA,2BAAAA;CACT,WAAWA,2BAAAA,iBAAiB,eAAe,KAAK;CACjD,CAAC;AAOF,SAAgB,6BAA6B,EAC3C,SACA,YACoC;CACpC,MAAM,CAAC,KAAK,WAAA,GAAA,MAAA,UAAwB,KAAK;CACzC,MAAM,aAAA,GAAA,MAAA,eAA0B,QAAQ,eAAe,IAAI,EAAE,CAAC,SAAS,IAAI,CAAC;AAE5E,EAAA,GAAA,MAAA,iBAAgB;AACd,MAAI,QAAQ,YACV,SAAQ,aAAa,CAAC,KAAK,OAAO;IAEnC,CAAC,QAAQ,CAAC;AAEb,QAAO,iBAAA,GAAA,kBAAA,KAAC,sBAAD;EAAsB,OAAO;GAAE;GAAS;GAAW;EAAG;EAAgC,CAAA;;AAG/F,SAAgB,eAAe;AAE7B,SAAA,GAAA,MAAA,KADgB,qBAAqB,EACzB,aAAaA,2BAAAA,iBAAiB,eAAe,KAAK"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlightProvider/adapters/highlight-js-adapter.ts
|
|
3
2
|
function createHighlightJsAdapter(hljs) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
};
|
|
3
|
+
return { getHighlighter: () => ({ code, language }) => {
|
|
4
|
+
const lang = hljs.getLanguage(language) ? language : "plaintext";
|
|
5
|
+
return {
|
|
6
|
+
highlightedCode: hljs.highlight(code.trim(), { language: lang }).value,
|
|
7
|
+
isHighlighted: true,
|
|
8
|
+
codeElementProps: { className: `hljs ${lang}` }
|
|
9
|
+
};
|
|
10
|
+
} };
|
|
14
11
|
}
|
|
15
|
-
|
|
12
|
+
//#endregion
|
|
16
13
|
exports.createHighlightJsAdapter = createHighlightJsAdapter;
|
|
17
|
-
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=highlight-js-adapter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight-js-adapter.cjs","sources":["../../../src/CodeHighlightProvider/adapters/highlight-js-adapter.ts"],"sourcesContent":["import type { CodeHighlightAdapter } from '../CodeHighlightProvider';\n\nexport function createHighlightJsAdapter(hljs: any): CodeHighlightAdapter {\n return {\n getHighlighter:\n () =>\n ({ code, language }) => {\n const lang = hljs.getLanguage(language) ? language : 'plaintext';\n return {\n highlightedCode: hljs.highlight(code.trim(), { language: lang }).value,\n isHighlighted: true,\n codeElementProps: { className: `hljs ${lang}` },\n };\n },\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"highlight-js-adapter.cjs","names":[],"sources":["../../../src/CodeHighlightProvider/adapters/highlight-js-adapter.ts"],"sourcesContent":["import type { CodeHighlightAdapter } from '../CodeHighlightProvider';\n\nexport function createHighlightJsAdapter(hljs: any): CodeHighlightAdapter {\n return {\n getHighlighter:\n () =>\n ({ code, language }) => {\n const lang = hljs.getLanguage(language) ? language : 'plaintext';\n return {\n highlightedCode: hljs.highlight(code.trim(), { language: lang }).value,\n isHighlighted: true,\n codeElementProps: { className: `hljs ${lang}` },\n };\n },\n };\n}\n"],"mappings":";AAEA,SAAgB,yBAAyB,MAAiC;AACxE,QAAO,EACL,uBAEG,EAAE,MAAM,eAAe;EACtB,MAAM,OAAO,KAAK,YAAY,SAAS,GAAG,WAAW;AACrD,SAAO;GACL,iBAAiB,KAAK,UAAU,KAAK,MAAM,EAAE,EAAE,UAAU,MAAM,CAAC,CAAC;GACjE,eAAe;GACf,kBAAkB,EAAE,WAAW,QAAQ,QAAQ;GAChD;IAEN"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
1
|
+
//#region packages/@mantine/code-highlight/src/CodeHighlightProvider/adapters/plain-text-adapter.ts
|
|
2
|
+
const plainTextAdapter = { getHighlighter: () => ({ code }) => ({
|
|
3
|
+
highlightedCode: code,
|
|
4
|
+
isHighlighted: false
|
|
5
|
+
}) };
|
|
6
|
+
//#endregion
|
|
7
7
|
exports.plainTextAdapter = plainTextAdapter;
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=plain-text-adapter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain-text-adapter.cjs","sources":["../../../src/CodeHighlightProvider/adapters/plain-text-adapter.ts"],"sourcesContent":["import type { CodeHighlightAdapter } from '../CodeHighlightProvider';\n\nexport const plainTextAdapter: CodeHighlightAdapter = {\n getHighlighter:\n () =>\n ({ code }) => ({ highlightedCode: code, isHighlighted: false }),\n};\n"],"
|
|
1
|
+
{"version":3,"file":"plain-text-adapter.cjs","names":[],"sources":["../../../src/CodeHighlightProvider/adapters/plain-text-adapter.ts"],"sourcesContent":["import type { CodeHighlightAdapter } from '../CodeHighlightProvider';\n\nexport const plainTextAdapter: CodeHighlightAdapter = {\n getHighlighter:\n () =>\n ({ code }) => ({ highlightedCode: code, isHighlighted: false }),\n};\n"],"mappings":";AAEA,MAAa,mBAAyC,EACpD,uBAEG,EAAE,YAAY;CAAE,iBAAiB;CAAM,eAAe;CAAO,GACjE"}
|