ninegrid2 6.109.0 → 6.111.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,8 +2,6 @@
2
2
 
3
3
  class aiSettings extends HTMLElement
4
4
  {
5
- #model;
6
-
7
5
  constructor() {
8
6
  console.log("construct");
9
7
 
@@ -11,23 +9,23 @@ class aiSettings extends HTMLElement
11
9
  this.attachShadow({ mode: 'open' });
12
10
  }
13
11
 
12
+ get server() {
13
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
14
+ };
15
+ set server(v) {
16
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
17
+ if (elem) elem.checked = true;
18
+ };
19
+
14
20
  get model() {
15
- return this.#model?.value || "";
21
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
16
22
  };
17
23
  set model(v) {
18
- console.log(v, this.#model);
19
-
20
- //this.#model = v;
21
-
22
- this.shadowRoot.querySelector("#model").value = this.#model = v;
23
-
24
- //this.#model.value = v;
25
-
26
-
27
- //if (this.#model) {
28
- // this.#model.value = v;
29
- //}
24
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
25
+ if (elem) elem.value = v;
30
26
  };
27
+
28
+
31
29
 
32
30
  connectedCallback() {
33
31
 
@@ -49,6 +47,10 @@ class aiSettings extends HTMLElement
49
47
  justify-content: center;
50
48
  align-items: center;
51
49
  opacity: 0;
50
+ flex-direction: column;
51
+ align-items: flex-start;
52
+ padding-left: 16px;
53
+ gap: 16px;
52
54
  transform: translateX(100%);
53
55
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
54
56
  }
@@ -57,21 +59,69 @@ class aiSettings extends HTMLElement
57
59
  display: flex;
58
60
  animation: slideLeft 0.3s ease-out forwards;
59
61
  }
62
+
63
+ .class {
64
+ display: flex;
65
+
66
+ }
60
67
  </style>
61
68
 
62
- <div">
63
- <div>
64
- <label for="model">Model:</label>
65
- <input id="model" value="${this.#model}"/>
66
- </div>
69
+ <div class="line">
70
+ <label for="server">Server:</label>
71
+ <label><input name="server" type="radio" value="openai" checked>Open AI</label>
72
+ <label><input name="server" type="radio" value="ollama">Ollama</label>
73
+ </div>
74
+ <div class="line openai">
75
+ <label>API Key: <input id="openaiApiKey" value="${this.openaiApiKey}"/></label>
76
+ </div>
77
+ <div class="line ollama">
78
+ <label>Url: <input id="ollamaUrl" value="${this.ollamaUrl}"/></label>
79
+ </div>
80
+ <div class="line openai">
81
+ <label>
82
+ Model:
83
+ <select id="openaiModel">
84
+ <option value="gpt-4">gpt-4</option>
85
+ <option value="gpt-4o">gpt-4o</option>
86
+ <option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
87
+ </select>
88
+ </label>
89
+ </div>
90
+ <div class="line ollama">
91
+ <label>
92
+ Model:
93
+ <select id="ollamaModel">
94
+ <option value="phi4:14b">phi4:14b</option>
95
+ <option value="llama3.1:8b">llama3.1:8b</option>
96
+ <option value="mistral:7b">mistral:7b</option>
97
+ </select>
98
+ </label>
67
99
  </div>
68
100
  `;
69
101
 
70
- //this.#model = this.shadowRoot.querySelector("#model");
71
-
72
- //console.log(this.#model);
73
- //this.classList.add("ai-settings");
102
+ this.#init();
74
103
  };
104
+
105
+
106
+
107
+ #init = () => {
108
+
109
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
110
+ radio.addEventListener("change", () => {
111
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
112
+
113
+ ["openai","ollama"].forEach(v => {
114
+ console.log(v);
115
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
116
+ console.log(elem);
117
+ elem.style.display = (server === v) ? "flex" : "none";
118
+ });
119
+ });
120
+ });
121
+ });
122
+
123
+ this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
124
+ }
75
125
  }
76
126
 
77
127
  customElements.define("nx-ai-settings", aiSettings);
@@ -27294,8 +27294,6 @@ customElements.define("nx-top-menu", nxTopMenu);
27294
27294
 
27295
27295
  class aiSettings extends HTMLElement
27296
27296
  {
27297
- #model;
27298
-
27299
27297
  constructor() {
27300
27298
  console.log("construct");
27301
27299
 
@@ -27303,23 +27301,23 @@ class aiSettings extends HTMLElement
27303
27301
  this.attachShadow({ mode: 'open' });
27304
27302
  }
27305
27303
 
27304
+ get server() {
27305
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
27306
+ };
27307
+ set server(v) {
27308
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27309
+ if (elem) elem.checked = true;
27310
+ };
27311
+
27306
27312
  get model() {
27307
- return this.#model?.value || "";
27313
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
27308
27314
  };
27309
27315
  set model(v) {
27310
- console.log(v, this.#model);
27311
-
27312
- //this.#model = v;
27313
-
27314
- this.shadowRoot.querySelector("#model").value = this.#model = v;
27315
-
27316
- //this.#model.value = v;
27317
-
27318
-
27319
- //if (this.#model) {
27320
- // this.#model.value = v;
27321
- //}
27316
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27317
+ if (elem) elem.value = v;
27322
27318
  };
27319
+
27320
+
27323
27321
 
27324
27322
  connectedCallback() {
27325
27323
 
@@ -27341,6 +27339,10 @@ class aiSettings extends HTMLElement
27341
27339
  justify-content: center;
27342
27340
  align-items: center;
27343
27341
  opacity: 0;
27342
+ flex-direction: column;
27343
+ align-items: flex-start;
27344
+ padding-left: 16px;
27345
+ gap: 16px;
27344
27346
  transform: translateX(100%);
27345
27347
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
27346
27348
  }
@@ -27349,21 +27351,69 @@ class aiSettings extends HTMLElement
27349
27351
  display: flex;
27350
27352
  animation: slideLeft 0.3s ease-out forwards;
27351
27353
  }
27354
+
27355
+ .class {
27356
+ display: flex;
27357
+
27358
+ }
27352
27359
  </style>
27353
27360
 
27354
- <div">
27355
- <div>
27356
- <label for="model">Model:</label>
27357
- <input id="model" value="${this.#model}"/>
27358
- </div>
27361
+ <div class="line">
27362
+ <label for="server">Server:</label>
27363
+ <label><input name="server" type="radio" value="openai" checked>Open AI</label>
27364
+ <label><input name="server" type="radio" value="ollama">Ollama</label>
27365
+ </div>
27366
+ <div class="line openai">
27367
+ <label>API Key: <input id="openaiApiKey" value="${this.openaiApiKey}"/></label>
27368
+ </div>
27369
+ <div class="line ollama">
27370
+ <label>Url: <input id="ollamaUrl" value="${this.ollamaUrl}"/></label>
27371
+ </div>
27372
+ <div class="line openai">
27373
+ <label>
27374
+ Model:
27375
+ <select id="openaiModel">
27376
+ <option value="gpt-4">gpt-4</option>
27377
+ <option value="gpt-4o">gpt-4o</option>
27378
+ <option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
27379
+ </select>
27380
+ </label>
27381
+ </div>
27382
+ <div class="line ollama">
27383
+ <label>
27384
+ Model:
27385
+ <select id="ollamaModel">
27386
+ <option value="phi4:14b">phi4:14b</option>
27387
+ <option value="llama3.1:8b">llama3.1:8b</option>
27388
+ <option value="mistral:7b">mistral:7b</option>
27389
+ </select>
27390
+ </label>
27359
27391
  </div>
27360
27392
  `;
27361
27393
 
27362
- //this.#model = this.shadowRoot.querySelector("#model");
27363
-
27364
- //console.log(this.#model);
27365
- //this.classList.add("ai-settings");
27394
+ this.#init();
27366
27395
  };
