ninegrid2 6.262.0 → 6.264.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.
@@ -1,51 +1,18 @@
1
1
  import ninegrid from "../index.js";
2
2
 
3
- class aiMyMessage extends HTMLElement
3
+ class aiIngMessage extends HTMLElement
4
4
  {
5
+ #message;
6
+
5
7
  constructor() {
6
8
  super();
7
9
  this.attachShadow({ mode: 'open' });
8
10
  }
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
11
 
44
12
  connectedCallback() {
13
+ //const message = this.getAttribute("message");
45
14
 
46
- const msg = this.getAttribute("message");
47
-
48
- console.log(msg);
15
+ this.#message = ".";
49
16
 
50
17
  this.shadowRoot.innerHTML = `
51
18
  <style>
@@ -53,43 +20,45 @@ class aiMyMessage extends HTMLElement
53
20
  ${ninegrid.getCustomPath(this,"aiMessage.css")}
54
21
  </style>
55
22
 
56
- <div class="line">
57
- aaa
23
+ <div class="wrapper">
24
+ .
58
25
  </div>
59
26
  `;
60
27
 
61
28
  this.#init();
62
29
  };
63
30
 
64
-
65
-
66
31
  #init = () => {
32
+ const interval = setInterval(() => {
33
+ this.#message = this.#message.length < 3 ? this.#message + "." : "";
67
34
 
35
+ this.shadowRoot.querySelector(".wrapper").innerHTML = this.#message;
36
+ }, 500);
37
+ };
38
+ }
68
39
 
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;
40
+ class aiMyMessage extends HTMLElement
41
+ {
42
+ constructor() {
43
+ super();
44
+ this.attachShadow({ mode: 'open' });
45
+ }
46
+
47
+ connectedCallback() {
48
+ const message = this.getAttribute("message");
74
49
 
75
- ["openai","ollama"].forEach(v => {
76
- this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
77
- elem.style.display = (server === v) ? "flex" : "none";
78
- });
79
- });
80
- });
81
- });
50
+ this.shadowRoot.innerHTML = `
51
+ <style>
52
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
53
+ ${ninegrid.getCustomPath(this,"aiMessage.css")}
54
+ </style>
82
55
 
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
- }
56
+ <div class="wrapper">
57
+ ${message}
58
+ </div>
59
+ `;
60
+ };
93
61
  }
94
62
 
63
+ customElements.define("nx-ai-ing-message", aiIngMessage);
95
64
  customElements.define("nx-ai-my-message", aiMyMessage);
@@ -27282,52 +27282,19 @@ class aiSettings extends HTMLElement
27282
27282
 
27283
27283
  customElements.define("nx-ai-settings", aiSettings);
27284
27284
 
27285
- class aiMyMessage extends HTMLElement
27285
+ class aiIngMessage extends HTMLElement
27286
27286
  {
27287
+ #message;
27288
+
27287
27289
  constructor() {
27288
27290
  super();
27289
27291
  this.attachShadow({ mode: 'open' });
27290
27292
  }
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
27293
 
27326
27294
  connectedCallback() {
27295
+ //const message = this.getAttribute("message");
27327
27296
 
27328
- const msg = this.getAttribute("message");
27329
-
27330
- console.log(msg);
27297
+ this.#message = ".";
27331
27298
 
27332
27299
  this.shadowRoot.innerHTML = `
27333
27300
  <style>
@@ -27335,23 +27302,47 @@ class aiMyMessage extends HTMLElement
27335
27302
  ${ninegrid.getCustomPath(this,"aiMessage.css")}
27336
27303
  </style>
27337
27304
 
27338
- <div class="line">
27339
- aaa
27305
+ <div class="wrapper">
27306
+ .
27340
27307
  </div>
27341
27308
  `;
27342
27309
 
27343
27310
  this.#init();
27344
27311
  };
27345
27312
 
27346
-
27347
-
27348
27313
  #init = () => {
27314
+ setInterval(() => {
27315
+ this.#message = this.#message.length < 3 ? this.#message + "." : "";
27349
27316
 
27317
+ this.shadowRoot.querySelector(".wrapper").innerHTML = this.#message;
27318
+ }, 500);
27319
+ };
27320
+ }
27350
27321
 
27351
- return;
27322
+ class aiMyMessage extends HTMLElement
27323
+ {
27324
+ constructor() {
27325
+ super();
27326
+ this.attachShadow({ mode: 'open' });
27352
27327
  }
27328
+
27329
+ connectedCallback() {
27330
+ const message = this.getAttribute("message");
27331
+
27332
+ this.shadowRoot.innerHTML = `
27333
+ <style>
27334
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
27335
+ ${ninegrid.getCustomPath(this,"aiMessage.css")}
27336
+ </style>
27337
+
27338
+ <div class="wrapper">
27339
+ ${message}
27340
+ </div>
27341
+ `;
27342
+ };
27353
27343
  }
27354
27344
 
27345
+ customElements.define("nx-ai-ing-message", aiIngMessage);
27355
27346
  customElements.define("nx-ai-my-message", aiMyMessage);
27356
27347
 
27357
27348
  //import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
@@ -27280,52 +27280,19 @@ class aiSettings extends HTMLElement
27280
27280
 
27281
27281
  customElements.define("nx-ai-settings", aiSettings);
27282
27282
 
