athena-ui-js 1.2.0 → 1.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.
Files changed (39) hide show
  1. package/README.md +228 -22
  2. package/package.json +9 -7
  3. package/src/athena-ui.js +33 -10
  4. package/src/libs/config/config.js +8 -1
  5. package/src/libs/core/controls.js +153 -0
  6. package/src/libs/core/dateRange.js +121 -0
  7. package/src/libs/core/dom.js +58 -8
  8. package/src/libs/{hephaestus/HTMLElementGenerator/src/HTMLElementGenerator.js → core/elementGenerator.js} +23 -21
  9. package/src/libs/{hephaestus/HTMLElementGenerator/src → core}/errors.js +7 -5
  10. package/src/libs/core/format.js +51 -0
  11. package/src/libs/core/hungarianControls.js +41 -0
  12. package/src/libs/core/i18n.js +64 -0
  13. package/src/libs/core/theme.js +131 -0
  14. package/src/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js +4 -6
  15. package/src/libs/hephaestus/LayoutGenerator/footerContentGenerator.js +2 -4
  16. package/src/libs/hephaestus/LayoutGenerator/headerContentGenerator.js +12 -5
  17. package/src/libs/hephaestus/MenuGenerator/basicMenuGenerator.js +3 -3
  18. package/src/libs/hephaestus/MenuGenerator/menuGenerator.js +253 -0
  19. package/src/libs/hephaestus/auth/authState.js +58 -0
  20. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +519 -87
  21. package/src/libs/hephaestus/componentGenerator/componentGenerator.js +121 -4
  22. package/src/libs/hephaestus/componentGenerator/themePicker.js +73 -0
  23. package/src/libs/hephaestus/dialogGenerator/dialogGenerator.js +88 -8
  24. package/src/libs/hephaestus/feedbackGenerator/feedbackGenerator.js +21 -0
  25. package/src/libs/hephaestus/formGenerator/authForms.js +130 -0
  26. package/src/libs/hephaestus/formGenerator/formUtils.js +10 -9
  27. package/src/libs/hephaestus/formGenerator/loginFormGenerator.js +9 -9
  28. package/src/libs/hephaestus/hephaestus.js +7 -2
  29. package/src/libs/hephaestus/inputGenerator/inputGenerator.js +30 -1
  30. package/src/libs/hephaestus/modalGenerator/modalGenerator.js +17 -11
  31. package/src/libs/hephaestus/router/router.js +54 -5
  32. package/src/libs/hephaestus/tableGenerator/tableGenerator.js +290 -16
  33. package/src/libs/libs.js +3 -3
  34. package/src/res/themes/appearance.css +154 -0
  35. package/src/res/themes/default/style.css +609 -0
  36. package/src/theme-boot.js +25 -0
  37. package/src/libs/hephaestus/HTMLControlGenerator/LICENSE +0 -21
  38. package/src/libs/hephaestus/HTMLControlGenerator/src/HTMLControlGenerator.min.js +0 -5
  39. package/src/libs/hephaestus/HTMLElementGenerator/LICENSE +0 -21
@@ -1519,3 +1519,612 @@ textarea {
1519
1519
  box-shadow: none;
1520
1520
  }
1521
1521
  }
