ninegrid2 6.117.0 → 6.118.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.
@@ -16,11 +16,13 @@ class aiSettings extends HTMLElement
16
16
  const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
17
17
  if (elem) elem.checked = true;
18
18
 
19
- console.log("----------")
20
19
  this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
21
- console.log(el);
22
20
  el.dispatchEvent(new Event("change"));
23
21
  });
22
+
23
+ this.dispatchEvent(new CustomEvent("setting-change", {
24
+ detail: { server: this.server, model: this.model }
25
+ }));
24
26
  };
25
27
 
26
28
  get model() {
@@ -28,7 +30,15 @@ class aiSettings extends HTMLElement
28
30
  };
29
31
  set model(v) {
30
32
  const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
31
- if (elem) elem.value = v;
33
+ if (elem) {
34
+ elem.value = v;
35
+ elem.dispatchEvent(new Event("change"));
36
+ }
37
+
38
+ /**
39
+ this.dispatchEvent(new CustomEvent("setting-change", {
40
+ detail: { server: this.server, model: this.model }
41
+ })); */
32
42
  };
33
43
 
34
44
 
@@ -106,6 +116,10 @@ class aiSettings extends HTMLElement
106
116
  `;
107
117
 
108
118
  this.#init();
119
+
120
+ setTimeout(() => {
121
+ this.server = "ollama";
122
+ }, 0);
109
123
  };
110
124
 
111
125
 
@@ -117,17 +131,21 @@ class aiSettings extends HTMLElement
117
131
  const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
118
132
 
119
133
  ["openai","ollama"].forEach(v => {
120
- console.log(v);
121
134
  this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
122
- console.log(elem);
123
135
  elem.style.display = (server === v) ? "flex" : "none";
124
136
  });
125
137
  });
126
138
  });
127
139
  });
128
140
 
129
- //this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
130
- this.server = "ollama";
141
+ this.shadowRoot.querySelectorAll('#ollamaModel').forEach(el => {
142
+ el.addEventListener("change", e => {
143
+ console.log(e);
144
+ this.dispatchEvent(new CustomEvent("setting-change", {
145
+ detail: { server: this.server, model: this.model }
146
+ }));
147
+ });
148
+ });
131
149
  }
132
150
  }
133
151
 
@@ -27308,11 +27308,13 @@ class aiSettings extends HTMLElement
27308
27308
  const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27309
27309
  if (elem) elem.checked = true;
27310
27310
 
27311
- console.log("----------");
27312
27311
  this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
27313
- console.log(el);
27314
27312
  el.dispatchEvent(new Event("change"));
27315
27313
  });
27314
+
27315
+ this.dispatchEvent(new CustomEvent("setting-change", {
27316
+ detail: { server: this.server, model: this.model }
27317
+ }));
27316
27318
  };
27317
27319
 
27318
27320
  get model() {
@@ -27320,7 +27322,15 @@ class aiSettings extends HTMLElement
27320
27322
  };
27321
27323
  set model(v) {
27322
27324
  const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27323
- if (elem) elem.value = v;
27325
+ if (elem) {
27326
+ elem.value = v;
27327
+ elem.dispatchEvent(new Event("change"));
27328
+ }
27329
+
27330
+ /**
27331
+ this.dispatchEvent(new CustomEvent("setting-change", {
27332
+ detail: { server: this.server, model: this.model }
27333
+ })); */
27324
27334
  };
27325
27335
 
27326
27336
 
@@ -27398,6 +27408,10 @@ class aiSettings extends HTMLElement
27398
27408
  `;
27399
27409
 
27400
27410
  this.#init();
27411
+
27412
+ setTimeout(() => {
27413
+ this.server = "ollama";
27414
+ }, 0);
27401
27415
  };
27402
27416
 
27403
27417
 
@@ -27409,17 +27423,21 @@ class aiSettings extends HTMLElement
27409
27423
  const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
27410
27424
 
27411
27425
  ["openai","ollama"].forEach(v => {
27412
- console.log(v);
27413
27426
  this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
27414
- console.log(elem);
27415
27427
  elem.style.display = (server === v) ? "flex" : "none";
27416
27428
  });
27417
27429
  });
27418
27430
  });
27419
27431
  });
27420
27432
 
27421
- //this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
27422
- this.server = "ollama";
27433
+ this.shadowRoot.querySelectorAll('#ollamaModel').forEach(el => {
27434
+ el.addEventListener("change", e => {
27435
+ console.log(e);
27436
+ this.dispatchEvent(new CustomEvent("setting-change", {
27437
+ detail: { server: this.server, model: this.model }
27438
+ }));
27439
+ });
27440
+ });
27423
27441
  }
27424
27442
  }
