ide-assi 0.301.0 → 0.303.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/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/components/ideAssi.js +1 -1
- package/dist/components/ideDiff.js +62 -0
- package/dist/components/ideDiffPopup.js +38 -0
- package/package.json +2 -1
- package/src/components/ideAssi.js +1 -1
- package/src/components/ideDiff.js +62 -0
- package/src/components/ideDiffPopup.js +38 -0
package/dist/bundle.cjs.js
CHANGED
|
@@ -194087,7 +194087,7 @@ class IdeAssi extends HTMLElement
|
|
|
194087
194087
|
});
|
|
194088
194088
|
};
|
|
194089
194089
|
|
|
194090
|
-
#init = (
|
|
194090
|
+
#init = () => {
|
|
194091
194091
|
this.#config();
|
|
194092
194092
|
|
|
194093
194093
|
this.#loadLocalSettings();
|
package/dist/bundle.esm.js
CHANGED
|
@@ -194083,7 +194083,7 @@ class IdeAssi extends HTMLElement
|
|
|
194083
194083
|
});
|
|
194084
194084
|
};
|
|
194085
194085
|
|
|
194086
|
-
#init = (
|
|
194086
|
+
#init = () => {
|
|
194087
194087
|
this.#config();
|
|
194088
194088
|
|
|
194089
194089
|
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);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ninegrid from "ninegrid2";
|
|
2
|
+
|
|
3
|
+
class ideDiffPopup extends HTMLElement
|
|
4
|
+
{
|
|
5
|
+
constructor() {
|
|
6
|
+
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this.attachShadow({ mode: 'open' });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
|
|
14
|
+
this.#owner = this.getRootNode().host;//this.closest("nine-grid");
|
|
15
|
+
|
|
16
|
+
this.shadowRoot.innerHTML = `
|
|
17
|
+
<style>
|
|
18
|
+
|
|
19
|
+
</style>
|
|
20
|
+
|
|
21
|
+
<nx-dialog>
|
|
22
|
+
<nx-diff></nx-diff>
|
|
23
|
+
</nx-dialog>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
popup = (src1, src2) => {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
const target = this.shadowRoot.querySelector("nx-diff");
|
|
30
|
+
target.initialize(src1, src2);
|
|
31
|
+
this.shadowRoot.querySelector('dialog').showModal();
|
|
32
|
+
}, 100);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
customElements.define("ide-diff-popup", ideDiffPopup);
|
|
38
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ide-assi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.303.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",
|
|
@@ -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);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ninegrid from "ninegrid2";
|
|
2
|
+
|
|
3
|
+
class ideDiffPopup extends HTMLElement
|
|
4
|
+
{
|
|
5
|
+
constructor() {
|
|
6
|
+
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this.attachShadow({ mode: 'open' });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
|
|
14
|
+
this.#owner = this.getRootNode().host;//this.closest("nine-grid");
|
|
15
|
+
|
|
16
|
+
this.shadowRoot.innerHTML = `
|
|
17
|
+
<style>
|
|
18
|
+
|
|
19
|
+
</style>
|
|
20
|
+
|
|
21
|
+
<nx-dialog>
|
|
22
|
+
<nx-diff></nx-diff>
|
|
23
|
+
</nx-dialog>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
popup = (src1, src2) => {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
const target = this.shadowRoot.querySelector("nx-diff");
|
|
30
|
+
target.initialize(src1, src2);
|
|
31
|
+
this.shadowRoot.querySelector('dialog').showModal();
|
|
32
|
+
}, 100);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
customElements.define("ide-diff-popup", ideDiffPopup);
|
|
38
|
+
|