monza-editor 0.4.2 → 0.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.
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export interface InitializationOptions {
|
|
|
10
10
|
onInput?: (event: TextareaEvent) => void;
|
|
11
11
|
pre: HTMLPreElement;
|
|
12
12
|
textarea: HTMLTextAreaElement;
|
|
13
|
-
value?: string;
|
|
14
13
|
}
|
|
15
|
-
export declare const initialize: ({ code, highlight, onChange, onInput, pre, textarea,
|
|
14
|
+
export declare const initialize: ({ code, highlight, onChange, onInput, pre, textarea, }: InitializationOptions) => void;
|
|
16
15
|
export interface RenderOptions extends Omit<InitializationOptions, ChildElementName> {
|
|
16
|
+
value?: string;
|
|
17
17
|
}
|
|
18
|
-
export declare const render: (div: HTMLDivElement, options: RenderOptions) => void;
|
|
18
|
+
export declare const render: (div: HTMLDivElement, { value, ...options }: RenderOptions) => void;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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};
|