@kerkhoff-ict/solora 2.1.10 → 2.2.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 +33 -137
  2. package/dist/index.js +100 -77
  3. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -175,42 +175,6 @@
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
- }
214
178
 
215
179
  /* src/components/codeblock.css */
216
180
  .codeblock {
@@ -465,8 +429,8 @@ flux\\:input:focus {
465
429
  }
466
430
  }
467
431
 
468
- /* src/components/dropdown.css */
469
- .dropdown {
432
+ /* src/components/dropdown-style.css */
433
+ .sol-container {
470
434
  position: relative;
471
435
  display: inline-block;
472
436
  font-family:
@@ -474,147 +438,79 @@ flux\\:input:focus {
474
438
  BlinkMacSystemFont,
475
439
  "Segoe UI",
476
440
  Roboto,
477
- Helvetica,
478
- Arial,
479
441
  sans-serif;
480
- cursor: pointer;
481
- user-select: none;
482
442
  }
483
- .dropdown-btn {
484
- padding: 0.3rem 0.4rem;
443
+ .sol-btn {
444
+ padding: 0.5rem 0.8rem;
485
445
  border-radius: 12px;
486
446
  border: 1px solid rgba(0, 0, 0, 0.1);
487
447
  background: var(--color-bg, #fefefe);
488
448
  color: var(--color-text-dark, #000);
489
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
449
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
490
450
  transition: all 0.2s ease;
491
451
  display: flex;
492
452
  align-items: center;
493
453
  justify-content: space-between;
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));
454
+ gap: 10px;
455
+ cursor: pointer;
456
+ user-select: none;
500
457
  }
501
- .dropdown-btn:after {
458
+ .sol-btn::after {
502
459
  content: "\25be";
503
- margin-left: 0.5rem;
504
- font-size: 0.75rem;
460
+ font-size: 0.8rem;
505
461
  transition: transform 0.2s ease;
506
462
  }
507
- .dropdown.open .dropdown-btn:after {
463
+ .sol-container.open .sol-btn::after {
508
464
  transform: rotate(180deg);
509
465
  }
510
- .dropdown-content {
466
+ .sol-menu {
511
467
  position: absolute;
512
468
  top: 100%;
513
469
  left: 0;
514
- width: 100%;
515
- min-width: 10rem;
516
- border-radius: 12px;
470
+ min-width: 100%;
517
471
  margin-top: 0.5rem;
518
- overflow: hidden;
519
- overflow-y: auto;
520
- background: transparent;
472
+ border-radius: 12px;
473
+ background: rgba(255, 255, 255, 0.7);
521
474
  border: 1px solid rgba(255, 255, 255, 0.3);
522
475
  backdrop-filter: blur(12px);
523
476
  -webkit-backdrop-filter: blur(12px);
524
477
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
525
- max-height: 15rem;
526
- scrollbar-width: thin;
527
- scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
478
+ z-index: 1000;
528
479
  opacity: 0;
529
480
  transform: translateY(-10px) scale(0.95);
530
481
  pointer-events: none;
531
482
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
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;
540
- }
541
- .dropdown-content::-webkit-scrollbar-track {
542
- background: transparent;
483
+ overflow: hidden;
543
484
  }
544
- .dropdown.open .dropdown-content {
485
+ .sol-container.open .sol-menu {
545
486
  opacity: 1;
546
487
  transform: translateY(0) scale(1);
547
488
  pointer-events: auto;
548
489
  }
549
- .dropdown-item {
550
- padding: 0.3rem 0.4rem;
551
- color: var(--color-text-dark, #000);
552
- transition: background 0.2s, color 0.2s;
490
+ .sol-item {
491
+ padding: 0.6rem 0.8rem;
492
+ transition: background 0.2s;
493
+ color: #000;
553
494
  cursor: pointer;
554
495
  }
555
- .dropdown-item:hover {
496
+ .sol-item:hover {
556
497
  background: rgba(0, 0, 0, 0.05);
557
498
  }
558
- .dropdown-item.active {
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);
575
- }
576
- .dropdown-label {
577
- padding: 0.3rem 0.4rem;
499
+ .sol-item.active {
500
+ background: rgba(0, 0, 0, 0.08);
578
501
  font-weight: 600;
579
- color: rgba(0, 0, 0, 0.6);
580
- cursor: default;
581
502
  }
582
- :root.dark .dropdown-btn {
503
+ :root.dark .sol-btn {
583
504
  background: #1c1c1e;
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);
587
- }
588
- :root.dark .dropdown-btn:hover {
589
- background: rgba(255, 255, 255, 0.05);
590
- }
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);
505
+ color: #fff;
506
+ border-color: rgba(255, 255, 255, 0.1);
612
507
  }
613
- :root.dark .dropdown-label {
614
- color: rgba(255, 255, 255, 0.6);
508
+ :root.dark .sol-menu {
509
+ background: rgba(28, 28, 30, 0.7);
510
+ color: #fff;
615
511
  }
616
- :root.dark .dropdown-content::-webkit-scrollbar-thumb {
617
- background: rgba(255, 255, 255, 0.2);
512
+ :root.dark .sol-item {
513
+ color: #fff;
618
514
  }
619
515
 
620
516
  /* src/components/input.css */
package/dist/index.js CHANGED
@@ -1741,6 +1741,66 @@ 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
+
1744
1804
  // src/components/codeblock.js
1745
1805
  var import_prismjs = __toESM(require_prism());
1746
1806
  var import_components = __toESM(require_components2());
@@ -1847,77 +1907,6 @@ function initMaximizeButton(block, maximizeBtn) {
1847
1907
  });
1848
1908
  }
1849
1909
 
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
-
1921
1910
  // src/components/contextMenu.js
1922
1911
  function initContextMenu() {
1923
1912
  let menu = document.querySelector(".sol-context-menu");
@@ -2269,18 +2258,52 @@ function initThemeToggle(elementSelector = ".sol-theme-toggle") {
2269
2258
  }
2270
2259
 
2271
2260
  // src/index.js
2272
- if (typeof window !== "undefined") {
2273
- document.addEventListener("DOMContentLoaded", () => {
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 {
2274
2283
  initCodeblocks();
2275
- initDropdowns();
2284
+ } catch (e) {
2285
+ console.error("Solora Codeblock Error:", e);
2286
+ }
2287
+ try {
2276
2288
  initContextMenu();
2277
- initThemeToggle();
2278
- });
2289
+ } catch (e) {
2290
+ console.error("Solora ContextMenu Error:", e);
2291
+ }
2292
+ };
2293
+ 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
2300
  }
2280
2301
  export {
2281
2302
  initCodeblocks,
2282
2303
  initContextMenu,
2283
- initDropdowns,
2304
+ initSolCore,
2305
+ initSolDropdown,
2306
+ initSolSelect,
2284
2307
  initThemeToggle
2285
2308
  };
2286
2309
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerkhoff-ict/solora",
3
- "version": "2.1.10",
3
+ "version": "2.2.1",
4
4
  "description": "Simple CSS component library",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/index.css",