@tamagui/web
Advanced tools
Comparing version 1.22.1 to 1.22.2
@@ -22,2 +22,3 @@ "use strict"; | ||
extendStaticConfig: () => extendStaticConfig, | ||
mergeVariants: () => mergeVariants, | ||
parseStaticConfig: () => parseStaticConfig | ||
@@ -34,17 +35,3 @@ }); | ||
const parentStaticConfig = parent.staticConfig; | ||
const variants = { | ||
...parentStaticConfig.variants | ||
}; | ||
if (config.variants) { | ||
for (const key in config.variants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...config.variants[key] | ||
}; | ||
} else { | ||
variants[key] = config.variants[key]; | ||
} | ||
} | ||
} | ||
const variants = mergeVariants(parentStaticConfig.variants, config.variants); | ||
const parentNames = [...parentStaticConfig.parentNames || []]; | ||
@@ -76,2 +63,20 @@ if (parentStaticConfig.componentName) { | ||
} | ||
const mergeVariants = (parentVariants, ourVariants) => { | ||
const variants = { | ||
...parentVariants | ||
}; | ||
if (ourVariants) { | ||
for (const key in ourVariants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...ourVariants[key] | ||
}; | ||
} else { | ||
variants[key] = ourVariants[key]; | ||
} | ||
} | ||
} | ||
return variants; | ||
}; | ||
const parseStaticConfig = (config) => { | ||
@@ -91,4 +96,5 @@ const parsed = { | ||
extendStaticConfig, | ||
mergeVariants, | ||
parseStaticConfig | ||
}); | ||
//# sourceMappingURL=extendStaticConfig.js.map |
@@ -26,2 +26,3 @@ "use strict"; | ||
var import_createComponent = require("./createComponent.js"); | ||
var import_extendStaticConfig = require("./helpers/extendStaticConfig.js"); | ||
var import_setupReactNative = require("./setupReactNative.js"); | ||
@@ -45,3 +46,3 @@ function styled(ComponentIn, options, staticExtractionOptions) { | ||
const isPlainStyledComponent = !!parentStaticConfig && !(parentStaticConfig.isReactNative || parentStaticConfig.isHOC); | ||
const Component = isPlainStyledComponent ? ComponentIn : (parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || ComponentIn; | ||
let Component = isPlainStyledComponent ? ComponentIn : (parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || ComponentIn; | ||
const isReactNative = Boolean( | ||
@@ -59,2 +60,8 @@ import_setupReactNative.ReactNativeStaticConfigs.has(Component) || (staticExtractionOptions == null ? void 0 : staticExtractionOptions.isReactNative) || import_setupReactNative.ReactNativeStaticConfigs.has(parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || (parentStaticConfig == null ? void 0 : parentStaticConfig.isReactNative) | ||
} = options; | ||
if (parentStaticConfig) { | ||
defaultProps = { | ||
...parentStaticConfig.defaultProps, | ||
...defaultProps | ||
}; | ||
} | ||
if (defaultVariants) { | ||
@@ -66,2 +73,5 @@ defaultProps = { | ||
} | ||
if (parentStaticConfig == null ? void 0 : parentStaticConfig.isHOC) { | ||
variants = (0, import_extendStaticConfig.mergeVariants)(parentStaticConfig.variants, variants); | ||
} | ||
const nativeConf = isReactNative && import_setupReactNative.ReactNativeStaticConfigs.get(Component) || null; | ||
@@ -68,0 +78,0 @@ const isText = Boolean( |
@@ -9,17 +9,3 @@ import { stylePropsView } from "@tamagui/helpers"; | ||
const parentStaticConfig = parent.staticConfig; | ||
const variants = { | ||
...parentStaticConfig.variants | ||
}; | ||
if (config.variants) { | ||
for (const key in config.variants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...config.variants[key] | ||
}; | ||
} else { | ||
variants[key] = config.variants[key]; | ||
} | ||
} | ||
} | ||
const variants = mergeVariants(parentStaticConfig.variants, config.variants); | ||
const parentNames = [...parentStaticConfig.parentNames || []]; | ||
@@ -51,2 +37,20 @@ if (parentStaticConfig.componentName) { | ||
} | ||
const mergeVariants = (parentVariants, ourVariants) => { | ||
const variants = { | ||
...parentVariants | ||
}; | ||
if (ourVariants) { | ||
for (const key in ourVariants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...ourVariants[key] | ||
}; | ||
} else { | ||
variants[key] = ourVariants[key]; | ||
} | ||
} | ||
} | ||
return variants; | ||
}; | ||
const parseStaticConfig = (config) => { | ||
@@ -65,4 +69,5 @@ const parsed = { | ||
extendStaticConfig, | ||
mergeVariants, | ||
parseStaticConfig | ||
}; | ||
//# sourceMappingURL=extendStaticConfig.js.map |
import { stylePropsAll } from "@tamagui/helpers"; | ||
import { createComponent } from "./createComponent.js"; | ||
import { mergeVariants } from "./helpers/extendStaticConfig.js"; | ||
import { ReactNativeStaticConfigs } from "./setupReactNative.js"; | ||
@@ -21,3 +22,3 @@ function styled(ComponentIn, options, staticExtractionOptions) { | ||
const isPlainStyledComponent = !!parentStaticConfig && !(parentStaticConfig.isReactNative || parentStaticConfig.isHOC); | ||
const Component = isPlainStyledComponent ? ComponentIn : (parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || ComponentIn; | ||
let Component = isPlainStyledComponent ? ComponentIn : (parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || ComponentIn; | ||
const isReactNative = Boolean( | ||
@@ -35,2 +36,8 @@ ReactNativeStaticConfigs.has(Component) || (staticExtractionOptions == null ? void 0 : staticExtractionOptions.isReactNative) || ReactNativeStaticConfigs.has(parentStaticConfig == null ? void 0 : parentStaticConfig.Component) || (parentStaticConfig == null ? void 0 : parentStaticConfig.isReactNative) | ||
} = options; | ||
if (parentStaticConfig) { | ||
defaultProps = { | ||
...parentStaticConfig.defaultProps, | ||
...defaultProps | ||
}; | ||
} | ||
if (defaultVariants) { | ||
@@ -42,2 +49,5 @@ defaultProps = { | ||
} | ||
if (parentStaticConfig == null ? void 0 : parentStaticConfig.isHOC) { | ||
variants = mergeVariants(parentStaticConfig.variants, variants); | ||
} | ||
const nativeConf = isReactNative && ReactNativeStaticConfigs.get(Component) || null; | ||
@@ -44,0 +54,0 @@ const isText = Boolean( |
{ | ||
"name": "@tamagui/web", | ||
"version": "1.22.1", | ||
"version": "1.22.2", | ||
"source": "src/index.ts", | ||
@@ -30,9 +30,9 @@ "main": "dist/cjs", | ||
"dependencies": { | ||
"@tamagui/compose-refs": "1.22.1", | ||
"@tamagui/constants": "1.22.1", | ||
"@tamagui/helpers": "1.22.1", | ||
"@tamagui/normalize-css-color": "1.22.1", | ||
"@tamagui/use-did-finish-ssr": "1.22.1", | ||
"@tamagui/use-event": "1.22.1", | ||
"@tamagui/use-force-update": "1.22.1" | ||
"@tamagui/compose-refs": "1.22.2", | ||
"@tamagui/constants": "1.22.2", | ||
"@tamagui/helpers": "1.22.2", | ||
"@tamagui/normalize-css-color": "1.22.2", | ||
"@tamagui/use-did-finish-ssr": "1.22.2", | ||
"@tamagui/use-event": "1.22.2", | ||
"@tamagui/use-force-update": "1.22.2" | ||
}, | ||
@@ -43,3 +43,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@tamagui/build": "1.22.1", | ||
"@tamagui/build": "1.22.2", | ||
"@testing-library/react": "^13.4.0", | ||
@@ -46,0 +46,0 @@ "csstype": "^3.0.10", |
import { stylePropsView } from '@tamagui/helpers' | ||
import type { StaticConfig, StaticConfigParsed, StylableComponent } from '../types.js' | ||
import type { | ||
GenericVariantDefinitions, | ||
StaticConfig, | ||
StaticConfigParsed, | ||
StylableComponent, | ||
} from '../types.js' | ||
import { createPropMapper } from './createPropMapper.js' | ||
@@ -16,22 +21,6 @@ import { mergeProps } from './mergeProps.js' | ||
const parentStaticConfig = parent.staticConfig as StaticConfig | ||
const variants = { | ||
...parentStaticConfig.variants, | ||
} | ||
// merge variants... can we type this? | ||
if (config.variants) { | ||
for (const key in config.variants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...config.variants[key], | ||
} | ||
} else { | ||
variants[key] = config.variants[key] | ||
} | ||
} | ||
} | ||
const variants = mergeVariants(parentStaticConfig.variants, config.variants) | ||
// console.log('variants', variants) | ||
// include our own | ||
@@ -71,2 +60,26 @@ const parentNames = [...(parentStaticConfig.parentNames || [])] | ||
export const mergeVariants = ( | ||
parentVariants?: GenericVariantDefinitions, | ||
ourVariants?: GenericVariantDefinitions | ||
) => { | ||
const variants = { | ||
...parentVariants, | ||
} | ||
if (ourVariants) { | ||
for (const key in ourVariants) { | ||
if (variants[key]) { | ||
variants[key] = { | ||
...variants[key], | ||
...ourVariants[key], | ||
} | ||
} else { | ||
variants[key] = ourVariants[key] | ||
} | ||
} | ||
} | ||
return variants | ||
} | ||
export const parseStaticConfig = (config: Partial<StaticConfig>): StaticConfigParsed => { | ||
@@ -73,0 +86,0 @@ const parsed = { |
@@ -1,4 +0,11 @@ | ||
import type { StaticConfig, StaticConfigParsed, StylableComponent } from '../types.js'; | ||
import type { GenericVariantDefinitions, StaticConfig, StaticConfigParsed, StylableComponent } from '../types.js'; | ||
export declare function extendStaticConfig(config: Partial<StaticConfig>, parent?: StylableComponent): StaticConfigParsed; | ||
export declare const mergeVariants: (parentVariants?: GenericVariantDefinitions, ourVariants?: GenericVariantDefinitions) => { | ||
[x: string]: { | ||
[key: string]: ((a: any, b: any) => any) | { | ||
[key: string]: any; | ||
}; | ||
}; | ||
}; | ||
export declare const parseStaticConfig: (config: Partial<StaticConfig>) => StaticConfigParsed; | ||
//# sourceMappingURL=extendStaticConfig.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1441165
29986
+ Added@tamagui/compose-refs@1.22.2(transitive)
+ Added@tamagui/constants@1.22.2(transitive)
+ Added@tamagui/helpers@1.22.2(transitive)
+ Added@tamagui/normalize-css-color@1.22.2(transitive)
+ Added@tamagui/simple-hash@1.22.2(transitive)
+ Added@tamagui/use-did-finish-ssr@1.22.2(transitive)
+ Added@tamagui/use-event@1.22.2(transitive)
+ Added@tamagui/use-force-update@1.22.2(transitive)
- Removed@tamagui/compose-refs@1.22.1(transitive)
- Removed@tamagui/constants@1.22.1(transitive)
- Removed@tamagui/helpers@1.22.1(transitive)
- Removed@tamagui/normalize-css-color@1.22.1(transitive)
- Removed@tamagui/simple-hash@1.22.1(transitive)
- Removed@tamagui/use-did-finish-ssr@1.22.1(transitive)
- Removed@tamagui/use-event@1.22.1(transitive)
- Removed@tamagui/use-force-update@1.22.1(transitive)
Updated@tamagui/compose-refs@1.22.2
Updated@tamagui/constants@1.22.2
Updated@tamagui/helpers@1.22.2
Updated@tamagui/use-event@1.22.2