ninegrid2 6.257.0 → 6.259.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.
@@ -0,0 +1,95 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class aiMyMessage extends HTMLElement
4
+ {
5
+ constructor() {
6
+ super();
7
+ this.attachShadow({ mode: 'open' });
8
+ }
9
+
10
+ get server() {
11
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
12
+ };
13
+ set server(v) {
14
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
15
+ if (elem) elem.checked = true;
16
+
17
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
18
+ el.dispatchEvent(new Event("change"));
19
+ });
20
+
21
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
22
+ detail: { server: this.server, model: this.model }
23
+ }));
24
+ };
25
+
26
+ get model() {
27
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
28
+ };
29
+ set model(v) {
30
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
31
+ if (elem) {
32
+ elem.value = v;
33
+ elem.dispatchEvent(new Event("change"));
34
+ }
35
+
36
+ /**
37
+ this.dispatchEvent(new CustomEvent("setting-change", {
38
+ detail: { server: this.server, model: this.model }
39
+ })); */
40
+ };
41
+
42
+
43
+
44
+ connectedCallback() {
45
+
46
+ const msg = this.getAttribute("message");
47
+
48
+ console.log(msg);
49
+
50
+ this.shadowRoot.innerHTML = `
51
+ <style>
52
+ @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/aiMessage.css";
53
+ ${ninegrid.getCustomPath(this,"ngInputText.css")}
54
+ </style>
55
+
56
+ <div class="line">
57
+ aaa
58
+ </div>
59
+ `;
60
+
61
+ this.#init();
62
+ };
63
+
64
+
65
+
66
+ #init = () => {
67
+
68
+
69
+ return;
70
+
71
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
72
+ radio.addEventListener("change", () => {
73
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
74
+
75
+ ["openai","ollama"].forEach(v => {
76
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
77
+ elem.style.display = (server === v) ? "flex" : "none";
78
+ });
79
+ });
80
+ });
81
+ });
82
+
83
+ this.shadowRoot.querySelectorAll('#ollamaModel,#openaiModel,input[name="server"]').forEach(el => {
84
+ //console.log(el);
85
+ el.addEventListener("change", e => {
86
+ //console.log(e);
87
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
88
+ detail: { server: this.server, model: this.model }
89
+ }));
90
+ });
91
+ });
92
+ }
93
+ }
94
+
95
+ customElements.define("nx-ai-my-message", aiMyMessage);
@@ -10725,8 +10725,6 @@ class ninegrid {
10725
10725
  });
10726
10726
  }
10727
10727
 
10728
- console.log("shadow" in Element.prototype);
10729
-
10730
10728
  if (!("shadow" in Element.prototype)) {
10731
10729
  Object.defineProperty(Element.prototype, "shadow", {
10732
10730
  get: function () {
@@ -19535,9 +19533,11 @@ class ngMaxPopup extends HTMLElement
19535
19533
  }
19536
19534
 
19537
19535
  popup = () => {
19538
- //console.log(this.#owner.data);
19539
- this.#grd.data.assign(this.#owner.data.get());
19540
- this.shadowRoot.querySelector('dialog').showModal();
19536
+ setTimeout(() => {
19537
+ /** 생성 즉시 호출시 오류 (this.#grd.data null) */
19538
+ this.#grd.data.assign(this.#owner.data.get());
19539
+ this.shadowRoot.querySelector('dialog').showModal();
19540
+ }, 100);
19541
19541
  };
19542
19542
  }
19543
19543
 
@@ -19674,9 +19674,9 @@ class ngMenu extends HTMLElement
19674
19674
  //if (ninegrid.j.querySelectorAll(this.#owner).hasClass("ng-maximize")) {
19675
19675
  $('ng-max-popup', this.#owner.shadowRoot).remove();
19676
19676
  $(this.#owner.shadowRoot).append($('<ng-max-popup></ng-max-popup>'));
19677
- setTimeout(() => {
19678
- this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
19679
- }, 1000);
19677
+ //setTimeout(() => {
19678
+ this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
19679
+ //}, 100);
19680
19680
 
19681
19681
  //}
19682
19682
  break;
@@ -27282,6 +27282,78 @@ class aiSettings extends HTMLElement
27282
27282
 
27283
27283
  customElements.define("nx-ai-settings", aiSettings);
27284
27284
 
27285
+ class aiMyMessage extends HTMLElement
27286
+ {
27287
+ constructor() {
27288
+ super();
27289
+ this.attachShadow({ mode: 'open' });
27290
+ }
27291
+
27292
+ get server() {
27293
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
27294
+ };
27295
+ set server(v) {
27296
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27297
+ if (elem) elem.checked = true;
27298
+
27299
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
27300
+ el.dispatchEvent(new Event("change"));
27301
+ });
27302
+
27303
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
27304
+ detail: { server: this.server, model: this.model }
27305
+ }));
27306
+ };
27307
+
27308
+ get model() {
27309
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
27310
+ };
27311
+ set model(v) {
27312
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27313
+ if (elem) {
27314
+ elem.value = v;
27315
+ elem.dispatchEvent(new Event("change"));
27316
+ }
27317
+
27318
+ /**
27319
+ this.dispatchEvent(new CustomEvent("setting-change", {
27320
+ detail: { server: this.server, model: this.model }
27321
+ })); */
27322
+ };
27323
+
27324
+
27325
+
27326
+ connectedCallback() {
27327
+
27328
+ const msg = this.getAttribute("message");
27329
+
27330
+ console.log(msg);
27331
+
27332
+ this.shadowRoot.innerHTML = `
27333
+ <style>
27334
+ @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/aiMessage.css";
27335
+ ${ninegrid.getCustomPath(this,"ngInputText.css")}
27336
+ </style>
27337
+
27338
+ <div class="line">
27339
+ aaa
27340
+ </div>
27341
+ `;
27342
+
27343
+ this.#init();
27344
+ };
27345
+
27346
+
27347
+
27348
+ #init = () => {
27349
+
27350
+
27351
+ return;
27352
+ }
27353
+ }
27354
+
27355
+ customElements.define("nx-ai-my-message", aiMyMessage);
27356
+
27285
27357
  //import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
