monza-editor 0.3.4 → 0.3.5

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/dist/index.css CHANGED
@@ -1 +1 @@
1
- .main-TdgjvV{position:relative}.text-YtgeQ_{white-space:break-spaces;word-break:break-word}.editor-ore7X3{box-sizing:border-box;font-family:var(--me-font-family,monospace);font-size:inherit;line-height:inherit;padding:var(--me-padding,.1rem);text-align:left;overscroll-behavior:none;border:none;width:100%;height:100%;margin:0;overflow:scroll}.textarea-ugnhty{resize:none}.pre-bJTdjq{pointer-events:none;scrollbar-width:0;position:absolute;top:0;left: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;border:none;width:100%;height:100%;margin:0;overflow:scroll}.textarea-ugnhty{resize:none}.pre-bJTdjq{pointer-events:none;scrollbar-width:0;position:absolute;top:0;left:0}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  export interface TextareaEvent extends Omit<Event, "target"> {
2
2
  target: HTMLTextAreaElement;
3
3
  }
4
- export interface Options {
4
+ export interface InitializationOptions {
5
+ code: HTMLElement;
6
+ div: HTMLDivElement;
5
7
  highlight: (text: string) => string;
6
8
  onChange?: (event: TextareaEvent) => void;
7
9
  onInput?: (event: TextareaEvent) => void;
10
+ pre: HTMLPreElement;
11
+ textarea: HTMLTextAreaElement;
8
12
  value?: string;
9
13
  }
10
- export declare const initialize: (container: Element, { highlight, onChange, onInput, value }: Options) => void;
14
+ export declare const initialize: ({ code, div, highlight, onChange, onInput, pre, textarea, value, }: InitializationOptions) => void;
15
+ export interface RenderOptions extends Omit<InitializationOptions, "code" | "div" | "pre" | "textarea"> {
16
+ }
17
+ export declare const render: (div: HTMLDivElement, options: RenderOptions) => void;
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC1D,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,OAAO;IACtB,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,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,GACrB,WAAW,OAAO,EAClB,yCAAyC,OAAO,KAC/C,IAyCF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,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,GAAG,EAAE,cAAc,CAAC;IACpB,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;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,GAAI,oEASxB,qBAAqB,KAAG,IAmC1B,CAAC;AAEF,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,CAAC;CAAG;AAE7E,eAAO,MAAM,MAAM,GAAI,KAAK,cAAc,EAAE,SAAS,aAAa,KAAG,IAYpE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- let e=(e,{highlight:t,onChange:l,onInput:a,value:n})=>{e.className+=" main-TdgjvV";let r=e.appendChild(document.createElement("textarea"));r.className+=" textarea-ugnhty editor-ore7X3 text-YtgeQ_",r.setAttribute("spellcheck","false"),r.value=n??"";let d=e.appendChild(document.createElement("pre"));d.className+=" pre-bJTdjq editor-ore7X3";let c=d.appendChild(document.createElement("code"));c.className+=" code-p0LDSQ text-YtgeQ_";let s=()=>{d.scrollTop=r.scrollTop,d.scrollLeft=r.scrollLeft},i=()=>window.requestAnimationFrame(()=>{let e=r.value;c.innerHTML=t("\n"===e.at(-1)?`${e} `:e),s()});r.addEventListener("input",e=>{i(),a?.(e)}),r.addEventListener("scroll",s),l&&r.addEventListener("change",e=>l(e)),i()};export{e as initialize};
1
+ let e=({code:e,div:t,highlight:a,onChange:l,onInput:n,pre:r,textarea:d,value:c})=>{t.className+=" main-TdgjvV",d.className+=" textarea-ugnhty editor-ore7X3 text-YtgeQ_",d.setAttribute("spellcheck","false"),d.value=c??"",r.className+=" pre-bJTdjq editor-ore7X3",e.className+=" code-p0LDSQ text-YtgeQ_";let s=()=>{r.scrollTop=d.scrollTop,r.scrollLeft=d.scrollLeft},i=()=>window.requestAnimationFrame(()=>{let t=d.value;e.innerHTML=a("\n"===t.at(-1)?`${t} `:t),s()});d.addEventListener("input",e=>{i(),n?.(e)}),d.addEventListener("scroll",s),l&&d.addEventListener("change",e=>l(e)),i()},t=(t,a)=>{let l=t.appendChild(document.createElement("textarea")),n=t.appendChild(document.createElement("pre")),r=n.appendChild(document.createElement("code"));e({...a,code:r,div:t,pre:n,textarea:l})};export{e as initialize,t as render};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monza-editor",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "The textarea element with syntax highlight",
5
5
  "repository": "https://github.com/raviqqe/monza-editor",
6
6
  "license": "MIT",
@@ -28,7 +28,6 @@
28
28
  },
29
29
  "scripts": {
30
30
  "build": "rslib build",
31
- "lint": "biome ci",
32
31
  "test": "vitest"
33
32
  }
34
33
  }