@tamagui/core
Advanced tools
Comparing version 1.0.0-alpha.32 to 1.0.0-alpha.36
@@ -0,4 +1,5 @@ | ||
var _a; | ||
import { useEffect, useLayoutEffect } from "react"; | ||
import { Platform } from "react-native"; | ||
const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : Platform?.OS === "web"; | ||
const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : ((_a = Platform) == null ? void 0 : _a.OS) === "web"; | ||
const isSSR = isWeb && typeof window === "undefined"; | ||
@@ -5,0 +6,0 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect; |
@@ -61,3 +61,3 @@ var __defProp = Object.defineProperty; | ||
const { Component, validStyles, isText, isZStack } = staticConfig; | ||
const validStyleProps = validStyles ?? stylePropsView; | ||
const validStyleProps = validStyles != null ? validStyles : stylePropsView; | ||
let defaultProps = null; | ||
@@ -69,2 +69,3 @@ let tamaguiConfig; | ||
const component = forwardRef((props, forwardedRef) => { | ||
var _a; | ||
const forceUpdate = useForceUpdate(); | ||
@@ -238,3 +239,3 @@ const features = useFeatures(props, { forceUpdate }); | ||
unPress(); | ||
onPressOut?.(e); | ||
onPressOut == null ? void 0 : onPressOut(e); | ||
} | ||
@@ -254,4 +255,4 @@ }, | ||
} | ||
onHoverIn?.(e); | ||
onMouseEnter?.(e); | ||
onHoverIn == null ? void 0 : onHoverIn(e); | ||
onMouseEnter == null ? void 0 : onMouseEnter(e); | ||
} : void 0, | ||
@@ -271,4 +272,4 @@ onMouseLeave: attachHover || attachPress ? (e) => { | ||
} | ||
onHoverOut?.(e); | ||
onMouseLeave?.(e); | ||
onHoverOut == null ? void 0 : onHoverOut(e); | ||
onMouseLeave == null ? void 0 : onMouseLeave(e); | ||
} : void 0 | ||
@@ -281,10 +282,10 @@ }, | ||
}); | ||
onPressIn?.(e); | ||
onMouseDown?.(e); | ||
onPressIn == null ? void 0 : onPressIn(e); | ||
onMouseDown == null ? void 0 : onMouseDown(e); | ||
} : onPressIn, | ||
onClick: attachPress ? (e) => { | ||
onPress?.(e); | ||
onClick?.(e); | ||
onPress == null ? void 0 : onPress(e); | ||
onClick == null ? void 0 : onClick(e); | ||
unPress(); | ||
onPressOut?.(e); | ||
onPressOut == null ? void 0 : onPressOut(e); | ||
} : onPressOut | ||
@@ -309,3 +310,3 @@ } : null; | ||
space, | ||
flexDirection: props.flexDirection || defaultProps?.flexDirection, | ||
flexDirection: props.flexDirection || (defaultProps == null ? void 0 : defaultProps.flexDirection), | ||
isZStack | ||
@@ -332,3 +333,3 @@ }); | ||
console.log("\u{1F95A} props out:", viewProps); | ||
console.log(props.onClick?.toString()); | ||
console.log((_a = props.onClick) == null ? void 0 : _a.toString()); | ||
console.log("\u{1F95A} etc:", { shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls }); | ||
@@ -343,2 +344,3 @@ if (isWeb) { | ||
onConfiguredOnce((conf) => { | ||
var _a; | ||
tamaguiConfig = conf; | ||
@@ -363,3 +365,3 @@ initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]; | ||
if (process.env.NODE_ENV === "development") { | ||
if (staticConfig.defaultProps?.debug) { | ||
if ((_a = staticConfig.defaultProps) == null ? void 0 : _a.debug) { | ||
console.log("tamagui debug component:", next, defaultsClassName, component.defaultProps); | ||
@@ -380,3 +382,3 @@ } | ||
...Component2.defaultProps, | ||
...conf?.defaultProps | ||
...conf == null ? void 0 : conf.defaultProps | ||
} | ||
@@ -398,6 +400,7 @@ }); | ||
"...size": (size, { tokens }) => { | ||
var _a, _b; | ||
size = size == true ? "$true" : size; | ||
return { | ||
width: tokens.size[size] ?? size, | ||
height: tokens.size[size] ?? size | ||
width: (_a = tokens.size[size]) != null ? _a : size, | ||
height: (_b = tokens.size[size]) != null ? _b : size | ||
}; | ||
@@ -422,2 +425,3 @@ } | ||
}) { | ||
var _a, _b; | ||
if (!space && !isZStack) { | ||
@@ -436,7 +440,7 @@ return children; | ||
} | ||
const key = `${child?.["key"] ?? index}`; | ||
const key = `${(_a = child == null ? void 0 : child["key"]) != null ? _a : index}`; | ||
next.push(/* @__PURE__ */ React.createElement(Fragment, { | ||
key | ||
}, isZStack ? /* @__PURE__ */ React.createElement(Absolute, null, child) : child)); | ||
if (child?.["type"]?.["isVisuallyHidden"]) { | ||
if ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isVisuallyHidden"]) { | ||
continue; | ||
@@ -443,0 +447,0 @@ } |
@@ -34,2 +34,3 @@ var __defProp = Object.defineProperty; | ||
const themeConfig = (() => { | ||
var _a; | ||
let cssRules = []; | ||
@@ -72,3 +73,3 @@ const varsByValue = new Map(); | ||
const val = theme[themeKey]; | ||
const varName = val instanceof Variable ? val.name : varsByValue[val]?.name; | ||
const varName = val instanceof Variable ? val.name : (_a = varsByValue[val]) == null ? void 0 : _a.name; | ||
vars += `--${themeKey}:${varName ? `var(--${varName});` : `${val}`};`; | ||
@@ -75,0 +76,0 @@ } |
@@ -12,2 +12,3 @@ var __defProp = Object.defineProperty; | ||
return (key, value, theme, props) => { | ||
var _a, _b; | ||
const conf = getTamagui(); | ||
@@ -22,5 +23,5 @@ if (!conf) { | ||
let fontFamily = props.fontFamily || defaultProps.fontFamily || "$body"; | ||
const variant = variantsParsed?.[key]; | ||
const variant = variantsParsed == null ? void 0 : variantsParsed[key]; | ||
if (variant && typeof value !== "undefined") { | ||
const val = value === true ? variant["$true"] || variant["true"] : variant[value] ?? variant["..."] ?? value; | ||
const val = value === true ? variant["$true"] || variant["true"] : (_b = (_a = variant[value]) != null ? _a : variant["..."]) != null ? _b : value; | ||
const res = typeof val === "function" ? val(value, { tokens: conf.tokensParsed, theme, props }) : isObj(val) ? { ...val } : val; | ||
@@ -69,2 +70,3 @@ if (isObj(res)) { | ||
const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, themeParsed }, theme, fontFamily = "$body") => { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
if (themeParsed[value]) { | ||
@@ -75,3 +77,3 @@ if (isWeb && themeParsed[value].variable) { | ||
if (value && value[0] === "$") { | ||
return theme[`${value.slice(1)}`]?.val || themeParsed[value]?.val; | ||
return ((_a = theme[`${value.slice(1)}`]) == null ? void 0 : _a.val) || ((_b = themeParsed[value]) == null ? void 0 : _b.val); | ||
} | ||
@@ -82,15 +84,15 @@ } | ||
if (key === "fontFamily") { | ||
valOrVar = tokensParsed.font[value]?.family || value; | ||
valOrVar = ((_c = tokensParsed.font[value]) == null ? void 0 : _c.family) || value; | ||
} | ||
if (key === "fontSize") { | ||
valOrVar = tokensParsed.font[fontFamily]?.size[value] || value; | ||
valOrVar = ((_d = tokensParsed.font[fontFamily]) == null ? void 0 : _d.size[value]) || value; | ||
} | ||
if (key === "lineHeight") { | ||
valOrVar = tokensParsed.font[fontFamily]?.lineHeight[value] || value; | ||
valOrVar = ((_e = tokensParsed.font[fontFamily]) == null ? void 0 : _e.lineHeight[value]) || value; | ||
} | ||
if (key === "letterSpacing") { | ||
valOrVar = tokensParsed.font[fontFamily]?.letterSpacing[value] || value; | ||
valOrVar = ((_f = tokensParsed.font[fontFamily]) == null ? void 0 : _f.letterSpacing[value]) || value; | ||
} | ||
if (key === "fontWeight") { | ||
valOrVar = tokensParsed.font[fontFamily]?.weight[value] || value; | ||
valOrVar = ((_g = tokensParsed.font[fontFamily]) == null ? void 0 : _g.weight[value]) || value; | ||
} | ||
@@ -97,0 +99,0 @@ if (typeof valOrVar !== "undefined") { |
@@ -5,2 +5,3 @@ var __defProp = Object.defineProperty; | ||
function extendStaticConfig(Component, config = {}) { | ||
var _a, _b; | ||
const parent = Component || {}; | ||
@@ -32,4 +33,4 @@ if (!parent.staticConfig) { | ||
isText: config.isText || parent.staticConfig.isText || false, | ||
neverFlatten: config.neverFlatten ?? parent.staticConfig.neverFlatten, | ||
ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp, | ||
neverFlatten: (_a = config.neverFlatten) != null ? _a : parent.staticConfig.neverFlatten, | ||
ensureOverriddenProp: (_b = config.ensureOverriddenProp) != null ? _b : parent.staticConfig.ensureOverriddenProp, | ||
validStyles: config.validStyles ? { | ||
@@ -36,0 +37,0 @@ ...parent.staticConfig.validStyles, |
@@ -37,2 +37,3 @@ var __defProp = Object.defineProperty; | ||
function getAtomicStyle(style, pseudo, avoidCollection) { | ||
var _a; | ||
if (style == null || typeof style !== "object") { | ||
@@ -43,3 +44,3 @@ throw new Error(`Wrong style type: "${typeof style}": ${style}`); | ||
if (key in style) { | ||
style[borderDefaults[key]] = style[borderDefaults[key]] ?? "solid"; | ||
style[borderDefaults[key]] = (_a = style[borderDefaults[key]]) != null ? _a : "solid"; | ||
} | ||
@@ -46,0 +47,0 @@ } |
@@ -5,3 +5,4 @@ var __defProp = Object.defineProperty; | ||
const isTamaguiElement = /* @__PURE__ */ __name((child) => { | ||
return isValidElement(child) && !!child.type["staticConfig"]?.parsed; | ||
var _a; | ||
return isValidElement(child) && !!((_a = child.type["staticConfig"]) == null ? void 0 : _a.parsed); | ||
}, "isTamaguiElement"); | ||
@@ -8,0 +9,0 @@ export { |
@@ -20,3 +20,3 @@ var __defProp = Object.defineProperty; | ||
const withTheme = withThemeComponent; | ||
withTheme.displayName = `Themed(${component?.displayName || component?.name || "Anonymous"})`; | ||
withTheme.displayName = `Themed(${(component == null ? void 0 : component.displayName) || (component == null ? void 0 : component.name) || "Anonymous"})`; | ||
return withTheme; | ||
@@ -23,0 +23,0 @@ }, "graphql"); |
@@ -15,3 +15,4 @@ var __defProp = Object.defineProperty; | ||
const removeMediaQueryListener = /* @__PURE__ */ __name((key, cb) => { | ||
mediaQueryListeners[key]?.delete(cb); | ||
var _a; | ||
(_a = mediaQueryListeners[key]) == null ? void 0 : _a.delete(cb); | ||
}, "removeMediaQueryListener"); | ||
@@ -51,2 +52,3 @@ let conf = null; | ||
} = {}) => { | ||
var _a; | ||
if (conf) { | ||
@@ -73,3 +75,3 @@ console.warn(`Already configured mediaQueries once (you may have called getMedia() before configureMedia())`); | ||
const listeners = mediaQueryListeners[key]; | ||
if (listeners?.size) { | ||
if (listeners == null ? void 0 : listeners.size) { | ||
for (const cb of [...listeners]) { | ||
@@ -82,3 +84,3 @@ cb(); | ||
console.error("Error running media query", str, err.message, err.stack); | ||
const isDefaultActive = defaultActive?.includes(key) ?? true; | ||
const isDefaultActive = (_a = defaultActive == null ? void 0 : defaultActive.includes(key)) != null ? _a : true; | ||
mediaState[key] = isDefaultActive; | ||
@@ -85,0 +87,0 @@ } |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var _a, _b; | ||
import { Pressable } from "react-native"; | ||
const getPressable = Pressable?.["type"]?.["render"]; | ||
const getPressable = (_b = (_a = Pressable) == null ? void 0 : _a["type"]) == null ? void 0 : _b["render"]; | ||
const usePressable = /* @__PURE__ */ __name((props) => { | ||
@@ -6,0 +7,0 @@ const out = getPressable(props); |
@@ -25,3 +25,3 @@ var __defProp = Object.defineProperty; | ||
return parent.onChangeTheme((next, manager) => { | ||
setName(opts?.parent ? manager.parentName : next); | ||
setName((opts == null ? void 0 : opts.parent) ? manager.parentName : next); | ||
}); | ||
@@ -35,2 +35,3 @@ }, [parent]); | ||
const useTheme = /* @__PURE__ */ __name(() => { | ||
var _a; | ||
const forceUpdate = useForceUpdate(); | ||
@@ -59,3 +60,3 @@ const manager = useContext(ThemeManagerContext); | ||
}, []); | ||
const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light; | ||
const theme = (_a = manager.name ? themes[manager.name] : themes.light) != null ? _a : themes.light; | ||
return useMemo(() => { | ||
@@ -62,0 +63,0 @@ return new Proxy(theme, { |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var _a, _b; | ||
import React, { createContext } from "react"; | ||
import { rnw } from "../constants/rnw"; | ||
const FallbackNativeContext = createContext(false); | ||
const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext; | ||
const TextAncestorContext = (_b = (_a = rnw) == null ? void 0 : _a.TextAncestorContext) != null ? _b : FallbackNativeContext; | ||
const TextAncestorProvider = /* @__PURE__ */ __name((props) => { | ||
@@ -8,0 +9,0 @@ return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, { |
@@ -10,2 +10,3 @@ var __defProp = Object.defineProperty; | ||
const Theme = /* @__PURE__ */ __name((props) => { | ||
var _a, _b; | ||
const parent = useContext(ThemeManagerContext); | ||
@@ -57,3 +58,3 @@ const themes = useContext(ThemeContext); | ||
if (name) { | ||
const color = themes[name]?.["color"]?.["variable"]; | ||
const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"]; | ||
return /* @__PURE__ */ React.createElement("div", { | ||
@@ -60,0 +61,0 @@ className: getThemeParentClassName(props.name), |
@@ -31,2 +31,3 @@ var __defProp = Object.defineProperty; | ||
update() { | ||
var _a; | ||
if (!this.name) { | ||
@@ -37,3 +38,3 @@ this.keys.clear(); | ||
if (keys.size) { | ||
this.listeners.get(uuid)?.(); | ||
(_a = this.listeners.get(uuid)) == null ? void 0 : _a(); | ||
} | ||
@@ -40,0 +41,0 @@ } |
@@ -0,4 +1,5 @@ | ||
var _a; | ||
import { useEffect, useLayoutEffect } from "react"; | ||
import { Platform } from "react-native"; | ||
const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : Platform?.OS === "web"; | ||
const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : ((_a = Platform) == null ? void 0 : _a.OS) === "web"; | ||
const isSSR = isWeb && typeof window === "undefined"; | ||
@@ -5,0 +6,0 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect; |
@@ -61,3 +61,3 @@ var __defProp = Object.defineProperty; | ||
const { Component, validStyles, isText, isZStack } = staticConfig; | ||
const validStyleProps = validStyles ?? stylePropsView; | ||
const validStyleProps = validStyles != null ? validStyles : stylePropsView; | ||
let defaultProps = null; | ||
@@ -69,2 +69,3 @@ let tamaguiConfig; | ||
const component = forwardRef((props, forwardedRef) => { | ||
var _a; | ||
const forceUpdate = useForceUpdate(); | ||
@@ -238,3 +239,3 @@ const features = useFeatures(props, { forceUpdate }); | ||
unPress(); | ||
onPressOut?.(e); | ||
onPressOut == null ? void 0 : onPressOut(e); | ||
} | ||
@@ -254,4 +255,4 @@ }, | ||
} | ||
onHoverIn?.(e); | ||
onMouseEnter?.(e); | ||
onHoverIn == null ? void 0 : onHoverIn(e); | ||
onMouseEnter == null ? void 0 : onMouseEnter(e); | ||
} : void 0, | ||
@@ -271,4 +272,4 @@ onMouseLeave: attachHover || attachPress ? (e) => { | ||
} | ||
onHoverOut?.(e); | ||
onMouseLeave?.(e); | ||
onHoverOut == null ? void 0 : onHoverOut(e); | ||
onMouseLeave == null ? void 0 : onMouseLeave(e); | ||
} : void 0 | ||
@@ -281,10 +282,10 @@ }, | ||
}); | ||
onPressIn?.(e); | ||
onMouseDown?.(e); | ||
onPressIn == null ? void 0 : onPressIn(e); | ||
onMouseDown == null ? void 0 : onMouseDown(e); | ||
} : onPressIn, | ||
onClick: attachPress ? (e) => { | ||
onPress?.(e); | ||
onClick?.(e); | ||
onPress == null ? void 0 : onPress(e); | ||
onClick == null ? void 0 : onClick(e); | ||
unPress(); | ||
onPressOut?.(e); | ||
onPressOut == null ? void 0 : onPressOut(e); | ||
} : onPressOut | ||
@@ -309,3 +310,3 @@ } : null; | ||
space, | ||
flexDirection: props.flexDirection || defaultProps?.flexDirection, | ||
flexDirection: props.flexDirection || (defaultProps == null ? void 0 : defaultProps.flexDirection), | ||
isZStack | ||
@@ -332,3 +333,3 @@ }); | ||
console.log("\u{1F95A} props out:", viewProps); | ||
console.log(props.onClick?.toString()); | ||
console.log((_a = props.onClick) == null ? void 0 : _a.toString()); | ||
console.log("\u{1F95A} etc:", { shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls }); | ||
@@ -346,2 +347,3 @@ if (isWeb) { | ||
onConfiguredOnce((conf) => { | ||
var _a; | ||
tamaguiConfig = conf; | ||
@@ -366,3 +368,3 @@ initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]; | ||
if (process.env.NODE_ENV === "development") { | ||
if (staticConfig.defaultProps?.debug) { | ||
if ((_a = staticConfig.defaultProps) == null ? void 0 : _a.debug) { | ||
console.log("tamagui debug component:", next, defaultsClassName, component.defaultProps); | ||
@@ -383,3 +385,3 @@ } | ||
...Component2.defaultProps, | ||
...conf?.defaultProps | ||
...conf == null ? void 0 : conf.defaultProps | ||
} | ||
@@ -401,6 +403,7 @@ }); | ||
"...size": (size, { tokens }) => { | ||
var _a, _b; | ||
size = size == true ? "$true" : size; | ||
return { | ||
width: tokens.size[size] ?? size, | ||
height: tokens.size[size] ?? size | ||
width: (_a = tokens.size[size]) != null ? _a : size, | ||
height: (_b = tokens.size[size]) != null ? _b : size | ||
}; | ||
@@ -425,2 +428,3 @@ } | ||
}) { | ||
var _a, _b; | ||
if (!space && !isZStack) { | ||
@@ -439,5 +443,5 @@ return children; | ||
} | ||
const key = `${child?.["key"] ?? index}`; | ||
const key = `${(_a = child == null ? void 0 : child["key"]) != null ? _a : index}`; | ||
next.push(<Fragment key={key}>{isZStack ? <Absolute>{child}</Absolute> : child}</Fragment>); | ||
if (child?.["type"]?.["isVisuallyHidden"]) { | ||
if ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isVisuallyHidden"]) { | ||
continue; | ||
@@ -444,0 +448,0 @@ } |
@@ -34,2 +34,3 @@ var __defProp = Object.defineProperty; | ||
const themeConfig = (() => { | ||
var _a; | ||
let cssRules = []; | ||
@@ -72,3 +73,3 @@ const varsByValue = new Map(); | ||
const val = theme[themeKey]; | ||
const varName = val instanceof Variable ? val.name : varsByValue[val]?.name; | ||
const varName = val instanceof Variable ? val.name : (_a = varsByValue[val]) == null ? void 0 : _a.name; | ||
vars += `--${themeKey}:${varName ? `var(--${varName});` : `${val}`};`; | ||
@@ -75,0 +76,0 @@ } |
@@ -12,2 +12,3 @@ var __defProp = Object.defineProperty; | ||
return (key, value, theme, props) => { | ||
var _a, _b; | ||
const conf = getTamagui(); | ||
@@ -22,5 +23,5 @@ if (!conf) { | ||
let fontFamily = props.fontFamily || defaultProps.fontFamily || "$body"; | ||
const variant = variantsParsed?.[key]; | ||
const variant = variantsParsed == null ? void 0 : variantsParsed[key]; | ||
if (variant && typeof value !== "undefined") { | ||
const val = value === true ? variant["$true"] || variant["true"] : variant[value] ?? variant["..."] ?? value; | ||
const val = value === true ? variant["$true"] || variant["true"] : (_b = (_a = variant[value]) != null ? _a : variant["..."]) != null ? _b : value; | ||
const res = typeof val === "function" ? val(value, { tokens: conf.tokensParsed, theme, props }) : isObj(val) ? { ...val } : val; | ||
@@ -69,2 +70,3 @@ if (isObj(res)) { | ||
const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, themeParsed }, theme, fontFamily = "$body") => { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
if (themeParsed[value]) { | ||
@@ -75,3 +77,3 @@ if (isWeb && themeParsed[value].variable) { | ||
if (value && value[0] === "$") { | ||
return theme[`${value.slice(1)}`]?.val || themeParsed[value]?.val; | ||
return ((_a = theme[`${value.slice(1)}`]) == null ? void 0 : _a.val) || ((_b = themeParsed[value]) == null ? void 0 : _b.val); | ||
} | ||
@@ -82,15 +84,15 @@ } | ||
if (key === "fontFamily") { | ||
valOrVar = tokensParsed.font[value]?.family || value; | ||
valOrVar = ((_c = tokensParsed.font[value]) == null ? void 0 : _c.family) || value; | ||
} | ||
if (key === "fontSize") { | ||
valOrVar = tokensParsed.font[fontFamily]?.size[value] || value; | ||
valOrVar = ((_d = tokensParsed.font[fontFamily]) == null ? void 0 : _d.size[value]) || value; | ||
} | ||
if (key === "lineHeight") { | ||
valOrVar = tokensParsed.font[fontFamily]?.lineHeight[value] || value; | ||
valOrVar = ((_e = tokensParsed.font[fontFamily]) == null ? void 0 : _e.lineHeight[value]) || value; | ||
} | ||
if (key === "letterSpacing") { | ||
valOrVar = tokensParsed.font[fontFamily]?.letterSpacing[value] || value; | ||
valOrVar = ((_f = tokensParsed.font[fontFamily]) == null ? void 0 : _f.letterSpacing[value]) || value; | ||
} | ||
if (key === "fontWeight") { | ||
valOrVar = tokensParsed.font[fontFamily]?.weight[value] || value; | ||
valOrVar = ((_g = tokensParsed.font[fontFamily]) == null ? void 0 : _g.weight[value]) || value; | ||
} | ||
@@ -97,0 +99,0 @@ if (typeof valOrVar !== "undefined") { |
@@ -5,2 +5,3 @@ var __defProp = Object.defineProperty; | ||
function extendStaticConfig(Component, config = {}) { | ||
var _a, _b; | ||
const parent = Component || {}; | ||
@@ -32,4 +33,4 @@ if (!parent.staticConfig) { | ||
isText: config.isText || parent.staticConfig.isText || false, | ||
neverFlatten: config.neverFlatten ?? parent.staticConfig.neverFlatten, | ||
ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp, | ||
neverFlatten: (_a = config.neverFlatten) != null ? _a : parent.staticConfig.neverFlatten, | ||
ensureOverriddenProp: (_b = config.ensureOverriddenProp) != null ? _b : parent.staticConfig.ensureOverriddenProp, | ||
validStyles: config.validStyles ? { | ||
@@ -36,0 +37,0 @@ ...parent.staticConfig.validStyles, |
@@ -37,2 +37,3 @@ var __defProp = Object.defineProperty; | ||
function getAtomicStyle(style, pseudo, avoidCollection) { | ||
var _a; | ||
if (style == null || typeof style !== "object") { | ||
@@ -43,3 +44,3 @@ throw new Error(`Wrong style type: "${typeof style}": ${style}`); | ||
if (key in style) { | ||
style[borderDefaults[key]] = style[borderDefaults[key]] ?? "solid"; | ||
style[borderDefaults[key]] = (_a = style[borderDefaults[key]]) != null ? _a : "solid"; | ||
} | ||
@@ -46,0 +47,0 @@ } |
@@ -5,3 +5,4 @@ var __defProp = Object.defineProperty; | ||
const isTamaguiElement = /* @__PURE__ */ __name((child) => { | ||
return isValidElement(child) && !!child.type["staticConfig"]?.parsed; | ||
var _a; | ||
return isValidElement(child) && !!((_a = child.type["staticConfig"]) == null ? void 0 : _a.parsed); | ||
}, "isTamaguiElement"); | ||
@@ -8,0 +9,0 @@ export { |
@@ -18,3 +18,3 @@ var __defProp = Object.defineProperty; | ||
const withTheme = withThemeComponent; | ||
withTheme.displayName = `Themed(${component?.displayName || component?.name || "Anonymous"})`; | ||
withTheme.displayName = `Themed(${(component == null ? void 0 : component.displayName) || (component == null ? void 0 : component.name) || "Anonymous"})`; | ||
return withTheme; | ||
@@ -21,0 +21,0 @@ }, "graphql"); |
@@ -15,3 +15,4 @@ var __defProp = Object.defineProperty; | ||
const removeMediaQueryListener = /* @__PURE__ */ __name((key, cb) => { | ||
mediaQueryListeners[key]?.delete(cb); | ||
var _a; | ||
(_a = mediaQueryListeners[key]) == null ? void 0 : _a.delete(cb); | ||
}, "removeMediaQueryListener"); | ||
@@ -51,2 +52,3 @@ let conf = null; | ||
} = {}) => { | ||
var _a; | ||
if (conf) { | ||
@@ -73,3 +75,3 @@ console.warn(`Already configured mediaQueries once (you may have called getMedia() before configureMedia())`); | ||
const listeners = mediaQueryListeners[key]; | ||
if (listeners?.size) { | ||
if (listeners == null ? void 0 : listeners.size) { | ||
for (const cb of [...listeners]) { | ||
@@ -82,3 +84,3 @@ cb(); | ||
console.error("Error running media query", str, err.message, err.stack); | ||
const isDefaultActive = defaultActive?.includes(key) ?? true; | ||
const isDefaultActive = (_a = defaultActive == null ? void 0 : defaultActive.includes(key)) != null ? _a : true; | ||
mediaState[key] = isDefaultActive; | ||
@@ -85,0 +87,0 @@ } |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var _a, _b; | ||
import { Pressable } from "react-native"; | ||
const getPressable = Pressable?.["type"]?.["render"]; | ||
const getPressable = (_b = (_a = Pressable) == null ? void 0 : _a["type"]) == null ? void 0 : _b["render"]; | ||
const usePressable = /* @__PURE__ */ __name((props) => { | ||
@@ -6,0 +7,0 @@ const out = getPressable(props); |
@@ -25,3 +25,3 @@ var __defProp = Object.defineProperty; | ||
return parent.onChangeTheme((next, manager) => { | ||
setName(opts?.parent ? manager.parentName : next); | ||
setName((opts == null ? void 0 : opts.parent) ? manager.parentName : next); | ||
}); | ||
@@ -35,2 +35,3 @@ }, [parent]); | ||
const useTheme = /* @__PURE__ */ __name(() => { | ||
var _a; | ||
const forceUpdate = useForceUpdate(); | ||
@@ -59,3 +60,3 @@ const manager = useContext(ThemeManagerContext); | ||
}, []); | ||
const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light; | ||
const theme = (_a = manager.name ? themes[manager.name] : themes.light) != null ? _a : themes.light; | ||
return useMemo(() => { | ||
@@ -62,0 +63,0 @@ return new Proxy(theme, { |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var _a, _b; | ||
import { createContext } from "react"; | ||
import { rnw } from "../constants/rnw"; | ||
const FallbackNativeContext = createContext(false); | ||
const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext; | ||
const TextAncestorContext = (_b = (_a = rnw) == null ? void 0 : _a.TextAncestorContext) != null ? _b : FallbackNativeContext; | ||
const TextAncestorProvider = /* @__PURE__ */ __name((props) => { | ||
@@ -8,0 +9,0 @@ return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>; |
@@ -10,2 +10,3 @@ var __defProp = Object.defineProperty; | ||
const Theme = /* @__PURE__ */ __name((props) => { | ||
var _a, _b; | ||
const parent = useContext(ThemeManagerContext); | ||
@@ -55,3 +56,3 @@ const themes = useContext(ThemeContext); | ||
if (name) { | ||
const color = themes[name]?.["color"]?.["variable"]; | ||
const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"]; | ||
return <div className={getThemeParentClassName(props.name)} style={{ display: "contents", color }}>{contents}</div>; | ||
@@ -58,0 +59,0 @@ } |
@@ -31,2 +31,3 @@ var __defProp = Object.defineProperty; | ||
update() { | ||
var _a; | ||
if (!this.name) { | ||
@@ -37,3 +38,3 @@ this.keys.clear(); | ||
if (keys.size) { | ||
this.listeners.get(uuid)?.(); | ||
(_a = this.listeners.get(uuid)) == null ? void 0 : _a(); | ||
} | ||
@@ -40,0 +41,0 @@ } |
{ | ||
"name": "@tamagui/core", | ||
"version": "1.0.0-alpha.32", | ||
"version": "1.0.0-alpha.36", | ||
"source": "src/index.ts", | ||
@@ -17,6 +17,6 @@ "main": "dist/cjs", | ||
"dependencies": { | ||
"@tamagui/helpers": "^1.0.0-alpha.32", | ||
"@tamagui/helpers": "^1.0.0-alpha.36", | ||
"@tamagui/ow": "^0.28.1", | ||
"@tamagui/use-debounce": "^1.0.0-alpha.32", | ||
"@tamagui/use-force-update": "^1.0.0-alpha.32", | ||
"@tamagui/use-debounce": "^1.0.0-alpha.36", | ||
"@tamagui/use-force-update": "^1.0.0-alpha.36", | ||
"react": "*", | ||
@@ -29,3 +29,3 @@ "react-dom": "*" | ||
"devDependencies": { | ||
"@tamagui/build": "^1.0.0-alpha.32", | ||
"@tamagui/build": "^1.0.0-alpha.36", | ||
"@types/react": "^17.0.35", | ||
@@ -42,3 +42,3 @@ "esbuild": "^0.13.12", | ||
}, | ||
"gitHead": "08084d0e70828a4d5fd18267d85db282a3a189d9" | ||
"gitHead": "d5b75feefe9694ee2f107b69c1be98a5f107eada" | ||
} |
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
639276
9101