27286
27358
 
27287
27359
 
@@ -10723,8 +10723,6 @@ class ninegrid {
10723
10723
  });
10724
10724
  }
10725
10725
 
10726
- console.log("shadow" in Element.prototype);
10727
-
10728
10726
  if (!("shadow" in Element.prototype)) {
10729
10727
  Object.defineProperty(Element.prototype, "shadow", {
10730
10728
  get: function () {
@@ -19533,9 +19531,11 @@ class ngMaxPopup extends HTMLElement
19533
19531
  }
19534
19532
 
19535
19533
  popup = () => {
19536
- //console.log(this.#owner.data);
19537
- this.#grd.data.assign(this.#owner.data.get());
19538
- this.shadowRoot.querySelector('dialog').showModal();
19534
+ setTimeout(() => {
19535
+ /** 생성 즉시 호출시 오류 (this.#grd.data null) */
19536
+ this.#grd.data.assign(this.#owner.data.get());
19537
+ this.shadowRoot.querySelector('dialog').showModal();
19538
+ }, 100);
19539
19539
  };
19540
19540
  }
19541
19541
 
@@ -19672,9 +19672,9 @@ class ngMenu extends HTMLElement
19672
19672
  //if (ninegrid.j.querySelectorAll(this.#owner).hasClass("ng-maximize")) {
19673
19673
  $('ng-max-popup', this.#owner.shadowRoot).remove();
19674
19674
  $(this.#owner.shadowRoot).append($('<ng-max-popup></ng-max-popup>'));
19675
- setTimeout(() => {
19676
- this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
19677
- }, 1000);
19675
+ //setTimeout(() => {
19676
+ this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
19677
+ //}, 100);
19678
19678
 
19679
19679
  //}
19680
19680
  break;
@@ -27280,6 +27280,78 @@ class aiSettings extends HTMLElement
27280
27280
 
27281
27281
  customElements.define("nx-ai-settings", aiSettings);
27282
27282
 
27283
+ class aiMyMessage extends HTMLElement
27284
+ {
27285
+ constructor() {
27286
+ super();
27287
+ this.attachShadow({ mode: 'open' });
27288
+ }
27289
+
27290
+ get server() {
27291
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
27292
+ };
27293
+ set server(v) {
27294
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27295
+ if (elem) elem.checked = true;
27296
+
27297
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
27298
+ el.dispatchEvent(new Event("change"));
27299
+ });
27300
+
27301
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
27302
+ detail: { server: this.server, model: this.model }
27303
+ }));
27304
+ };
27305
+
27306
+ get model() {
27307
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
27308
+ };
27309
+ set model(v) {
27310
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27311
+ if (elem) {
27312
+ elem.value = v;
27313
+ elem.dispatchEvent(new Event("change"));
27314
+ }
27315
+
27316
+ /**
27317
+ this.dispatchEvent(new CustomEvent("setting-change", {
27318
+ detail: { server: this.server, model: this.model }
27319
+ })); */
27320
+ };
27321
+
27322
+
27323
+
27324
+ connectedCallback() {
27325
+
27326
+ const msg = this.getAttribute("message");
27327
+
27328
+ console.log(msg);
27329
+
27330
+ this.shadowRoot.innerHTML = `
27331
+ <style>
27332
+ @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/aiMessage.css";
27333
+ ${ninegrid.getCustomPath(this,"ngInputText.css")}
27334
+ </style>
27335
+
27336
+ <div class="line">
27337
+ aaa
27338
+ </div>
27339
+ `;
27340
+
27341
+ this.#init();
27342
+ };
27343
+
27344
+
27345
+
27346
+ #init = () => {
27347
+
27348
+
27349
+ return;
27350
+ }
27351
+ }
27352
+
27353
+ customElements.define("nx-ai-my-message", aiMyMessage);
27354
+
27283
27355
  //import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
