@kerkhoff-ict/solora 2.2.1 → 2.3.1

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.
Files changed (3) hide show
  1. package/dist/index.css +137 -33
  2. package/dist/index.js +79 -104
  3. package/package.json +1 -1
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,79 +474,147 @@
438
474
  BlinkMacSystemFont,
439
475
  "Segoe UI",
440
476
  Roboto,
477
+ Helvetica,
478
+ Arial,
441
479
  sans-serif;
480
+ cursor: pointer;
481
+ user-select: none;
442
482
  }
443
- .sol-btn {
444
- padding: 0.5rem 0.8rem;
483
+ .dropdown-btn {
484
+ padding: 0.3rem 0.4rem;
445
485
  border-radius: 12px;
446
486
  border: 1px solid rgba(0, 0, 0, 0.1);
447
487
  background: var(--color-bg, #fefefe);
448
488
  color: var(--color-text-dark, #000);
449
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
489
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
450
490
  transition: all 0.2s ease;
451
491
  display: flex;
452
492
  align-items: center;
453
493
  justify-content: space-between;
454
- gap: 10px;
455
- cursor: pointer;
456
- user-select: none;
494
+ white-space: nowrap;
495
+ overflow: hidden;
496
+ text-overflow: ellipsis;
497
+ }
498
+ .dropdown-btn:hover {
499
+ background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
457
500
  }
458
- .sol-btn::after {
501
+ .dropdown-btn:after {
459
502
  content: "\25be";
460
- font-size: 0.8rem;
503
+ margin-left: 0.5rem;
504
+ font-size: 0.75rem;
461
505
  transition: transform 0.2s ease;
462
506
  }
463
- .sol-container.open .sol-btn::after {
507
+ .dropdown.open .dropdown-btn:after {
464
508
  transform: rotate(180deg);
465
509
  }
466
- .sol-menu {
510
+ .dropdown-content {
467
511
  position: absolute;
468
512
  top: 100%;
469
513
  left: 0;
470
- min-width: 100%;
471
- margin-top: 0.5rem;
514
+ width: 100%;
515
+ min-width: 10rem;
472
516
  border-radius: 12px;
473
- background: rgba(255, 255, 255, 0.7);
517
+ margin-top: 0.5rem;
518
+ overflow: hidden;
519
+ overflow-y: auto;
520
+ background: transparent;
474
521
  border: 1px solid rgba(255, 255, 255, 0.3);
475
522
  backdrop-filter: blur(12px);
476
523
  -webkit-backdrop-filter: blur(12px);
477
524
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
478
- z-index: 1000;
525
+ max-height: 15rem;
526
+ scrollbar-width: thin;
527
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
479
528
  opacity: 0;
480
529
  transform: translateY(-10px) scale(0.95);
481
530
  pointer-events: none;
482
531
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
483
- overflow: hidden;
532
+ z-index: 1000;
533
+ }
534
+ .dropdown-content::-webkit-scrollbar {
535
+ width: 6px;
536
+ }
537
+ .dropdown-content::-webkit-scrollbar-thumb {
538
+ background: rgba(0, 0, 0, 0.2);
539
+ border-radius: 3px;
484
540
  }
485
- .sol-container.open .sol-menu {
541
+ .dropdown-content::-webkit-scrollbar-track {
542
+ background: transparent;
543
+ }
544
+ .dropdown.open .dropdown-content {
486
545
  opacity: 1;
487
546
  transform: translateY(0) scale(1);
488
547
  pointer-events: auto;
489
548
  }
490
- .sol-item {
491
- padding: 0.6rem 0.8rem;
492
- transition: background 0.2s;
493
- 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;
494
553
  cursor: pointer;
495
554
  }
496
- .sol-item:hover {
555
+ .dropdown-item:hover {
497
556
  background: rgba(0, 0, 0, 0.05);
498
557
  }
499
- .sol-item.active {
500
- background: rgba(0, 0, 0, 0.08);
558
+ .dropdown-item.active {
501
559
  font-weight: 600;
560
+ background: rgba(0, 0, 0, 0.1);
502
561
  }
503
- :root.dark .sol-btn {
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);
575
+ }
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 {
504
583
  background: #1c1c1e;
505
- color: #fff;
506
- 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);
507
587
  }
508
- :root.dark .sol-menu {
509
- background: rgba(28, 28, 30, 0.7);
510
- color: #fff;
588
+ :root.dark .dropdown-btn:hover {
589
+ background: rgba(255, 255, 255, 0.05);
511
590
  }
512
- :root.dark .sol-item {
513
- 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);
514
618
  }
515
619
 
516
620
  /* src/components/input.css */
package/dist/index.js CHANGED
@@ -1741,66 +1741,6 @@ var require_components2 = __commonJS({
1741
1741
  }
1742
1742
  });
1743
1743
 
1744
- // src/components/sol-core.js
1745
- function initSolCore() {
1746
- const elements = document.querySelectorAll('[class*="sol-dropdown-w-["]');
1747
- elements.forEach((el) => {
1748
- const widthMatch = el.className.match(/sol-dropdown-w-\[(.*?)\]/);
1749
- if (widthMatch && widthMatch[1]) {
1750
- el.style.width = widthMatch[1];
1751
- const btn = el.querySelector(".sol-btn");
1752
- if (btn) btn.style.width = "100%";
1753
- }
1754
- });
1755
- }
1756
-
1757
- // src/components/sol-select.js
1758
- function initSolSelect() {
1759
- document.addEventListener("click", (e) => {
1760
- const btn = e.target.closest(".sol-select .sol-btn");
1761
- const item = e.target.closest(".sol-select .sol-item");
1762
- if (btn) {
1763
- e.stopPropagation();
1764
- const parent = btn.parentElement;
1765
- document.querySelectorAll(".sol-container.open").forEach((openEl) => {
1766
- if (openEl !== parent) openEl.classList.remove("open");
1767
- });
1768
- parent.classList.toggle("open");
1769
- }
1770
- if (item) {
1771
- const select = item.closest(".sol-select");
1772
- const button = select.querySelector(".sol-btn");
1773
- const input = select.querySelector('input[type="hidden"]');
1774
- button.innerText = item.innerText;
1775
- if (input) {
1776
- input.value = item.dataset.value || item.innerText;
1777
- input.dispatchEvent(new Event("change", { bubbles: true }));
1778
- }
1779
- select.querySelectorAll(".sol-item").forEach((i) => i.classList.remove("active"));
1780
- item.classList.add("active");
1781
- select.classList.remove("open");
1782
- }
1783
- });
1784
- }
1785
-
1786
- // src/components/sol-dropdown.js
1787
- function initSolDropdown() {
1788
- document.addEventListener("click", (e) => {
1789
- const btn = e.target.closest(".sol-dropdown .sol-btn");
1790
- const item = e.target.closest(".sol-dropdown .sol-item");
1791
- if (btn) {
1792
- e.stopPropagation();
1793
- btn.parentElement.classList.toggle("open");
1794
- }
1795
- if (item) {
1796
- item.closest(".sol-dropdown").classList.remove("open");
1797
- }
1798
- if (!e.target.closest(".sol-container")) {
1799
- document.querySelectorAll(".sol-container").forEach((el) => el.classList.remove("open"));
1800
- }
1801
- });
1802
- }
1803
-
1804
1744
  // src/components/codeblock.js
1805
1745
  var import_prismjs = __toESM(require_prism());
1806
1746
  var import_components = __toESM(require_components2());
@@ -1907,6 +1847,77 @@ function initMaximizeButton(block, maximizeBtn) {
1907
1847
  });
1908
1848
  }
1909
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
+
1910
1921
  // src/components/contextMenu.js
1911
1922
  function initContextMenu() {
1912
1923
  let menu = document.querySelector(".sol-context-menu");
@@ -2258,53 +2269,17 @@ function initThemeToggle(elementSelector = ".sol-theme-toggle") {
2258
2269
  }
2259
2270
 
2260
2271
  // src/index.js
2261
- var startSolora = () => {
2262
- try {
2263
- initSolCore();
2264
- } catch (e) {
2265
- console.error("Solora Core Error:", e);
2266
- }
2267
- try {
2268
- initSolSelect();
2269
- } catch (e) {
2270
- console.error("Solora Select Error:", e);
2271
- }
2272
- try {
2273
- initSolDropdown();
2274
- } catch (e) {
2275
- console.error("Solora Dropdown Error:", e);
2276
- }
2277
- try {
2278
- initThemeToggle();
2279
- } catch (e) {
2280
- console.error("Solora Theme Error:", e);
2281
- }
2282
- try {
2283
- initCodeblocks();
2284
- } catch (e) {
2285
- console.error("Solora Codeblock Error:", e);
2286
- }
2287
- try {
2288
- initContextMenu();
2289
- } catch (e) {
2290
- console.error("Solora ContextMenu Error:", e);
2291
- }
2292
- };
2272
+ function initAll() {
2273
+ initCodeblocks();
2274
+ initDropdowns();
2275
+ initContextMenu();
2276
+ initThemeToggle();
2277
+ }
2293
2278
  if (typeof window !== "undefined") {
2294
- window.Solora = { reinit: startSolora };
2295
- if (document.readyState === "loading") {
2296
- document.addEventListener("DOMContentLoaded", startSolora);
2297
- } else {
2298
- startSolora();
2299
- }
2279
+ document.addEventListener("DOMContentLoaded", initAll);
2300
2280
  }
2301
2281
  export {
2302
- initCodeblocks,
2303
- initContextMenu,
2304
- initSolCore,
2305
- initSolDropdown,
2306
- initSolSelect,
2307
- initThemeToggle
2282
+ initAll
2308
2283
  };
2309
2284
  /*! Bundled license information:
2310
2285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerkhoff-ict/solora",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
4
  "description": "Simple CSS component library",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/index.css",