monza-editor 0.1.1 → 0.2.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/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Monza editor
2
2
 
3
3
  [![GitHub Action](https://img.shields.io/github/actions/workflow/status/raviqqe/monza-editor/test.yaml?branch=main&style=flat-square)](https://github.com/raviqqe/monza-editor/actions)
4
- [![Codecov](https://img.shields.io/codecov/c/github/raviqqe/monza-editor.svg?style=flat-square)](https://codecov.io/gh/raviqqe/monza-editor)
5
4
  [![npm](https://img.shields.io/npm/v/monza-editor?style=flat-square)](https://www.npmjs.com/package/monza-editor)
6
5
  [![License](https://img.shields.io/github/license/raviqqe/monza-editor.svg?style=flat-square)](LICENSE)
7
6
 
8
- The `textarea` element with syntax highlight.
7
+ The minimal `textarea` element with syntax highlight.
9
8
 
10
9
  ## License
11
10
 
package/cspell.json CHANGED
@@ -1,3 +1,13 @@
1
1
  {
2
- "words": ["byonm", "codecov", "deno", "monza", "raviqqe", "rslib", "typeof"]
2
+ "words": [
3
+ "byonm",
4
+ "codecov",
5
+ "deno",
6
+ "monza",
7
+ "raviqqe",
8
+ "rslib",
9
+ "shiki",
10
+ "typeof",
11
+ "vitesse"
12
+ ]
3
13
  }
package/dist/index.css ADDED
@@ -0,0 +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(--font-family,monospace);font-size:inherit;line-height:inherit;padding:var(--padding,.1rem);text-align:left;border:none;width:100%;height:100%;margin:0}.textarea-ugnhty{field-sizing:content;resize:none}.pre-bJTdjq{pointer-events:none;position:absolute;top:0;left:0}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const initializeEditor: () => void;
1
+ export declare const initialize: (container: Element, highlight: (text: string) => string) => void;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GACrB,WAAW,OAAO,EAClB,WAAW,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,KAClC,IAuBF,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- let i=()=>{};export{i as initializeEditor};
1
+ let e=(e,t)=>{e.className+=" main-TdgjvV";let a=e.appendChild(document.createElement("textarea"));a.className+=" textarea-ugnhty editor-ore7X3 text-YtgeQ_";let l=e.appendChild(document.createElement("pre"));l.className+=" pre-bJTdjq editor-ore7X3";let n=l.appendChild(document.createElement("code"));n.className+=" code-p0LDSQ text-YtgeQ_";let i=()=>window.requestAnimationFrame(()=>{n.innerHTML=t(a.value),a.style.height="0",a.style.height=`max(${a.scrollHeight}px, 100%)`});a.addEventListener("input",i),i()};export{e as initialize};
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Shiki example for Monza editor</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/index.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@monza-editor/shiki-example",
3
+ "description": "Shiki example for Monza editor",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "start": "vite",
8
+ "build": "tsc && vite build"
9
+ },
10
+ "dependencies": {
11
+ "monza-editor": "workspace:*",
12
+ "shiki": "^3.9.2"
13
+ },
14
+ "devDependencies": {
15
+ "@raviqqe/tsconfig": "^2.0.1",
16
+ "typescript": "~5.9.2",
17
+ "vite": "^7.1.2"
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "monza-editor",
3
- "version": "0.1.1",
4
- "description": "The textarea with syntax highlight",
3
+ "version": "0.2.0",
4
+ "description": "The minimal textarea with syntax highlight",
5
5
  "repository": "https://github.com/raviqqe/monza-editor",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -16,22 +16,29 @@
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
18
  "default": "./dist/index.js"
19
+ },
20
+ "./style.css": {
21
+ "default": "./dist/index.css"
19
22
  }
20
23
  },
21
24
  "scripts": {
22
25
  "build": "rslib build",
23
26
  "build:tsc": "tsc --emitDeclarationOnly",
24
27
  "lint": "biome ci",
25
- "test": "vitest --coverage"
28
+ "test": "vitest"
29
+ },
30
+ "dependencies": {
31
+ "shiki": "^3.9.2"
26
32
  },
27
- "dependencies": {},
28
33
  "devDependencies": {
29
34
  "@biomejs/biome": "^2.1.4",
30
35
  "@raviqqe/biome-config": "^2.0.10",
31
- "@raviqqe/tsconfig": "^2.0.0",
36
+ "@raviqqe/tsconfig": "^2.0.1",
32
37
  "@rslib/core": "^0.12.0",
33
38
  "@vitest/coverage-v8": "^3.0.2",
39
+ "jsdom": "^26.1.0",
34
40
  "typescript": "^5.0.2",
41
+ "typescript-plugin-css-modules": "^5.2.0",
35
42
  "vitest": "^3.0.2"
36
43
  }
37
44
  }
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - .
3
+ - examples/shiki
package/rslib.config.ts CHANGED
@@ -10,6 +10,9 @@ export default defineConfig({
10
10
  },
11
11
  },
12
12
  ],
13
+ output: {
14
+ target: "web",
15
+ },
13
16
  source: {
14
17
  entry: {
15
18
  index: "./src/index.ts",
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: "jsdom",
6
+ },
7
+ });