@orion-ds/react 5.0.0 → 5.1.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 +48 -4
- package/dist/client.cjs +1 -1
- package/dist/client.mjs +143 -139
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/Button.module.css.cjs +1 -1
- package/dist/components/Button/Button.module.css.mjs +28 -28
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.mjs +105 -86
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.d.ts +2 -3
- package/dist/components/Chart/Chart.d.ts.map +1 -1
- package/dist/components/Chart/Chart.mjs +124 -71
- package/dist/components/Chat/components/ChatMarkdown.cjs +1 -1
- package/dist/components/Chat/components/ChatMarkdown.d.ts.map +1 -1
- package/dist/components/Chat/components/ChatMarkdown.mjs +32 -17
- package/dist/components/CodeEditor/CodeEditor.cjs +6 -6
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.mjs +118 -99
- package/dist/components/CollapsibleFolder/CollapsibleFolder.cjs +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.d.ts.map +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.mjs +123 -105
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +70 -52
- package/dist/components/MissingDependencyError.cjs +1 -0
- package/dist/components/MissingDependencyError.d.ts +5 -0
- package/dist/components/MissingDependencyError.d.ts.map +1 -0
- package/dist/components/MissingDependencyError.mjs +140 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +143 -139
- package/dist/styles.css +111 -3
- package/dist/theme.css +110 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/optionalDeps.cjs +1 -0
- package/dist/utils/optionalDeps.d.ts +63 -0
- package/dist/utils/optionalDeps.d.ts.map +1 -0
- package/dist/utils/optionalDeps.mjs +55 -0
- package/package.json +2 -1
|
@@ -1,103 +1,156 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as y, createContext as K } from "react";
|
|
3
|
+
import { useResolvedChartColors as R } from "./useResolvedChartColors.mjs";
|
|
4
|
+
import { MissingDependencyError as C } from "../MissingDependencyError.mjs";
|
|
5
5
|
import o from "./Chart.module.css.mjs";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
let b, L, x, p = null;
|
|
7
|
+
try {
|
|
8
|
+
const t = require("recharts");
|
|
9
|
+
b = t.ResponsiveContainer, L = t.Tooltip, x = t.Legend;
|
|
10
|
+
} catch (t) {
|
|
11
|
+
p = t instanceof Error ? t : new Error("recharts not found");
|
|
12
|
+
}
|
|
13
|
+
const u = K({}), U = ({
|
|
14
|
+
config: t,
|
|
15
|
+
children: n,
|
|
16
|
+
className: a,
|
|
17
|
+
style: r,
|
|
18
|
+
...s
|
|
12
19
|
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
if (p)
|
|
21
|
+
return /* @__PURE__ */ e(
|
|
22
|
+
C,
|
|
23
|
+
{
|
|
24
|
+
available: !1,
|
|
25
|
+
componentName: "Chart",
|
|
26
|
+
depName: "recharts",
|
|
27
|
+
installCommand: "npm install recharts",
|
|
28
|
+
pnpmCommand: "pnpm add recharts",
|
|
29
|
+
docsUrl: "https://docs.orion-ds.dev/components/chart"
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
const { resolvedConfig: l, resolvedColorVars: i } = R(t), c = [o.container, a].filter(Boolean).join(" ");
|
|
33
|
+
return /* @__PURE__ */ e(u.Provider, { value: l, children: /* @__PURE__ */ e(
|
|
15
34
|
"div",
|
|
16
35
|
{
|
|
17
36
|
role: "figure",
|
|
18
37
|
className: c,
|
|
19
|
-
style: { ...
|
|
20
|
-
...
|
|
21
|
-
children: /* @__PURE__ */
|
|
38
|
+
style: { ...i, ...r },
|
|
39
|
+
...s,
|
|
40
|
+
children: /* @__PURE__ */ e(b, { width: "100%", height: "100%", children: n })
|
|
22
41
|
}
|
|
23
42
|
) });
|
|
24
43
|
};
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
active:
|
|
28
|
-
payload:
|
|
29
|
-
label:
|
|
30
|
-
indicator:
|
|
31
|
-
hideLabel:
|
|
32
|
-
hideIndicator:
|
|
33
|
-
labelFormatter:
|
|
44
|
+
U.displayName = "ChartContainer";
|
|
45
|
+
const B = ({
|
|
46
|
+
active: t,
|
|
47
|
+
payload: n,
|
|
48
|
+
label: a,
|
|
49
|
+
indicator: r = "dot",
|
|
50
|
+
hideLabel: s = !1,
|
|
51
|
+
hideIndicator: l = !1,
|
|
52
|
+
labelFormatter: i,
|
|
34
53
|
formatter: c,
|
|
35
|
-
className:
|
|
54
|
+
className: f
|
|
36
55
|
}) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
if (p)
|
|
57
|
+
return /* @__PURE__ */ e(
|
|
58
|
+
C,
|
|
59
|
+
{
|
|
60
|
+
available: !1,
|
|
61
|
+
componentName: "Chart",
|
|
62
|
+
depName: "recharts",
|
|
63
|
+
installCommand: "npm install recharts",
|
|
64
|
+
pnpmCommand: "pnpm add recharts",
|
|
65
|
+
docsUrl: "https://docs.orion-ds.dev/components/chart"
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
const j = y(u);
|
|
69
|
+
if (!t || !n?.length) return null;
|
|
70
|
+
const I = [o.tooltip, f].filter(Boolean).join(" "), v = i ? i(String(a)) : a, T = {
|
|
40
71
|
dot: o.tooltipDot,
|
|
41
72
|
line: o.tooltipLine,
|
|
42
73
|
dashed: o.tooltipDashed
|
|
43
|
-
}[
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
!
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
const
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
!
|
|
74
|
+
}[r];
|
|
75
|
+
return /* @__PURE__ */ h("div", { className: I, children: [
|
|
76
|
+
!s && v && /* @__PURE__ */ e("div", { className: o.tooltipLabel, children: v }),
|
|
77
|
+
/* @__PURE__ */ e("div", { className: o.tooltipItems, children: n.map((d) => {
|
|
78
|
+
const m = String(d.dataKey || d.name), g = j[m], D = g?.label || m, E = c ? c(d.value, m) : String(d.value), N = d.color || g?.color;
|
|
79
|
+
return /* @__PURE__ */ h("div", { className: o.tooltipItem, children: [
|
|
80
|
+
!l && /* @__PURE__ */ e(
|
|
50
81
|
"span",
|
|
51
82
|
{
|
|
52
|
-
className:
|
|
53
|
-
style: { backgroundColor:
|
|
83
|
+
className: T,
|
|
84
|
+
style: { backgroundColor: N, borderColor: N }
|
|
54
85
|
}
|
|
55
86
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
] },
|
|
87
|
+
/* @__PURE__ */ e("span", { className: o.tooltipName, children: D }),
|
|
88
|
+
/* @__PURE__ */ e("span", { className: o.tooltipValue, children: E })
|
|
89
|
+
] }, m);
|
|
59
90
|
}) })
|
|
60
91
|
] });
|
|
61
92
|
};
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
payload:
|
|
65
|
-
className:
|
|
93
|
+
B.displayName = "ChartTooltipContent";
|
|
94
|
+
const G = ({
|
|
95
|
+
payload: t,
|
|
96
|
+
className: n
|
|
66
97
|
}) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
if (p)
|
|
99
|
+
return /* @__PURE__ */ e(
|
|
100
|
+
C,
|
|
101
|
+
{
|
|
102
|
+
available: !1,
|
|
103
|
+
componentName: "Chart",
|
|
104
|
+
depName: "recharts",
|
|
105
|
+
installCommand: "npm install recharts",
|
|
106
|
+
pnpmCommand: "pnpm add recharts",
|
|
107
|
+
docsUrl: "https://docs.orion-ds.dev/components/chart"
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
const a = y(u);
|
|
111
|
+
if (!t?.length) return null;
|
|
112
|
+
const r = [o.legend, n].filter(Boolean).join(" ");
|
|
113
|
+
return /* @__PURE__ */ e("div", { className: r, children: t.map((s) => {
|
|
114
|
+
const l = s.dataKey || s.value, i = a[l], c = i?.label || l, f = s.color || i?.color;
|
|
115
|
+
return /* @__PURE__ */ h("div", { className: o.legendItem, children: [
|
|
116
|
+
/* @__PURE__ */ e(
|
|
74
117
|
"span",
|
|
75
118
|
{
|
|
76
119
|
className: o.legendDot,
|
|
77
|
-
style: { backgroundColor:
|
|
120
|
+
style: { backgroundColor: f }
|
|
78
121
|
}
|
|
79
122
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
] },
|
|
123
|
+
/* @__PURE__ */ e("span", { children: c })
|
|
124
|
+
] }, l);
|
|
82
125
|
}) });
|
|
83
126
|
};
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
id:
|
|
87
|
-
color:
|
|
88
|
-
startOpacity:
|
|
89
|
-
endOpacity:
|
|
90
|
-
}) => /* @__PURE__ */
|
|
91
|
-
|
|
92
|
-
|
|
127
|
+
G.displayName = "ChartLegendContent";
|
|
128
|
+
const S = ({
|
|
129
|
+
id: t,
|
|
130
|
+
color: n,
|
|
131
|
+
startOpacity: a = 0.4,
|
|
132
|
+
endOpacity: r = 0.05
|
|
133
|
+
}) => p ? /* @__PURE__ */ e(
|
|
134
|
+
C,
|
|
135
|
+
{
|
|
136
|
+
available: !1,
|
|
137
|
+
componentName: "Chart",
|
|
138
|
+
depName: "recharts",
|
|
139
|
+
installCommand: "npm install recharts",
|
|
140
|
+
pnpmCommand: "pnpm add recharts",
|
|
141
|
+
docsUrl: "https://docs.orion-ds.dev/components/chart"
|
|
142
|
+
}
|
|
143
|
+
) : /* @__PURE__ */ h("linearGradient", { id: t, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
144
|
+
/* @__PURE__ */ e("stop", { offset: "5%", stopColor: n, stopOpacity: a }),
|
|
145
|
+
/* @__PURE__ */ e("stop", { offset: "95%", stopColor: n, stopOpacity: r })
|
|
93
146
|
] });
|
|
94
|
-
|
|
95
|
-
const
|
|
147
|
+
S.displayName = "ChartGradient";
|
|
148
|
+
const M = L || null, P = x || null;
|
|
96
149
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
U as ChartContainer,
|
|
151
|
+
S as ChartGradient,
|
|
152
|
+
P as ChartLegend,
|
|
153
|
+
G as ChartLegendContent,
|
|
154
|
+
M as ChartTooltip,
|
|
155
|
+
B as ChartTooltipContent
|
|
103
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("./ChatCodeBlock.cjs"),p=require("../../MissingDependencyError.cjs"),g=require("../Chat.module.css.cjs");let s,c,i=null;try{s=require("react-markdown"),c=require("remark-gfm")}catch(a){i=a instanceof Error?a:new Error("react-markdown or remark-gfm not found")}const d=({content:a,className:m,...l})=>i?r.jsx(p.MissingDependencyError,{available:!1,componentName:"Chat",depName:["react-markdown","remark-gfm"],installCommand:"npm install react-markdown remark-gfm",pnpmCommand:"pnpm add react-markdown remark-gfm",docsUrl:"https://docs.orion-ds.dev/components/chat"}):r.jsx("div",{className:[g.default.markdown,m].filter(Boolean).join(" "),...l,children:r.jsx(s,{remarkPlugins:[c],components:{code({className:e,children:t,...o}){const n=/language-(\w+)/.exec(e||"");if(!n)return r.jsx("code",{className:e,...o,children:t});const u=String(t).replace(/\n$/,"");return r.jsx(k.ChatCodeBlock,{code:u,language:n[1]})},pre({children:e}){return r.jsx(r.Fragment,{children:e})},a({href:e,children:t,...o}){const n=e?.startsWith("http");return r.jsx("a",{href:e,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,...o,children:t})}},children:a})});d.displayName="ChatMarkdown";exports.ChatMarkdown=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMarkdown.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMarkdown.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAiBvD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuEpD,CAAC"}
|
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { ChatCodeBlock as p } from "./ChatCodeBlock.mjs";
|
|
1
|
+
import { jsx as e, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { ChatCodeBlock as k } from "./ChatCodeBlock.mjs";
|
|
3
|
+
import { MissingDependencyError as f } from "../../MissingDependencyError.mjs";
|
|
5
4
|
import g from "../Chat.module.css.mjs";
|
|
6
|
-
|
|
5
|
+
let m, c, i = null;
|
|
6
|
+
try {
|
|
7
|
+
m = require("react-markdown"), c = require("remark-gfm");
|
|
8
|
+
} catch (a) {
|
|
9
|
+
i = a instanceof Error ? a : new Error("react-markdown or remark-gfm not found");
|
|
10
|
+
}
|
|
11
|
+
const u = ({
|
|
7
12
|
content: a,
|
|
8
|
-
className:
|
|
9
|
-
...
|
|
10
|
-
}) => /* @__PURE__ */ e(
|
|
13
|
+
className: s,
|
|
14
|
+
...l
|
|
15
|
+
}) => i ? /* @__PURE__ */ e(
|
|
16
|
+
f,
|
|
17
|
+
{
|
|
18
|
+
available: !1,
|
|
19
|
+
componentName: "Chat",
|
|
20
|
+
depName: ["react-markdown", "remark-gfm"],
|
|
21
|
+
installCommand: "npm install react-markdown remark-gfm",
|
|
22
|
+
pnpmCommand: "pnpm add react-markdown remark-gfm",
|
|
23
|
+
docsUrl: "https://docs.orion-ds.dev/components/chat"
|
|
24
|
+
}
|
|
25
|
+
) : /* @__PURE__ */ e(
|
|
11
26
|
"div",
|
|
12
27
|
{
|
|
13
|
-
className: [g.markdown,
|
|
14
|
-
...
|
|
28
|
+
className: [g.markdown, s].filter(Boolean).join(" "),
|
|
29
|
+
...l,
|
|
15
30
|
children: /* @__PURE__ */ e(
|
|
16
|
-
|
|
31
|
+
m,
|
|
17
32
|
{
|
|
18
|
-
remarkPlugins: [
|
|
33
|
+
remarkPlugins: [c],
|
|
19
34
|
components: {
|
|
20
35
|
// Custom code block rendering
|
|
21
36
|
code({ className: r, children: o, ...t }) {
|
|
22
37
|
const n = /language-(\w+)/.exec(r || "");
|
|
23
38
|
if (!n)
|
|
24
39
|
return /* @__PURE__ */ e("code", { className: r, ...t, children: o });
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */ e(
|
|
40
|
+
const d = String(o).replace(/\n$/, "");
|
|
41
|
+
return /* @__PURE__ */ e(k, { code: d, language: n[1] });
|
|
27
42
|
},
|
|
28
43
|
// Custom pre rendering (remove wrapper for code blocks)
|
|
29
44
|
pre({ children: r }) {
|
|
30
|
-
return /* @__PURE__ */ e(
|
|
45
|
+
return /* @__PURE__ */ e(p, { children: r });
|
|
31
46
|
},
|
|
32
47
|
// Custom link rendering (open in new tab)
|
|
33
48
|
a({ href: r, children: o, ...t }) {
|
|
@@ -49,7 +64,7 @@ const f = ({
|
|
|
49
64
|
)
|
|
50
65
|
}
|
|
51
66
|
);
|
|
52
|
-
|
|
67
|
+
u.displayName = "ChatMarkdown";
|
|
53
68
|
export {
|
|
54
|
-
|
|
69
|
+
u as ChatMarkdown
|
|
55
70
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`).length,m);i.useEffect(()=>{if(
|
|
3
|
-
`),f=Math.max(a.length,m),b=[];for(let
|
|
4
|
-
`).length-1)},
|
|
5
|
-
`,
|
|
6
|
-
`})}),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),W=require("../MissingDependencyError.cjs"),l=require("./CodeEditor.module.css.cjs"),I=require("../../contexts/ThemeContext.cjs");let D,$,A,B=null;try{D=require("react-syntax-highlighter").Prism;const d=require("react-syntax-highlighter/dist/esm/styles/prism");$=d.oneDark,A=d.oneLight}catch(r){B=r instanceof Error?r:new Error("react-syntax-highlighter not found")}try{const r=require("refractor/all");r.default&&r.default.registered&&r.default.registered("markdown")&&!r.default.languages.markdown?.["quoted-string"]&&r.default.languages.insertBefore("markdown","bold",{"quoted-string":{pattern:/"(?:\\.|[^"\\])*"/,greedy:!0,alias:"string"}})}catch{}const K=i.forwardRef(({value:r="",onChange:d,language:j,readOnly:C=!1,showLineNumbers:k=!0,placeholder:E,minRows:m=10,className:F,"aria-label":S,...T},O)=>{if(B)return n.jsx(W.MissingDependencyError,{available:!1,componentName:"CodeEditor",depName:"react-syntax-highlighter",installCommand:"npm install react-syntax-highlighter",pnpmCommand:"pnpm add react-syntax-highlighter",docsUrl:"https://docs.orion-ds.dev/components/code-editor"});const p=i.useRef(null),x=i.useRef(null),v=i.useRef(null),R=i.useRef(null),P=i.useRef(null),h=i.useRef(null),g=O||P,[y,U]=i.useState(0),[u,V]=i.useState([]);let q="dark";try{q=I.useThemeContext().theme}catch{}const _=q==="light"?A:$,L=Math.max(r.split(`
|
|
2
|
+
`).length,m);i.useEffect(()=>{if(h.current&&g.current){const{start:e,end:t}=h.current;g.current.setSelectionRange(e,t),h.current=null}}),i.useEffect(()=>{const e=v.current,t=R.current;if(!e||!t)return;const s=()=>{const c=t.clientWidth;if(c<=0)return;e.style.width=`${c}px`;const a=r.split(`
|
|
3
|
+
`),f=Math.max(a.length,m),b=[];for(let w=0;w<f;w++){const z=a[w]??"";e.textContent=z||" ",b.push(e.scrollHeight)}V(b)};s();const o=new ResizeObserver(s);return o.observe(t),()=>o.disconnect()},[r,m]),i.useEffect(()=>{const e=s=>{const o=s.target;p.current&&(p.current.scrollTop=o.scrollTop),x.current&&(x.current.scrollTop=o.scrollTop,x.current.scrollLeft=o.scrollLeft)},t=g?.current;if(t)return t.addEventListener("scroll",e),()=>{t.removeEventListener("scroll",e)}},[g]);const N=e=>{const t=e.value.substring(0,e.selectionStart);U(t.split(`
|
|
4
|
+
`).length-1)},M=e=>{if(e.key==="Tab"){e.preventDefault();const t=e.currentTarget,s=t.selectionStart,o=t.selectionEnd,c=" ";if(s===o){const a=r.substring(0,s)+c+r.substring(o);h.current={start:s+c.length,end:s+c.length},d?.(a)}else if(e.shiftKey){const a=r.lastIndexOf(`
|
|
5
|
+
`,s-1)+1,f=r.substring(a).match(/^ {1,2}/)?.[0]??"";if(f.length>0){const b=r.substring(0,a)+r.substring(a+f.length);h.current={start:Math.max(a,s-f.length),end:Math.max(a,o-f.length)},d?.(b)}}else{const a=r.substring(0,s)+c+r.substring(o);h.current={start:s+c.length,end:s+c.length},d?.(a)}}},H=[l.default.wrapper,F].filter(Boolean).join(" ");return j?n.jsxs("div",{className:H,style:{minHeight:`calc(${m} * 1.6em + 2 * var(--spacing-4))`},children:[n.jsx("div",{ref:v,className:l.default.lineMirror,"aria-hidden":"true"}),k&&n.jsx("div",{ref:p,className:l.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:L}).map((e,t)=>n.jsx("div",{className:l.default.lineNumber,style:u[t]!==void 0?{height:`${u[t]}px`}:void 0,children:t+1},t))}),n.jsxs("div",{ref:R,className:l.default.editorArea,children:[n.jsx("div",{className:l.default.lineHighlight,style:{top:u.length>0?`calc(var(--spacing-4) + ${u.slice(0,y).reduce((e,t)=>e+t,0)}px)`:`calc(var(--spacing-4) + ${(y*1.6).toFixed(2)}em)`,...u[y]!==void 0?{height:`${u[y]}px`}:{}},"aria-hidden":"true"}),n.jsx("div",{ref:x,className:l.default.highlightLayer,"aria-hidden":"true",children:n.jsx(D,{language:j,style:_,customStyle:{margin:0,padding:0,background:"transparent",fontSize:"inherit",lineHeight:"inherit",fontFamily:"inherit",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"visible"},codeTagProps:{style:{fontFamily:"inherit",background:"transparent",color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:r+`
|
|
6
|
+
`})}),n.jsx("textarea",{ref:g,className:l.default.textareaOverlay,value:r,onChange:e=>d?.(e.target.value),onKeyDown:M,onKeyUp:e=>N(e.currentTarget),onMouseUp:e=>N(e.currentTarget),onClick:e=>N(e.currentTarget),placeholder:E,readOnly:C,"aria-label":S||"Code editor",spellCheck:"false",...T})]})]}):n.jsxs("div",{className:H,style:{minHeight:`calc(${m} * 1.6em + 2 * var(--spacing-4))`},children:[n.jsx("div",{ref:v,className:l.default.lineMirror,"aria-hidden":"true"}),k&&n.jsx("div",{ref:p,className:l.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:L}).map((e,t)=>n.jsx("div",{className:l.default.lineNumber,style:u[t]!==void 0?{height:`${u[t]}px`}:void 0,children:t+1},t))}),n.jsx("textarea",{ref:g,className:l.default.textarea,value:r,onChange:e=>d?.(e.target.value),onKeyDown:M,placeholder:E,readOnly:C,"aria-label":S||"Code editor",spellCheck:"false",...T})]})});K.displayName="CodeEditor";exports.CodeEditor=K;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA4C1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,6FA8UtB,CAAC"}
|