27284
27356
 
27285
27357
 
@@ -0,0 +1,31 @@
1
+ :host {
2
+ display: flex;
3
+ justify-content: flex-end;
4
+ padding: 5px;
5
+ max-width: 70%;
6
+ padding: 8px 16px;
7
+ border-radius: 8px;
8
+ font-size: 14px;
9
+ background-color: #fef01b;
10
+ text-align: left;
11
+ color: #333;
12
+ align-self: flex-end;
13
+ position: relative;
14
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15);
15
+ }
16
+
17
+ :host(nx-ai-my-message) {
18
+ display: flex;
19
+ justify-content: flex-end;
20
+ padding: 5px;
21
+ max-width: 70%;
22
+ padding: 8px 16px;
23
+ border-radius: 8px;
24
+ font-size: 14px;
25
+ background-color: red;
26
+ text-align: left;
27
+ color: #333;
28
+ align-self: flex-end;
29
+ position: relative;
30
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15);
31
+ }
@@ -77,9 +77,11 @@ class ngMaxPopup extends HTMLElement
77
77
  }
78
78
 
79
79
  popup = () => {
80
- //console.log(this.#owner.data);
81
- this.#grd.data.assign(this.#owner.data.get());
82
- this.shadowRoot.querySelector('dialog').showModal();
80
+ setTimeout(() => {
81
+ /** 생성 즉시 호출시 오류 (this.#grd.data null) */
82
+ this.#grd.data.assign(this.#owner.data.get());
83
+ this.shadowRoot.querySelector('dialog').showModal();
84
+ }, 100);
83
85
  };
84
86
  }
85
87
 
@@ -133,9 +133,9 @@ class ngMenu extends HTMLElement
133
133
  //if (ninegrid.j.querySelectorAll(this.#owner).hasClass("ng-maximize")) {
