@tamagui/static 1.1.11 → 1.1.12
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.
|
@@ -1634,6 +1634,30 @@ export function createExtractor(
|
|
|
1634
1634
|
pressIn: false,
|
|
1635
1635
|
}
|
|
1636
1636
|
|
|
1637
|
+
function splitVariants(style: any) {
|
|
1638
|
+
const variants = {}
|
|
1639
|
+
const styles = {}
|
|
1640
|
+
for (const key in style) {
|
|
1641
|
+
if (staticConfig.variants?.[key]) {
|
|
1642
|
+
variants[key] = style[key]
|
|
1643
|
+
} else {
|
|
1644
|
+
styles[key] = style[key]
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
return {
|
|
1648
|
+
variants,
|
|
1649
|
+
styles,
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
function expandStylesWithoutVariants(style: any) {
|
|
1654
|
+
const { variants, styles } = splitVariants(style)
|
|
1655
|
+
return {
|
|
1656
|
+
...expandStyles(styles),
|
|
1657
|
+
...variants,
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1637
1661
|
// evaluates all static attributes into a simple object
|
|
1638
1662
|
let foundStaticProps = {}
|
|
1639
1663
|
for (const key in attrs) {
|
|
@@ -1792,44 +1816,14 @@ export function createExtractor(
|
|
|
1792
1816
|
// merge styles, leave undefined values
|
|
1793
1817
|
let prev: ExtractedAttr | null = null
|
|
1794
1818
|
|
|
1795
|
-
function splitVariants(style: any) {
|
|
1796
|
-
const variants = {}
|
|
1797
|
-
const styles = {}
|
|
1798
|
-
for (const key in style) {
|
|
1799
|
-
if (staticConfig.variants?.[key]) {
|
|
1800
|
-
variants[key] = style[key]
|
|
1801
|
-
} else {
|
|
1802
|
-
styles[key] = style[key]
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
return {
|
|
1806
|
-
variants,
|
|
1807
|
-
styles,
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
function expandStylesWithoutVariants(style: any) {
|
|
1812
|
-
const { variants, styles } = splitVariants(style)
|
|
1813
|
-
return {
|
|
1814
|
-
...expandStyles(styles),
|
|
1815
|
-
...variants,
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
1819
|
function mergeStyles(
|
|
1820
1820
|
prev: ViewStyle & PseudoStyles,
|
|
1821
|
-
|
|
1821
|
+
next: ViewStyle & PseudoStyles
|
|
1822
1822
|
) {
|
|
1823
|
-
const next = expandStylesWithoutVariants(nextIn)
|
|
1824
1823
|
for (const key in next) {
|
|
1825
1824
|
// merge pseudos
|
|
1826
1825
|
if (pseudoDescriptors[key]) {
|
|
1827
1826
|
prev[key] = prev[key] || {}
|
|
1828
|
-
if (shouldPrintDebug) {
|
|
1829
|
-
if (!next[key] || !prev[key]) {
|
|
1830
|
-
logger.info(['warn: missing', key, prev, next].join(' '))
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
1827
|
Object.assign(prev[key], next[key])
|
|
1834
1828
|
} else {
|
|
1835
1829
|
prev[key] = next[key]
|
|
@@ -1848,7 +1842,7 @@ export function createExtractor(
|
|
|
1848
1842
|
// de-opt if non-style
|
|
1849
1843
|
!validStyles[key] &&
|
|
1850
1844
|
!pseudoDescriptors[key] &&
|
|
1851
|
-
!key.startsWith('data-')
|
|
1845
|
+
!(key.startsWith('data-') || key.startsWith('aria-'))
|
|
1852
1846
|
|
|
1853
1847
|
if (shouldKeepOriginalAttr) {
|
|
1854
1848
|
if (shouldPrintDebug) {
|