@tamagui/web 1.89.0 → 1.89.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.
@@ -104,7 +104,8 @@ function addThemesFromCSS(cssStyleRule, tokens) {
104
104
  for (const rule of rules) {
105
105
  const sepI = rule.indexOf(":");
106
106
  if (sepI === -1) continue;
107
- const key = rule.slice(rule.indexOf("--") + 2, sepI),
107
+ const varIndex = rule.indexOf("--"),
108
+ key = rule.slice(varIndex === -1 ? 0 : varIndex + 2, sepI),
108
109
  val = rule.slice(sepI + 2);
109
110
  let value;
110
111
  if (val.startsWith("var(")) {
@@ -3,11 +3,11 @@ import { mergeVariants } from "./helpers/mergeVariants.mjs";
3
3
  import { getReactNativeConfig } from "./setupReactNative.mjs";
4
4
  function styled(ComponentIn, options, staticExtractionOptions) {
5
5
  if (process.env.NODE_ENV !== "production" && !ComponentIn) throw new Error("No component given to styled()");
6
- const parentSC = ComponentIn.staticConfig,
7
- isPlainStyledComponent = !!parentSC && !(parentSC.isReactNative || parentSC.isHOC);
8
- let Component = parentSC?.isHOC && !parentSC?.isStyledHOC || isPlainStyledComponent ? ComponentIn : parentSC?.Component || ComponentIn;
9
- const reactNativeConfig = parentSC ? void 0 : getReactNativeConfig(Component),
10
- isReactNative = !!(reactNativeConfig || staticExtractionOptions?.isReactNative || parentSC?.isReactNative),
6
+ const parentStaticConfig = ComponentIn.staticConfig,
7
+ isPlainStyledComponent = !!parentStaticConfig && !(parentStaticConfig.isReactNative || parentStaticConfig.isHOC);
8
+ let Component = parentStaticConfig?.isHOC && !parentStaticConfig?.isStyledHOC || isPlainStyledComponent ? ComponentIn : parentStaticConfig?.Component || ComponentIn;
9
+ const reactNativeConfig = parentStaticConfig ? void 0 : getReactNativeConfig(Component),
10
+ isReactNative = !!(reactNativeConfig || staticExtractionOptions?.isReactNative || parentStaticConfig?.isReactNative),
11
11
  staticConfigProps = (() => {
12
12
  if (options) {
13
13
  let {
@@ -21,14 +21,14 @@ function styled(ComponentIn, options, staticExtractionOptions) {
21
21
  defaultVariants && (defaultProps = {
22
22
  ...defaultVariants,
23
23
  ...defaultProps
24
- }), parentSC && (parentSC.isHOC && !parentSC.isStyledHOC || (defaultProps = {
25
- ...parentSC.defaultProps,
24
+ }), parentStaticConfig && (parentStaticConfig.isHOC && !parentStaticConfig.isStyledHOC || (defaultProps = {
25
+ ...parentStaticConfig.defaultProps,
26
26
  ...defaultProps
27
- }, parentSC.variants && (variants = mergeVariants(parentSC.variants, variants)))), parentSC?.isHOC && name && (defaultProps.componentName = name);
28
- const isText = !!(staticExtractionOptions?.isText || parentSC?.isText),
29
- acceptsClassName = acceptsClassNameProp ?? !!(isPlainStyledComponent || isReactNative || parentSC?.acceptsClassName),
27
+ }, parentStaticConfig.variants && (variants = mergeVariants(parentStaticConfig.variants, variants)))), parentStaticConfig?.isHOC && name && (defaultProps.componentName = name);
28
+ const isText = !!(staticExtractionOptions?.isText || parentStaticConfig?.isText),
29
+ acceptsClassName = acceptsClassNameProp ?? (isPlainStyledComponent || isReactNative || parentStaticConfig?.isHOC && parentStaticConfig?.acceptsClassName),
30
30
  conf = {
31
- ...parentSC,
31
+ ...parentStaticConfig,
32
32
  ...staticExtractionOptions,
33
33
  ...(!isPlainStyledComponent && {
34
34
  Component
@@ -37,14 +37,14 @@ function styled(ComponentIn, options, staticExtractionOptions) {
37
37
  variants,
38
38
  defaultProps,
39
39
  defaultVariants,
40
- componentName: name || parentSC?.componentName,
40
+ componentName: name || parentStaticConfig?.componentName,
41
41
  isReactNative,
42
42
  isText,
43
43
  acceptsClassName,
44
44
  context,
45
45
  ...reactNativeConfig,
46
- isStyledHOC: !!parentSC?.isHOC,
47
- parentSC
46
+ isStyledHOC: !!parentStaticConfig?.isHOC,
47
+ parentStaticConfig
48
48
  };
49
49
  return (defaultProps.children || !acceptsClassName || context) && (conf.neverFlatten = !0), conf;
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/web",
3
- "version": "1.89.0",
3
+ "version": "1.89.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -27,20 +27,20 @@
27
27
  "reset.css"
28
28
  ],
29
29
  "dependencies": {
30
- "@tamagui/compose-refs": "1.89.0",
31
- "@tamagui/constants": "1.89.0",
32
- "@tamagui/helpers": "1.89.0",
33
- "@tamagui/normalize-css-color": "1.89.0",
34
- "@tamagui/timer": "1.89.0",
35
- "@tamagui/types": "1.89.0",
36
- "@tamagui/use-did-finish-ssr": "1.89.0",
37
- "@tamagui/use-event": "1.89.0",
38
- "@tamagui/use-force-update": "1.89.0",
30
+ "@tamagui/compose-refs": "1.89.1",
31
+ "@tamagui/constants": "1.89.1",
32
+ "@tamagui/helpers": "1.89.1",
33
+ "@tamagui/normalize-css-color": "1.89.1",
34
+ "@tamagui/timer": "1.89.1",
35
+ "@tamagui/types": "1.89.1",
36
+ "@tamagui/use-did-finish-ssr": "1.89.1",
37
+ "@tamagui/use-event": "1.89.1",
38
+ "@tamagui/use-force-update": "1.89.1",
39
39
  "react": "^18.2.0",
40
40
  "react-dom": "^18.2.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@tamagui/build": "1.89.0",
43
+ "@tamagui/build": "1.89.1",
44
44
  "@testing-library/react": "^14.0.0",
45
45
  "csstype": "^3.0.10",
46
46
  "typescript": "^5.3.3",