@kerkhoff-ict/solora 2.2.0 → 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.
package/dist/index.css CHANGED
@@ -439,8 +439,6 @@
439
439
  "Segoe UI",
440
440
  Roboto,
441
441
  sans-serif;
442
- cursor: pointer;
443
- user-select: none;
444
442
  }
445
443
  .sol-btn {
446
444
  padding: 0.5rem 0.8rem;
@@ -454,9 +452,8 @@
454
452
  align-items: center;
455
453
  justify-content: space-between;
456
454
  gap: 10px;
457
- }
458
- .sol-btn:hover {
459
- background: rgba(0, 0, 0, 0.03);
455
+ cursor: pointer;
456
+ user-select: none;
460
457
  }
461
458
  .sol-btn::after {
462
459
  content: "\25be";
@@ -494,6 +491,7 @@
494
491
  padding: 0.6rem 0.8rem;
495
492
  transition: background 0.2s;
496
493
  color: #000;
494
+ cursor: pointer;
497
495
  }
498
496
  .sol-item:hover {
499
497
  background: rgba(0, 0, 0, 0.05);
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());
@@ -2197,73 +2257,46 @@ function initThemeToggle(elementSelector = ".sol-theme-toggle") {
2197
2257
  });
2198
2258
  }
2199
2259
 
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
2260
  // src/index.js
2258
- if (typeof window !== "undefined") {
2259
- document.addEventListener("DOMContentLoaded", () => {
2261
+ var startSolora = () => {
2262
+ try {
2260
2263
  initSolCore();
2261
- initCodeblocks();
2262
- initContextMenu();
2263
- initThemeToggle();
2264
+ } catch (e) {
2265
+ console.error("Solora Core Error:", e);
2266
+ }
2267
+ try {
2264
2268
  initSolSelect();
2269
+ } catch (e) {
2270
+ console.error("Solora Select Error:", e);
2271
+ }
2272
+ try {
2265
2273
  initSolDropdown();
2266
- });
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
+ };
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
+ }
2267
2300
  }
2268
2301
  export {
2269
2302
  initCodeblocks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerkhoff-ict/solora",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Simple CSS component library",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/index.css",