@tamagui/web 1.4.0 → 1.5.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/cjs/createComponent.js +4 -5
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +7 -6
- package/dist/cjs/createTamagui.js.map +3 -3
- package/dist/cjs/helpers/expandStyle.js +5 -14
- package/dist/cjs/helpers/expandStyle.js.map +2 -2
- package/dist/cjs/helpers/expandStyles.js +4 -42
- package/dist/cjs/helpers/expandStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +22 -23
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/normalizeColor.js +13 -15
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js +8 -19
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/themeable.js.map +1 -1
- package/dist/cjs/views/Theme.js +2 -2
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/esm/createComponent.js +5 -10
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +5 -10
- package/dist/esm/createComponent.mjs.map +2 -2
- package/dist/esm/createTamagui.js +7 -6
- package/dist/esm/createTamagui.js.map +3 -3
- package/dist/esm/createTamagui.mjs +7 -6
- package/dist/esm/createTamagui.mjs.map +3 -3
- package/dist/esm/helpers/expandStyle.js +5 -14
- package/dist/esm/helpers/expandStyle.js.map +2 -2
- package/dist/esm/helpers/expandStyle.mjs +5 -14
- package/dist/esm/helpers/expandStyle.mjs.map +2 -2
- package/dist/esm/helpers/expandStyles.js +3 -41
- package/dist/esm/helpers/expandStyles.js.map +2 -2
- package/dist/esm/helpers/expandStyles.mjs +3 -41
- package/dist/esm/helpers/expandStyles.mjs.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +20 -21
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +20 -21
- package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
- package/dist/esm/helpers/normalizeColor.js +12 -15
- package/dist/esm/helpers/normalizeColor.js.map +2 -2
- package/dist/esm/helpers/normalizeColor.mjs +12 -15
- package/dist/esm/helpers/normalizeColor.mjs.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.js +9 -20
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +9 -20
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +2 -2
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themeable.mjs.map +1 -1
- package/dist/esm/views/Theme.js +2 -2
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/Theme.mjs +2 -2
- package/dist/esm/views/Theme.mjs.map +2 -2
- package/package.json +9 -9
- package/src/createComponent.tsx +7 -13
- package/src/createTamagui.ts +6 -4
- package/src/helpers/expandStyle.ts +5 -18
- package/src/helpers/expandStyles.ts +9 -46
- package/src/helpers/getSplitStyles.tsx +31 -24
- package/src/helpers/normalizeColor.ts +11 -22
- package/src/helpers/normalizeShadow.native.ts +30 -0
- package/src/helpers/normalizeShadow.ts +20 -0
- package/src/helpers/normalizeStylePropKeys.native.ts +12 -0
- package/src/helpers/normalizeStylePropKeys.ts +3 -0
- package/src/helpers/normalizeValueWithProperty.ts +9 -23
- package/src/helpers/themeable.tsx +2 -2
- package/src/views/Theme.tsx +2 -3
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/helpers/expandStyle.d.ts.map +1 -1
- package/types/helpers/expandStyles.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +1 -2
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/normalizeColor.d.ts +5 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -1
- package/types/helpers/normalizeColor.native.d.ts +16 -0
- package/types/helpers/normalizeShadow.d.ts +10 -0
- package/types/helpers/normalizeShadow.native.d.ts +10 -0
- package/types/helpers/normalizeStylePropKeys.d.ts +2 -0
- package/types/helpers/normalizeStylePropKeys.native.d.ts +13 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
- package/types/helpers/themeable.d.ts +2 -2
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/src/helpers/mergeTransform.ts +0 -30
|
@@ -88,25 +88,26 @@ function createTamagui(configIn) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
const dedupedThemes = {};
|
|
91
|
-
const existing = /* @__PURE__ */ new
|
|
91
|
+
const existing = /* @__PURE__ */ new Map();
|
|
92
92
|
for (const themeName in themes) {
|
|
93
93
|
const rawTheme = themes[themeName];
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const key = JSON.stringify(rawTheme);
|
|
95
|
+
if (existing.has(key)) {
|
|
96
|
+
const e = existing.get(key);
|
|
96
97
|
themes[themeName] = e.theme;
|
|
97
98
|
e.names.push(themeName);
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
const theme = { ...rawTheme };
|
|
101
|
-
for (const
|
|
102
|
-
ensureThemeVariable(theme,
|
|
102
|
+
for (const key2 in theme) {
|
|
103
|
+
ensureThemeVariable(theme, key2);
|
|
103
104
|
}
|
|
104
105
|
themes[themeName] = theme;
|
|
105
106
|
dedupedThemes[themeName] = {
|
|
106
107
|
names: [themeName],
|
|
107
108
|
theme
|
|
108
109
|
};
|
|
109
|
-
existing.set(
|
|
110
|
+
existing.set(key, dedupedThemes[themeName]);
|
|
110
111
|
}
|
|
111
112
|
let themeRuleSets = [];
|
|
112
113
|
if (isWeb || isRSC) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["import { isRSC, isWeb } from '@tamagui/constants'\n\nimport { configListeners, setConfig } from './config'\nimport { createVariables, tokensKeysOrdered } from './createVariables'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport {\n getAllRules,\n listenForSheetChanges,\n scanAllSheets,\n} from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokensValueToVariable,\n variableToCSS,\n} from './helpers/registerCSSVariable'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport { Tamagui } from './Tamagui'\nimport {\n CreateTamaguiProps,\n InferTamaguiConfig,\n TamaguiInternalConfig,\n ThemeParsed,\n} from './types'\n\n// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n configIn: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(configIn)) {\n return configIn as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!configIn.tokens) {\n throw new Error('Must define tokens')\n }\n if (!configIn.themes) {\n throw new Error('Must define themes')\n }\n if (!configIn.fonts) {\n throw new Error('Must define fonts')\n }\n }\n\n scanAllSheets()\n listenForSheetChanges()\n\n const fontTokens = Object.fromEntries(\n Object.entries(configIn.fonts!).map(([k, v]) => {\n return [k, createVariables(v, 'f', true)]\n })\n )\n\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...configIn.themes }\n const cssRuleSets: string[] = []\n\n if (isWeb) {\n const declarations: string[] = []\n const fontDeclarations: Record<\n string,\n { name: string; declarations: string[]; language?: string }\n > = {}\n\n for (const key in configIn.tokens) {\n for (const skey in configIn.tokens[key]) {\n const val = configIn.tokens[key][skey]\n registerCSSVariable(val)\n declarations.push(variableToCSS(val))\n }\n }\n\n for (const key in fontsParsed) {\n const fontParsed = fontsParsed[key]\n const [name, language] = key.includes('_') ? key.split('_') : [key]\n const fontVars = registerFontVariables(fontParsed)\n fontDeclarations[key] = {\n name: name.slice(1),\n declarations: fontVars,\n language,\n }\n }\n\n const sep =\n process.env.NODE_ENV === 'development' ? configIn.cssStyleSeparator || ' ' : ''\n\n function declarationsToRuleSet(decs: string[], selector = '') {\n return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`\n }\n\n // non-font\n cssRuleSets.push(declarationsToRuleSet(declarations))\n\n // fonts\n if (fontDeclarations) {\n for (const key in fontDeclarations) {\n const { name, declarations, language = 'default' } = fontDeclarations[key]\n const fontSelector = `.font_${name}`\n const langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`\n const selectors =\n language === 'default' ? ` ${fontSelector}, ${langSelector}` : langSelector\n const specificRuleSet = declarationsToRuleSet(declarations, selectors)\n cssRuleSets.push(specificRuleSet)\n }\n }\n }\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeParsed\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new
|
|
5
|
-
"mappings": "AAAA,SAAS,OAAO,aAAa;AAE7B,SAAS,iBAAiB,iBAAiB;AAC3C,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB,2BAA2B;AACzD,SAAS,sBAAsB;AAC/B,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe;AASxB,MAAM,iBAAiB,oBAAI,QAAsB;AAE1C,SAAS,cACd,UAC0B;AA/B5B;AAgCE,MAAI,eAAe,IAAI,QAAQ,GAAG;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,SAAS,QAAQ;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AI,MAAM,GAAG,IAAI,CAAC,GAAG;AAClE,cAAM,WAAW,sBAAsB,UAAU;AACjD,yBAAiB,GAAG,IAAI;AAAA,UACtB,MAAM,KAAK,MAAM,CAAC;AAAA,UAClB,cAAc;AAAA,UACd;AAAA,QACF;AAAA,MACF;AAEA,YAAM,MACJ,QAAQ,IAAI,aAAa,gBAAgB,SAAS,qBAAqB,MAAM;AAO/E,kBAAY,KAAKA,uBAAsB,YAAY,CAAC;AAGpD,UAAI,kBAAkB;AACpB,mBAAW,OAAO,kBAAkB;AAClC,gBAAM,EAAE,MAAM,cAAAC,eAAc,WAAW,UAAU,IAAI,iBAAiB,GAAG;AACzE,gBAAM,eAAe,SAAS;AAC9B,gBAAM,eAAe,iBAAiB,QAAQ,YAAY;AAC1D,gBAAM,YACJ,aAAa,YAAY,IAAI,iBAAiB,iBAAiB;AACjE,gBAAM,kBAAkBD,uBAAsBC,eAAc,SAAS;AACrE,sBAAY,KAAK,eAAe;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAOA,UAAM,gBAEF,CAAC;AACL,UAAM,WAAW,oBAAI,
|
|
6
|
-
"names": ["declarationsToRuleSet", "declarations", "k", "v"]
|
|
4
|
+
"sourcesContent": ["import { isRSC, isWeb } from '@tamagui/constants'\n\nimport { configListeners, setConfig } from './config'\nimport { createVariables, tokensKeysOrdered } from './createVariables'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport {\n getAllRules,\n listenForSheetChanges,\n scanAllSheets,\n} from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokensValueToVariable,\n variableToCSS,\n} from './helpers/registerCSSVariable'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport { Tamagui } from './Tamagui'\nimport {\n CreateTamaguiProps,\n InferTamaguiConfig,\n TamaguiInternalConfig,\n ThemeParsed,\n} from './types'\n\n// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n configIn: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(configIn)) {\n return configIn as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!configIn.tokens) {\n throw new Error('Must define tokens')\n }\n if (!configIn.themes) {\n throw new Error('Must define themes')\n }\n if (!configIn.fonts) {\n throw new Error('Must define fonts')\n }\n }\n\n scanAllSheets()\n listenForSheetChanges()\n\n const fontTokens = Object.fromEntries(\n Object.entries(configIn.fonts!).map(([k, v]) => {\n return [k, createVariables(v, 'f', true)]\n })\n )\n\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...configIn.themes }\n const cssRuleSets: string[] = []\n\n if (isWeb) {\n const declarations: string[] = []\n const fontDeclarations: Record<\n string,\n { name: string; declarations: string[]; language?: string }\n > = {}\n\n for (const key in configIn.tokens) {\n for (const skey in configIn.tokens[key]) {\n const val = configIn.tokens[key][skey]\n registerCSSVariable(val)\n declarations.push(variableToCSS(val))\n }\n }\n\n for (const key in fontsParsed) {\n const fontParsed = fontsParsed[key]\n const [name, language] = key.includes('_') ? key.split('_') : [key]\n const fontVars = registerFontVariables(fontParsed)\n fontDeclarations[key] = {\n name: name.slice(1),\n declarations: fontVars,\n language,\n }\n }\n\n const sep =\n process.env.NODE_ENV === 'development' ? configIn.cssStyleSeparator || ' ' : ''\n\n function declarationsToRuleSet(decs: string[], selector = '') {\n return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`\n }\n\n // non-font\n cssRuleSets.push(declarationsToRuleSet(declarations))\n\n // fonts\n if (fontDeclarations) {\n for (const key in fontDeclarations) {\n const { name, declarations, language = 'default' } = fontDeclarations[key]\n const fontSelector = `.font_${name}`\n const langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`\n const selectors =\n language === 'default' ? ` ${fontSelector}, ${langSelector}` : langSelector\n const specificRuleSet = declarationsToRuleSet(declarations, selectors)\n cssRuleSets.push(specificRuleSet)\n }\n }\n }\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeParsed\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new Map<string, DedupedTheme>()\n\n // first, de-dupe and parse them\n for (const themeName in themes) {\n const rawTheme = themes[themeName] as ThemeParsed\n // dont force referential equality but may need something more consistent than JSON.stringify\n const key = JSON.stringify(rawTheme)\n\n // if existing, avoid\n if (existing.has(key)) {\n const e = existing.get(key)!\n themes[themeName] = e.theme\n e.names.push(themeName)\n continue\n }\n\n // ensure each theme object unique for dedupe\n const theme = { ...rawTheme }\n // parse into variables\n for (const key in theme) {\n // make sure properly names theme variables\n ensureThemeVariable(theme, key)\n }\n themes[themeName] = theme\n\n // set deduped\n dedupedThemes[themeName] = {\n names: [themeName],\n theme,\n }\n\n existing.set(key, dedupedThemes[themeName])\n }\n\n // then, generate CSS from de-duped\n let themeRuleSets: string[] = []\n\n if (isWeb || isRSC) {\n for (const themeName in dedupedThemes) {\n themeRuleSets = [\n ...themeRuleSets,\n ...getThemeCSSRules({\n config: configIn,\n themeName,\n ...dedupedThemes[themeName],\n }),\n ]\n }\n }\n\n // proxy upwards to get parent variables (themes are subset going down)\n for (const themeName in themes) {\n themes[themeName] = proxyThemeToParents(themeName, themes[themeName], themes)\n }\n\n tokensValueToVariable.clear()\n\n return {\n themes,\n cssRuleSets,\n themeRuleSets,\n }\n })()\n\n // faster $lookups\n const tokensParsed: any = Object.fromEntries(\n Object.entries(configIn.tokens).map(([k, v]) => {\n const val = Object.fromEntries(Object.entries(v).map(([k, v]) => [`$${k}`, v]))\n tokensKeysOrdered.set(val, tokensKeysOrdered.get(v))\n return [k, val]\n })\n )\n\n const shorthands = configIn.shorthands || {}\n\n const config: TamaguiInternalConfig = {\n fontLanguages: [],\n animations: {} as any,\n media: {},\n ...configIn,\n // already processed by createTokens()\n tokens: configIn.tokens as any,\n // vite made this into a function if it wasn't set\n shorthands: { ...shorthands },\n inverseShorthands: shorthands\n ? Object.fromEntries(Object.entries(shorthands).map(([k, v]) => [v, k]))\n : {},\n themes: themeConfig.themes as any,\n fontsParsed,\n themeConfig,\n tokensParsed,\n parsed: true,\n getCSS: (separator = '\\n') => {\n return `\n._ovs-contain {overscroll-behavior:contain;}\n.t_unmounted .t_will-mount {opacity:0;visibility:hidden;}\n.is_Text .is_Text {display:inline-flex;}\n._dsp_contents {display:contents;}\n${themeConfig.cssRuleSets.join(separator)}\n${themeConfig.themeRuleSets.join(separator)}\n${getAllRules().join(separator)}`\n },\n // const tokens = [...getToken(tokens.size[0])]\n // .spacer-sm + ._dsp_contents._dsp-sm-hidden { margin-left: -var(--${}) }\n }\n\n configureMedia(config)\n setConfig(config)\n\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(config))\n configListeners.clear()\n }\n\n createdConfigs.set(config, true)\n\n if (process.env.NODE_ENV === 'development') {\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log('Tamagui config:', config)\n }\n if (!globalThis['Tamagui']) {\n globalThis['Tamagui'] = Tamagui\n }\n }\n\n return config as any\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,aAAa;AAE7B,SAAS,iBAAiB,iBAAiB;AAC3C,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB,2BAA2B;AACzD,SAAS,sBAAsB;AAC/B,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe;AASxB,MAAM,iBAAiB,oBAAI,QAAsB;AAE1C,SAAS,cACd,UAC0B;AA/B5B;AAgCE,MAAI,eAAe,IAAI,QAAQ,GAA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,YAAY;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ,CAAC,YAAY,SAAS;AAC5B,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX,YAAY,YAAY,KAAK,SAAS;AAAA,EACtC,YAAY,cAAc,KAAK,SAAS;AAAA,EACxC,YAAY,EAAE,KAAK,SAAS;AAAA,IAC1B;AAAA;AAAA;AAAA,EAGF;AAEA,iBAAe,MAAM;AACrB,YAAU,MAAM;AAEhB,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAC1C,oBAAgB,MAAM;AAAA,EACxB;AAEA,iBAAe,IAAI,QAAQ,IAAI;AAE/B,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,SAAI,aAAQ,IAAI,UAAZ,mBAAmB,WAAW,YAAY;AAE5C,cAAQ,IAAI,mBAAmB,MAAM;AAAA,IACvC;AACA,QAAI,CAAC,WAAW,SAAS,GAAG;AAC1B,iBAAW,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["declarationsToRuleSet", "declarations", "key", "k", "v"]
|
|
7
7
|
}
|
|
@@ -88,25 +88,26 @@ function createTamagui(configIn) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
const dedupedThemes = {};
|
|
91
|
-
const existing = /* @__PURE__ */ new
|
|
91
|
+
const existing = /* @__PURE__ */ new Map();
|
|
92
92
|
for (const themeName in themes) {
|
|
93
93
|
const rawTheme = themes[themeName];
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const key = JSON.stringify(rawTheme);
|
|
95
|
+
if (existing.has(key)) {
|
|
96
|
+
const e = existing.get(key);
|
|
96
97
|
themes[themeName] = e.theme;
|
|
97
98
|
e.names.push(themeName);
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
const theme = { ...rawTheme };
|
|
101
|
-
for (const
|
|
102
|
-
ensureThemeVariable(theme,
|
|
102
|
+
for (const key2 in theme) {
|
|
103
|
+
ensureThemeVariable(theme, key2);
|
|
103
104
|
}
|
|
104
105
|
themes[themeName] = theme;
|
|
105
106
|
dedupedThemes[themeName] = {
|
|
106
107
|
names: [themeName],
|
|
107
108
|
theme
|
|
108
109
|
};
|
|
109
|
-
existing.set(
|
|
110
|
+
existing.set(key, dedupedThemes[themeName]);
|
|
110
111
|
}
|
|
111
112
|
let themeRuleSets = [];
|
|
112
113
|
if (isWeb || isRSC) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["import { isRSC, isWeb } from '@tamagui/constants'\n\nimport { configListeners, setConfig } from './config'\nimport { createVariables, tokensKeysOrdered } from './createVariables'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport {\n getAllRules,\n listenForSheetChanges,\n scanAllSheets,\n} from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokensValueToVariable,\n variableToCSS,\n} from './helpers/registerCSSVariable'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport { Tamagui } from './Tamagui'\nimport {\n CreateTamaguiProps,\n InferTamaguiConfig,\n TamaguiInternalConfig,\n ThemeParsed,\n} from './types'\n\n// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n configIn: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(configIn)) {\n return configIn as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!configIn.tokens) {\n throw new Error('Must define tokens')\n }\n if (!configIn.themes) {\n throw new Error('Must define themes')\n }\n if (!configIn.fonts) {\n throw new Error('Must define fonts')\n }\n }\n\n scanAllSheets()\n listenForSheetChanges()\n\n const fontTokens = Object.fromEntries(\n Object.entries(configIn.fonts!).map(([k, v]) => {\n return [k, createVariables(v, 'f', true)]\n })\n )\n\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...configIn.themes }\n const cssRuleSets: string[] = []\n\n if (isWeb) {\n const declarations: string[] = []\n const fontDeclarations: Record<\n string,\n { name: string; declarations: string[]; language?: string }\n > = {}\n\n for (const key in configIn.tokens) {\n for (const skey in configIn.tokens[key]) {\n const val = configIn.tokens[key][skey]\n registerCSSVariable(val)\n declarations.push(variableToCSS(val))\n }\n }\n\n for (const key in fontsParsed) {\n const fontParsed = fontsParsed[key]\n const [name, language] = key.includes('_') ? key.split('_') : [key]\n const fontVars = registerFontVariables(fontParsed)\n fontDeclarations[key] = {\n name: name.slice(1),\n declarations: fontVars,\n language,\n }\n }\n\n const sep =\n process.env.NODE_ENV === 'development' ? configIn.cssStyleSeparator || ' ' : ''\n\n function declarationsToRuleSet(decs: string[], selector = '') {\n return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`\n }\n\n // non-font\n cssRuleSets.push(declarationsToRuleSet(declarations))\n\n // fonts\n if (fontDeclarations) {\n for (const key in fontDeclarations) {\n const { name, declarations, language = 'default' } = fontDeclarations[key]\n const fontSelector = `.font_${name}`\n const langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`\n const selectors =\n language === 'default' ? ` ${fontSelector}, ${langSelector}` : langSelector\n const specificRuleSet = declarationsToRuleSet(declarations, selectors)\n cssRuleSets.push(specificRuleSet)\n }\n }\n }\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeParsed\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new
|
|
5
|
-
"mappings": "AAAA,SAAS,OAAO,aAAa;AAE7B,S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} from '@tamagui/constants'\n\nimport { configListeners, setConfig } from './config'\nimport { createVariables, tokensKeysOrdered } from './createVariables'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport {\n getAllRules,\n listenForSheetChanges,\n scanAllSheets,\n} from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokensValueToVariable,\n variableToCSS,\n} from './helpers/registerCSSVariable'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport { Tamagui } from './Tamagui'\nimport {\n CreateTamaguiProps,\n InferTamaguiConfig,\n TamaguiInternalConfig,\n ThemeParsed,\n} from './types'\n\n// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n configIn: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(configIn)) {\n return configIn as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!configIn.tokens) {\n throw new Error('Must define tokens')\n }\n if (!configIn.themes) {\n throw new Error('Must define themes')\n }\n if (!configIn.fonts) {\n throw new Error('Must define fonts')\n }\n }\n\n scanAllSheets()\n listenForSheetChanges()\n\n const fontTokens = Object.fromEntries(\n Object.entries(configIn.fonts!).map(([k, v]) => {\n return [k, createVariables(v, 'f', true)]\n })\n )\n\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...configIn.themes }\n const cssRuleSets: string[] = []\n\n if (isWeb) {\n const declarations: string[] = []\n const fontDeclarations: Record<\n string,\n { name: string; declarations: string[]; language?: string }\n > = {}\n\n for (const key in configIn.tokens) {\n for (const skey in configIn.tokens[key]) {\n const val = configIn.tokens[key][skey]\n registerCSSVariable(val)\n declarations.push(variableToCSS(val))\n }\n }\n\n for (const key in fontsParsed) {\n const fontParsed = fontsParsed[key]\n const [name, language] = key.includes('_') ? key.split('_') : [key]\n const fontVars = registerFontVariables(fontParsed)\n fontDeclarations[key] = {\n name: name.slice(1),\n declarations: fontVars,\n language,\n }\n }\n\n const sep =\n process.env.NODE_ENV === 'development' ? configIn.cssStyleSeparator || ' ' : ''\n\n function declarationsToRuleSet(decs: string[], selector = '') {\n return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`\n }\n\n // non-font\n cssRuleSets.push(declarationsToRuleSet(declarations))\n\n // fonts\n if (fontDeclarations) {\n for (const key in fontDeclarations) {\n const { name, declarations, language = 'default' } = fontDeclarations[key]\n const fontSelector = `.font_${name}`\n const langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`\n const selectors =\n language === 'default' ? ` ${fontSelector}, ${langSelector}` : langSelector\n const specificRuleSet = declarationsToRuleSet(declarations, selectors)\n cssRuleSets.push(specificRuleSet)\n }\n }\n }\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeParsed\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new Map<string, DedupedTheme>()\n\n // first, de-dupe and parse them\n for (const themeName in themes) {\n const rawTheme = themes[themeName] as ThemeParsed\n // dont force referential equality but may need something more consistent than JSON.stringify\n const key = JSON.stringify(rawTheme)\n\n // if existing, avoid\n if (existing.has(key)) {\n const e = existing.get(key)!\n themes[themeName] = e.theme\n e.names.push(themeName)\n continue\n }\n\n // ensure each theme object unique for dedupe\n const theme = { ...rawTheme }\n // parse into variables\n for (const key in theme) {\n // make sure properly names theme variables\n ensureThemeVariable(theme, key)\n }\n themes[themeName] = theme\n\n // set deduped\n dedupedThemes[themeName] = {\n names: [themeName],\n theme,\n }\n\n existing.set(key, dedupedThemes[themeName])\n }\n\n // then, generate CSS from de-duped\n let themeRuleSets: string[] = []\n\n if (isWeb || isRSC) {\n for (const themeName in dedupedThemes) {\n themeRuleSets = [\n ...themeRuleSets,\n ...getThemeCSSRules({\n config: configIn,\n themeName,\n ...dedupedThemes[themeName],\n }),\n ]\n }\n }\n\n // proxy upwards to get parent variables (themes are subset going down)\n for (const themeName in themes) {\n themes[themeName] = proxyThemeToParents(themeName, themes[themeName], themes)\n }\n\n tokensValueToVariable.clear()\n\n return {\n themes,\n cssRuleSets,\n themeRuleSets,\n }\n })()\n\n // faster $lookups\n const tokensParsed: any = Object.fromEntries(\n Object.entries(configIn.tokens).map(([k, v]) => {\n const val = Object.fromEntries(Object.entries(v).map(([k, v]) => [`$${k}`, v]))\n tokensKeysOrdered.set(val, tokensKeysOrdered.get(v))\n return [k, val]\n })\n )\n\n const shorthands = configIn.shorthands || {}\n\n const config: TamaguiInternalConfig = {\n fontLanguages: [],\n animations: {} as any,\n media: {},\n ...configIn,\n // already processed by createTokens()\n tokens: configIn.tokens as any,\n // vite made this into a function if it wasn't set\n shorthands: { ...shorthands },\n inverseShorthands: shorthands\n ? Object.fromEntries(Object.entries(shorthands).map(([k, v]) => [v, k]))\n : {},\n themes: themeConfig.themes as any,\n fontsParsed,\n themeConfig,\n tokensParsed,\n parsed: true,\n getCSS: (separator = '\\n') => {\n return `\n._ovs-contain {overscroll-behavior:contain;}\n.t_unmounted .t_will-mount {opacity:0;visibility:hidden;}\n.is_Text .is_Text {display:inline-flex;}\n._dsp_contents {display:contents;}\n${themeConfig.cssRuleSets.join(separator)}\n${themeConfig.themeRuleSets.join(separator)}\n${getAllRules().join(separator)}`\n },\n // const tokens = [...getToken(tokens.size[0])]\n // .spacer-sm + ._dsp_contents._dsp-sm-hidden { margin-left: -var(--${}) }\n }\n\n configureMedia(config)\n setConfig(config)\n\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(config))\n configListeners.clear()\n }\n\n createdConfigs.set(config, true)\n\n if (process.env.NODE_ENV === 'development') {\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log('Tamagui config:', config)\n }\n if (!globalThis['Tamagui']) {\n globalThis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}
|
|
@@ -3,20 +3,11 @@ import { isWeb } from "@tamagui/constants";
|
|
|
3
3
|
function expandStyle(key, value) {
|
|
4
4
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
5
5
|
if (key === "flex") {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
if (value >= 0) {
|
|
14
|
-
return [
|
|
15
|
-
["flexGrow", value],
|
|
16
|
-
["flexShrink", 1]
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
6
|
+
return [
|
|
7
|
+
["flexGrow", value],
|
|
8
|
+
["flexShrink", 1],
|
|
9
|
+
["flexBasis", "auto"]
|
|
10
|
+
];
|
|
20
11
|
}
|
|
21
12
|
switch (key) {
|
|
22
13
|
case "textAlignVertical": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/expandStyle.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nexport function expandStyle(key: string, value: any) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (key === 'flex') {\n
|
|
5
|
-
"mappings": "AAAA;AAKA,SAAS,aAAa;AAEf,SAAS,YAAY,KAAa,OAAY;AACnD,MAAI,QAAQ,IAAI,mBAAmB,OAAO;AACxC,QAAI,QAAQ,QAAQ;
|
|
4
|
+
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nexport function expandStyle(key: string, value: any) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (key === 'flex') {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n\n // web only\n switch (key) {\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n }\n\n const longKey = EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n }\n}\n\nconst all = ['Top', 'Right', 'Bottom', 'Left']\nconst horiz = ['Right', 'Left']\nconst vert = ['Top', 'Bottom']\nconst xy = ['X', 'Y']\n\nconst EXPANSIONS: Record<string, string[]> = {\n borderColor: ['TopColor', 'RightColor', 'BottomColor', 'LeftColor'],\n borderRadius: [\n 'TopLeftRadius',\n 'TopRightRadius',\n 'BottomRightRadius',\n 'BottomLeftRadius',\n ],\n borderWidth: ['TopWidth', 'RightWidth', 'BottomWidth', 'LeftWidth'],\n margin: all,\n marginHorizontal: horiz,\n marginVertical: vert,\n overscrollBehavior: xy,\n padding: all,\n paddingHorizontal: horiz,\n paddingVertical: vert,\n ...(isWeb && {\n // react-native only supports borderStyle\n borderStyle: ['TopStyle', 'RightStyle', 'BottomStyle', 'LeftStyle'],\n // react-native doesn't support X / Y\n overflow: xy,\n }),\n}\n\nfor (const parent in EXPANSIONS) {\n const prefix = parent.slice(0, /[A-Z]/.exec(parent)?.index ?? parent.length)\n EXPANSIONS[parent] = EXPANSIONS[parent].map((k) => `${prefix}${k}`)\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAKA,SAAS,aAAa;AAEf,SAAS,YAAY,KAAa,OAAY;AACnD,MAAI,QAAQ,IAAI,mBAAmB,OAAO;AACxC,QAAI,QAAQ,QAAQ;AAClB,aAAO;AAAA,QACL,CAAC,YAAY,KAAK;AAAA,QAClB,CAAC,cAAc,CAAC;AAAA,QAChB,CAAC,aAAa,MAAM;AAAA,MACtB;AAAA,IACF;AAGA,YAAQ,KAAK;AAAA,MACX,KAAK,qBAAqB;AACxB,eAAO,CAAC,CAAC,iBAAiB,UAAU,WAAW,WAAW,KAAK,CAAC;AAAA,MAClE;AAAA,MACA,KAAK,oBAAoB;AACvB,eAAO,CAAC,CAAC,aAAa,KAAK,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,WAAW,GAAG;AAC9B,MAAI,SAAS;AACX,WAAO,QAAQ,IAAI,CAACA,SAAQ;AAC1B,aAAO,CAACA,MAAK,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AACF;AAEA,MAAM,MAAM,CAAC,OAAO,SAAS,UAAU,MAAM;AAC7C,MAAM,QAAQ,CAAC,SAAS,MAAM;AAC9B,MAAM,OAAO,CAAC,OAAO,QAAQ;AAC7B,MAAM,KAAK,CAAC,KAAK,GAAG;AAEpB,MAAM,aAAuC;AAAA,EAC3C,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA,EAClE,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA,EAClE,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,GAAI,SAAS;AAAA;AAAA,IAEX,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA;AAAA,IAElE,UAAU;AAAA,EACZ;AACF;AAEA,WAAW,UAAU,YAAY;AAC/B,QAAM,SAAS,OAAO,MAAM,KAAG,aAAQ,KAAK,MAAM,MAAnB,mBAAsB,UAAS,OAAO,MAAM;AAC3E,aAAW,MAAM,IAAI,WAAW,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG;AACpE;",
|
|
6
6
|
"names": ["key"]
|
|
7
7
|
}
|
|
@@ -3,20 +3,11 @@ import { isWeb } from "@tamagui/constants";
|
|
|
3
3
|
function expandStyle(key, value) {
|
|
4
4
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
5
5
|
if (key === "flex") {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
if (value >= 0) {
|
|
14
|
-
return [
|
|
15
|
-
["flexGrow", value],
|
|
16
|
-
["flexShrink", 1]
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
6
|
+
return [
|
|
7
|
+
["flexGrow", value],
|
|
8
|
+
["flexShrink", 1],
|
|
9
|
+
["flexBasis", "auto"]
|
|
10
|
+
];
|
|
20
11
|
}
|
|
21
12
|
switch (key) {
|
|
22
13
|
case "textAlignVertical": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/expandStyle.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nexport function expandStyle(key: string, value: any) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (key === 'flex') {\n
|
|
5
|
-
"mappings": "AAAA;AAKA,SAAS,aAAa;AAEf,SAAS,YAAY,KAAa,OAAY;AACnD,MAAI,QAAQ,IAAI,mBAAmB,OAAO;AACxC,QAAI,QAAQ,QAAQ;
|
|
4
|
+
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nexport function expandStyle(key: string, value: any) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (key === 'flex') {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n\n // web only\n switch (key) {\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n }\n\n const longKey = EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n }\n}\n\nconst all = ['Top', 'Right', 'Bottom', 'Left']\nconst horiz = ['Right', 'Left']\nconst vert = ['Top', 'Bottom']\nconst xy = ['X', 'Y']\n\nconst EXPANSIONS: Record<string, string[]> = {\n borderColor: ['TopColor', 'RightColor', 'BottomColor', 'LeftColor'],\n borderRadius: [\n 'TopLeftRadius',\n 'TopRightRadius',\n 'BottomRightRadius',\n 'BottomLeftRadius',\n ],\n borderWidth: ['TopWidth', 'RightWidth', 'BottomWidth', 'LeftWidth'],\n margin: all,\n marginHorizontal: horiz,\n marginVertical: vert,\n overscrollBehavior: xy,\n padding: all,\n paddingHorizontal: horiz,\n paddingVertical: vert,\n ...(isWeb && {\n // react-native only supports borderStyle\n borderStyle: ['TopStyle', 'RightStyle', 'BottomStyle', 'LeftStyle'],\n // react-native doesn't support X / Y\n overflow: xy,\n }),\n}\n\nfor (const parent in EXPANSIONS) {\n const prefix = parent.slice(0, /[A-Z]/.exec(parent)?.index ?? parent.length)\n EXPANSIONS[parent] = EXPANSIONS[parent].map((k) => `${prefix}${k}`)\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAKA,SAAS,aAAa;AAEf,SAAS,YAAY,KAAa,OAAY;AACnD,MAAI,QAAQ,IAAI,mBAAmB,OAAO;AACxC,QAAI,QAAQ,QAAQ;AAClB,aAAO;AAAA,QACL,CAAC,YAAY,KAAK;AAAA,QAClB,CAAC,cAAc,CAAC;AAAA,QAChB,CAAC,aAAa,MAAM;AAAA,MACtB;AAAA,IACF;AAGA,YAAQ,KAAK;AAAA,MACX,KAAK,qBAAqB;AACxB,eAAO,CAAC,CAAC,iBAAiB,UAAU,WAAW,WAAW,KAAK,CAAC;AAAA,MAClE;AAAA,MACA,KAAK,oBAAoB;AACvB,eAAO,CAAC,CAAC,aAAa,KAAK,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,WAAW,GAAG;AAC9B,MAAI,SAAS;AACX,WAAO,QAAQ,IAAI,CAACA,SAAQ;AAC1B,aAAO,CAACA,MAAK,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AACF;AAEA,MAAM,MAAM,CAAC,OAAO,SAAS,UAAU,MAAM;AAC7C,MAAM,QAAQ,CAAC,SAAS,MAAM;AAC9B,MAAM,OAAO,CAAC,OAAO,QAAQ;AAC7B,MAAM,KAAK,CAAC,KAAK,GAAG;AAEpB,MAAM,aAAuC;AAAA,EAC3C,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA,EAClE,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA,EAClE,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,GAAI,SAAS;AAAA;AAAA,IAEX,aAAa,CAAC,YAAY,cAAc,eAAe,WAAW;AAAA;AAAA,IAElE,UAAU;AAAA,EACZ;AACF;AAEA,WAAW,UAAU,YAAY;AAC/B,QAAM,SAAS,OAAO,MAAM,KAAG,aAAQ,KAAK,MAAM,MAAnB,mBAAsB,UAAS,OAAO,MAAM;AAC3E,aAAW,MAAM,IAAI,WAAW,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG;AACpE;",
|
|
6
6
|
"names": ["key"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { isWeb } from "@tamagui/constants";
|
|
2
|
-
import { normalizeCSSColor } from "@tamagui/normalize-css-color";
|
|
3
1
|
import { getConfig } from "../config";
|
|
4
2
|
import { expandStyle } from "./expandStyle";
|
|
5
|
-
import {
|
|
3
|
+
import { normalizeShadow } from "./normalizeShadow";
|
|
6
4
|
import { normalizeValueWithProperty } from "./normalizeValueWithProperty.js";
|
|
7
5
|
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
8
6
|
let shorthands = null;
|
|
@@ -30,11 +28,11 @@ function expandStyles(style, config = getConfig()) {
|
|
|
30
28
|
return res;
|
|
31
29
|
}
|
|
32
30
|
function fixStyles(style) {
|
|
33
|
-
if (style.shadowRadius) {
|
|
31
|
+
if (style.shadowRadius || style.shadowColor || style.shadowOpacity || style.shadowOffset) {
|
|
34
32
|
Object.assign(style, normalizeShadow(style));
|
|
35
33
|
}
|
|
36
34
|
for (const key in borderDefaults) {
|
|
37
|
-
if (
|
|
35
|
+
if (key in style && !style[borderDefaults[key]]) {
|
|
38
36
|
style[borderDefaults[key]] = "solid";
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -46,42 +44,6 @@ const borderDefaults = {
|
|
|
46
44
|
borderLeftWidth: "borderLeftStyle",
|
|
47
45
|
borderRightWidth: "borderRightStyle"
|
|
48
46
|
};
|
|
49
|
-
function normalizeShadow({
|
|
50
|
-
shadowColor,
|
|
51
|
-
shadowOffset,
|
|
52
|
-
shadowOpacity,
|
|
53
|
-
shadowRadius
|
|
54
|
-
}) {
|
|
55
|
-
const { height, width } = shadowOffset || defaultOffset;
|
|
56
|
-
const colorStr = String(shadowColor || "black");
|
|
57
|
-
return {
|
|
58
|
-
shadowOffset: {
|
|
59
|
-
width: normalizeValueWithProperty(width || 0),
|
|
60
|
-
height: normalizeValueWithProperty(height || 0)
|
|
61
|
-
},
|
|
62
|
-
shadowRadius: normalizeValueWithProperty(shadowRadius || 0),
|
|
63
|
-
...isWeb && {
|
|
64
|
-
shadowColor: normalizeColor(colorStr, shadowOpacity)
|
|
65
|
-
},
|
|
66
|
-
...process.env.TAMAGUI_TARGET === "native" && (() => {
|
|
67
|
-
const val = normalizeCSSColor(colorStr);
|
|
68
|
-
if (!val) {
|
|
69
|
-
if (process.env.NODE_ENV === "development") {
|
|
70
|
-
console.warn("No rgba form", colorStr);
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
shadowColor,
|
|
74
|
-
shadowOpacity
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const { r, g, b, a } = rgba(val);
|
|
78
|
-
return {
|
|
79
|
-
shadowColor: `rgb(${r},${g},${b})`,
|
|
80
|
-
shadowOpacity: shadowOpacity ?? a
|
|
81
|
-
};
|
|
82
|
-
})()
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
47
|
export {
|
|
86
48
|
defaultOffset,
|
|
87
49
|
expandStyles,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/expandStyles.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../config'\nimport { expandStyle } from './expandStyle'\nimport { normalizeShadow } from './normalizeShadow'\nimport { normalizeValueWithProperty } from './normalizeValueWithProperty.js'\nimport { pseudoDescriptors } from './pseudoDescriptors'\n\nlet shorthands: Record<string, string> | null = null\nexport const defaultOffset = { height: 0, width: 0 }\n\n/**\n * This is what you want to run before Object.assign() a style onto another.\n * It does the following:\n * 1. Turns user shorthands into longhands, ie px = paddingHorizontal\n * 2. Normalizes various inconsistent styles to be more consistent\n * 3. Expands react-native shorthands, ie paddingHorizontal => paddingLeft, paddingRight\n */\n\nexport function expandStyles(style: Record<string, any>, config = getConfig()) {\n const res: Record<string, any> = {}\n\n for (let key in style) {\n shorthands = shorthands || (config ? config.shorthands : null)\n if (shorthands) {\n key = shorthands[key] || key\n }\n if (key in pseudoDescriptors) {\n res[key] = expandStyles(style[key])\n continue\n }\n const val = normalizeValueWithProperty(style[key], key)\n // expand react-native shorthands\n const out = expandStyle(key, val)\n if (out) {\n Object.assign(res, Object.fromEntries(out))\n } else {\n res[key] = val\n }\n }\n\n fixStyles(res)\n\n return res\n}\n\nexport function fixStyles(style: Record<string, any>) {\n if (\n style.shadowRadius ||\n style.shadowColor ||\n style.shadowOpacity ||\n style.shadowOffset\n ) {\n Object.assign(style, normalizeShadow(style))\n }\n\n // TODO could be native-only\n // ensure border style set by default to solid\n for (const key in borderDefaults) {\n if (key in style && !style[borderDefaults[key]]) {\n style[borderDefaults[key]] = 'solid'\n }\n }\n}\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,yBAAyB;AAElC,IAAI,aAA4C;AACzC,MAAM,gBAAgB,EAAE,QAAQ,GAAG,OAAO,EAAE;AAU5C,SAAS,aAAa,OAA4B,SAAS,UAAU,GAAG;AAC7E,QAAM,MAA2B,CAAC;AAElC,WAAS,OAAO,OAAO;AACrB,iBAAa,eAAe,SAAS,OAAO,aAAa;AACzD,QAAI,YAAY;AACd,YAAM,WAAW,GAAG,KAAK;AAAA,IAC3B;AACA,QAAI,OAAO,mBAAmB;AAC5B,UAAI,GAAG,IAAI,aAAa,MAAM,GAAG,CAAC;AAClC;AAAA,IACF;AACA,UAAM,MAAM,2BAA2B,MAAM,GAAG,GAAG,GAAG;AAEtD,UAAM,MAAM,YAAY,KAAK,GAAG;AAChC,QAAI,KAAK;AACP,aAAO,OAAO,KAAK,OAAO,YAAY,GAAG,CAAC;AAAA,IAC5C,OAAO;AACL,UAAI,GAAG,IAAI;AAAA,IACb;AAAA,EACF;AAEA,YAAU,GAAG;AAEb,SAAO;AACT;AAEO,SAAS,UAAU,OAA4B;AACpD,MACE,MAAM,gBACN,MAAM,eACN,MAAM,iBACN,MAAM,cACN;AACA,WAAO,OAAO,OAAO,gBAAgB,KAAK,CAAC;AAAA,EAC7C;AAIA,aAAW,OAAO,gBAAgB;AAChC,QAAI,OAAO,SAAS,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG;AAC/C,YAAM,eAAe,GAAG,CAAC,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { isWeb } from "@tamagui/constants";
|
|
2
|
-
import { normalizeCSSColor } from "@tamagui/normalize-css-color";
|
|
3
1
|
import { getConfig } from "../config";
|
|
4
2
|
import { expandStyle } from "./expandStyle";
|
|
5
|
-
import {
|
|
3
|
+
import { normalizeShadow } from "./normalizeShadow";
|
|
6
4
|
import { normalizeValueWithProperty } from "./normalizeValueWithProperty.js";
|
|
7
5
|
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
8
6
|
let shorthands = null;
|
|
@@ -30,11 +28,11 @@ function expandStyles(style, config = getConfig()) {
|
|
|
30
28
|
return res;
|
|
31
29
|
}
|
|
32
30
|
function fixStyles(style) {
|
|
33
|
-
if (style.shadowRadius) {
|
|
31
|
+
if (style.shadowRadius || style.shadowColor || style.shadowOpacity || style.shadowOffset) {
|
|
34
32
|
Object.assign(style, normalizeShadow(style));
|
|
35
33
|
}
|
|
36
34
|
for (const key in borderDefaults) {
|
|
37
|
-
if (
|
|
35
|
+
if (key in style && !style[borderDefaults[key]]) {
|
|
38
36
|
style[borderDefaults[key]] = "solid";
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -46,42 +44,6 @@ const borderDefaults = {
|
|
|
46
44
|
borderLeftWidth: "borderLeftStyle",
|
|
47
45
|
borderRightWidth: "borderRightStyle"
|
|
48
46
|
};
|
|
49
|
-
function normalizeShadow({
|
|
50
|
-
shadowColor,
|
|
51
|
-
shadowOffset,
|
|
52
|
-
shadowOpacity,
|
|
53
|
-
shadowRadius
|
|
54
|
-
}) {
|
|
55
|
-
const { height, width } = shadowOffset || defaultOffset;
|
|
56
|
-
const colorStr = String(shadowColor || "black");
|
|
57
|
-
return {
|
|
58
|
-
shadowOffset: {
|
|
59
|
-
width: normalizeValueWithProperty(width || 0),
|
|
60
|
-
height: normalizeValueWithProperty(height || 0)
|
|
61
|
-
},
|
|
62
|
-
shadowRadius: normalizeValueWithProperty(shadowRadius || 0),
|
|
63
|
-
...isWeb && {
|
|
64
|
-
shadowColor: normalizeColor(colorStr, shadowOpacity)
|
|
65
|
-
},
|
|
66
|
-
...process.env.TAMAGUI_TARGET === "native" && (() => {
|
|
67
|
-
const val = normalizeCSSColor(colorStr);
|
|
68
|
-
if (!val) {
|
|
69
|
-
if (process.env.NODE_ENV === "development") {
|
|
70
|
-
console.warn("No rgba form", colorStr);
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
shadowColor,
|
|
74
|
-
shadowOpacity
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const { r, g, b, a } = rgba(val);
|
|
78
|
-
return {
|
|
79
|
-
shadowColor: `rgb(${r},${g},${b})`,
|
|
80
|
-
shadowOpacity: shadowOpacity ?? a
|
|
81
|
-
};
|
|
82
|
-
})()
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
47
|
export {
|
|
86
48
|
defaultOffset,
|
|
87
49
|
expandStyles,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/expandStyles.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../config'\nimport { expandStyle } from './expandStyle'\nimport { normalizeShadow } from './normalizeShadow'\nimport { normalizeValueWithProperty } from './normalizeValueWithProperty.js'\nimport { pseudoDescriptors } from './pseudoDescriptors'\n\nlet shorthands: Record<string, string> | null = null\nexport const defaultOffset = { height: 0, width: 0 }\n\n/**\n * This is what you want to run before Object.assign() a style onto another.\n * It does the following:\n * 1. Turns user shorthands into longhands, ie px = paddingHorizontal\n * 2. Normalizes various inconsistent styles to be more consistent\n * 3. Expands react-native shorthands, ie paddingHorizontal => paddingLeft, paddingRight\n */\n\nexport function expandStyles(style: Record<string, any>, config = getConfig()) {\n const res: Record<string, any> = {}\n\n for (let key in style) {\n shorthands = shorthands || (config ? config.shorthands : null)\n if (shorthands) {\n key = shorthands[key] || key\n }\n if (key in pseudoDescriptors) {\n res[key] = expandStyles(style[key])\n continue\n }\n const val = normalizeValueWithProperty(style[key], key)\n // expand react-native shorthands\n const out = expandStyle(key, val)\n if (out) {\n Object.assign(res, Object.fromEntries(out))\n } else {\n res[key] = val\n }\n }\n\n fixStyles(res)\n\n return res\n}\n\nexport function fixStyles(style: Record<string, any>) {\n if (\n style.shadowRadius ||\n style.shadowColor ||\n style.shadowOpacity ||\n style.shadowOffset\n ) {\n Object.assign(style, normalizeShadow(style))\n }\n\n // TODO could be native-only\n // ensure border style set by default to solid\n for (const key in borderDefaults) {\n if (key in style && !style[borderDefaults[key]]) {\n style[borderDefaults[key]] = 'solid'\n }\n }\n}\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,yBAAyB;AAElC,IAAI,aAA4C;AACzC,MAAM,gBAAgB,EAAE,QAAQ,GAAG,OAAO,EAAE;AAU5C,SAAS,aAAa,OAA4B,SAAS,UAAU,GAAG;AAC7E,QAAM,MAA2B,CAAC;AAElC,WAAS,OAAO,OAAO;AACrB,iBAAa,eAAe,SAAS,OAAO,aAAa;AACzD,QAAI,YAAY;AACd,YAAM,WAAW,GAAG,KAAK;AAAA,IAC3B;AACA,QAAI,OAAO,mBAAmB;AAC5B,UAAI,GAAG,IAAI,aAAa,MAAM,GAAG,CAAC;AAClC;AAAA,IACF;AACA,UAAM,MAAM,2BAA2B,MAAM,GAAG,GAAG,GAAG;AAEtD,UAAM,MAAM,YAAY,KAAK,GAAG;AAChC,QAAI,KAAK;AACP,aAAO,OAAO,KAAK,OAAO,YAAY,GAAG,CAAC;AAAA,IAC5C,OAAO;AACL,UAAI,GAAG,IAAI;AAAA,IACb;AAAA,EACF;AAEA,YAAU,GAAG;AAEb,SAAO;AACT;AAEO,SAAS,UAAU,OAA4B;AACpD,MACE,MAAM,gBACN,MAAM,eACN,MAAM,iBACN,MAAM,cACN;AACA,WAAO,OAAO,OAAO,gBAAgB,KAAK,CAAC;AAAA,EAC7C;AAIA,aAAW,OAAO,gBAAgB;AAChC,QAAI,OAAO,SAAS,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG;AAC/C,YAAM,eAAe,GAAG,CAAC,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,13 +33,11 @@ import {
|
|
|
33
33
|
shouldInsertStyleRules,
|
|
34
34
|
updateRules
|
|
35
35
|
} from "./insertStyleRule";
|
|
36
|
-
import { mergeTransform, mergeTransforms } from "./mergeTransform";
|
|
37
36
|
import {
|
|
38
37
|
normalizeValueWithProperty,
|
|
39
38
|
reverseMapClassNameToValue
|
|
40
39
|
} from "./normalizeValueWithProperty.js";
|
|
41
40
|
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
42
|
-
import { warnOnce } from "./warnOnce";
|
|
43
41
|
const skipProps = {
|
|
44
42
|
animation: true,
|
|
45
43
|
space: true,
|
|
@@ -131,15 +129,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
131
129
|
}
|
|
132
130
|
conf = conf || getConfig();
|
|
133
131
|
const { shorthands } = conf;
|
|
134
|
-
const {
|
|
135
|
-
defaultVariants,
|
|
136
|
-
variants,
|
|
137
|
-
propMapper,
|
|
138
|
-
isReactNative,
|
|
139
|
-
deoptProps,
|
|
140
|
-
inlineProps,
|
|
141
|
-
inlineWhenUnflattened
|
|
142
|
-
} = staticConfig;
|
|
132
|
+
const { variants, propMapper, isReactNative, inlineProps, inlineWhenUnflattened } = staticConfig;
|
|
143
133
|
const validStyleProps = staticConfig.isText ? stylePropsText : validStyles;
|
|
144
134
|
const viewProps = {};
|
|
145
135
|
let pseudos = null;
|
|
@@ -161,7 +151,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
161
151
|
const styleState = {
|
|
162
152
|
classNames,
|
|
163
153
|
conf,
|
|
164
|
-
flatTransforms,
|
|
165
154
|
props,
|
|
166
155
|
state,
|
|
167
156
|
staticConfig,
|
|
@@ -171,11 +160,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
171
160
|
viewProps,
|
|
172
161
|
languageContext
|
|
173
162
|
};
|
|
174
|
-
if (process.env.NODE_ENV === "development") {
|
|
175
|
-
if (props.selectable) {
|
|
176
|
-
warnOnce("props.selectable", "selectable props deprecated, use userSelect");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
163
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
180
164
|
console.groupCollapsed("getSplitStyles (looping backwards)");
|
|
181
165
|
console.log({ staticConfig, shouldDoClasses, state, IS_STATIC, propKeys });
|
|
@@ -474,7 +458,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
474
458
|
if (isDisabled) {
|
|
475
459
|
if (!(pkey in usedKeys) && pkey in animatableDefaults) {
|
|
476
460
|
const defaultVal = animatableDefaults[pkey];
|
|
477
|
-
mergeStyle(styleState, pkey, defaultVal, true);
|
|
461
|
+
mergeStyle(styleState, flatTransforms, pkey, defaultVal, true);
|
|
478
462
|
}
|
|
479
463
|
continue;
|
|
480
464
|
}
|
|
@@ -485,7 +469,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
485
469
|
pseudos ||= {};
|
|
486
470
|
pseudos[key] ||= {};
|
|
487
471
|
pseudos[key][pkey] = val2;
|
|
488
|
-
mergeStyle(styleState, pkey, val2);
|
|
472
|
+
mergeStyle(styleState, flatTransforms, pkey, val2);
|
|
489
473
|
}
|
|
490
474
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
491
475
|
console.log("Merged pseudo?", shouldMerge, { importance, curImportance, pkey, val: val2 });
|
|
@@ -584,7 +568,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
584
568
|
fontFamily = valInit[0] === "$" ? valInit : val;
|
|
585
569
|
}
|
|
586
570
|
if (key in validStyleProps) {
|
|
587
|
-
mergeStyle(styleState, key, val);
|
|
571
|
+
mergeStyle(styleState, flatTransforms, key, val);
|
|
588
572
|
continue;
|
|
589
573
|
}
|
|
590
574
|
if (!variants || !(key in variants)) {
|
|
@@ -751,7 +735,7 @@ function getSubStyleProps(defaultProps, baseProps, specificProps) {
|
|
|
751
735
|
}
|
|
752
736
|
return cache.get(key);
|
|
753
737
|
}
|
|
754
|
-
function mergeStyle({ usedKeys, classNames,
|
|
738
|
+
function mergeStyle({ usedKeys, classNames, viewProps, style }, flatTransforms, key, val, dontSetUsed = false) {
|
|
755
739
|
if (!dontSetUsed) {
|
|
756
740
|
usedKeys[key] ||= 1;
|
|
757
741
|
}
|
|
@@ -834,6 +818,21 @@ const animatableDefaults = {
|
|
|
834
818
|
};
|
|
835
819
|
const lowercaseHyphenate = (match) => `-${match.toLowerCase()}`;
|
|
836
820
|
const hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate);
|
|
821
|
+
const mergeTransform = (obj, key, val, backwards = false) => {
|
|
822
|
+
obj.transform ||= [];
|
|
823
|
+
obj.transform[backwards ? "unshift" : "push"]({
|
|
824
|
+
[mapTransformKeys[key] || key]: val
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
const mergeTransforms = (obj, flatTransforms, backwards = false) => {
|
|
828
|
+
Object.entries(flatTransforms).forEach(([key, val]) => {
|
|
829
|
+
mergeTransform(obj, key, val, backwards);
|
|
830
|
+
});
|
|
831
|
+
};
|
|
832
|
+
const mapTransformKeys = {
|
|
833
|
+
x: "translateX",
|
|
834
|
+
y: "translateY"
|
|
835
|
+
};
|
|
837
836
|
export {
|
|
838
837
|
PROP_SPLIT,
|
|
839
838
|
getSplitStyles,
|