ide-assi 0.301.0 → 0.302.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.
@@ -194087,7 +194087,7 @@ class IdeAssi extends HTMLElement
194087
194087
  });
194088
194088
  };
194089
194089
 
194090
- #init = (info) => {
194090
+ #init = () => {
194091
194091
  this.#config();
194092
194092
 
194093
194093
  this.#loadLocalSettings();
@@ -194083,7 +194083,7 @@ class IdeAssi extends HTMLElement
194083
194083
  });
194084
194084
  };
194085
194085
 
194086
- #init = (info) => {
194086
+ #init = () => {
194087
194087
  this.#config();
194088
194088
 
194089
194089
  this.#loadLocalSettings();
@@ -91,7 +91,7 @@ export class IdeAssi extends HTMLElement
91
91
  });
92
92
  };
93
93
 
94
- #init = (info) => {
94
+ #init = () => {
95
95
  this.#config();
96
96
 
97
97
  this.#loadLocalSettings();
@@ -0,0 +1,62 @@
1
+ import ninegrid from "ninegrid2";
2
+ //import { IdeAi } from "./ideAi.js";
3
+ import {diff_match_patch} from 'diff-match-patch';
4
+
5
+ export class IdeDiff extends HTMLElement
6
+ {
7
+ #asisSrc;
8
+ #tobeSrc;
9
+
10
+ constructor() {
11
+ super();
12
+ this.attachShadow({ mode: 'open' });
13
+ }
14
+
15
+ connectedCallback() {
16
+
17
+ this.shadowRoot.innerHTML = `
18
+ <style>
19
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/ideDiff.css";
20
+ ${ninegrid.getCustomPath(this,"ideDiff.css")}
21
+ </style>
22
+
23
+ <div class="wrapper">
24
+ <div class="asis"></div>
25
+ <nx-splitter></nx-splitter>
26
+ <div class="tobe"></div>
27
+ </div>
28
+ `;
29
+
30
+ requestAnimationFrame(() => {
31
+ this.#init();
32
+ });
33
+ };
34
+
35
+ #init = () => {
36
+ };
37
+
38
+ #renderDiff = () => {
39
+ const dmp = new diff_match_patch();
40
+ const diffs = dmp.diff_main(this.#asisSrc, this.#tobeSrc);
41
+ dmp.diff_cleanupSemantic(diffs);
42
+
43
+ const html = diffs.map(([op, text]) => {
44
+ switch (op) {
45
+ case diff_match_patch.DIFF_INSERT: return `<ins>${text}</ins>`;
46
+ case diff_match_patch.DIFF_DELETE: return `<del>${text}</del>`;
47
+ case diff_match_patch.DIFF_EQUAL: return `<span>${text}</span>`;
48
+ }
49
+ }).join('');
50
+
51
+ this.shadowRoot.querySelector('.tobe').innerHTML = html;
52
+ };
53
+
54
+ initialize = (scr1, scr2) => {
55
+ this.#asisSrc = scr1.src;
56
+ this.#tobeSrc = scr2.src;
57
+
58
+ this.#renderDiff();
59
+ };
60
+ }
61
+
62
+ customElements.define("ide-diff", IdeDiff);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.301.0",
4
+ "version": "0.302.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -28,6 +28,7 @@
28
28
  "@langchain/google-genai": "^0.x.x",
29
29
  "@langchain/ollama": "^0.x.x",
30
30
  "@langchain/openai": "^0.x.x",
31
+ "diff-match-patch": "^1.0.5",
31
32
  "exceljs": "^4.4.0",
32
33
  "jquery": "^3.6.0",
33
34
  "ninegrid2": "^6.650.0",
@@ -91,7 +91,7 @@ export class IdeAssi extends HTMLElement
91
91
  });
92
92
  };
93
93
 
94
- #init = (info) => {
94
+ #init = () => {
95
95
  this.#config();
96
96
 
97
97
  this.#loadLocalSettings();
@@ -0,0 +1,62 @@
1
+ import ninegrid from "ninegrid2";
2
+ //import { IdeAi } from "./ideAi.js";
3
+ import {diff_match_patch} from 'diff-match-patch';
4
+
5
+ export class IdeDiff extends HTMLElement
6
+ {
7
+ #asisSrc;
8
+ #tobeSrc;
9
+
10
+ constructor() {
11
+ super();
12
+ this.attachShadow({ mode: 'open' });
13
+ }
14
+
15
+ connectedCallback() {
16
+
17
+ this.shadowRoot.innerHTML = `
18
+ <style>
19
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/ideDiff.css";
20
+ ${ninegrid.getCustomPath(this,"ideDiff.css")}
21
+ </style>
22
+
23
+ <div class="wrapper">
24
+ <div class="asis"></div>
25
+ <nx-splitter></nx-splitter>
26
+ <div class="tobe"></div>
27
+ </div>
28
+ `;
29
+
30
+ requestAnimationFrame(() => {
31
+ this.#init();
32
+ });
33
+ };
34
+
35
+ #init = () => {
36
+ };
37
+
38
+ #renderDiff = () => {
39
+ const dmp = new diff_match_patch();
40
+ const diffs = dmp.diff_main(this.#asisSrc, this.#tobeSrc);
41
+ dmp.diff_cleanupSemantic(diffs);
42
+
43
+ const html = diffs.map(([op, text]) => {
44
+ switch (op) {
45
+ case diff_match_patch.DIFF_INSERT: return `<ins>${text}</ins>`;
46
+ case diff_match_patch.DIFF_DELETE: return `<del>${text}</del>`;
47
+ case diff_match_patch.DIFF_EQUAL: return `<span>${text}</span>`;
48
+ }
49
+ }).join('');
50
+
51
+ this.shadowRoot.querySelector('.tobe').innerHTML = html;
52
+ };
53
+
54
+ initialize = (scr1, scr2) => {
55
+ this.#asisSrc = scr1.src;
56
+ this.#tobeSrc = scr2.src;
57
+
58
+ this.#renderDiff();
59
+ };
60
+ }
61
+
62
+ customElements.define("ide-diff", IdeDiff);