Comparing version
@@ -0,6 +1,5 @@ | ||
import * as react from 'react'; | ||
import * as react_jsx_runtime from 'react/jsx-runtime'; | ||
import * as react from 'react'; | ||
declare const Editor$1: react.ForwardRefExoticComponent<{ | ||
id?: string; | ||
declare const Editor: react.ForwardRefExoticComponent<{ | ||
title?: string; | ||
@@ -12,10 +11,9 @@ value?: string; | ||
padding?: string; | ||
extension?: string; | ||
onChange?: (code: string) => void; | ||
} & { | ||
fontSize?: string | number; | ||
fontFamily?: string; | ||
} & react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>; | ||
type EditorProps = React.HTMLAttributes<HTMLDivElement> & Exclude<Parameters<typeof Editor$1>[0], 'id'> & { | ||
fontSize?: string | number; | ||
}; | ||
declare function Editor(props: EditorProps): react_jsx_runtime.JSX.Element; | ||
declare function Code({ children: code, title, controls, fontSize, highlightLines, preformatted, lineNumbers, lineNumbersWidth, padding, asMarkup, extension, ...props }: { | ||
@@ -22,0 +20,0 @@ children: string; |
@@ -1,108 +0,2 @@ | ||
import { jsxs, jsx } from 'react/jsx-runtime'; | ||
import { f as fontSizeCss, S as Style, E as Editor$1 } from './editor-client-DE3nx3oL.js'; | ||
export { C as Code } from './editor-client-DE3nx3oL.js'; | ||
import { useId } from 'react'; | ||
const css = (id, { fontSize, lineNumbersWidth = '2.5rem', padding = '1rem' })=>{ | ||
const R = `[data-codice-editor="${id}"]`; | ||
return `\ | ||
${R} { | ||
--codice-text-color: transparent; | ||
--codice-background-color: transparent; | ||
--codice-caret-color: inherit; | ||
--codice-font-size: ${fontSizeCss(fontSize)}; | ||
--codice-code-line-number-width: ${lineNumbersWidth}; | ||
--codice-code-padding: ${padding}; | ||
position: relative; | ||
overflow-y: scroll; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: stretch; | ||
scrollbar-width: none; | ||
} | ||
${R} code, | ||
${R} textarea { | ||
font-family: Consolas, Monaco, monospace; | ||
line-break: anywhere; | ||
overflow-wrap: break-word; | ||
scrollbar-width: none; | ||
padding: calc(var(--codice-code-padding) * 1.5) var(--codice-code-padding); | ||
line-height: 1.5; | ||
font-size: var(--codice-font-size); | ||
caret-color: var(--codice-caret-color); | ||
border: none; | ||
outline: none; | ||
width: 100%; | ||
} | ||
${R} code { | ||
display: inline-block; | ||
width: 100%; | ||
margin-left: calc(var(--codice-code-line-number-width) - 2.5rem); ${''} | ||
} | ||
${R} textarea::-webkit-scrollbar, | ||
${R} textarea:focus::-webkit-scrollbar, | ||
${R} textarea:hover::-webkit-scrollbar { | ||
width: 0; | ||
} | ||
${R} [data-codice-content] { | ||
position: relative; | ||
} | ||
${R} textarea { | ||
resize: none; | ||
display: block; | ||
color: var(--codice-text-color); | ||
background-color: var(--codice-background-color); | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
${R}[data-codice-line-numbers="true"] textarea { | ||
padding-left: calc(var(--codice-code-line-number-width) + var(--codice-code-padding)); | ||
} | ||
`; | ||
// line number padding-left is [[width 24px] margin-right 16px] + 15px | ||
}; | ||
function Editor(props) { | ||
const { title, value, onChange, controls = true, lineNumbers = true, lineNumbersWidth, padding, fontSize, ...restProps } = props; | ||
const editorProps = { | ||
title, | ||
value, | ||
onChange, | ||
controls, | ||
lineNumbers, | ||
lineNumbersWidth, | ||
padding | ||
}; | ||
const id = useId().replace(':', '_').replace(/[0-9]/g, (match)=>String.fromCharCode(65 + Number(match))); | ||
return /*#__PURE__*/ jsxs("div", { | ||
...restProps, | ||
"data-codice": "editor", | ||
"data-codice-editor": id, | ||
// DOM attributes for selecting the stateful editor easily. | ||
// e.g. [data-codice-line-numbers="true"] | ||
"data-codice-title": title || '', | ||
"data-codice-controls": !!controls, | ||
"data-codice-line-numbers": !!lineNumbers, | ||
children: [ | ||
/*#__PURE__*/ jsx(Style, { | ||
css: css(id, { | ||
fontSize, | ||
padding, | ||
lineNumbersWidth | ||
}) | ||
}), | ||
/*#__PURE__*/ jsx(Editor$1, { | ||
...editorProps, | ||
id: id | ||
}) | ||
] | ||
}); | ||
} | ||
export { Editor }; | ||
export { E as Editor } from './editor-client-CPL_FNT2.js'; | ||
export { a as Code } from './code-client-CMonmmX4.js'; |
{ | ||
"name": "codice", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./dist/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6
20%20245
-0.17%455
-1.09%