@kerkhoff-ict/solora 2.2.0 → 2.3.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.
package/dist/index.css CHANGED
@@ -175,6 +175,42 @@
175
175
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
176
176
  }
177
177
  }
178
+ flux\\:button {
179
+ all: unset;
180
+ display: inline-flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ font-weight: 600;
184
+ border-radius: 9999px;
185
+ padding: 0.5rem 1rem;
186
+ cursor: pointer;
187
+ transition: all 0.2s ease;
188
+ background: var(--color-primary, #0071e3);
189
+ color: var(--color-text-light, #fff);
190
+ }
191
+ flux\\:button:hover {
192
+ filter: brightness(0.85);
193
+ }
194
+ flux\\:button.btn-secondary {
195
+ background: var(--color-secondary, #f5f5f5);
196
+ color: var(--color-text-dark, #000);
197
+ border: 2px solid rgba(0, 0, 0, 0.1);
198
+ }
199
+ flux\\:input {
200
+ all: unset;
201
+ width: 100%;
202
+ padding: 0.3rem 0.4rem;
203
+ border-radius: 12px;
204
+ border: 1px solid rgba(0, 0, 0, 0.1);
205
+ background: var(--color-bg, #fefefe);
206
+ color: var(--color-text-dark, #000);
207
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.05);
208
+ transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
209
+ }
210
+ flux\\:input:focus {
211
+ border-color: var(--color-primary, #0071e3);
212
+ box-shadow: 0 0 0 4px var(--color-focus-glow, rgba(0, 113, 227, 0.15));
213
+ }
178
214
 
179
215
  /* src/components/codeblock.css */
180
216
  .codeblock {
@@ -429,8 +465,8 @@
429
465
  }
430
466
  }
431
467
 
432
- /* src/components/dropdown-style.css */
433
- .sol-container {
468
+ /* src/components/dropdown.css */
469
+ .dropdown {
434
470
  position: relative;
435
471
  display: inline-block;
436
472
  font-family:
@@ -438,81 +474,147 @@
438
474
  BlinkMacSystemFont,
439
475
  "Segoe UI",
440
476
  Roboto,
477
+ Helvetica,
478
+ Arial,
441
479
  sans-serif;
442
480
  cursor: pointer;
443
481
  user-select: none;
444
482
  }
445
- .sol-btn {
446
- padding: 0.5rem 0.8rem;
483
+ .dropdown-btn {
484
+ padding: 0.3rem 0.4rem;
447
485
  border-radius: 12px;
448
486
  border: 1px solid rgba(0, 0, 0, 0.1);
449
487
  background: var(--color-bg, #fefefe);
450
488
  color: var(--color-text-dark, #000);
451
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
489
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
452
490
  transition: all 0.2s ease;
453
491
  display: flex;
454
492
  align-items: center;
455
493
  justify-content: space-between;
456
- gap: 10px;
494
+ white-space: nowrap;
495
+ overflow: hidden;
496
+ text-overflow: ellipsis;
457
497
  }
458
- .sol-btn:hover {
459
- background: rgba(0, 0, 0, 0.03);
498
+ .dropdown-btn:hover {
499
+ background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
460
500
  }
461
- .sol-btn::after {
501
+ .dropdown-btn:after {
462
502
  content: "\25be";
463
- font-size: 0.8rem;
503
+ margin-left: 0.5rem;
504
+ font-size: 0.75rem;
464
505
  transition: transform 0.2s ease;
465
506
  }
466
- .sol-container.open .sol-btn::after {
507
+ .dropdown.open .dropdown-btn:after {
467
508
  transform: rotate(180deg);
468
509
  }
469
- .sol-menu {
510
+ .dropdown-content {
470
511
  position: absolute;
471
512
  top: 100%;
472
513
  left: 0;
473
- min-width: 100%;
474
- margin-top: 0.5rem;
514
+ width: 100%;
515
+ min-width: 10rem;
475
516
  border-radius: 12px;
476
- background: rgba(255, 255, 255, 0.7);
517
+ margin-top: 0.5rem;
518
+ overflow: hidden;
519
+ overflow-y: auto;
520
+ background: transparent;
477
521
  border: 1px solid rgba(255, 255, 255, 0.3);
478
522
  backdrop-filter: blur(12px);
479
523
  -webkit-backdrop-filter: blur(12px);
480
524
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
481
- z-index: 1000;
525
+ max-height: 15rem;
526
+ scrollbar-width: thin;
527
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
482
528
  opacity: 0;
483
529
  transform: translateY(-10px) scale(0.95);
484
530
  pointer-events: none;
485
531
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
486
- overflow: hidden;
532
+ z-index: 1000;
533
+ }
534
+ .dropdown-content::-webkit-scrollbar {
535
+ width: 6px;
487
536
  }
488
- .sol-container.open .sol-menu {
537
+ .dropdown-content::-webkit-scrollbar-thumb {
538
+ background: rgba(0, 0, 0, 0.2);
539
+ border-radius: 3px;
540
+ }
541
+ .dropdown-content::-webkit-scrollbar-track {
542
+ background: transparent;
543
+ }
544
+ .dropdown.open .dropdown-content {
489
545
  opacity: 1;
490
546
  transform: translateY(0) scale(1);
491
547
  pointer-events: auto;
492
548
  }
493
- .sol-item {
494
- padding: 0.6rem 0.8rem;
495
- transition: background 0.2s;
496
- color: #000;
549
+ .dropdown-item {
550
+ padding: 0.3rem 0.4rem;
551
+ color: var(--color-text-dark, #000);
552
+ transition: background 0.2s, color 0.2s;
553
+ cursor: pointer;
497
554
  }
498
- .sol-item:hover {
555
+ .dropdown-item:hover {
499
556
  background: rgba(0, 0, 0, 0.05);
500
557
  }
501
- .sol-item.active {
502
- background: rgba(0, 0, 0, 0.08);
558
+ .dropdown-item.active {
503
559
  font-weight: 600;
560
+ background: rgba(0, 0, 0, 0.1);
561
+ }
562
+ .dropdown-item[aria-disabled=true],
563
+ .dropdown-item.placeholder {
564
+ color: rgba(0, 0, 0, 0.4);
565
+ cursor: default;
566
+ pointer-events: none;
567
+ }
568
+ .dropdown input[type=hidden] {
569
+ display: none;
570
+ }
571
+ .dropdown-divider {
572
+ height: 1px;
573
+ margin: 0.25rem 0;
574
+ background: rgba(0, 0, 0, 0.1);
504
575
  }
505
- :root.dark .sol-btn {
576
+ .dropdown-label {
577
+ padding: 0.3rem 0.4rem;
578
+ font-weight: 600;
579
+ color: rgba(0, 0, 0, 0.6);
580
+ cursor: default;
581
+ }
582
+ :root.dark .dropdown-btn {
506
583
  background: #1c1c1e;
507
- color: #fff;
508
- border-color: rgba(255, 255, 255, 0.1);
584
+ color: #f0f0f0;
585
+ border: 1px solid rgba(255, 255, 255, 0.2);
586
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
509
587
  }
510
- :root.dark .sol-menu {
511
- background: rgba(28, 28, 30, 0.7);
512
- color: #fff;
588
+ :root.dark .dropdown-btn:hover {
589
+ background: rgba(255, 255, 255, 0.05);
513
590
  }
514
- :root.dark .sol-item {
515
- color: #fff;
591
+ :root.dark .dropdown-content {
592
+ background: transparent;
593
+ backdrop-filter: blur(12px);
594
+ -webkit-backdrop-filter: blur(12px);
595
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
596
+ }
597
+ :root.dark .dropdown-item {
598
+ color: #f0f0f0;
599
+ }
600
+ :root.dark .dropdown-item:hover {
601
+ background: rgba(255, 255, 255, 0.08);
602
+ }
603
+ :root.dark .dropdown-item.active {
604
+ background: rgba(255, 255, 255, 0.12);
605
+ }
606
+ :root.dark .dropdown-divider {
607
+ background: rgba(255, 255, 255, 0.2);
608
+ }
609
+ :root.dark .dropdown-item[aria-disabled=true],
610
+ :root.dark .dropdown-item.placeholder {
611
+ color: rgba(255, 255, 255, 0.4);
612
+ }
613
+ :root.dark .dropdown-label {
614
+ color: rgba(255, 255, 255, 0.6);
615
+ }
616
+ :root.dark .dropdown-content::-webkit-scrollbar-thumb {
617
+ background: rgba(255, 255, 255, 0.2);
516
618
  }
517
619
 
518
620
  /* src/components/input.css */
package/dist/index.js CHANGED
@@ -1847,6 +1847,77 @@ function initMaximizeButton(block, maximizeBtn) {
1847
1847
  });
1848
1848
  }
1849
1849
 
1850
+ // src/components/dropdown.js
1851
+ function initDropdowns() {
1852
+ if (typeof window === "undefined") return;
1853
+ document.querySelectorAll(".dropdown").forEach((drop) => {
1854
+ if (drop.dataset.initialized) return;
1855
+ drop.dataset.initialized = "true";
1856
+ const btn = drop.querySelector(".dropdown-btn");
1857
+ const content = drop.querySelector(".dropdown-content");
1858
+ if (!btn || !content) return;
1859
+ let hiddenInput = drop.querySelector('input[type="hidden"]');
1860
+ if (!hiddenInput) {
1861
+ hiddenInput = document.createElement("input");
1862
+ hiddenInput.type = "hidden";
1863
+ hiddenInput.name = drop.dataset.name || "dropdown";
1864
+ drop.appendChild(hiddenInput);
1865
+ }
1866
+ const getItems = () => Array.from(content.querySelectorAll('.dropdown-item:not([aria-disabled="true"])'));
1867
+ const setValue = (item) => {
1868
+ if (item.getAttribute("aria-disabled") === "true") return;
1869
+ btn.innerHTML = item.innerHTML;
1870
+ content.querySelectorAll(".dropdown-item").forEach((i) => i.classList.remove("active"));
1871
+ item.classList.add("active");
1872
+ hiddenInput.value = item.dataset.value ?? item.textContent.trim();
1873
+ drop.dispatchEvent(new CustomEvent("change", { detail: hiddenInput.value }));
1874
+ };
1875
+ const initialItem = content.querySelector(".dropdown-item.active") || content.querySelector('.dropdown-item:not([aria-disabled="true"])');
1876
+ if (initialItem) setValue(initialItem);
1877
+ const toggle = () => drop.classList.toggle("open");
1878
+ const close = () => drop.classList.remove("open");
1879
+ btn.addEventListener("click", (e) => {
1880
+ e.stopPropagation();
1881
+ toggle();
1882
+ });
1883
+ document.addEventListener("click", (e) => {
1884
+ if (!drop.contains(e.target)) close();
1885
+ });
1886
+ btn.addEventListener("keydown", (e) => {
1887
+ if (!["ArrowDown", "ArrowUp", "Enter", "Escape"].includes(e.key)) return;
1888
+ const items = getItems();
1889
+ let currentIndex = items.findIndex((i) => i.classList.contains("active"));
1890
+ e.preventDefault();
1891
+ drop.classList.add("open");
1892
+ if (e.key === "ArrowDown") {
1893
+ currentIndex = (currentIndex + 1) % items.length;
1894
+ } else if (e.key === "ArrowUp") {
1895
+ currentIndex = (currentIndex - 1 + items.length) % items.length;
1896
+ } else if (e.key === "Enter") {
1897
+ if (currentIndex >= 0) setValue(items[currentIndex]);
1898
+ close();
1899
+ return;
1900
+ } else if (e.key === "Escape") {
1901
+ close();
1902
+ return;
1903
+ }
1904
+ items.forEach((i) => i.classList.remove("active"));
1905
+ items[currentIndex].classList.add("active");
1906
+ items[currentIndex].scrollIntoView({ block: "nearest" });
1907
+ });
1908
+ content.addEventListener("click", (e) => {
1909
+ const item = e.target.closest(".dropdown-item");
1910
+ if (item) {
1911
+ setValue(item);
1912
+ close();
1913
+ }
1914
+ });
1915
+ btn.setAttribute("tabindex", "0");
1916
+ btn.setAttribute("role", "combobox");
1917
+ btn.setAttribute("aria-haspopup", "listbox");
1918
+ });
1919
+ }
1920
+
1850
1921
  // src/components/contextMenu.js
1851
1922
  function initContextMenu() {
1852
1923
  let menu = document.querySelector(".sol-context-menu");
@@ -2197,81 +2268,18 @@ function initThemeToggle(elementSelector = ".sol-theme-toggle") {
2197
2268
  });
2198
2269
  }
2199
2270
 
2200
- // src/components/sol-core.js
2201
- function initSolCore() {
2202
- const elements = document.querySelectorAll('[class*="sol-dropdown-w-["]');
2203
- elements.forEach((el) => {
2204
- const classList = Array.from(el.classList);
2205
- const widthClass = classList.find((c) => c.startsWith("sol-dropdown-w-["));
2206
- if (widthClass) {
2207
- const widthValue = widthClass.match(/\[(.*?)\]/)[1];
2208
- el.style.width = widthValue;
2209
- const btn = el.querySelector(".sol-btn");
2210
- if (btn) btn.style.width = "100%";
2211
- }
2212
- });
2213
- }
2214
-
2215
- // src/components/sol-select.js
2216
- function initSolSelect() {
2217
- document.querySelectorAll(".sol-select").forEach((select) => {
2218
- const btn = select.querySelector(".sol-btn");
2219
- const items = select.querySelectorAll(".sol-item");
2220
- const input = select.querySelector('input[type="hidden"]');
2221
- btn.addEventListener("click", (e) => {
2222
- e.stopPropagation();
2223
- select.classList.toggle("open");
2224
- });
2225
- items.forEach((item) => {
2226
- item.addEventListener("click", () => {
2227
- const val = item.dataset.value || item.innerText;
2228
- btn.innerText = item.innerText;
2229
- if (input) input.value = val;
2230
- items.forEach((i) => i.classList.remove("active"));
2231
- item.classList.add("active");
2232
- select.classList.remove("open");
2233
- });
2234
- });
2235
- });
2236
- }
2237
-
2238
- // src/components/sol-dropdown.js
2239
- function initSolDropdown() {
2240
- document.querySelectorAll(".sol-dropdown").forEach((dropdown) => {
2241
- const btn = dropdown.querySelector(".sol-btn");
2242
- btn.addEventListener("click", (e) => {
2243
- e.stopPropagation();
2244
- dropdown.classList.toggle("open");
2245
- });
2246
- dropdown.querySelectorAll(".sol-item").forEach((item) => {
2247
- item.addEventListener("click", () => {
2248
- dropdown.classList.remove("open");
2249
- });
2250
- });
2251
- });
2252
- document.addEventListener("click", () => {
2253
- document.querySelectorAll(".sol-container").forEach((el) => el.classList.remove("open"));
2254
- });
2255
- }
2256
-
2257
2271
  // src/index.js
2272
+ function initAll() {
2273
+ initCodeblocks();
2274
+ initDropdowns();
2275
+ initContextMenu();
2276
+ initThemeToggle();
2277
+ }
2258
2278
  if (typeof window !== "undefined") {
2259
- document.addEventListener("DOMContentLoaded", () => {
2260
- initSolCore();
2261
- initCodeblocks();
2262
- initContextMenu();
2263
- initThemeToggle();
2264
- initSolSelect();
2265
- initSolDropdown();
2266
- });
2279
+ document.addEventListener("DOMContentLoaded", initAll);
2267
2280
  }
2268
2281
  export {
2269
- initCodeblocks,
2270
- initContextMenu,
2271
- initSolCore,
2272
- initSolDropdown,
2273
- initSolSelect,
2274
- initThemeToggle
2282
+ initAll
2275
2283
  };
2276
2284
  /*! Bundled license information:
2277
2285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerkhoff-ict/solora",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Simple CSS component library",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/index.css",