27396
+
27397
+
27398
+
27399
+ #init = () => {
27400
+
27401
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
27402
+ radio.addEventListener("change", () => {
27403
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
27404
+
27405
+ ["openai","ollama"].forEach(v => {
27406
+ console.log(v);
27407
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
27408
+ console.log(elem);
27409
+ elem.style.display = (server === v) ? "flex" : "none";
27410
+ });
27411
+ });
27412
+ });
27413
+ });
27414
+
27415
+ this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
27416
+ }
27367
27417
  }
27368
27418
 
27369
27419
  customElements.define("nx-ai-settings", aiSettings);
@@ -27292,8 +27292,6 @@ customElements.define("nx-top-menu", nxTopMenu);
27292
27292
 
27293
27293
  class aiSettings extends HTMLElement
27294
27294
  {
27295
- #model;
27296
-
27297
27295
  constructor() {
27298
27296
  console.log("construct");
27299
27297
 
@@ -27301,23 +27299,23 @@ class aiSettings extends HTMLElement
27301
27299
  this.attachShadow({ mode: 'open' });
27302
27300
  }
27303
27301
 
27302
+ get server() {
27303
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
27304
+ };
27305
+ set server(v) {
27306
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
27307
+ if (elem) elem.checked = true;
27308
+ };
27309
+
27304
27310
  get model() {
27305
- return this.#model?.value || "";
27311
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
27306
27312
  };
27307
27313
  set model(v) {
27308
- console.log(v, this.#model);
27309
-
27310
- //this.#model = v;
27311
-
27312
- this.shadowRoot.querySelector("#model").value = this.#model = v;
27313
-
27314
- //this.#model.value = v;
27315
-
27316
-
27317
- //if (this.#model) {
27318
- // this.#model.value = v;
27319
- //}
27314
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
27315
+ if (elem) elem.value = v;
27320
27316
  };
27317
+
27318
+
27321
27319
 
27322
27320
  connectedCallback() {
27323
27321
 
@@ -27339,6 +27337,10 @@ class aiSettings extends HTMLElement
27339
27337
  justify-content: center;
27340
27338
  align-items: center;
27341
27339
  opacity: 0;
27340
+ flex-direction: column;
27341
+ align-items: flex-start;
27342
+ padding-left: 16px;
27343
+ gap: 16px;
27342
27344
  transform: translateX(100%);
27343
27345
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
27344
27346
  }
@@ -27347,21 +27349,69 @@ class aiSettings extends HTMLElement
27347
27349
  display: flex;
27348
27350
  animation: slideLeft 0.3s ease-out forwards;
27349
27351
  }
27352
+
27353
+ .class {
27354
+ display: flex;
27355
+
27356
+ }
27350
27357
  </style>
27351
27358
 
27352
- <div">
27353
- <div>
27354
- <label for="model">Model:</label>
27355
- <input id="model" value="${this.#model}"/>
27356
- </div>
27359
+ <div class="line">
27360
+ <label for="server">Server:</label>
27361
+ <label><input name="server" type="radio" value="openai" checked>Open AI</label>
27362
+ <label><input name="server" type="radio" value="ollama">Ollama</label>
27363
+ </div>
27364
+ <div class="line openai">
27365
+ <label>API Key: <input id="openaiApiKey" value="${this.openaiApiKey}"/></label>
27366
+ </div>
27367
+ <div class="line ollama">
27368
+ <label>Url: <input id="ollamaUrl" value="${this.ollamaUrl}"/></label>
27369
+ </div>
27370
+ <div class="line openai">
27371
+ <label>
27372
+ Model:
27373
+ <select id="openaiModel">
27374
+ <option value="gpt-4">gpt-4</option>
27375
+ <option value="gpt-4o">gpt-4o</option>
27376
+ <option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
27377
+ </select>
27378
+ </label>
27379
+ </div>
27380
+ <div class="line ollama">
27381
+ <label>
27382
+ Model:
27383
+ <select id="ollamaModel">
27384
+ <option value="phi4:14b">phi4:14b</option>
27385
+ <option value="llama3.1:8b">llama3.1:8b</option>
27386
+ <option value="mistral:7b">mistral:7b</option>
27387
+ </select>
27388
+ </label>
27357
27389
  </div>
27358
27390
  `;
27359
27391
 
27360
- //this.#model = this.shadowRoot.querySelector("#model");
27361
-
27362
- //console.log(this.#model);
27363
- //this.classList.add("ai-settings");
27392
+ this.#init();
27364
27393
  };
27394
+
27395
+
27396
+
27397
+ #init = () => {
27398
+
27399
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
27400
+ radio.addEventListener("change", () => {
27401
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
27402
+
27403
+ ["openai","ollama"].forEach(v => {
27404
+ console.log(v);
27405
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
27406
+ console.log(elem);
27407
+ elem.style.display = (server === v) ? "flex" : "none";
27408
+ });
27409
+ });
27410
+ });
27411
+ });
27412
+
27413
+ this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
27414
+ }
27365
27415
  }
27366
27416
 
27367
27417
  customElements.define("nx-ai-settings", aiSettings);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.109.0",
4
+ "version": "6.111.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -2,8 +2,6 @@
2
2
 
3
3
  class aiSettings extends HTMLElement
4
4
  {
5
- #model;
6
-
7
5
  constructor() {
8
6
  console.log("construct");
9
7
 
@@ -11,23 +9,23 @@ class aiSettings extends HTMLElement
11
9
  this.attachShadow({ mode: 'open' });
12
10
  }
13
11
 
12
+ get server() {
13
+ return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
14
+ };
15
+ set server(v) {
16
+ const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
17
+ if (elem) elem.checked = true;
18
+ };
19
+
14
20
  get model() {
15
- return this.#model?.value || "";
21
+ return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
16
22
  };
17
23
  set model(v) {
18
- console.log(v, this.#model);
19
-
20
- //this.#model = v;
21
-
22
- this.shadowRoot.querySelector("#model").value = this.#model = v;
23
-
24
- //this.#model.value = v;
25
-
26
-
27
- //if (this.#model) {
28
- // this.#model.value = v;
29
- //}
24
+ const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
25
+ if (elem) elem.value = v;
30
26
  };
27
+
28
+
31
29
 
32
30
  connectedCallback() {
33
31
 
@@ -49,6 +47,10 @@ class aiSettings extends HTMLElement
49
47
  justify-content: center;
50
48
  align-items: center;
51
49
  opacity: 0;
50
+ flex-direction: column;
51
+ align-items: flex-start;
52
+ padding-left: 16px;
53
+ gap: 16px;
52
54
  transform: translateX(100%);
53
55
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
54
56
  }
@@ -57,21 +59,69 @@ class aiSettings extends HTMLElement
57
59
  display: flex;
58
60
  animation: slideLeft 0.3s ease-out forwards;
59
61
  }
62
+
63
+ .class {
64
+ display: flex;
65
+
66
+ }
60
67
  </style>
61
68
 
62
- <div">
63
- <div>
64
- <label for="model">Model:</label>
65
- <input id="model" value="${this.#model}"/>
66
- </div>
69
+ <div class="line">
70
+ <label for="server">Server:</label>
71
+ <label><input name="server" type="radio" value="openai" checked>Open AI</label>
72
+ <label><input name="server" type="radio" value="ollama">Ollama</label>
73
+ </div>
74
+ <div class="line openai">
75
+ <label>API Key: <input id="openaiApiKey" value="${this.openaiApiKey}"/></label>
76
+ </div>
77
+ <div class="line ollama">
78
+ <label>Url: <input id="ollamaUrl" value="${this.ollamaUrl}"/></label>
79
+ </div>
80
+ <div class="line openai">
81
+ <label>
82
+ Model:
83
+ <select id="openaiModel">
84
+ <option value="gpt-4">gpt-4</option>
85
+ <option value="gpt-4o">gpt-4o</option>
86
+ <option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
87
+ </select>
88
+ </label>
89
+ </div>
90
+ <div class="line ollama">
91
+ <label>
92
+ Model:
93
+ <select id="ollamaModel">
94
+ <option value="phi4:14b">phi4:14b</option>
95
+ <option value="llama3.1:8b">llama3.1:8b</option>
96
+ <option value="mistral:7b">mistral:7b</option>
97
+ </select>
98
+ </label>
67
99
  </div>
68
100
  `;
69
101
 
70
- //this.#model = this.shadowRoot.querySelector("#model");
71
-
72
- //console.log(this.#model);
73
- //this.classList.add("ai-settings");
102
+ this.#init();
74
103
  };
104
+
105
+
106
+
107
+ #init = () => {
108
+
109
+ this.shadowRoot.querySelectorAll('input[name="server"]').forEach((radio) => {
110
+ radio.addEventListener("change", () => {
111
+ const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
112
+
113
+ ["openai","ollama"].forEach(v => {
114
+ console.log(v);
115
+ this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
116
+ console.log(elem);
117
+ elem.style.display = (server === v) ? "flex" : "none";
118
+ });
119
+ });
120
+ });
121
+ });
122
+
123
+ this.shadowRoot.querySelector('input[name="server"][value="ollama"]').checked = true;
124
+ }
75
125
  }
76
126
 
77
127
  customElements.define("nx-ai-settings", aiSettings);