134
134
  $('ng-max-popup', this.#owner.shadowRoot).remove();
135
135
  $(this.#owner.shadowRoot).append($('<ng-max-popup></ng-max-popup>'));
136
- setTimeout(() => {
137
- this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
138
- }, 1000);
136
+ //setTimeout(() => {
137
+ this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
138
+ //}, 100);
139
139
 
140
140
  //}
141
141
  break;
package/dist/index.js CHANGED
@@ -100,6 +100,7 @@ import "./etc/nxTopMenu.js";
100
100
  //import "./etc/object-observe.js";
101
101
 
102
102
  import "./ai/aiSettings.js";
103
+ import "./ai/aiMessage.js";
103
104
 
104
105
  if (typeof window !== "undefined") {
105
106
  //window.ninegrid = window.NG = ninegrid;
@@ -19,8 +19,6 @@ export class ninegrid {
19
19
  });
20
20
  }
21
21
 
22
- console.log("shadow" in Element.prototype);
23
-
24
22
  if (!("shadow" in Element.prototype)) {
25
23
  Object.defineProperty(Element.prototype, "shadow", {
26
24
  get: function () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.257.0",
4
+ "version": "6.259.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -0,0 +1,95 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class aiMyMessage extends HTMLElement
4
+ {
5
+ constructor() {
6
+ super();
7
+ this.attachShadow({ mode: 'open' });
8
+ }
9
+
10
+ get server() {
11
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
12
+ };
13
+ set server(v) {
14
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
15
+ if (elem) elem.checked = true;
16
+
17
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
18
+ el.dispatchEvent(new Event("change"));
19
+ });
20
+
21
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
22
+ detail: { server: this.server, model: this.model }
23
+ }));
24
+ };
25
+
26
+ get model() {
27
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
28
+ };
29
+ set model(v) {
30
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
31
+ if (elem) {
32
+ elem.value = v;
33
+ elem.dispatchEvent(new Event("change"));
34
+ }
35
+
36
+ /**
37
+ this.dispatchEvent(new CustomEvent("setting-change", {
38
+ detail: { server: this.server, model: this.model }
39
+ })); */
40
+ };
41
+
42
+
43
+
44
+ connectedCallback() {
45
+
46
+ const msg = this.getAttribute("message");
47
+
48
+ console.log(msg);
49
+
50
+ this.shadowRoot.innerHTML = `
51
+ <style>
52
+ @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/aiMessage.css";
53
+ ${ninegrid.getCustomPath(this,"ngInputText.css")}
54
+ </style>
55
+
56
+ <div class="line">
57
+ aaa
58
+ </div>
59
+ `;
60
+
61
+ this.#init();
62
+ };
63
+
64
+
65
+
66
+ #init = () => {
67
+
68
+
69
+ return;
70
+
71
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
72
+ radio.addEventListener("change", () => {
73
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
74
+
75
+ ["openai","ollama"].forEach(v => {
76
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
77
+ elem.style.display = (server === v) ? "flex" : "none";
78
+ });
79
+ });
80
+ });
81
+ });
82
+
83
+ this.shadowRoot.querySelectorAll('#ollamaModel,#openaiModel,input[name="server"]').forEach(el => {
84
+ //console.log(el);
85
+ el.addEventListener("change", e => {
86
+ //console.log(e);
87
+ this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
88
+ detail: { server: this.server, model: this.model }
89
+ }));
90
+ });
91
+ });
92
+ }
93
+ }
94
+
95
+ customElements.define("nx-ai-my-message", aiMyMessage);
@@ -0,0 +1,31 @@
1
+ :host {
2
+ display: flex;
3
+ justify-content: flex-end;
4
+ padding: 5px;
5
+ max-width: 70%;
6
+ padding: 8px 16px;
7
+ border-radius: 8px;
8
+ font-size: 14px;
9
+ background-color: #fef01b;
10
+ text-align: left;
11
+ color: #333;
12
+ align-self: flex-end;
13
+ position: relative;
14
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15);
15
+ }
16
+
17
+ :host(nx-ai-my-message) {
18
+ display: flex;
19
+ justify-content: flex-end;
20
+ padding: 5px;
21
+ max-width: 70%;
22
+ padding: 8px 16px;
23
+ border-radius: 8px;
24
+ font-size: 14px;
25
+ background-color: red;
26
+ text-align: left;
27
+ color: #333;
28
+ align-self: flex-end;
29
+ position: relative;
30
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15);
31
+ }
@@ -77,9 +77,11 @@ class ngMaxPopup extends HTMLElement
77
77
  }
78
78
 
79
79
  popup = () => {
80
- //console.log(this.#owner.data);
81
- this.#grd.data.assign(this.#owner.data.get());
82
- this.shadowRoot.querySelector('dialog').showModal();
80
+ setTimeout(() => {
81
+ /** 생성 즉시 호출시 오류 (this.#grd.data null) */
82
+ this.#grd.data.assign(this.#owner.data.get());
83
+ this.shadowRoot.querySelector('dialog').showModal();
84
+ }, 100);
83
85
  };
84
86
  }
85
87
 
package/src/etc/ngMenu.js CHANGED
@@ -133,9 +133,9 @@ class ngMenu extends HTMLElement
133
133
  //if (ninegrid.j.querySelectorAll(this.#owner).hasClass("ng-maximize")) {
134
134
  $('ng-max-popup', this.#owner.shadowRoot).remove();
135
135
  $(this.#owner.shadowRoot).append($('<ng-max-popup></ng-max-popup>'));
136
- setTimeout(() => {
137
- this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
138
- }, 1000);
136
+ //setTimeout(() => {
137
+ this.#owner.shadowRoot.querySelector("ng-max-popup").popup();
138
+ //}, 100);
139
139
 
140
140
  //}
141
141
  break;
package/src/index.js CHANGED
@@ -100,6 +100,7 @@ import "./etc/nxTopMenu.js";
100
100
  //import "./etc/object-observe.js";
101
101
 
102
102
  import "./ai/aiSettings.js";
103
+ import "./ai/aiMessage.js";
103
104
 
104
105
  if (typeof window !== "undefined") {
105
106
  //window.ninegrid = window.NG = ninegrid;
@@ -19,8 +19,6 @@ export class ninegrid {
19
19
  });
20
20
  }
21
21
 
22
- console.log("shadow" in Element.prototype);
23
-
24
22
  if (!("shadow" in Element.prototype)) {
25
23
  Object.defineProperty(Element.prototype, "shadow", {
26
24
  get: function () {