27283
- class aiMyMessage extends HTMLElement
27283
+ class aiIngMessage extends HTMLElement
27284
27284
  {
27285
+ #message;
27286
+
27285
27287
  constructor() {
27286
27288
  super();
27287
27289
  this.attachShadow({ mode: 'open' });
27288
27290
  }
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
27291
 
27324
27292
  connectedCallback() {
27293
+ //const message = this.getAttribute("message");
27325
27294
 
27326
- const msg = this.getAttribute("message");
27327
-
27328
- console.log(msg);
27295
+ this.#message = ".";
27329
27296
 
27330
27297
  this.shadowRoot.innerHTML = `
27331
27298
  <style>
@@ -27333,23 +27300,47 @@ class aiMyMessage extends HTMLElement
27333
27300
  ${ninegrid.getCustomPath(this,"aiMessage.css")}
27334
27301
  </style>
27335
27302
 
27336
- <div class="line">
27337
- aaa
27303
+ <div class="wrapper">
27304
+ .
27338
27305
  </div>
27339
27306
  `;
27340
27307
 
27341
27308
  this.#init();
27342
27309
  };
27343
27310
 
27344
-
27345
-
27346
27311
  #init = () => {
27312
+ setInterval(() => {
27313
+ this.#message = this.#message.length < 3 ? this.#message + "." : "";
27347
27314
 
27315
+ this.shadowRoot.querySelector(".wrapper").innerHTML = this.#message;
27316
+ }, 500);
27317
+ };
27318
+ }
27348
27319
 
27349
- return;
27320
+ class aiMyMessage extends HTMLElement
27321
+ {
27322
+ constructor() {
27323
+ super();
27324
+ this.attachShadow({ mode: 'open' });
27350
27325
  }
27326
+
27327
+ connectedCallback() {
27328
+ const message = this.getAttribute("message");
27329
+
27330
+ this.shadowRoot.innerHTML = `
27331
+ <style>
27332
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
27333
+ ${ninegrid.getCustomPath(this,"aiMessage.css")}
27334
+ </style>
27335
+
27336
+ <div class="wrapper">
27337
+ ${message}
27338
+ </div>
27339
+ `;
27340
+ };
27351
27341
  }
27352
27342
 
27343
+ customElements.define("nx-ai-ing-message", aiIngMessage);
27353
27344
  customElements.define("nx-ai-my-message", aiMyMessage);
27354
27345
 
27355
27346
  //import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
@@ -1,12 +1,10 @@
1
1
  :host {
2
2
  display: flex;
3
- justify-content: flex-end;
4
3
  padding: 5px;
5
4
  max-width: 70%;
6
5
  padding: 8px 16px;
7
6
  border-radius: 8px;
8
7
  font-size: 14px;
9
- background-color: #fef01b;
10
8
  text-align: left;
11
9
  color: #333;
12
10
  align-self: flex-end;
@@ -15,17 +13,6 @@
15
13
  }
16
14
 
17
15
  :host(nx-ai-my-message) {
18
- display: flex;
19
16
  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
- }
17
+ background-color: #fef01b;
18
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.262.0",
4
+ "version": "6.264.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -1,51 +1,18 @@
1
1
  import ninegrid from "../index.js";
2
2
 
3
- class aiMyMessage extends HTMLElement
3
+ class aiIngMessage extends HTMLElement
4
4
  {
5
+ #message;
6
+
5
7
  constructor() {
6
8
  super();
7
9
  this.attachShadow({ mode: 'open' });
8
10
  }
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
11
 
44
12
  connectedCallback() {
13
+ //const message = this.getAttribute("message");
45
14
 
46
- const msg = this.getAttribute("message");
47
-
48
- console.log(msg);
15
+ this.#message = ".";
49
16
 
50
17
  this.shadowRoot.innerHTML = `
51
18
  <style>
@@ -53,43 +20,45 @@ class aiMyMessage extends HTMLElement
53
20
  ${ninegrid.getCustomPath(this,"aiMessage.css")}
54
21
  </style>
55
22
 
56
- <div class="line">
57
- aaa
23
+ <div class="wrapper">
24
+ .
58
25
  </div>
59
26
  `;
60
27
 
61
28
  this.#init();
62
29
  };
63
30
 
64
-
65
-
66
31
  #init = () => {
32
+ const interval = setInterval(() => {
33
+ this.#message = this.#message.length < 3 ? this.#message + "." : "";
67
34
 
35
+ this.shadowRoot.querySelector(".wrapper").innerHTML = this.#message;
36
+ }, 500);
37
+ };
38
+ }
68
39
 
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;
40
+ class aiMyMessage extends HTMLElement
41
+ {
42
+ constructor() {
43
+ super();
44
+ this.attachShadow({ mode: 'open' });
45
+ }
46
+
47
+ connectedCallback() {
48
+ const message = this.getAttribute("message");
74
49
 
75
- ["openai","ollama"].forEach(v => {
76
- this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
77
- elem.style.display = (server === v) ? "flex" : "none";
78
- });
79
- });
80
- });
81
- });
50
+ this.shadowRoot.innerHTML = `
51
+ <style>
52
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
53
+ ${ninegrid.getCustomPath(this,"aiMessage.css")}
54
+ </style>
82
55
 
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
- }
56
+ <div class="wrapper">
57
+ ${message}
58
+ </div>
59
+ `;
60
+ };
93
61
  }
94
62
 
63
+ customElements.define("nx-ai-ing-message", aiIngMessage);
95
64
  customElements.define("nx-ai-my-message", aiMyMessage);
@@ -1,12 +1,10 @@
1
1
  :host {
2
2
  display: flex;
3
- justify-content: flex-end;
4
3
  padding: 5px;
5
4
  max-width: 70%;
6
5
  padding: 8px 16px;
7
6
  border-radius: 8px;
8
7
  font-size: 14px;
9
- background-color: #fef01b;
10
8
  text-align: left;
11
9
  color: #333;
12
10
  align-self: flex-end;
@@ -15,17 +13,6 @@
15
13
  }
16
14
 
17
15
  :host(nx-ai-my-message) {
18
- display: flex;
19
16
  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
- }
17
+ background-color: #fef01b;
18
+ }