@tamagui/web
Advanced tools
Comparing version 1.5.21 to 1.5.22
@@ -542,2 +542,3 @@ "use strict"; | ||
shallow: stateRef.current.themeShallow | ||
// passPropsToChildren: true, | ||
}); | ||
@@ -808,20 +809,17 @@ if (process.env.TAMAGUI_TARGET === "web") { | ||
function createSpacer({ key, direction, space, spaceFlex }) { | ||
return ( | ||
// @ts-ignore this one blew up but the types seem better | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
Spacer, | ||
{ | ||
size: space, | ||
direction, | ||
...typeof spaceFlex !== "undefined" && { | ||
flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex | ||
} | ||
}, | ||
key | ||
) | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
Spacer, | ||
{ | ||
size: space, | ||
direction, | ||
...typeof spaceFlex !== "undefined" && { | ||
flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex | ||
} | ||
}, | ||
key | ||
); | ||
} | ||
function isUnspaced(child) { | ||
var _a, _b; | ||
return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]); | ||
const t = child == null ? void 0 : child["type"]; | ||
return (t == null ? void 0 : t["isVisuallyHidden"]) || (t == null ? void 0 : t["isUnspaced"]); | ||
} | ||
@@ -857,3 +855,2 @@ const DefaultProps = /* @__PURE__ */ new Map(); | ||
const AbsoluteFill = createComponent({ | ||
componentName: "AbsoluteFill", | ||
defaultProps: { | ||
@@ -860,0 +857,0 @@ ...import_constants2.stackDefaultStyles, |
@@ -50,34 +50,26 @@ "use strict"; | ||
} | ||
if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) { | ||
return children; | ||
if (isNewTheme || hasEverThemed.current || forceClassName) { | ||
let next = import_react.Children.toArray(children); | ||
if (shallow && themeManager) { | ||
next = next.map((child) => { | ||
return (0, import_react.isValidElement)(child) ? (0, import_react.cloneElement)( | ||
child, | ||
void 0, | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children }) | ||
) : child; | ||
}); | ||
} | ||
const wrapped = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next }); | ||
if (forceClassName === false) { | ||
return wrapped; | ||
} | ||
if (import_constants.isWeb && !options.passPropsToChildren) { | ||
const themeColor = theme && isNewTheme ? (0, import_createVariable.variableToString)(theme.color) : ""; | ||
const colorStyle = { | ||
color: themeColor | ||
}; | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className || ""} _dsp_contents`, style: colorStyle, children: wrapped }); | ||
} | ||
} | ||
let next = children; | ||
if (shallow && themeManager) { | ||
next = import_react.Children.map(next, (child) => { | ||
return (0, import_react.cloneElement)( | ||
child, | ||
void 0, | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children }) | ||
); | ||
}); | ||
} | ||
next = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next }); | ||
if (import_constants.isWeb) { | ||
const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
"span", | ||
{ | ||
className: "_dsp_contents", | ||
...theme && enableClassName && { | ||
className: `${className} _dsp_contents`, | ||
style: { | ||
// in order to provide currentColor, set color by default | ||
color: (0, import_createVariable.variableToString)(theme.color) | ||
} | ||
}, | ||
children: next | ||
} | ||
); | ||
} | ||
return next; | ||
return children; | ||
} | ||
@@ -84,0 +76,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -514,2 +514,3 @@ import { jsx } from "react/jsx-runtime"; | ||
shallow: stateRef.current.themeShallow | ||
// passPropsToChildren: true, | ||
}); | ||
@@ -780,20 +781,17 @@ if (process.env.TAMAGUI_TARGET === "web") { | ||
function createSpacer({ key, direction, space, spaceFlex }) { | ||
return ( | ||
// @ts-ignore this one blew up but the types seem better | ||
/* @__PURE__ */ jsx( | ||
Spacer, | ||
{ | ||
size: space, | ||
direction, | ||
...typeof spaceFlex !== "undefined" && { | ||
flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex | ||
} | ||
}, | ||
key | ||
) | ||
return /* @__PURE__ */ jsx( | ||
Spacer, | ||
{ | ||
size: space, | ||
direction, | ||
...typeof spaceFlex !== "undefined" && { | ||
flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex | ||
} | ||
}, | ||
key | ||
); | ||
} | ||
function isUnspaced(child) { | ||
var _a, _b; | ||
return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]); | ||
const t = child == null ? void 0 : child["type"]; | ||
return (t == null ? void 0 : t["isVisuallyHidden"]) || (t == null ? void 0 : t["isUnspaced"]); | ||
} | ||
@@ -829,3 +827,2 @@ const DefaultProps = /* @__PURE__ */ new Map(); | ||
const AbsoluteFill = createComponent({ | ||
componentName: "AbsoluteFill", | ||
defaultProps: { | ||
@@ -832,0 +829,0 @@ ...stackDefaultStyles, |
import { jsx } from "react/jsx-runtime"; | ||
import { isWeb } from "@tamagui/constants"; | ||
import { Children, cloneElement } from "react"; | ||
import { Children, cloneElement, isValidElement } from "react"; | ||
import { variableToString } from "../createVariable.js"; | ||
@@ -26,34 +26,26 @@ import { ThemeManagerContext } from "../helpers/ThemeManagerContext.js"; | ||
} | ||
if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) { | ||
return children; | ||
if (isNewTheme || hasEverThemed.current || forceClassName) { | ||
let next = Children.toArray(children); | ||
if (shallow && themeManager) { | ||
next = next.map((child) => { | ||
return isValidElement(child) ? cloneElement( | ||
child, | ||
void 0, | ||
/* @__PURE__ */ jsx(Theme, { name: themeManager.state.parentName, children: child.props.children }) | ||
) : child; | ||
}); | ||
} | ||
const wrapped = /* @__PURE__ */ jsx(ThemeManagerContext.Provider, { value: themeManager, children: next }); | ||
if (forceClassName === false) { | ||
return wrapped; | ||
} | ||
if (isWeb && !options.passPropsToChildren) { | ||
const themeColor = theme && isNewTheme ? variableToString(theme.color) : ""; | ||
const colorStyle = { | ||
color: themeColor | ||
}; | ||
return /* @__PURE__ */ jsx("span", { className: `${className || ""} _dsp_contents`, style: colorStyle, children: wrapped }); | ||
} | ||
} | ||
let next = children; | ||
if (shallow && themeManager) { | ||
next = Children.map(next, (child) => { | ||
return cloneElement( | ||
child, | ||
void 0, | ||
/* @__PURE__ */ jsx(Theme, { name: themeManager.state.parentName, children: child.props.children }) | ||
); | ||
}); | ||
} | ||
next = /* @__PURE__ */ jsx(ThemeManagerContext.Provider, { value: themeManager, children: next }); | ||
if (isWeb) { | ||
const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme); | ||
return /* @__PURE__ */ jsx( | ||
"span", | ||
{ | ||
className: "_dsp_contents", | ||
...theme && enableClassName && { | ||
className: `${className} _dsp_contents`, | ||
style: { | ||
// in order to provide currentColor, set color by default | ||
color: variableToString(theme.color) | ||
} | ||
}, | ||
children: next | ||
} | ||
); | ||
} | ||
return next; | ||
return children; | ||
} | ||
@@ -60,0 +52,0 @@ export { |
{ | ||
"name": "@tamagui/web", | ||
"version": "1.5.21", | ||
"version": "1.5.22", | ||
"source": "src/index.ts", | ||
@@ -30,9 +30,9 @@ "main": "dist/cjs", | ||
"dependencies": { | ||
"@tamagui/compose-refs": "^1.5.21", | ||
"@tamagui/constants": "^1.5.21", | ||
"@tamagui/helpers": "^1.5.21", | ||
"@tamagui/normalize-css-color": "^1.5.21", | ||
"@tamagui/use-did-finish-ssr": "^1.5.21", | ||
"@tamagui/use-event": "^1.5.21", | ||
"@tamagui/use-force-update": "^1.5.21" | ||
"@tamagui/compose-refs": "^1.5.22", | ||
"@tamagui/constants": "^1.5.22", | ||
"@tamagui/helpers": "^1.5.22", | ||
"@tamagui/normalize-css-color": "^1.5.22", | ||
"@tamagui/use-did-finish-ssr": "^1.5.22", | ||
"@tamagui/use-event": "^1.5.22", | ||
"@tamagui/use-force-update": "^1.5.22" | ||
}, | ||
@@ -43,3 +43,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@tamagui/build": "^1.5.21", | ||
"@tamagui/build": "^1.5.22", | ||
"@testing-library/react": "^13.4.0", | ||
@@ -46,0 +46,0 @@ "csstype": "^3.0.10", |
@@ -7,3 +7,4 @@ import { ChangedThemeResponse } from '../hooks/useTheme.js'; | ||
shallow?: boolean; | ||
passPropsToChildren?: boolean; | ||
}): any; | ||
//# sourceMappingURL=Theme.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
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
2013540
750
27838