monza-editor 0.5.1 → 0.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monza-editor",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "The textarea element with syntax highlight",
5
5
  "repository": "https://github.com/raviqqe/monza-editor",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {},
21
21
  "devDependencies": {
22
22
  "@raviqqe/tsconfig": "^2.0.1",
23
- "@rslib/core": "^0.12.2",
23
+ "@rslib/core": "^0.12.4",
24
24
  "jsdom": "^26.1.0",
25
25
  "typescript": "^5.9.2",
26
26
  "typescript-plugin-css-modules": "^5.2.0",
package/dist/index.css DELETED
@@ -1 +0,0 @@
1
- .main-TdgjvV{position:relative}.text-YtgeQ_{white-space:break-spaces;word-break:break-word}.editor-ore7X3{box-sizing:border-box;font-size:inherit;line-height:inherit;padding:var(--me-padding,.1rem);text-align:left;overscroll-behavior:none;background:0 0;border:none;width:100%;height:100%;margin:0;overflow:scroll}.textarea-ugnhty{caret-color:light-dark(#000,#fff);color:#0000;resize:none;outline:none}.pre-bJTdjq{pointer-events:none;scrollbar-width:0;position:absolute;top:0;left:0}
package/dist/index.d.ts DELETED
@@ -1,20 +0,0 @@
1
- type ChildElementName = "code" | "pre" | "textarea";
2
- export declare const styles: Record<ChildElementName | "main", string>;
3
- export interface TextareaEvent extends Omit<Event, "target"> {
4
- target: HTMLTextAreaElement;
5
- }
6
- export interface InitializationOptions {
7
- code: HTMLElement;
8
- highlight: (text: string) => string;
9
- onChange?: (event: TextareaEvent) => void;
10
- onInput?: (event: TextareaEvent) => void;
11
- pre: HTMLPreElement;
12
- textarea: HTMLTextAreaElement;
13
- }
14
- export declare const initialize: ({ code, highlight, onChange, onInput, pre, textarea, }: InitializationOptions) => void;
15
- export interface RenderOptions extends Omit<InitializationOptions, ChildElementName> {
16
- value?: string;
17
- }
18
- export declare const render: (div: HTMLDivElement, { value, ...options }: RenderOptions) => void;
19
- export {};
20
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;AAEpD,eAAO,MAAM,MAAM,EAAgB,MAAM,CAAC,gBAAgB,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7E,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC1D,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,GAAI,wDAOxB,qBAAqB,KAAG,IA+B1B,CAAC;AAEF,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,GACjB,KAAK,cAAc,EACnB,uBAAuB,aAAa,KACnC,IAaF,CAAC"}
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- let e={main:"main-TdgjvV",text:"text-YtgeQ_",editor:"editor-ore7X3",textarea:"textarea-ugnhty editor-ore7X3 text-YtgeQ_",pre:"pre-bJTdjq editor-ore7X3",code:"code-p0LDSQ text-YtgeQ_"},t=({code:e,highlight:t,onChange:a,onInput:r,pre:l,textarea:d})=>{d.setAttribute("autocapitalize","off"),d.setAttribute("spellcheck","false");let n=()=>{l.scrollTop=d.scrollTop,l.scrollLeft=d.scrollLeft},i=()=>window.requestAnimationFrame(()=>{let a=d.value;e.innerHTML=t("\n"===a.at(-1)?`${a} `:a),n()});d.addEventListener("input",e=>{i(),r?.(e)}),d.addEventListener("scroll",n),a&&d.addEventListener("change",e=>a(e)),i()},a=(a,{value:r,...l})=>{let d=a.appendChild(document.createElement("textarea")),n=a.appendChild(document.createElement("pre")),i=n.appendChild(document.createElement("code"));d.value=r??"",a.classList.add(e.main),d.className=e.textarea,n.className=e.pre,i.className=e.code,t({...l,code:i,pre:n,textarea:d})};export{t as initialize,a as render,e as styles};