fernwell 0.1.0 → 0.2.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/CHANGELOG.md +13 -1
- package/README.md +30 -3
- package/dist/fernwell.cjs +3 -3
- package/dist/fernwell.cjs.map +4 -4
- package/dist/fernwell.css +356 -1
- package/dist/fernwell.esm.js +3 -3
- package/dist/fernwell.esm.js.map +4 -4
- package/dist/fernwell.iife.js +3 -3
- package/dist/fernwell.iife.js.map +4 -4
- package/dist/fernwell.min.css +2 -2
- package/dist/fernwell.tokens.css +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/menu.d.ts +49 -0
- package/dist/table.d.ts +40 -0
- package/package.json +2 -1
package/dist/fernwell.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! fernwell v0.
|
|
1
|
+
/*! fernwell v0.2.0 | MIT | https://github.com/JacobKnaack/fernwell */
|
|
2
2
|
/* src/css/tokens.css */
|
|
3
3
|
@layer fw-tokens {
|
|
4
4
|
:root,
|
|
@@ -549,6 +549,15 @@ textarea.fw-input,
|
|
|
549
549
|
.fw-checkbox input:checked + .fw-box::after {
|
|
550
550
|
opacity: 1;
|
|
551
551
|
}
|
|
552
|
+
.fw-checkbox input:indeterminate + .fw-box {
|
|
553
|
+
background: var(--fw-primary);
|
|
554
|
+
border-color: var(--fw-primary);
|
|
555
|
+
}
|
|
556
|
+
.fw-checkbox input:indeterminate + .fw-box::after {
|
|
557
|
+
opacity: 1;
|
|
558
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8h9' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
559
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8h9' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
560
|
+
}
|
|
552
561
|
.fw-checkbox input:focus-visible + .fw-box {
|
|
553
562
|
box-shadow: var(--fw-focus-ring);
|
|
554
563
|
}
|
|
@@ -1493,6 +1502,158 @@ textarea.fw-input,
|
|
|
1493
1502
|
gap: var(--fw-sp-3);
|
|
1494
1503
|
}
|
|
1495
1504
|
|
|
1505
|
+
/* src/css/components/menu.css */
|
|
1506
|
+
.fw-menu {
|
|
1507
|
+
--fw-menu-indent: var(--fw-sp-4);
|
|
1508
|
+
--fw-menu-row-h: 36px;
|
|
1509
|
+
font-family: var(--fw-font-body);
|
|
1510
|
+
color: var(--fw-text);
|
|
1511
|
+
}
|
|
1512
|
+
.fw-menu-list {
|
|
1513
|
+
list-style: none;
|
|
1514
|
+
margin: 0;
|
|
1515
|
+
padding: 0;
|
|
1516
|
+
display: flex;
|
|
1517
|
+
flex-direction: column;
|
|
1518
|
+
gap: 2px;
|
|
1519
|
+
}
|
|
1520
|
+
.fw-menu-group > .fw-menu-list {
|
|
1521
|
+
margin: 2px 0 0 var(--fw-menu-indent);
|
|
1522
|
+
padding-left: var(--fw-sp-3);
|
|
1523
|
+
border-left: var(--fw-border-w) solid var(--fw-bg-dim);
|
|
1524
|
+
}
|
|
1525
|
+
.fw-menu-link,
|
|
1526
|
+
.fw-menu-summary {
|
|
1527
|
+
display: flex;
|
|
1528
|
+
align-items: center;
|
|
1529
|
+
gap: var(--fw-sp-2);
|
|
1530
|
+
min-height: var(--fw-menu-row-h);
|
|
1531
|
+
padding: 0 var(--fw-sp-3);
|
|
1532
|
+
border-radius: var(--fw-r-sm);
|
|
1533
|
+
color: var(--fw-text);
|
|
1534
|
+
font-family: var(--fw-font-body);
|
|
1535
|
+
font-size: 14px;
|
|
1536
|
+
font-weight: 600;
|
|
1537
|
+
line-height: 1.3;
|
|
1538
|
+
text-decoration: none;
|
|
1539
|
+
text-align: left;
|
|
1540
|
+
background: none;
|
|
1541
|
+
border: none;
|
|
1542
|
+
cursor: pointer;
|
|
1543
|
+
transition: background-color var(--fw-motion-fast) var(--fw-motion-ease), color var(--fw-motion-fast) var(--fw-motion-ease);
|
|
1544
|
+
}
|
|
1545
|
+
@media (hover: hover) {
|
|
1546
|
+
.fw-menu-link:hover,
|
|
1547
|
+
.fw-menu-summary:hover {
|
|
1548
|
+
background: var(--fw-bg);
|
|
1549
|
+
text-decoration: none;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
.fw-menu-link:focus-visible,
|
|
1553
|
+
.fw-menu-summary:focus-visible {
|
|
1554
|
+
outline: none;
|
|
1555
|
+
box-shadow: var(--fw-focus-ring);
|
|
1556
|
+
}
|
|
1557
|
+
.fw-menu-link[aria-current=page] {
|
|
1558
|
+
background: var(--fw-secondary-bg);
|
|
1559
|
+
color: var(--fw-secondary);
|
|
1560
|
+
}
|
|
1561
|
+
.fw-menu-summary.is-current {
|
|
1562
|
+
color: var(--fw-secondary);
|
|
1563
|
+
}
|
|
1564
|
+
.fw-menu-summary {
|
|
1565
|
+
list-style: none;
|
|
1566
|
+
user-select: none;
|
|
1567
|
+
}
|
|
1568
|
+
.fw-menu-summary::-webkit-details-marker {
|
|
1569
|
+
display: none;
|
|
1570
|
+
}
|
|
1571
|
+
.fw-menu-summary::after {
|
|
1572
|
+
content: "";
|
|
1573
|
+
flex-shrink: 0;
|
|
1574
|
+
width: 16px;
|
|
1575
|
+
height: 16px;
|
|
1576
|
+
margin-left: auto;
|
|
1577
|
+
background-color: currentColor;
|
|
1578
|
+
opacity: 0.55;
|
|
1579
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M6 4l4 4-4 4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1580
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M6 4l4 4-4 4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1581
|
+
transition: transform var(--fw-motion-fast) var(--fw-motion-ease), opacity var(--fw-motion-fast) var(--fw-motion-ease);
|
|
1582
|
+
}
|
|
1583
|
+
.fw-menu-summary:hover::after,
|
|
1584
|
+
.fw-menu-summary.is-current::after {
|
|
1585
|
+
opacity: 1;
|
|
1586
|
+
}
|
|
1587
|
+
.fw-menu-group[open] > .fw-menu-summary::after {
|
|
1588
|
+
transform: rotate(90deg);
|
|
1589
|
+
}
|
|
1590
|
+
.fw-menu-split {
|
|
1591
|
+
position: relative;
|
|
1592
|
+
}
|
|
1593
|
+
.fw-menu-split > .fw-menu-link {
|
|
1594
|
+
padding-right: 44px;
|
|
1595
|
+
}
|
|
1596
|
+
.fw-menu-summary-icon {
|
|
1597
|
+
position: absolute;
|
|
1598
|
+
top: 0;
|
|
1599
|
+
right: 0;
|
|
1600
|
+
width: var(--fw-menu-row-h);
|
|
1601
|
+
height: var(--fw-menu-row-h);
|
|
1602
|
+
min-height: 0;
|
|
1603
|
+
padding: 0;
|
|
1604
|
+
justify-content: center;
|
|
1605
|
+
}
|
|
1606
|
+
.fw-menu-summary-icon::after {
|
|
1607
|
+
margin-left: 0;
|
|
1608
|
+
}
|
|
1609
|
+
.fw-menu-panel {
|
|
1610
|
+
padding: var(--fw-sp-2) var(--fw-sp-3) var(--fw-sp-4);
|
|
1611
|
+
color: var(--fw-text-soft);
|
|
1612
|
+
font-size: 14px;
|
|
1613
|
+
line-height: 1.5;
|
|
1614
|
+
}
|
|
1615
|
+
.fw-menu-panel > :first-child {
|
|
1616
|
+
margin-top: 0;
|
|
1617
|
+
}
|
|
1618
|
+
.fw-menu-panel > :last-child {
|
|
1619
|
+
margin-bottom: 0;
|
|
1620
|
+
}
|
|
1621
|
+
.fw-menu-accordion > .fw-menu-group + .fw-menu-group {
|
|
1622
|
+
border-top: var(--fw-border-w) solid var(--fw-bg-dim);
|
|
1623
|
+
}
|
|
1624
|
+
.fw-menu-accordion > .fw-menu-group > .fw-menu-summary {
|
|
1625
|
+
min-height: 44px;
|
|
1626
|
+
padding-inline: 0;
|
|
1627
|
+
border-radius: 0;
|
|
1628
|
+
font-family: var(--fw-font-display);
|
|
1629
|
+
font-size: 15px;
|
|
1630
|
+
font-weight: 700;
|
|
1631
|
+
}
|
|
1632
|
+
.fw-menu-accordion > .fw-menu-group > .fw-menu-summary::after {
|
|
1633
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1634
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1635
|
+
}
|
|
1636
|
+
.fw-menu-accordion > .fw-menu-group[open] > .fw-menu-summary::after {
|
|
1637
|
+
transform: rotate(180deg);
|
|
1638
|
+
}
|
|
1639
|
+
@media (hover: hover) {
|
|
1640
|
+
.fw-menu-accordion > .fw-menu-group > .fw-menu-summary:hover {
|
|
1641
|
+
background: none;
|
|
1642
|
+
color: var(--fw-secondary);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
.fw-menu-accordion > .fw-menu-group > .fw-menu-summary:focus-visible {
|
|
1646
|
+
border-radius: 4px;
|
|
1647
|
+
}
|
|
1648
|
+
.fw-menu-accordion > .fw-menu-group > .fw-menu-panel {
|
|
1649
|
+
padding-inline: 0;
|
|
1650
|
+
}
|
|
1651
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1652
|
+
.fw-menu-summary::after {
|
|
1653
|
+
transition: none;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1496
1657
|
/* src/css/components/pagination.css */
|
|
1497
1658
|
.fw-pagination {
|
|
1498
1659
|
display: flex;
|
|
@@ -1545,4 +1706,198 @@ textarea.fw-input,
|
|
|
1545
1706
|
pointer-events: none;
|
|
1546
1707
|
}
|
|
1547
1708
|
|
|
1709
|
+
/* src/css/components/table.css */
|
|
1710
|
+
.fw-table-wrap {
|
|
1711
|
+
overflow-x: auto;
|
|
1712
|
+
background: var(--fw-surface);
|
|
1713
|
+
border: var(--fw-border-w) solid var(--fw-bg-dim);
|
|
1714
|
+
border-radius: var(--fw-r-lg);
|
|
1715
|
+
box-shadow: var(--fw-shadow-sm);
|
|
1716
|
+
font-family: var(--fw-font-body);
|
|
1717
|
+
color: var(--fw-text);
|
|
1718
|
+
}
|
|
1719
|
+
.fw-table-wrap:focus-visible {
|
|
1720
|
+
outline: none;
|
|
1721
|
+
box-shadow: var(--fw-focus-ring);
|
|
1722
|
+
}
|
|
1723
|
+
.fw-table-wrap.fw-table-sticky {
|
|
1724
|
+
max-height: var(--fw-table-max-height, 460px);
|
|
1725
|
+
overflow: auto;
|
|
1726
|
+
}
|
|
1727
|
+
.fw-table-sticky .fw-table thead th {
|
|
1728
|
+
position: sticky;
|
|
1729
|
+
top: 0;
|
|
1730
|
+
z-index: 1;
|
|
1731
|
+
}
|
|
1732
|
+
.fw-table {
|
|
1733
|
+
width: 100%;
|
|
1734
|
+
border-collapse: separate;
|
|
1735
|
+
border-spacing: 0;
|
|
1736
|
+
font-family: var(--fw-font-body);
|
|
1737
|
+
font-size: 14px;
|
|
1738
|
+
line-height: 1.4;
|
|
1739
|
+
color: var(--fw-text);
|
|
1740
|
+
text-align: left;
|
|
1741
|
+
}
|
|
1742
|
+
.fw-table caption {
|
|
1743
|
+
caption-side: top;
|
|
1744
|
+
text-align: left;
|
|
1745
|
+
font-family: var(--fw-font-display);
|
|
1746
|
+
font-weight: 700;
|
|
1747
|
+
font-size: 16px;
|
|
1748
|
+
color: var(--fw-text);
|
|
1749
|
+
padding: var(--fw-sp-4) var(--fw-sp-5) var(--fw-sp-2);
|
|
1750
|
+
}
|
|
1751
|
+
.fw-table th,
|
|
1752
|
+
.fw-table td {
|
|
1753
|
+
padding: var(--fw-sp-3) var(--fw-sp-4);
|
|
1754
|
+
vertical-align: middle;
|
|
1755
|
+
}
|
|
1756
|
+
.fw-table th:first-child,
|
|
1757
|
+
.fw-table td:first-child {
|
|
1758
|
+
padding-left: var(--fw-sp-5);
|
|
1759
|
+
}
|
|
1760
|
+
.fw-table th:last-child,
|
|
1761
|
+
.fw-table td:last-child {
|
|
1762
|
+
padding-right: var(--fw-sp-5);
|
|
1763
|
+
}
|
|
1764
|
+
.fw-table thead th {
|
|
1765
|
+
font-size: 12px;
|
|
1766
|
+
font-weight: 700;
|
|
1767
|
+
letter-spacing: 0.02em;
|
|
1768
|
+
color: var(--fw-text-soft);
|
|
1769
|
+
background: var(--fw-surface);
|
|
1770
|
+
border-bottom: var(--fw-border-w) solid var(--fw-bg-dim);
|
|
1771
|
+
white-space: nowrap;
|
|
1772
|
+
}
|
|
1773
|
+
.fw-table tbody tr + tr > td {
|
|
1774
|
+
border-top: var(--fw-border-w) solid var(--fw-bg-dim);
|
|
1775
|
+
}
|
|
1776
|
+
.fw-table tbody td {
|
|
1777
|
+
transition: background-color var(--fw-motion-fast) var(--fw-motion-ease);
|
|
1778
|
+
}
|
|
1779
|
+
.fw-table-striped tbody tr:nth-child(even) > td {
|
|
1780
|
+
background: var(--fw-bg);
|
|
1781
|
+
}
|
|
1782
|
+
@media (hover: hover) {
|
|
1783
|
+
.fw-table tbody tr:hover > td {
|
|
1784
|
+
background: var(--fw-secondary-bg);
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
.fw-table tbody tr.is-selected > td,
|
|
1788
|
+
.fw-table tbody tr[aria-selected=true] > td {
|
|
1789
|
+
background: var(--fw-secondary-bg);
|
|
1790
|
+
}
|
|
1791
|
+
.fw-table tbody tr.is-selected > td:first-child,
|
|
1792
|
+
.fw-table tbody tr[aria-selected=true] > td:first-child {
|
|
1793
|
+
box-shadow: inset 3px 0 0 var(--fw-secondary);
|
|
1794
|
+
}
|
|
1795
|
+
.fw-table-compact th,
|
|
1796
|
+
.fw-table-compact td {
|
|
1797
|
+
padding: var(--fw-sp-2) var(--fw-sp-3);
|
|
1798
|
+
font-size: 13px;
|
|
1799
|
+
}
|
|
1800
|
+
.fw-table-compact th:first-child,
|
|
1801
|
+
.fw-table-compact td:first-child {
|
|
1802
|
+
padding-left: var(--fw-sp-4);
|
|
1803
|
+
}
|
|
1804
|
+
.fw-table-compact th:last-child,
|
|
1805
|
+
.fw-table-compact td:last-child {
|
|
1806
|
+
padding-right: var(--fw-sp-4);
|
|
1807
|
+
}
|
|
1808
|
+
.fw-table-num {
|
|
1809
|
+
font-family: var(--fw-font-mono);
|
|
1810
|
+
text-align: right;
|
|
1811
|
+
font-variant-numeric: tabular-nums;
|
|
1812
|
+
white-space: nowrap;
|
|
1813
|
+
}
|
|
1814
|
+
.fw-table-num .fw-table-sort {
|
|
1815
|
+
flex-direction: row-reverse;
|
|
1816
|
+
}
|
|
1817
|
+
.fw-table-select {
|
|
1818
|
+
width: 1%;
|
|
1819
|
+
padding-right: 0;
|
|
1820
|
+
}
|
|
1821
|
+
.fw-table-select .fw-checkbox {
|
|
1822
|
+
gap: 0;
|
|
1823
|
+
vertical-align: middle;
|
|
1824
|
+
}
|
|
1825
|
+
.fw-table-actions {
|
|
1826
|
+
width: 1%;
|
|
1827
|
+
text-align: right;
|
|
1828
|
+
white-space: nowrap;
|
|
1829
|
+
}
|
|
1830
|
+
.fw-table-actions .fw-icon-btn {
|
|
1831
|
+
vertical-align: middle;
|
|
1832
|
+
}
|
|
1833
|
+
.fw-table-actions > * + * {
|
|
1834
|
+
margin-left: var(--fw-sp-1);
|
|
1835
|
+
}
|
|
1836
|
+
.fw-table-empty > td {
|
|
1837
|
+
text-align: center;
|
|
1838
|
+
padding: var(--fw-sp-7) var(--fw-sp-5);
|
|
1839
|
+
color: var(--fw-text-soft);
|
|
1840
|
+
font-family: var(--fw-font-display);
|
|
1841
|
+
}
|
|
1842
|
+
.fw-table-empty:hover > td {
|
|
1843
|
+
background: transparent;
|
|
1844
|
+
}
|
|
1845
|
+
.fw-table-loading > td {
|
|
1846
|
+
text-align: center;
|
|
1847
|
+
padding: var(--fw-sp-6) var(--fw-sp-5);
|
|
1848
|
+
}
|
|
1849
|
+
.fw-table[aria-busy=true] tbody,
|
|
1850
|
+
.fw-table.is-loading tbody {
|
|
1851
|
+
opacity: 0.5;
|
|
1852
|
+
pointer-events: none;
|
|
1853
|
+
transition: opacity var(--fw-motion-fast) var(--fw-motion-ease);
|
|
1854
|
+
}
|
|
1855
|
+
th[data-fw-sort] {
|
|
1856
|
+
cursor: pointer;
|
|
1857
|
+
}
|
|
1858
|
+
.fw-table-sort {
|
|
1859
|
+
display: inline-flex;
|
|
1860
|
+
align-items: center;
|
|
1861
|
+
gap: var(--fw-sp-1);
|
|
1862
|
+
padding: 2px 4px;
|
|
1863
|
+
margin: -2px -4px;
|
|
1864
|
+
border: 0;
|
|
1865
|
+
background: none;
|
|
1866
|
+
font: inherit;
|
|
1867
|
+
color: inherit;
|
|
1868
|
+
letter-spacing: inherit;
|
|
1869
|
+
cursor: pointer;
|
|
1870
|
+
border-radius: 6px;
|
|
1871
|
+
}
|
|
1872
|
+
th[data-fw-sort]:hover .fw-table-sort,
|
|
1873
|
+
th[aria-sort=ascending] .fw-table-sort,
|
|
1874
|
+
th[aria-sort=descending] .fw-table-sort {
|
|
1875
|
+
color: var(--fw-text);
|
|
1876
|
+
}
|
|
1877
|
+
.fw-table-sort:focus-visible {
|
|
1878
|
+
outline: none;
|
|
1879
|
+
box-shadow: var(--fw-focus-ring);
|
|
1880
|
+
}
|
|
1881
|
+
.fw-table-sort::after {
|
|
1882
|
+
content: "";
|
|
1883
|
+
width: 12px;
|
|
1884
|
+
height: 12px;
|
|
1885
|
+
flex-shrink: 0;
|
|
1886
|
+
background-color: currentColor;
|
|
1887
|
+
opacity: 0.35;
|
|
1888
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M5 6.5l3-3 3 3M5 9.5l3 3 3-3' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1889
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M5 6.5l3-3 3 3M5 9.5l3 3 3-3' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1890
|
+
transition: opacity var(--fw-motion-fast) var(--fw-motion-ease);
|
|
1891
|
+
}
|
|
1892
|
+
th[aria-sort=ascending] .fw-table-sort::after {
|
|
1893
|
+
opacity: 1;
|
|
1894
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 10l4-4 4 4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1895
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 10l4-4 4 4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1896
|
+
}
|
|
1897
|
+
th[aria-sort=descending] .fw-table-sort::after {
|
|
1898
|
+
opacity: 1;
|
|
1899
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1900
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1548
1903
|
/* src/css/index.css */
|
package/dist/fernwell.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! fernwell v0.
|
|
2
|
-
var
|
|
3
|
-
`)}function Se(e,t={}){var s,i;let n=(s=t.scope)!=null?s:":root",o=(i=L.get(n))!=null?i:{light:{},dark:{}};Oe(e)?(Object.assign(o.light,e.light),Object.assign(o.dark,e.dark)):(Object.assign(o.light,e),Object.assign(o.dark,e)),L.set(n,o),pe()}function Be(e){e?L.delete(e):L.clear(),pe()}function Ce(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(me(e)).trim()}var q={};E(q,{combobox:()=>ve,init:()=>$});var Ne=0;function x(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function ve(e,t={}){var se,re,ie,ae;let n=(se=t.filter)!=null?se:((r,l)=>r.toLowerCase().includes(l)),o=(re=t.emptyText)!=null?re:"No matches",s=(ie=t.options)!=null?ie:$e(e),i=[],a=-1,u=!1,w=e.getAttribute("list");w&&(e.dataset.fwList=w,e.removeAttribute("list"));let X=(ae=e.closest(".fw-combobox"))!=null?ae:qe(e),c=document.createElement("ul"),A=`fw-combobox-${++Ne}`;c.className="fw-combobox-list",c.id=A,c.setAttribute("role","listbox"),X.appendChild(c),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",A),e.autocomplete="off";function ke(r){i=r,a=-1;let l=e.value.trim().toLowerCase();if(r.length===0){c.innerHTML=`<li class="fw-combobox-empty">${x(o)}</li>`;return}c.innerHTML=r.map((f,b)=>{let g=l?f.toLowerCase().indexOf(l):-1,ye=g>-1?`${x(f.slice(0,g))}<b>${x(f.slice(g,g+l.length))}</b>${x(f.slice(g+l.length))}`:x(f);return`<li class="fw-combobox-option" role="option" id="${A}-${b}" data-index="${b}" aria-selected="false">${ye}</li>`}).join("")}function h(){let r=e.value.trim().toLowerCase();ke(r?s.filter(l=>n(l,r)):s),c.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function y(){c.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),a=-1}function J(r){let l=c.querySelectorAll(".fw-combobox-option");l.forEach(b=>{b.classList.remove("is-active"),b.setAttribute("aria-selected","false")});let f=l[r];f&&(f.classList.add("is-active"),f.setAttribute("aria-selected","true"),f.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",f.id)),a=r}function Q(r){var l;e.value=r,y(),u=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),u=!1,(l=t.onSelect)==null||l.call(t,r)}let Z=()=>{u||h()},ee=()=>{u||h()},te=r=>{r.key==="ArrowDown"?(r.preventDefault(),c.classList.contains("is-open")||h(),J(Math.min(a+1,i.length-1))):r.key==="ArrowUp"?(r.preventDefault(),J(Math.max(a-1,0))):r.key==="Enter"?a>-1&&i[a]!==void 0&&(r.preventDefault(),Q(i[a])):r.key==="Escape"&&y()},ne=r=>{let l=r.target.closest(".fw-combobox-option");l&&(r.preventDefault(),Q(i[Number(l.dataset.index)]))},oe=r=>{X.contains(r.target)||y()};return e.addEventListener("input",Z),e.addEventListener("focus",ee),e.addEventListener("keydown",te),c.addEventListener("mousedown",ne),document.addEventListener("click",oe),{open:h,close:y,setOptions(r){s=r,c.classList.contains("is-open")&&h()},destroy(){e.removeEventListener("input",Z),e.removeEventListener("focus",ee),e.removeEventListener("keydown",te),c.removeEventListener("mousedown",ne),document.removeEventListener("click",oe),c.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function $e(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(s=>s.value||s.textContent||""):[]}function qe(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function $(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",ve(t))})}var V={};E(V,{bindOutsideClickToClose:()=>j,close:()=>m,init:()=>K,open:()=>F,toggle:()=>je});var p="is-open",Le="fw-scroll-lock",v=[],I=new WeakMap,Ie='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function P(e){return typeof e=="string"?document.getElementById(e):e}function D(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function F(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var i;let o=P(e);if(!o||o.classList.contains(p))return;o.classList.add(p),(i=D(o))==null||i.classList.add(p),I.set(o,t),v.push(o),document.body.classList.add(Le),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let s=o.querySelector(Ie);s?s.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function m(e){var o,s,i;let t=P(e);if(!t||!t.classList.contains(p))return;t.classList.remove(p),(o=D(t))==null||o.classList.remove(p);let n=v.indexOf(t);n>-1&&v.splice(n,1),v.length===0&&document.body.classList.remove(Le),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(i=(s=I.get(t))==null?void 0:s.focus)==null||i.call(s,{preventScroll:!0}),I.delete(t)}function je(e){let t=P(e);t&&(t.classList.contains(p)?m:F)(t)}function j(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var Ee=!1;function K(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,s;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(s=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?s:"";t.addEventListener("click",()=>F(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",j(t,()=>m(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>m(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=D(t);n&&j(n,()=>m(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>m(t)))}),Ee||(Ee=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&v.length&&m(v[v.length-1])}))}var z={};E(z,{close:()=>H,init:()=>W,open:()=>Te});var R="is-open";function Te(e){let t=_(e);t&&(t.classList.add(R),e.setAttribute("aria-expanded","true"))}function H(e){let t=_(e);t&&(t.classList.remove(R),e.setAttribute("aria-expanded","false"))}function _(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function W(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var s,i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=_(t);if(!n)return;let o=(i=(s=t.closest(".fw-nav"))!=null?s:t.parentElement)!=null?i:t;t.addEventListener("click",a=>{a.stopPropagation(),(n.classList.contains(R)?H:Te)(t)}),document.addEventListener("click",a=>{!o.contains(a.target)&&!n.contains(a.target)&&H(t)}),document.addEventListener("keydown",a=>{a.key==="Escape"&&H(t)})})}var U={};E(U,{init:()=>G,resetAll:()=>ge,resetButtonLoading:()=>be,setButtonLoading:()=>he});var k="fw-btn-loading";function he(e,t){var o,s;if(!e||e.classList.contains(k))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(k);let n=(s=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?s:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function be(e){!e||!e.classList.contains(k)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(k),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function ge(e=document){e.querySelectorAll(`.${k}`).forEach(be)}var we=!1;function G(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');he(n)}))}),we||(we=!0,window.addEventListener("pageshow",t=>{t.persisted&&ge()}))}var Y={};E(Y,{hide:()=>xe,show:()=>De});var d=null,T=null;function Pe(){return d&&d.isConnected||(d=document.createElement("div"),d.className="fw-toast",d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),d.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(d)),d}function De(e,{variant:t="success",duration:n=4e3}={}){let o=Pe();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,T&&clearTimeout(T),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(T=setTimeout(xe,n)),o}function xe(){d==null||d.classList.remove("is-show"),T&&clearTimeout(T),T=null}var Fe="0.1.0";function Ke(e=document){C(e),$(e),K(e),W(e),G(e)}var Ve={version:Fe,init:Ke,theme:N,combobox:q,modal:V,nav:z,loading:U,toast:Y},_e=Ve;export{q as combobox,_e as default,Ke as init,U as loading,V as modal,z as nav,N as theme,Y as toast,Fe as version};
|
|
1
|
+
/*! fernwell v0.2.0 | MIT | https://github.com/JacobKnaack/fernwell */
|
|
2
|
+
var Xe=Object.defineProperty;var T=(e,t)=>{for(var n in t)Xe(e,n,{get:t[n],enumerable:!0})};var P={};T(P,{get:()=>$,getToken:()=>nt,init:()=>R,resetTokens:()=>tt,set:()=>S,setTokens:()=>et,toggle:()=>ye});var N="fw-theme",Je="fw:themechange",Qe="--fw-",ge="data-fw-tokens";function I(){try{return window.localStorage}catch{return null}}function $(){var t;let e=document.documentElement.getAttribute("data-theme");return e==="dark"||e==="light"?e:(t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function S(e,{persist:t=!0}={}){var n;document.documentElement.setAttribute("data-theme",e),t&&((n=I())==null||n.setItem(N,e)),document.querySelectorAll("[data-fw-theme-toggle]").forEach(o=>xe(o,e)),document.dispatchEvent(new CustomEvent(Je,{detail:e}))}function ye(){let e=$()==="dark"?"light":"dark";return S(e),e}function xe(e,t){e.setAttribute("aria-pressed",String(t==="dark"));let n=t==="dark"?e.dataset.fwThemeLabelDark:e.dataset.fwThemeLabelLight;n!==void 0&&(e.textContent=n)}function R(e=document){var o,r,s,l;let t=(o=I())==null?void 0:o.getItem(N),n=t==="dark"||t==="light"?t:$();S(n,{persist:!1}),e.querySelectorAll("[data-fw-theme-toggle]").forEach(d=>{d.dataset.fwBound||(d.dataset.fwBound="1",xe(d,n),d.addEventListener("click",()=>ye()))}),(l=(r=window.matchMedia)==null?void 0:(s=r.call(window,"(prefers-color-scheme: dark)")).addEventListener)==null||l.call(s,"change",d=>{var f;(f=I())!=null&&f.getItem(N)||S(d.matches?"dark":"light",{persist:!1})})}var b=new Map;function ke(e){return e.startsWith("--")?e:`${Qe}${e}`}function Ze(e){return Object.values(e).some(t=>t!==null&&typeof t=="object")}function Me(e){return Object.entries(e).map(([t,n])=>`${ke(t)}:${n};`).join("")}function He(e){let t=document.head.querySelector(`style[${ge}]`);if(t||!e)return t;let n=document.createElement("style");return n.setAttribute(ge,""),document.head.appendChild(n),n}function Ae(){var t;if(b.size===0){(t=He(!1))==null||t.remove();return}let e=[];b.forEach(({light:n,dark:o},r)=>{if(Object.keys(n).length&&e.push(`${r}{${Me(n)}}`),Object.keys(o).length){let s=r===":root"?'[data-theme="dark"]':`[data-theme="dark"] ${r}, ${r}[data-theme="dark"]`;e.push(`${s}{${Me(o)}}`)}}),He(!0).textContent=e.join(`
|
|
3
|
+
`)}function et(e,t={}){var r,s;let n=(r=t.scope)!=null?r:":root",o=(s=b.get(n))!=null?s:{light:{},dark:{}};Ze(e)?(Object.assign(o.light,e.light),Object.assign(o.dark,e.dark)):(Object.assign(o.light,e),Object.assign(o.dark,e)),b.set(n,o),Ae()}function tt(e){e?b.delete(e):b.clear(),Ae()}function nt(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(ke(e)).trim()}var K={};T(K,{combobox:()=>Se,init:()=>j});var ot=0;function x(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function Se(e,t={}){var we,ve,he,be;let n=(we=t.filter)!=null?we:((i,c)=>i.toLowerCase().includes(c)),o=(ve=t.emptyText)!=null?ve:"No matches",r=(he=t.options)!=null?he:rt(e),s=[],l=-1,d=!1,f=e.getAttribute("list");f&&(e.dataset.fwList=f,e.removeAttribute("list"));let u=(be=e.closest(".fw-combobox"))!=null?be:st(e),a=document.createElement("ul"),B=`fw-combobox-${++ot}`;a.className="fw-combobox-list",a.id=B,a.setAttribute("role","listbox"),u.appendChild(a),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",B),e.autocomplete="off";function ze(i){s=i,l=-1;let c=e.value.trim().toLowerCase();if(i.length===0){a.innerHTML=`<li class="fw-combobox-empty">${x(o)}</li>`;return}a.innerHTML=i.map((E,H)=>{let y=c?E.toLowerCase().indexOf(c):-1,Ye=y>-1?`${x(E.slice(0,y))}<b>${x(E.slice(y,y+c.length))}</b>${x(E.slice(y+c.length))}`:x(E);return`<li class="fw-combobox-option" role="option" id="${B}-${H}" data-index="${H}" aria-selected="false">${Ye}</li>`}).join("")}function M(){let i=e.value.trim().toLowerCase();ze(i?r.filter(c=>n(c,i)):r),a.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function A(){a.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),l=-1}function ue(i){let c=a.querySelectorAll(".fw-combobox-option");c.forEach(H=>{H.classList.remove("is-active"),H.setAttribute("aria-selected","false")});let E=c[i];E&&(E.classList.add("is-active"),E.setAttribute("aria-selected","true"),E.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",E.id)),l=i}function fe(i){var c;e.value=i,A(),d=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),d=!1,(c=t.onSelect)==null||c.call(t,i)}let me=()=>{d||M()},Ee=()=>{d||M()},pe=i=>{i.key==="ArrowDown"?(i.preventDefault(),a.classList.contains("is-open")||M(),ue(Math.min(l+1,s.length-1))):i.key==="ArrowUp"?(i.preventDefault(),ue(Math.max(l-1,0))):i.key==="Enter"?l>-1&&s[l]!==void 0&&(i.preventDefault(),fe(s[l])):i.key==="Escape"&&A()},Te=i=>{let c=i.target.closest(".fw-combobox-option");c&&(i.preventDefault(),fe(s[Number(c.dataset.index)]))},Le=i=>{u.contains(i.target)||A()};return e.addEventListener("input",me),e.addEventListener("focus",Ee),e.addEventListener("keydown",pe),a.addEventListener("mousedown",Te),document.addEventListener("click",Le),{open:M,close:A,setOptions(i){r=i,a.classList.contains("is-open")&&M()},destroy(){e.removeEventListener("input",me),e.removeEventListener("focus",Ee),e.removeEventListener("keydown",pe),a.removeEventListener("mousedown",Te),document.removeEventListener("click",Le),a.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function rt(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(r=>r.value||r.textContent||""):[]}function st(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function j(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",Se(t))})}var z={};T(z,{bindOutsideClickToClose:()=>V,close:()=>L,init:()=>_,open:()=>W,toggle:()=>lt});var w="is-open",Ce="fw-scroll-lock",v=[],F=new WeakMap,it='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function G(e){return typeof e=="string"?document.getElementById(e):e}function U(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function W(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var s;let o=G(e);if(!o||o.classList.contains(w))return;o.classList.add(w),(s=U(o))==null||s.classList.add(w),F.set(o,t),v.push(o),document.body.classList.add(Ce),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let r=o.querySelector(it);r?r.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function L(e){var o,r,s;let t=G(e);if(!t||!t.classList.contains(w))return;t.classList.remove(w),(o=U(t))==null||o.classList.remove(w);let n=v.indexOf(t);n>-1&&v.splice(n,1),v.length===0&&document.body.classList.remove(Ce),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(s=(r=F.get(t))==null?void 0:r.focus)==null||s.call(r,{preventScroll:!0}),F.delete(t)}function lt(e){let t=G(e);t&&(t.classList.contains(w)?L:W)(t)}function V(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var Oe=!1;function _(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?r:"";t.addEventListener("click",()=>W(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",V(t,()=>L(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>L(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=U(t);n&&V(n,()=>L(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>L(t)))}),Oe||(Oe=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&v.length&&L(v[v.length-1])}))}var Q={};T(Q,{close:()=>O,init:()=>J,open:()=>De});var Y="is-open";function De(e){let t=X(e);t&&(t.classList.add(Y),e.setAttribute("aria-expanded","true"))}function O(e){let t=X(e);t&&(t.classList.remove(Y),e.setAttribute("aria-expanded","false"))}function X(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function J(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var r,s;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=X(t);if(!n)return;let o=(s=(r=t.closest(".fw-nav"))!=null?r:t.parentElement)!=null?s:t;t.addEventListener("click",l=>{l.stopPropagation(),(n.classList.contains(Y)?O:De)(t)}),document.addEventListener("click",l=>{!o.contains(l.target)&&!n.contains(l.target)&&O(t)}),document.addEventListener("keydown",l=>{l.key==="Escape"&&O(t)})})}var ee={};T(ee,{init:()=>Z,resetAll:()=>Ie,resetButtonLoading:()=>Ne,setButtonLoading:()=>Be});var k="fw-btn-loading";function Be(e,t){var o,r;if(!e||e.classList.contains(k))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(k);let n=(r=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?r:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function Ne(e){!e||!e.classList.contains(k)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(k),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function Ie(e=document){e.querySelectorAll(`.${k}`).forEach(Ne)}var qe=!1;function Z(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');Be(n)}))}),qe||(qe=!0,window.addEventListener("pageshow",t=>{t.persisted&&Ie()}))}var te={};T(te,{hide:()=>$e,show:()=>ct});var m=null,g=null;function at(){return m&&m.isConnected||(m=document.createElement("div"),m.className="fw-toast",m.setAttribute("role","status"),m.setAttribute("aria-live","polite"),m.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(m)),m}function ct(e,{variant:t="success",duration:n=4e3}={}){let o=at();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,g&&clearTimeout(g),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(g=setTimeout($e,n)),o}function $e(){m==null||m.classList.remove("is-show"),g&&clearTimeout(g),g=null}var ae={};T(ae,{getSelected:()=>ie,init:()=>le,selectAll:()=>Fe,setRowSelected:()=>Ke,sort:()=>ne});var dt="is-selected";function oe(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function Re(e,t){var o,r,s;let n=e.cells[t];return(s=(r=n==null?void 0:n.dataset.fwSortValue)!=null?r:(o=n==null?void 0:n.textContent)==null?void 0:o.trim())!=null?s:""}function ut(e,t){let n=Number(e),o=Number(t);return e!==""&&t!==""&&Number.isFinite(n)&&Number.isFinite(o)?n-o:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function je(e){var t,n;return Array.from((n=(t=e.tHead)==null?void 0:t.querySelectorAll("th[data-fw-sort]"))!=null?n:[])}function Pe(e){return e.getAttribute("aria-sort")==="ascending"?"descending":"ascending"}function ne(e,t,n){let o=e.tBodies[0];if(!o)return;let r=Array.from(o.rows),s=r.filter(u=>u.cells.length>t),l=r.filter(u=>u.cells.length<=t),d=n==="ascending"?1:-1;s.sort((u,a)=>d*ut(Re(u,t),Re(a,t))),[...s,...l].forEach(u=>o.appendChild(u));let f=null;je(e).forEach(u=>{let a=u.cellIndex===t;u.setAttribute("aria-sort",a?n:"none"),a&&(f=u)}),f&&oe(e,"fw:sort",{column:t,direction:n,th:f})}function C(e){return Array.from(e.querySelectorAll("tbody input[data-fw-select-row]"))}function re(e,t){e.classList.toggle(dt,t),e.setAttribute("aria-selected",t?"true":"false")}function se(e){let t=e.querySelector("[data-fw-select-all]");if(!t)return;let n=C(e),o=n.filter(r=>r.checked).length;t.checked=o>0&&o===n.length,t.indeterminate=o>0&&o<n.length}function ie(e){return C(e).filter(t=>t.checked).map(t=>t.closest("tr")).filter(t=>t!==null)}function Ke(e,t){let n=e.querySelector("input[data-fw-select-row]");n&&(n.checked=t),re(e,t);let o=e.closest("table");o&&(se(o),oe(o,"fw:select",{rows:ie(o),all:!1}))}function Fe(e,t){C(e).forEach(n=>{n.checked=t;let o=n.closest("tr");o&&re(o,t)}),se(e),oe(e,"fw:select",{rows:ie(e),all:!0})}function le(e=document){e.querySelectorAll("table[data-fw-table]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",je(t).forEach(n=>{n.hasAttribute("aria-sort")||n.setAttribute("aria-sort","none")}),t.addEventListener("click",n=>{let o=n.target.closest("th[data-fw-sort]");o&&t.contains(o)&&ne(t,o.cellIndex,Pe(o))}),t.addEventListener("keydown",n=>{if(n.key!=="Enter"&&n.key!==" ")return;let o=n.target;if(!o.matches("th[data-fw-sort], th[data-fw-sort] .fw-table-sort"))return;let r=o.closest("th[data-fw-sort]");r&&(n.preventDefault(),ne(t,r.cellIndex,Pe(r)))}),t.addEventListener("change",n=>{let o=n.target;if(o.matches("[data-fw-select-all]"))Fe(t,o.checked);else if(o.matches("[data-fw-select-row]")){let r=o.closest("tr");r&&Ke(r,o.checked)}}),C(t).forEach(n=>{let o=n.closest("tr");o&&n.checked&&re(o,!0)}),se(t))})}var de={};T(de,{close:()=>q,collapseAll:()=>Tt,expandAll:()=>pt,init:()=>ce,open:()=>D,reveal:()=>Ue,toggle:()=>Et});var p=".fw-menu-group",Ge=".fw-menu-link, .fw-menu-summary",ft="is-current";function mt(e,t){e.dispatchEvent(new CustomEvent("fw:toggle",{bubbles:!0,detail:t}))}function D(e){e.open=!0}function q(e){e.open=!1}function Et(e,t){e.open=t!=null?t:!e.open}function pt(e){e.querySelectorAll(p).forEach(D)}function Tt(e){e.querySelectorAll(p).forEach(q)}function Ue(e){var n,o,r,s;let t=(o=(n=e.parentElement)==null?void 0:n.closest(p))!=null?o:null;for(;t;)D(t),t=(s=(r=t.parentElement)==null?void 0:r.closest(p))!=null?s:null}function Ve(e){e.querySelectorAll(p).forEach(t=>{let n=t.querySelector(":scope > .fw-menu-summary");if(!n)return;let o=!t.open&&t.querySelector("[aria-current]")!==null;n.classList.toggle(ft,o)})}function We(e){return e.matches(".fw-menu-summary")?e.closest(p):null}function _e(e){var n,o,r;return(r=(o=((n=We(e))!=null?n:e).parentElement)==null?void 0:o.closest(p))!=null?r:null}function Lt(e){var t,n;for(let o=_e(e);o;o=(n=(t=o.parentElement)==null?void 0:t.closest(p))!=null?n:null)if(!o.open)return!1;return!0}function wt(e){return Array.from(e.querySelectorAll(Ge)).filter(Lt)}function h(e){return e?(e.focus(),!0):!1}function vt(e){var n;let t=e.closest(".fw-menu-split");return(n=t==null?void 0:t.querySelector(":scope > .fw-menu-group > .fw-menu-summary"))!=null?n:null}function ht(e,t){var d;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let n=t.target instanceof HTMLElement&&t.target.matches(Ge)?t.target:null;if(!n||!e.contains(n))return;let o=wt(e),r=o.indexOf(n),s=We(n),l=!0;switch(t.key){case"ArrowDown":h(o[r+1]);break;case"ArrowUp":h(o[r-1]);break;case"Home":h(o[0]);break;case"End":h(o[o.length-1]);break;case"ArrowRight":s?s.open?s.contains((d=o[r+1])!=null?d:e)&&h(o[r+1]):D(s):h(vt(n));break;case"ArrowLeft":if(s!=null&&s.open)q(s);else{let f=_e(n);h(f==null?void 0:f.querySelector(":scope > .fw-menu-summary"))}break;default:l=!1}l&&t.preventDefault()}function ce(e=document){e.querySelectorAll("[data-fw-menu]").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.hasAttribute("data-fw-menu-exclusive");t.addEventListener("toggle",o=>{let r=o.target;!(r instanceof HTMLDetailsElement)||!r.matches(p)||(n&&r.open&&r.parentElement&&Array.from(r.parentElement.children).forEach(s=>{s!==r&&s instanceof HTMLDetailsElement&&s.matches(p)&&q(s)}),Ve(t),mt(r,{group:r,open:r.open}))},!0),t.addEventListener("keydown",o=>ht(t,o)),t.querySelectorAll("[aria-current]").forEach(Ue),Ve(t)})}var bt="0.2.0";function gt(e=document){R(e),j(e),_(e),J(e),Z(e),le(e),ce(e)}var Mt={version:bt,init:gt,theme:P,combobox:K,modal:z,nav:Q,loading:ee,toast:te,table:ae,menu:de},yt=Mt;export{K as combobox,yt as default,gt as init,ee as loading,de as menu,z as modal,Q as nav,ae as table,P as theme,te as toast,bt as version};
|
|
4
4
|
//# sourceMappingURL=fernwell.esm.js.map
|