27425
27443
 
@@ -27306,11 +27306,13 @@ class aiSettings extends HTMLElement
27306
27306
  const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27307
27307
  if (elem) elem.checked = true;
27308
27308
 
27309
- console.log("----------");
27310
27309
  this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
27311
- console.log(el);
27312
27310
  el.dispatchEvent(new Event("change"));
27313
27311
  });
27312
+
27313
+ this.dispatchEvent(new CustomEvent("setting-change", {
27314
+ detail: { server: this.server, model: this.model }
27315
+ }));
27314
27316
  };
27315
27317
 
27316
27318
  get model() {
@@ -27318,7 +27320,15 @@ class aiSettings extends HTMLElement
27318
27320
  };
27319
27321
  set model(v) {
27320
27322
  const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27321
- if (elem) elem.value = v;
27323
+ if (elem) {
27324
+ elem.value = v;
27325
+ elem.dispatchEvent(new Event("change"));
27326
+ }
27327
+
27328
+ /**
27329
+ this.dispatchEvent(new CustomEvent("setting-change", {
27330
+ detail: { server: this.server, model: this.model }
27331
+ })); */
27322
27332
  };
27323
27333
 
27324
27334
 
@@ -27396,6 +27406,10 @@ class aiSettings extends HTMLElement
27396
27406
  `;
27397
27407
 
27398
27408
  this.#init();
27409
+
27410
+ setTimeout(() => {
27411
+ this.server = "ollama";
27412
+ }, 0);
27399
27413
  };
27400
27414
 
27401
27415
 
@@ -27407,17 +27421,21 @@ class aiSettings extends HTMLElement
27407
27421
  const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
27408
27422
 
27409
27423
  ["openai","ollama"].forEach(v => {
27410
- console.log(v);
27411
27424
  this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
27412
- console.log(elem);
27413
27425
  elem.style.display = (server === v) ? "flex" : "none";
27414
27426
  });
27415
27427
  });
27416
27428
  });
27417
27429
  });
27418
27430
 
27419
- //this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
27420
- this.server = "ollama";
27431
+ this.shadowRoot.querySelectorAll('#ollamaModel').forEach(el => {
27432
+ el.addEventListener("change", e => {
27433
+ console.log(e);
27434
+ this.dispatchEvent(new CustomEvent("setting-change", {
27435
+ detail: { server: this.server, model: this.model }
27436
+ }));
27437
+ });
27438
+ });
27421
27439
  }
27422
27440
  }
27423
27441
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.117.0",
4
+ "version": "6.118.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -16,11 +16,13 @@ class aiSettings extends HTMLElement
16
16
  const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
17
17
  if (elem) elem.checked = true;
18
18
 
19
- console.log("----------")
20
19
  this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
21
- console.log(el);
22
20
  el.dispatchEvent(new Event("change"));
23
21
  });
22
+
23
+ this.dispatchEvent(new CustomEvent("setting-change", {
24
+ detail: { server: this.server, model: this.model }
25
+ }));
24
26
  };
25
27
 
26
28
  get model() {
@@ -28,7 +30,15 @@ class aiSettings extends HTMLElement
28
30
  };
29
31
  set model(v) {
30
32
  const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
31
- if (elem) elem.value = v;
33
+ if (elem) {
34
+ elem.value = v;
35
+ elem.dispatchEvent(new Event("change"));
36
+ }
37
+
38
+ /**
39
+ this.dispatchEvent(new CustomEvent("setting-change", {
40
+ detail: { server: this.server, model: this.model }
41
+ })); */
32
42
  };
33
43
 
34
44
 
@@ -106,6 +116,10 @@ class aiSettings extends HTMLElement
106
116
  `;
107
117
 
108
118
  this.#init();
119
+
120
+ setTimeout(() => {
121
+ this.server = "ollama";
122
+ }, 0);
109
123
  };
110
124
 
111
125
 
@@ -117,17 +131,21 @@ class aiSettings extends HTMLElement
117
131
  const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
118
132
 
119
133
  ["openai","ollama"].forEach(v => {
120
- console.log(v);
121
134
  this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
122
- console.log(elem);
123
135
  elem.style.display = (server === v) ? "flex" : "none";
124
136
  });
125
137
  });
126
138
  });
127
139
  });
128
140
 
129
- //this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
130
- this.server = "ollama";
141
+ this.shadowRoot.querySelectorAll('#ollamaModel').forEach(el => {
142
+ el.addEventListener("change", e => {
143
+ console.log(e);
144
+ this.dispatchEvent(new CustomEvent("setting-change", {
145
+ detail: { server: this.server, model: this.model }
146
+ }));
147
+ });
148
+ });
131
149
  }
132
150
  }
133
151