1522
+
1523
+ /* Theme picker (generateThemePicker). The preview is drawn with the colours of the theme it shows. */
1524
+
1525
+ .theme-picker {
1526
+ display: flex;
1527
+ flex-direction: column;
1528
+ gap: 16px;
1529
+ }
1530
+
1531
+ .theme-picker-group {
1532
+ border: 0;
1533
+ margin: 0;
1534
+ padding: 0;
1535
+ }
1536
+
1537
+ .theme-picker-options {
1538
+ display: flex;
1539
+ flex-wrap: wrap;
1540
+ gap: 12px;
1541
+ }
1542
+
1543
+ .theme-picker-option {
1544
+ display: flex;
1545
+ flex-direction: column;
1546
+ gap: 4px;
1547
+ min-width: 140px;
1548
+ padding: 8px;
1549
+ border: 1px solid var(--athena-line);
1550
+ border-radius: var(--athena-radius);
1551
+ cursor: pointer;
1552
+ }
1553
+
1554
+ .theme-picker-option:has(input:checked) {
1555
+ border-color: var(--athena-accent);
1556
+ box-shadow: 0 0 0 1px var(--athena-accent);
1557
+ }
1558
+
1559
+ .theme-picker-option:has(input:focus-visible) {
1560
+ outline: 2px solid var(--athena-focus, var(--athena-accent));
1561
+ outline-offset: 2px;
1562
+ }
1563
+
1564
+ .theme-picker-option input {
1565
+ position: absolute;
1566
+ opacity: 0;
1567
+ pointer-events: none;
1568
+ }
1569
+
1570
+ .theme-picker-description {
1571
+ color: var(--athena-muted);
1572
+ font-size: 0.85em;
1573
+ }
1574
+
1575
+ .theme-preview {
1576
+ display: block;
1577
+ border: 1px solid var(--athena-line);
1578
+ border-radius: 4px;
1579
+ overflow: hidden;
1580
+ background: var(--athena-bg);
1581
+ }
1582
+
1583
+ .theme-preview-bar {
1584
+ display: block;
1585
+ height: 10px;
1586
+ background: var(--athena-accent);
1587
+ }
1588
+
1589
+ .theme-preview-body {
1590
+ display: flex;
1591
+ flex-direction: column;
1592
+ gap: 5px;
1593
+ padding: 8px;
1594
+ }
1595
+
1596
+ .theme-preview-line {
1597
+ display: block;
1598
+ height: 5px;
1599
+ width: 70%;
1600
+ border-radius: 3px;
1601
+ background: var(--athena-fg);
1602
+ opacity: 0.6;
1603
+ }
1604
+
1605
+ .theme-preview-button {
1606
+ display: block;
1607
+ height: 8px;
1608
+ width: 30%;
1609
+ border-radius: 3px;
1610
+ background: var(--athena-accent);
1611
+ }
1612
+
1613
+ /* Tables with a data source and row actions */
1614
+
1615
+ .athena-visually-hidden {
1616
+ position: absolute;
1617
+ width: 1px;
1618
+ height: 1px;
1619
+ overflow: hidden;
1620
+ clip-path: inset(50%);
1621
+ white-space: nowrap;
1622
+ }
1623
+
1624
+ .athena-table-is-loading tbody {
1625
+ opacity: 0.6;
1626
+ }
1627
+
1628
+ .athena-table td.athena-table-loading,
1629
+ .athena-table td.athena-table-error {
1630
+ text-align: center;
1631
+ color: var(--athena-muted);
1632
+ }
1633
+
1634
+ .athena-table .athena-table-error {
1635
+ color: var(--athena-danger);
1636
+ }
1637
+
1638
+ .athena-table td.athena-table-actions {
1639
+ width: 1%;
1640
+ white-space: nowrap;
1641
+ text-align: right;
1642
+ }
1643
+
1644
+ .athena-table td.athena-table-actions .athena-button + .athena-button {
1645
+ margin-left: 4px;
1646
+ }
1647
+
1648
+ /* Charts: series colours, tooltip, legend, table of values.
1649
+ An application sets --series-1 ... --series-8 (on :root or per theme) to recolour every chart. */
1650
+
1651
+ .athena-chart .s1 { color: var(--series-1, #4e79a7); }
1652
+ .athena-chart .s2 { color: var(--series-2, #f28e2b); }
1653
+ .athena-chart .s3 { color: var(--series-3, #e15759); }
1654
+ .athena-chart .s4 { color: var(--series-4, #76b7b2); }
1655
+ .athena-chart .s5 { color: var(--series-5, #59a14f); }
1656
+ .athena-chart .s6 { color: var(--series-6, #edc948); }
1657
+ .athena-chart .s7 { color: var(--series-7, #b07aa1); }
1658
+ .athena-chart .s8 { color: var(--series-8, #ff9da7); }
1659
+
1660
+ .athena-chart .chart-bar,
1661
+ .athena-chart .chart-slice,
1662
+ .athena-chart .chart-swatch,
1663
+ .athena-chart .chart-point,
1664
+ .athena-chart .chart-area {
1665
+ fill: currentColor;
1666
+ }
1667
+
1668
+ .athena-chart .chart-area {
1669
+ opacity: 0.18;
1670
+ }
1671
+
1672
+ .athena-chart .chart-line {
1673
+ stroke: currentColor;
1674
+ stroke-width: 2;
1675
+ stroke-linejoin: round;
1676
+ }
1677
+
1678
+ .athena-chart-sparkline .chart-line {
1679
+ stroke-width: 1.5;
1680
+ }
1681
+
1682
+ .athena-chart .chart-ring {
1683
+ stroke: currentColor;
1684
+ }
1685
+
1686
+ .athena-chart .chart-point {
1687
+ stroke: var(--athena-bg);
1688
+ stroke-width: 1;
1689
+ }
1690
+
1691
+ .athena-chart .chart-hidden {
1692
+ display: none;
1693
+ }
1694
+
1695
+ .athena-chart-sparkline {
1696
+ vertical-align: middle;
1697
+ }
1698
+
1699
+ .athena-chart .chart-legend-item {
1700
+ cursor: pointer;
1701
+ }
1702
+
1703
+ .athena-chart .chart-legend-item.is-off {
1704
+ opacity: 0.45;
1705
+ }
1706
+
1707
+ .athena-chart [tabindex]:focus-visible {
1708
+ outline: 2px solid var(--athena-focus, currentColor);
1709
+ outline-offset: 2px;
1710
+ }
1711
+
1712
+ .athena-chart .chart-tooltip {
1713
+ display: none;
1714
+ pointer-events: none;
1715
+ }
1716
+
1717
+ .athena-chart .chart-tooltip.is-visible {
1718
+ display: block;
1719
+ }
1720
+
1721
+ .athena-chart .chart-tooltip-box {
1722
+ fill: var(--athena-fg);
1723
+ }
1724
+
1725
+ .athena-chart .chart-tooltip-text {
1726
+ fill: var(--athena-bg);
1727
+ font-size: 12px;
1728
+ }
1729
+
1730
+ .chart-data {
1731
+ margin-top: 8px;
1732
+ }
1733
+
1734
+ .chart-data summary {
1735
+ cursor: pointer;
1736
+ }
1737
+
1738
+ /* Menu (generateMenu): a bar, or tabs at the bottom of the screen with sheets for the groups */
1739
+
1740
+ .athena-menu-list {
1741
+ display: flex;
1742
+ flex-wrap: wrap;
1743
+ align-items: center;
1744
+ gap: 2px;
1745
+ margin: 0;
1746
+ padding: 0;
1747
+ list-style: none;
1748
+ }
1749
+
1750
+ .athena-menu .menu-item {
1751
+ position: relative;
1752
+ }
1753
+
1754
+ .athena-menu .menu-item-end {
1755
+ margin-left: auto;
1756
+ }
1757
+
1758
+ .athena-menu .menu-control {
1759
+ display: inline-flex;
1760
+ align-items: center;
1761
+ gap: 6px;
1762
+ padding: 8px 12px;
1763
+ border: 0;
1764
+ border-radius: var(--athena-radius);
1765
+ background: none;
1766
+ color: inherit;
1767
+ font: inherit;
1768
+ text-decoration: none;
1769
+ cursor: pointer;
1770
+ }
1771
+
1772
+ .athena-menu .menu-control:hover:not([aria-disabled="true"]):not(:disabled),
1773
+ .athena-menu .menu-control:focus-visible {
1774
+ background-color: var(--athena-hover);
1775
+ }
1776
+
1777
+ .athena-menu .menu-control:focus-visible {
1778
+ outline: 2px solid var(--athena-focus, var(--athena-accent));
1779
+ outline-offset: -2px;
1780
+ }
1781
+
1782
+ .athena-menu .menu-control.is-active,
1783
+ .athena-menu .has-active > .menu-control {
1784
+ font-weight: bold;
1785
+ box-shadow: inset 0 -3px 0 var(--athena-accent);
1786
+ }
1787
+
1788
+ .athena-menu .menu-control:disabled,
1789
+ .athena-menu .menu-control[aria-disabled="true"] {
1790
+ opacity: 0.5;
1791
+ cursor: not-allowed;
1792
+ }
1793
+
1794
+ .athena-menu .menu-icon {
1795
+ display: inline-flex;
1796
+ line-height: 1;
1797
+ }
1798
+
1799
+ .athena-menu .menu-avatar {
1800
+ display: inline-flex;
1801
+ align-items: center;
1802
+ justify-content: center;
1803
+ width: 28px;
1804
+ height: 28px;
1805
+ overflow: hidden;
1806
+ border-radius: 50%;
1807
+ background: var(--athena-accent);
1808
+ color: var(--athena-accent-fg);
1809
+ font-size: 0.8em;
1810
+ font-weight: bold;
1811
+ }
1812
+
1813
+ .athena-menu .menu-avatar img {
1814
+ width: 100%;
1815
+ height: 100%;
1816
+ object-fit: cover;
1817
+ }
1818
+
1819
+ .athena-menu .menu-sheet {
1820
+ position: absolute;
1821
+ z-index: 20;
1822
+ top: 100%;
1823
+ left: 0;
1824
+ min-width: 180px;
1825
+ margin: 2px 0 0;
1826
+ padding: 4px;
1827
+ list-style: none;
1828
+ background: var(--athena-bg);
1829
+ color: var(--athena-fg);
1830
+ border: 1px solid var(--athena-line);
1831
+ border-radius: var(--athena-radius);
1832
+ box-shadow: var(--athena-shadow);
1833
+ }
1834
+
1835
+ .athena-menu .menu-item-end .menu-sheet {
1836
+ left: auto;
1837
+ right: 0;
1838
+ }
1839
+
1840
+ .athena-menu .menu-sheet[hidden] {
1841
+ display: none;
1842
+ }
1843
+
1844
+ .athena-menu .menu-sheet .menu-control {
1845
+ display: flex;
1846
+ width: 100%;
1847
+ text-align: left;
1848
+ }
1849
+
1850
+ /* Tabs at the bottom (layout "responsive" switches to it under 700px) */
1851
+
1852
+ .athena-menu-bottom-tabs {
1853
+ position: fixed;
1854
+ z-index: 30;
1855
+ inset: auto 0 0;
1856
+ background: var(--athena-bg);
1857
+ border-top: 1px solid var(--athena-line);
1858
+ }
1859
+
1860
+ .athena-menu-bottom-tabs .athena-menu-list {
1861
+ flex-wrap: nowrap;
1862
+ justify-content: space-around;
1863
+ gap: 0;
1864
+ }
1865
+
1866
+ .athena-menu-bottom-tabs .menu-item {
1867
+ flex: 1;
1868
+ position: static;
1869
+ }
1870
+
1871
+ .athena-menu-bottom-tabs .menu-item-end {
1872
+ margin-left: 0;
1873
+ }
1874
+
1875
+ .athena-menu-bottom-tabs .menu-control {
1876
+ flex-direction: column;
1877
+ width: 100%;
1878
+ gap: 2px;
1879
+ padding: 6px 4px;
1880
+ font-size: 0.75em;
1881
+ }
1882
+
1883
+ .athena-menu-bottom-tabs .menu-sheet {
1884
+ position: fixed;
1885
+ inset: auto 0 56px;
1886
+ margin: 0;
1887
+ border-radius: var(--athena-radius) var(--athena-radius) 0 0;
1888
+ }
1889
+
1890
+ @media (max-width: 700px) {
1891
+ .athena-menu-responsive {
1892
+ position: fixed;
1893
+ z-index: 30;
1894
+ inset: auto 0 0;
1895
+ background: var(--athena-bg);
1896
+ border-top: 1px solid var(--athena-line);
1897
+ }
1898
+
1899
+ .athena-menu-responsive .athena-menu-list {
1900
+ flex-wrap: nowrap;
1901
+ justify-content: space-around;
1902
+ gap: 0;
1903
+ }
1904
+
1905
+ .athena-menu-responsive .menu-item {
1906
+ flex: 1;
1907
+ position: static;
1908
+ }
1909
+
1910
+ .athena-menu-responsive .menu-item-end {
1911
+ margin-left: 0;
1912
+ }
1913
+
1914
+ .athena-menu-responsive .menu-control {
1915
+ flex-direction: column;
1916
+ width: 100%;
1917
+ gap: 2px;
1918
+ padding: 6px 4px;
1919
+ font-size: 0.75em;
1920
+ }
1921
+
1922
+ .athena-menu-responsive .menu-sheet {
1923
+ position: fixed;
1924
+ inset: auto 0 56px;
1925
+ margin: 0;
1926
+ border-radius: var(--athena-radius) var(--athena-radius) 0 0;
1927
+ }
1928
+ }
1929
+
1930
+ /* Menu: groups inside groups, and badges */
1931
+
1932
+ .athena-menu .menu-sheet-nested {
1933
+ top: 0;
1934
+ left: 100%;
1935
+ margin: 0 0 0 2px;
1936
+ }
1937
+
1938
+ .athena-menu .menu-sheet .menu-caret {
1939
+ margin-left: auto;
1940
+ }
1941
+
1942
+ .athena-menu .menu-badge {
1943
+ display: inline-block;
1944
+ min-width: 1.5em;
1945
+ padding: 0 6px;
1946
+ border-radius: 999px;
1947
+ background: var(--athena-accent);
1948
+ color: var(--athena-accent-fg);
1949
+ font-size: 0.75em;
1950
+ font-weight: bold;
1951
+ line-height: 1.6;
1952
+ text-align: center;
1953
+ }
1954
+
1955
+ .athena-menu .menu-badge-ok { background: var(--athena-success); }
1956
+ .athena-menu .menu-badge-warn { background: var(--athena-warning); }
1957
+ .athena-menu .menu-badge-bad { background: var(--athena-danger); }
1958
+ .athena-menu .menu-badge-info { background: var(--athena-info); }
1959
+
1960
+ .athena-menu-bottom-tabs .menu-sheet-nested {
1961
+ position: static;
1962
+ margin: 0;
1963
+ padding: 0 0 0 12px;
1964
+ border: 0;
1965
+ box-shadow: none;
1966
+ background: none;
1967
+ }
1968
+
1969
+ @media (max-width: 700px) {
1970
+ .athena-menu-responsive .menu-sheet-nested {
1971
+ position: static;
1972
+ margin: 0;
1973
+ padding: 0 0 0 12px;
1974
+ border: 0;
1975
+ box-shadow: none;
1976
+ background: none;
1977
+ }
1978
+ }
1979
+
1980
+ .athena-table-placeholder td {
1981
+ color: var(--athena-muted);
1982
+ }
1983
+
1984
+ .athena-table-status {
1985
+ margin-top: 4px;
1986
+ }
1987
+
1988
+ .athena-table-status[hidden] {
1989
+ display: none;
1990
+ }
1991
+
1992
+ /* Charts: pointer layer, zoom */
1993
+
1994
+ .athena-chart .chart-hit {
1995
+ fill: transparent;
1996
+ cursor: crosshair;
1997
+ }
1998
+
1999
+ .athena-chart .chart-hit:focus-visible {
2000
+ outline: 2px solid var(--athena-focus, var(--athena-accent));
2001
+ outline-offset: 2px;
2002
+ }
2003
+
2004
+ .athena-chart .chart-marker {
2005
+ stroke: var(--athena-muted);
2006
+ stroke-dasharray: 3 3;
2007
+ pointer-events: none;
2008
+ }
2009
+
2010
+ .athena-chart .chart-selection {
2011
+ fill: var(--athena-accent);
2012
+ opacity: 0.2;
2013
+ pointer-events: none;
2014
+ }
2015
+
2016
+ .athena-chart .chart-reset {
2017
+ cursor: pointer;
2018
+ }
2019
+
2020
+ /* Page header, facts, empty state, loading, stat tone and note */
2021
+
2022
+ .page-header {
2023
+ margin-bottom: 16px;
2024
+ }
2025
+
2026
+ .page-header-row {
2027
+ display: flex;
2028
+ flex-wrap: wrap;
2029
+ align-items: flex-start;
2030
+ justify-content: space-between;
2031
+ gap: 12px;
2032
+ }
2033
+
2034
+ .page-title {
2035
+ margin: 0;
2036
+ }
2037
+
2038
+ .page-description {
2039
+ margin: 4px 0 0;
2040
+ color: var(--athena-muted);
2041
+ }
2042
+
2043
+ .page-actions {
2044
+ display: flex;
2045
+ flex-wrap: wrap;
2046
+ gap: 8px;
2047
+ }
2048
+
2049
+ .facts {
2050
+ display: grid;
2051
+ gap: 8px;
2052
+ margin: 0;
2053
+ }
2054
+
2055
+ .facts .fact {
2056
+ display: flex;
2057
+ flex-direction: column;
2058
+ }
2059
+
2060
+ .facts dt {
2061
+ color: var(--athena-muted);
2062
+ font-size: 0.85em;
2063
+ }
2064
+
2065
+ .facts dd {
2066
+ margin: 0;
2067
+ overflow-wrap: anywhere;
2068
+ }
2069
+
2070
+ .facts-inline .fact {
2071
+ flex-direction: row;
2072
+ gap: 12px;
2073
+ }
2074
+
2075
+ .facts-inline dt {
2076
+ min-width: 10em;
2077
+ font-size: inherit;
2078
+ }
2079
+
2080
+ .empty-state {
2081
+ display: flex;
2082
+ flex-direction: column;
2083
+ align-items: center;
2084
+ gap: 8px;
2085
+ padding: 32px 16px;
2086
+ text-align: center;
2087
+ color: var(--athena-muted);
2088
+ }
2089
+
2090
+ .empty-state .empty-icon {
2091
+ font-size: 2.5em;
2092
+ line-height: 1;
2093
+ }
2094
+
2095
+ .empty-state .empty-title {
2096
+ margin: 0;
2097
+ color: var(--athena-fg);
2098
+ font-weight: bold;
2099
+ }
2100
+
2101
+ .empty-state .empty-message {
2102
+ margin: 0;
2103
+ max-width: 40em;
2104
+ }
2105
+
2106
+ .loading-state {
2107
+ display: flex;
2108
+ align-items: center;
2109
+ justify-content: center;
2110
+ gap: 8px;
2111
+ padding: 24px;
2112
+ color: var(--athena-muted);
2113
+ }
2114
+
2115
+ .stat-note {
2116
+ margin-top: 2px;
2117
+ color: var(--athena-muted);
2118
+ font-size: 0.85em;
2119
+ }
2120
+
2121
+ .stat-note[hidden] {
2122
+ display: none;
2123
+ }
2124
+
2125
+ .stat.is-ok { border-left: 4px solid var(--athena-success); }
2126
+ .stat.is-warn { border-left: 4px solid var(--athena-warning); }
2127
+ .stat.is-bad { border-left: 4px solid var(--athena-danger); }
2128
+ .stat.is-ok .stat-value { color: var(--athena-success); }
2129
+ .stat.is-warn .stat-value { color: var(--athena-warning); }
2130
+ .stat.is-bad .stat-value { color: var(--athena-danger); }
@@ -0,0 +1,25 @@
1
+ // Athena UI theme boot script (MIT). A classic script, not a module: load it in <head>, before the stylesheet, so the saved
2
+ // theme and mode are on <html> before the page is drawn and the wrong colours never flash. createThemeManager does the rest.
3
+ // It is a file of its own because a strict Content-Security-Policy does not allow an inline script. Configure it with
4
+ // data attributes on its own tag (they have to match createThemeManager):
5
+ //
6
+ // <script src="/athena-ui/theme-boot.js" data-key="myapp.appearance" data-theme="ocean"></script>
7
+ //
8
+ // data-key localStorage key (default "athena.appearance")
9
+ // data-theme the theme that is used when nothing is saved (default "default")
10
+ (function () {
11
+ var tag = document.currentScript;
12
+ var key = (tag && tag.getAttribute("data-key")) || "athena.appearance";
13
+ var theme = (tag && tag.getAttribute("data-theme")) || "default";
14
+ var mode = "system";
15
+ try {
16
+ var saved = JSON.parse(localStorage.getItem(key) || "{}");
17
+ if (/^[a-z0-9_-]+$/i.test(saved.theme || "")) theme = saved.theme;
18
+ if (saved.mode === "light" || saved.mode === "dark") mode = saved.mode;
19
+ } catch (e) {
20
+ // Private browsing, or a value that is not JSON: the defaults
21
+ }
22
+ var dark = mode === "dark" || (mode === "system" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches);
23
+ document.documentElement.setAttribute("data-theme", theme);
24
+ document.documentElement.setAttribute("data-mode", dark ? "dark" : "light");
25
+ })();
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 csabatibortoth
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,5 +0,0 @@
1
- //Author: Csaba Tóth https://github.com/csabatibortoth/
2
- //LICENCE: MIT
3
- //Repository: https://github.com/csabatibortoth/HTMLControlGenerator/
4
- //Version: 0.4.0
5
- (()=>{"use strict";const T=["text","password","submit","reset","radio","checkbox","button","color","date","datetime-local","email","file","month","number","range","search","tel","time","url","week"],V=new Set(["reset","file"]),M=new Set(["date","number","range"]),C=new Set(["radio","checkbox"]),E=["change","click"],N="HTMLControlGenerator",u=e=>({errorCode:0,errorString:"undefined",errorVariable:e,errorFunction:N}),w=e=>({errorCode:1,errorString:"Wrong Input Type defined",errorVariable:"options",errorFunction:N,errorMiscInfo:e}),r=e=>{console.error(e),document.body&&jQuery("<div>").text(`Error Code: ${e.errorCode}, Error description: ${e.errorString}! For more information see console!`).appendTo(document.body)},h=(e,t)=>{const n=e[`on${t}`]??("change"===t?e.change:void 0);return"function"==typeof n?n:void 0},c=(e,t)=>jQuery(`<${e}>`).attr("id",t.id).addClass(t.class),f=(e,t)=>{const n=c(e,t).attr("name",t.name).prop({readOnly:t.readOnly,disabled:t.disabled});for(const e of E){const o=h(t,e);o&&n.on(e,()=>o.call(t,t.data))}return n},i=e=>{const t=e.inputType,n=f("input",e).attr("type",t);return void 0===e.value||V.has(t)||n.val(e.value),M.has(t)&&n.attr({min:e.min,max:e.max}),C.has(t)&&n.prop("checked",e.checked),n},s=e=>f("select",e).append((e.items??[]).map(e=>jQuery("<option>").val(e.value).text(e.text).attr("selected",e.selected?"selected":null))),l=e=>{const t=[...e.items??[]],n=c(e.inputType,e);n.append(t.map(e=>c("li",e).text(e.text)));for(const o of E)[e,...t].some(e=>h(e,o))&&n.on(o,"li",function(){const n=t[jQuery(this).index()],a=n&&h(n,o)?n:e;h(a,o)?.call(a,a.data)});return n},F=new Map([...T.map(e=>[e,i]),["select",s],["ul",l],["ol",l]]),g=e=>{if(void 0===e)return void r(u("options"));const t=F.get(e.inputType);return t||r(w(e)),t};function HTMLControlGenerator(e){const t=g(e);if(!t)return;if(void 0===e.parent)return void r(u("options.parent"));const n=t(e),o=document.getElementById(e.parent);o?jQuery(o).append(n):document.body?jQuery("<div>").append(n).appendTo(document.body):r({errorCode:2,errorString:"No body or parent to append input!",errorFunction:N})}HTMLControlGenerator.create=e=>g(e)?.(e),HTMLControlGenerator.register=(e,t)=>{F.set(e,t)},globalThis.HTMLControlGenerator=HTMLControlGenerator})();
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Csaba Tóth
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.