@orion-ds/react 5.4.0 → 5.5.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),
|
|
3
|
-
`).length,
|
|
4
|
-
`).length-1)},
|
|
5
|
-
`,
|
|
6
|
-
`})}),
|
|
1
|
+
"use strict";var Z=Object.create;var F=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var se=(r,n,d,x)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of te(n))!ne.call(r,h)&&h!==d&&F(r,h,{get:()=>n[h],enumerable:!(x=ee(n,h))||x.enumerable});return r};var O=(r,n,d)=>(d=r!=null?Z(re(r)):{},se(n||!r||!r.__esModule?F(d,"default",{value:r,enumerable:!0}):d,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),ie=require("../MissingDependencyError.cjs"),ae=require("../../utils/optionalDeps.cjs"),o=require("./CodeEditor.module.css.cjs"),ce=require("../../contexts/ThemeContext.cjs");let k,N,S;Promise.all([import("react-syntax-highlighter"),import("react-syntax-highlighter/dist/esm/styles/prism")]).then(([r,n])=>{k=r.Prism,N=n.oneDark,S=n.oneLight}).catch(()=>{});const V=i.forwardRef(({value:r="",onChange:n,language:d,readOnly:x=!1,showLineNumbers:h=!0,placeholder:D,minRows:y=10,className:_,"aria-label":M,...H},z)=>{const[$,T]=i.useState(),[I,U]=i.useState(!0),[W,E]=i.useState(!1),[b,G]=i.useState(0),[f,J]=i.useState([]),v=i.useRef(null),j=i.useRef(null),w=i.useRef(null),q=i.useRef(null),Q=i.useRef(null),g=i.useRef(null),m=z||Q;i.useEffect(()=>{(async()=>{try{const t=ae.checkComponent("CodeEditor");t instanceof Promise?T(await t):T(t)}catch{T(void 0)}finally{U(!1)}})()},[]),i.useEffect(()=>{if(k&&N&&S){E(!0);return}const e=setTimeout(()=>{E(!0)},0);return()=>clearTimeout(e)},[]),i.useEffect(()=>{if(g.current&&m.current){const{start:e,end:t}=g.current;m.current.setSelectionRange(e,t),g.current=null}}),i.useEffect(()=>{const e=w.current,t=q.current;if(!e||!t)return;const a=()=>{const u=t.clientWidth;if(u<=0)return;e.style.width=`${u}px`;const c=r.split(`
|
|
2
|
+
`),p=Math.max(c.length,y),C=[];for(let R=0;R<p;R++){const Y=c[R]??"";e.textContent=Y||" ",C.push(e.scrollHeight)}J(C)};a();const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[r,y]),i.useEffect(()=>{const e=a=>{const l=a.target;v.current&&(v.current.scrollTop=l.scrollTop),j.current&&(j.current.scrollTop=l.scrollTop,j.current.scrollLeft=l.scrollLeft)},t=m?.current;if(t)return t.addEventListener("scroll",e),()=>{t.removeEventListener("scroll",e)}},[m]);let A="dark";try{A=ce.useThemeContext().theme}catch{}const X=A==="light"?S:N,K=Math.max(r.split(`
|
|
3
|
+
`).length,y);if($)return s.jsx(ie.MissingDependencyError,{...$});if(I)return s.jsx("div",{children:"Loading code editor..."});if(d&&!W)return s.jsx("div",{children:"Loading code editor..."});const L=e=>{const t=e.value.substring(0,e.selectionStart);G(t.split(`
|
|
4
|
+
`).length-1)},P=e=>{if(e.key==="Tab"){e.preventDefault();const t=e.currentTarget,a=t.selectionStart,l=t.selectionEnd,u=" ";if(a===l){const c=r.substring(0,a)+u+r.substring(l);g.current={start:a+u.length,end:a+u.length},n?.(c)}else if(e.shiftKey){const c=r.lastIndexOf(`
|
|
5
|
+
`,a-1)+1,p=r.substring(c).match(/^ {1,2}/)?.[0]??"";if(p.length>0){const C=r.substring(0,c)+r.substring(c+p.length);g.current={start:Math.max(c,a-p.length),end:Math.max(c,l-p.length)},n?.(C)}}else{const c=r.substring(0,a)+u+r.substring(l);g.current={start:a+u.length,end:a+u.length},n?.(c)}}},B=[o.default.wrapper,_].filter(Boolean).join(" ");return d?s.jsxs("div",{className:B,style:{minHeight:`calc(${y} * 1.6em + 2 * var(--spacing-4))`},children:[s.jsx("div",{ref:w,className:o.default.lineMirror,"aria-hidden":"true"}),h&&s.jsx("div",{ref:v,className:o.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:K}).map((e,t)=>s.jsx("div",{className:o.default.lineNumber,style:f[t]!==void 0?{height:`${f[t]}px`}:void 0,children:t+1},t))}),s.jsxs("div",{ref:q,className:o.default.editorArea,children:[s.jsx("div",{className:o.default.lineHighlight,style:{top:f.length>0?`calc(var(--spacing-4) + ${f.slice(0,b).reduce((e,t)=>e+t,0)}px)`:`calc(var(--spacing-4) + ${(b*1.6).toFixed(2)}em)`,...f[b]!==void 0?{height:`${f[b]}px`}:{}},"aria-hidden":"true"}),s.jsx("div",{ref:j,className:o.default.highlightLayer,"aria-hidden":"true",children:s.jsx(k,{language:d,style:X,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
|
+
`})}),s.jsx("textarea",{ref:m,className:o.default.textareaOverlay,value:r,onChange:e=>n?.(e.target.value),onKeyDown:P,onKeyUp:e=>L(e.currentTarget),onMouseUp:e=>L(e.currentTarget),onClick:e=>L(e.currentTarget),placeholder:D,readOnly:x,"aria-label":M||"Code editor",spellCheck:"false",...H})]})]}):s.jsxs("div",{className:B,style:{minHeight:`calc(${y} * 1.6em + 2 * var(--spacing-4))`},children:[s.jsx("div",{ref:w,className:o.default.lineMirror,"aria-hidden":"true"}),h&&s.jsx("div",{ref:v,className:o.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:K}).map((e,t)=>s.jsx("div",{className:o.default.lineNumber,style:f[t]!==void 0?{height:`${f[t]}px`}:void 0,children:t+1},t))}),s.jsx("textarea",{ref:m,className:o.default.textarea,value:r,onChange:e=>n?.(e.target.value),onKeyDown:P,placeholder:D,readOnly:x,"aria-label":M||"Code editor",spellCheck:"false",...H})]})});V.displayName="CodeEditor";exports.CodeEditor=V;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AA+B1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,6FA4XtB,CAAC"}
|
|
@@ -1,157 +1,156 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { MissingDependencyError as
|
|
4
|
-
import { checkComponent as
|
|
5
|
-
import
|
|
6
|
-
import { useThemeContext as
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const r = require("refractor/all");
|
|
18
|
-
r.default && r.default.registered && r.default.registered("markdown") && !r.default.languages.markdown?.["quoted-string"] && r.default.languages.insertBefore("markdown", "bold", {
|
|
19
|
-
"quoted-string": {
|
|
20
|
-
pattern: /"(?:\\.|[^"\\])*"/,
|
|
21
|
-
greedy: !0,
|
|
22
|
-
alias: "string"
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
const te = X(
|
|
1
|
+
import { jsx as i, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Z, useState as p, useRef as m, useEffect as x } from "react";
|
|
3
|
+
import { MissingDependencyError as ee } from "../MissingDependencyError.mjs";
|
|
4
|
+
import { checkComponent as te } from "../../utils/optionalDeps.mjs";
|
|
5
|
+
import o from "./CodeEditor.module.css.mjs";
|
|
6
|
+
import { useThemeContext as re } from "../../contexts/ThemeContext.mjs";
|
|
7
|
+
let N, w, C;
|
|
8
|
+
Promise.all([
|
|
9
|
+
import("react-syntax-highlighter"),
|
|
10
|
+
import("react-syntax-highlighter/dist/esm/styles/prism")
|
|
11
|
+
]).then(([r, l]) => {
|
|
12
|
+
N = r.Prism, w = l.oneDark, C = l.oneLight;
|
|
13
|
+
}).catch(() => {
|
|
14
|
+
});
|
|
15
|
+
const ne = Z(
|
|
28
16
|
({
|
|
29
17
|
value: r = "",
|
|
30
18
|
onChange: l,
|
|
31
|
-
language:
|
|
32
|
-
readOnly:
|
|
33
|
-
showLineNumbers:
|
|
34
|
-
placeholder:
|
|
35
|
-
minRows:
|
|
36
|
-
className:
|
|
37
|
-
"aria-label":
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
const [
|
|
41
|
-
|
|
19
|
+
language: T,
|
|
20
|
+
readOnly: $ = !1,
|
|
21
|
+
showLineNumbers: A = !0,
|
|
22
|
+
placeholder: R,
|
|
23
|
+
minRows: g = 10,
|
|
24
|
+
className: O,
|
|
25
|
+
"aria-label": K,
|
|
26
|
+
...B
|
|
27
|
+
}, U) => {
|
|
28
|
+
const [P, L] = p(), [W, _] = p(!0), [q, S] = p(!1), [y, G] = p(0), [d, J] = p([]), v = m(null), b = m(null), D = m(null), j = m(null), Q = m(null), h = m(null), u = U || Q;
|
|
29
|
+
x(() => {
|
|
42
30
|
(async () => {
|
|
43
31
|
try {
|
|
44
|
-
const t =
|
|
45
|
-
t instanceof Promise ?
|
|
32
|
+
const t = te("CodeEditor");
|
|
33
|
+
t instanceof Promise ? L(await t) : L(t);
|
|
46
34
|
} catch {
|
|
47
|
-
|
|
35
|
+
L(void 0);
|
|
48
36
|
} finally {
|
|
49
|
-
|
|
37
|
+
_(!1);
|
|
50
38
|
}
|
|
51
39
|
})();
|
|
52
|
-
}, []),
|
|
40
|
+
}, []), x(() => {
|
|
41
|
+
if (N && w && C) {
|
|
42
|
+
S(!0);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const e = setTimeout(() => {
|
|
46
|
+
S(!0);
|
|
47
|
+
}, 0);
|
|
48
|
+
return () => clearTimeout(e);
|
|
49
|
+
}, []), x(() => {
|
|
53
50
|
if (h.current && u.current) {
|
|
54
51
|
const { start: e, end: t } = h.current;
|
|
55
52
|
u.current.setSelectionRange(e, t), h.current = null;
|
|
56
53
|
}
|
|
57
|
-
}),
|
|
58
|
-
const e =
|
|
54
|
+
}), x(() => {
|
|
55
|
+
const e = D.current, t = j.current;
|
|
59
56
|
if (!e || !t) return;
|
|
60
57
|
const n = () => {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
e.style.width = `${
|
|
64
|
-
const
|
|
65
|
-
`), f = Math.max(
|
|
66
|
-
for (let
|
|
67
|
-
const
|
|
68
|
-
e.textContent =
|
|
58
|
+
const a = t.clientWidth;
|
|
59
|
+
if (a <= 0) return;
|
|
60
|
+
e.style.width = `${a}px`;
|
|
61
|
+
const s = r.split(`
|
|
62
|
+
`), f = Math.max(s.length, g), k = [];
|
|
63
|
+
for (let M = 0; M < f; M++) {
|
|
64
|
+
const Y = s[M] ?? "";
|
|
65
|
+
e.textContent = Y || " ", k.push(e.scrollHeight);
|
|
69
66
|
}
|
|
70
|
-
|
|
67
|
+
J(k);
|
|
71
68
|
};
|
|
72
69
|
n();
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
}, [r,
|
|
70
|
+
const c = new ResizeObserver(n);
|
|
71
|
+
return c.observe(t), () => c.disconnect();
|
|
72
|
+
}, [r, g]), x(() => {
|
|
76
73
|
const e = (n) => {
|
|
77
|
-
const
|
|
78
|
-
|
|
74
|
+
const c = n.target;
|
|
75
|
+
v.current && (v.current.scrollTop = c.scrollTop), b.current && (b.current.scrollTop = c.scrollTop, b.current.scrollLeft = c.scrollLeft);
|
|
79
76
|
}, t = u?.current;
|
|
80
77
|
if (t)
|
|
81
78
|
return t.addEventListener("scroll", e), () => {
|
|
82
79
|
t.removeEventListener("scroll", e);
|
|
83
80
|
};
|
|
84
81
|
}, [u]);
|
|
85
|
-
let
|
|
82
|
+
let F = "dark";
|
|
86
83
|
try {
|
|
87
|
-
|
|
84
|
+
F = re().theme;
|
|
88
85
|
} catch {
|
|
89
86
|
}
|
|
90
|
-
const
|
|
91
|
-
`).length,
|
|
92
|
-
if (
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
if (
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
|
|
87
|
+
const X = F === "light" ? C : w, V = Math.max(r.split(`
|
|
88
|
+
`).length, g);
|
|
89
|
+
if (P)
|
|
90
|
+
return /* @__PURE__ */ i(ee, { ...P });
|
|
91
|
+
if (W)
|
|
92
|
+
return /* @__PURE__ */ i("div", { children: "Loading code editor..." });
|
|
93
|
+
if (T && !q)
|
|
94
|
+
return /* @__PURE__ */ i("div", { children: "Loading code editor..." });
|
|
95
|
+
const E = (e) => {
|
|
97
96
|
const t = e.value.substring(0, e.selectionStart);
|
|
98
|
-
|
|
97
|
+
G(t.split(`
|
|
99
98
|
`).length - 1);
|
|
100
|
-
},
|
|
99
|
+
}, z = (e) => {
|
|
101
100
|
if (e.key === "Tab") {
|
|
102
101
|
e.preventDefault();
|
|
103
|
-
const t = e.currentTarget, n = t.selectionStart,
|
|
104
|
-
if (n ===
|
|
105
|
-
const
|
|
102
|
+
const t = e.currentTarget, n = t.selectionStart, c = t.selectionEnd, a = " ";
|
|
103
|
+
if (n === c) {
|
|
104
|
+
const s = r.substring(0, n) + a + r.substring(c);
|
|
106
105
|
h.current = {
|
|
107
|
-
start: n +
|
|
108
|
-
end: n +
|
|
109
|
-
}, l?.(
|
|
106
|
+
start: n + a.length,
|
|
107
|
+
end: n + a.length
|
|
108
|
+
}, l?.(s);
|
|
110
109
|
} else if (e.shiftKey) {
|
|
111
|
-
const
|
|
112
|
-
`, n - 1) + 1, f = r.substring(
|
|
110
|
+
const s = r.lastIndexOf(`
|
|
111
|
+
`, n - 1) + 1, f = r.substring(s).match(/^ {1,2}/)?.[0] ?? "";
|
|
113
112
|
if (f.length > 0) {
|
|
114
|
-
const
|
|
113
|
+
const k = r.substring(0, s) + r.substring(s + f.length);
|
|
115
114
|
h.current = {
|
|
116
|
-
start: Math.max(
|
|
117
|
-
end: Math.max(
|
|
118
|
-
}, l?.(
|
|
115
|
+
start: Math.max(s, n - f.length),
|
|
116
|
+
end: Math.max(s, c - f.length)
|
|
117
|
+
}, l?.(k);
|
|
119
118
|
}
|
|
120
119
|
} else {
|
|
121
|
-
const
|
|
120
|
+
const s = r.substring(0, n) + a + r.substring(c);
|
|
122
121
|
h.current = {
|
|
123
|
-
start: n +
|
|
124
|
-
end: n +
|
|
125
|
-
}, l?.(
|
|
122
|
+
start: n + a.length,
|
|
123
|
+
end: n + a.length
|
|
124
|
+
}, l?.(s);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
129
|
-
return
|
|
127
|
+
}, I = [o.wrapper, O].filter(Boolean).join(" ");
|
|
128
|
+
return T ? /* @__PURE__ */ H(
|
|
130
129
|
"div",
|
|
131
130
|
{
|
|
132
|
-
className:
|
|
131
|
+
className: I,
|
|
133
132
|
style: {
|
|
134
|
-
minHeight: `calc(${
|
|
133
|
+
minHeight: `calc(${g} * 1.6em + 2 * var(--spacing-4))`
|
|
135
134
|
},
|
|
136
135
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ i(
|
|
138
137
|
"div",
|
|
139
138
|
{
|
|
140
|
-
ref:
|
|
141
|
-
className:
|
|
139
|
+
ref: D,
|
|
140
|
+
className: o.lineMirror,
|
|
142
141
|
"aria-hidden": "true"
|
|
143
142
|
}
|
|
144
143
|
),
|
|
145
|
-
|
|
144
|
+
A && /* @__PURE__ */ i(
|
|
146
145
|
"div",
|
|
147
146
|
{
|
|
148
|
-
ref:
|
|
149
|
-
className:
|
|
147
|
+
ref: v,
|
|
148
|
+
className: o.lineNumbers,
|
|
150
149
|
"aria-hidden": "true",
|
|
151
|
-
children: Array.from({ length:
|
|
150
|
+
children: Array.from({ length: V }).map((e, t) => /* @__PURE__ */ i(
|
|
152
151
|
"div",
|
|
153
152
|
{
|
|
154
|
-
className:
|
|
153
|
+
className: o.lineNumber,
|
|
155
154
|
style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
|
|
156
155
|
children: t + 1
|
|
157
156
|
},
|
|
@@ -159,29 +158,29 @@ const te = X(
|
|
|
159
158
|
))
|
|
160
159
|
}
|
|
161
160
|
),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ H("div", { ref: j, className: o.editorArea, children: [
|
|
162
|
+
/* @__PURE__ */ i(
|
|
164
163
|
"div",
|
|
165
164
|
{
|
|
166
|
-
className:
|
|
165
|
+
className: o.lineHighlight,
|
|
167
166
|
style: {
|
|
168
|
-
top: d.length > 0 ? `calc(var(--spacing-4) + ${d.slice(0,
|
|
169
|
-
...d[
|
|
167
|
+
top: d.length > 0 ? `calc(var(--spacing-4) + ${d.slice(0, y).reduce((e, t) => e + t, 0)}px)` : `calc(var(--spacing-4) + ${(y * 1.6).toFixed(2)}em)`,
|
|
168
|
+
...d[y] !== void 0 ? { height: `${d[y]}px` } : {}
|
|
170
169
|
},
|
|
171
170
|
"aria-hidden": "true"
|
|
172
171
|
}
|
|
173
172
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ i(
|
|
175
174
|
"div",
|
|
176
175
|
{
|
|
177
|
-
ref:
|
|
178
|
-
className:
|
|
176
|
+
ref: b,
|
|
177
|
+
className: o.highlightLayer,
|
|
179
178
|
"aria-hidden": "true",
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
|
|
179
|
+
children: /* @__PURE__ */ i(
|
|
180
|
+
N,
|
|
182
181
|
{
|
|
183
|
-
language:
|
|
184
|
-
style:
|
|
182
|
+
language: T,
|
|
183
|
+
style: X,
|
|
185
184
|
customStyle: {
|
|
186
185
|
margin: 0,
|
|
187
186
|
padding: 0,
|
|
@@ -208,44 +207,44 @@ const te = X(
|
|
|
208
207
|
)
|
|
209
208
|
}
|
|
210
209
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ i(
|
|
212
211
|
"textarea",
|
|
213
212
|
{
|
|
214
213
|
ref: u,
|
|
215
|
-
className:
|
|
214
|
+
className: o.textareaOverlay,
|
|
216
215
|
value: r,
|
|
217
216
|
onChange: (e) => l?.(e.target.value),
|
|
218
|
-
onKeyDown:
|
|
219
|
-
onKeyUp: (e) =>
|
|
220
|
-
onMouseUp: (e) =>
|
|
221
|
-
onClick: (e) =>
|
|
222
|
-
placeholder:
|
|
223
|
-
readOnly:
|
|
224
|
-
"aria-label":
|
|
217
|
+
onKeyDown: z,
|
|
218
|
+
onKeyUp: (e) => E(e.currentTarget),
|
|
219
|
+
onMouseUp: (e) => E(e.currentTarget),
|
|
220
|
+
onClick: (e) => E(e.currentTarget),
|
|
221
|
+
placeholder: R,
|
|
222
|
+
readOnly: $,
|
|
223
|
+
"aria-label": K || "Code editor",
|
|
225
224
|
spellCheck: "false",
|
|
226
|
-
|
|
225
|
+
...B
|
|
227
226
|
}
|
|
228
227
|
)
|
|
229
228
|
] })
|
|
230
229
|
]
|
|
231
230
|
}
|
|
232
|
-
) : /* @__PURE__ */
|
|
231
|
+
) : /* @__PURE__ */ H(
|
|
233
232
|
"div",
|
|
234
233
|
{
|
|
235
|
-
className:
|
|
236
|
-
style: { minHeight: `calc(${
|
|
234
|
+
className: I,
|
|
235
|
+
style: { minHeight: `calc(${g} * 1.6em + 2 * var(--spacing-4))` },
|
|
237
236
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
|
|
237
|
+
/* @__PURE__ */ i("div", { ref: D, className: o.lineMirror, "aria-hidden": "true" }),
|
|
238
|
+
A && /* @__PURE__ */ i(
|
|
240
239
|
"div",
|
|
241
240
|
{
|
|
242
|
-
ref:
|
|
243
|
-
className:
|
|
241
|
+
ref: v,
|
|
242
|
+
className: o.lineNumbers,
|
|
244
243
|
"aria-hidden": "true",
|
|
245
|
-
children: Array.from({ length:
|
|
244
|
+
children: Array.from({ length: V }).map((e, t) => /* @__PURE__ */ i(
|
|
246
245
|
"div",
|
|
247
246
|
{
|
|
248
|
-
className:
|
|
247
|
+
className: o.lineNumber,
|
|
249
248
|
style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
|
|
250
249
|
children: t + 1
|
|
251
250
|
},
|
|
@@ -253,19 +252,19 @@ const te = X(
|
|
|
253
252
|
))
|
|
254
253
|
}
|
|
255
254
|
),
|
|
256
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ i(
|
|
257
256
|
"textarea",
|
|
258
257
|
{
|
|
259
258
|
ref: u,
|
|
260
|
-
className:
|
|
259
|
+
className: o.textarea,
|
|
261
260
|
value: r,
|
|
262
261
|
onChange: (e) => l?.(e.target.value),
|
|
263
|
-
onKeyDown:
|
|
264
|
-
placeholder:
|
|
265
|
-
readOnly:
|
|
266
|
-
"aria-label":
|
|
262
|
+
onKeyDown: z,
|
|
263
|
+
placeholder: R,
|
|
264
|
+
readOnly: $,
|
|
265
|
+
"aria-label": K || "Code editor",
|
|
267
266
|
spellCheck: "false",
|
|
268
|
-
|
|
267
|
+
...B
|
|
269
268
|
}
|
|
270
269
|
)
|
|
271
270
|
]
|
|
@@ -273,7 +272,7 @@ const te = X(
|
|
|
273
272
|
);
|
|
274
273
|
}
|
|
275
274
|
);
|
|
276
|
-
|
|
275
|
+
ne.displayName = "CodeEditor";
|
|
277
276
|
export {
|
|
278
|
-
|
|
277
|
+
ne as CodeEditor
|
|
279
278
|
};
|
package/package.json
CHANGED