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