@tamagui/text 1.0.1-beta.138 → 1.0.1-beta.141
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/Headings.js +0 -0
- package/dist/cjs/Headings.js.map +0 -0
- package/dist/cjs/Paragraph.js +0 -0
- package/dist/cjs/Paragraph.js.map +0 -0
- package/dist/cjs/SizableText.js +0 -0
- package/dist/cjs/SizableText.js.map +0 -0
- package/dist/cjs/index.js +0 -0
- package/dist/cjs/index.js.map +0 -0
- package/dist/cjs/types.js +0 -0
- package/dist/cjs/types.js.map +0 -0
- package/dist/cjs/wrapChildrenInText.js +21 -20
- package/dist/cjs/wrapChildrenInText.js.map +2 -2
- package/dist/cjs/wrapChildrenInText.test.js +0 -0
- package/dist/cjs/wrapChildrenInText.test.js.map +0 -0
- package/dist/esm/Headings.js +0 -0
- package/dist/esm/Headings.js.map +0 -0
- package/dist/esm/Paragraph.js +0 -0
- package/dist/esm/Paragraph.js.map +0 -0
- package/dist/esm/SizableText.js +0 -0
- package/dist/esm/SizableText.js.map +0 -0
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/esm/wrapChildrenInText.js +21 -20
- package/dist/esm/wrapChildrenInText.js.map +2 -2
- package/dist/esm/wrapChildrenInText.test.js +0 -0
- package/dist/esm/wrapChildrenInText.test.js.map +0 -0
- package/dist/jsx/Headings.js +0 -0
- package/dist/jsx/Headings.js.map +0 -0
- package/dist/jsx/Paragraph.js +0 -0
- package/dist/jsx/Paragraph.js.map +0 -0
- package/dist/jsx/SizableText.js +0 -0
- package/dist/jsx/SizableText.js.map +0 -0
- package/dist/jsx/index.js +0 -0
- package/dist/jsx/index.js.map +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/types.js.map +0 -0
- package/dist/jsx/wrapChildrenInText.js +21 -20
- package/dist/jsx/wrapChildrenInText.js.map +2 -2
- package/dist/jsx/wrapChildrenInText.test.js +0 -0
- package/dist/jsx/wrapChildrenInText.test.js.map +0 -0
- package/package.json +4 -4
- package/src/wrapChildrenInText.tsx +12 -13
- package/types/wrapChildrenInText.d.ts +1 -1
package/dist/cjs/Headings.js
CHANGED
|
File without changes
|
package/dist/cjs/Headings.js.map
CHANGED
|
File without changes
|
package/dist/cjs/Paragraph.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/cjs/SizableText.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/cjs/index.js
CHANGED
|
File without changes
|
package/dist/cjs/index.js.map
CHANGED
|
File without changes
|
package/dist/cjs/types.js
CHANGED
|
File without changes
|
package/dist/cjs/types.js.map
CHANGED
|
File without changes
|
|
@@ -25,37 +25,38 @@ __export(wrapChildrenInText_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(wrapChildrenInText_exports);
|
|
27
27
|
var import_react = __toESM(require("react"));
|
|
28
|
-
function wrapChildrenInText(TextComponent, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
function wrapChildrenInText(TextComponent, propsIn) {
|
|
29
|
+
const {
|
|
30
|
+
children,
|
|
31
|
+
textProps,
|
|
32
|
+
size,
|
|
33
|
+
noTextWrap,
|
|
34
|
+
color,
|
|
35
|
+
fontFamily,
|
|
36
|
+
fontSize,
|
|
37
|
+
fontWeight,
|
|
38
|
+
letterSpacing,
|
|
39
|
+
textAlign
|
|
40
|
+
} = propsIn;
|
|
40
41
|
if (noTextWrap || !children) {
|
|
41
42
|
return children;
|
|
42
43
|
}
|
|
43
44
|
const allChildren = import_react.default.Children.toArray(children);
|
|
44
45
|
const nextChildren = [];
|
|
45
46
|
let lastIsString = false;
|
|
46
|
-
const
|
|
47
|
+
const props = {};
|
|
47
48
|
if (color)
|
|
48
|
-
|
|
49
|
+
props.color = color;
|
|
49
50
|
if (fontFamily)
|
|
50
|
-
|
|
51
|
+
props.fontFamily = fontFamily;
|
|
51
52
|
if (fontSize)
|
|
52
|
-
|
|
53
|
+
props.fontSize = fontSize;
|
|
53
54
|
if (fontWeight)
|
|
54
|
-
|
|
55
|
+
props.fontWeight = fontWeight;
|
|
55
56
|
if (letterSpacing)
|
|
56
|
-
|
|
57
|
+
props.letterSpacing = letterSpacing;
|
|
57
58
|
if (textAlign)
|
|
58
|
-
|
|
59
|
+
props.textAlign = textAlign;
|
|
59
60
|
function concatStringChildren() {
|
|
60
61
|
if (!lastIsString)
|
|
61
62
|
return;
|
|
@@ -63,7 +64,7 @@ function wrapChildrenInText(TextComponent, {
|
|
|
63
64
|
const childrenStrings = nextChildren[index];
|
|
64
65
|
nextChildren[index] = /* @__PURE__ */ import_react.default.createElement(TextComponent, {
|
|
65
66
|
key: index,
|
|
66
|
-
...
|
|
67
|
+
...props,
|
|
67
68
|
size,
|
|
68
69
|
...textProps
|
|
69
70
|
}, childrenStrings);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapChildrenInText.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AASX,
|
|
4
|
+
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(TextComponent: any, propsIn: Props) {\n const {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n } = propsIn\n\n if (noTextWrap || !children) {\n return children\n }\n\n // in the case of using variables, like so:\n // <ListItem>Hello, {name}</ListItem>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n const allChildren = React.Children.toArray(children)\n const nextChildren: any[] = []\n let lastIsString = false\n const props: any = {}\n // to avoid setting undefined\n if (color) props.color = color\n if (fontFamily) props.fontFamily = fontFamily\n if (fontSize) props.fontSize = fontSize\n if (fontWeight) props.fontWeight = fontWeight\n if (letterSpacing) props.letterSpacing = letterSpacing\n if (textAlign) props.textAlign = textAlign\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <TextComponent key={index} {...props} size={size} {...textProps}>\n {childrenStrings}\n </TextComponent>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n return nextChildren\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AASX,4BAA4B,eAAoB,SAAgB;AACrE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,QAAM,cAAc,qBAAM,SAAS,QAAQ,QAAQ;AACnD,QAAM,eAAsB,CAAC;AAC7B,MAAI,eAAe;AACnB,QAAM,QAAa,CAAC;AAEpB,MAAI;AAAO,UAAM,QAAQ;AACzB,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAU,UAAM,WAAW;AAC/B,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAe,UAAM,gBAAgB;AACzC,MAAI;AAAW,UAAM,YAAY;AAEjC,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,mDAAC;AAAA,MAAc,KAAK;AAAA,MAAQ,GAAG;AAAA,MAAO;AAAA,MAAa,GAAG;AAAA,OACnD,eACH;AAAA,EAEJ;AAEA,aAAW,SAAS,aAAa;AAC/B,UAAM,OAAO,aAAa,aAAa,SAAS;AAChD,UAAM,WAAW,OAAO,UAAU;AAClC,QAAI,UAAU;AACZ,UAAI,cAAc;AAChB,aAAK,KAAK,KAAK;AAAA,MACjB,OAAO;AACL,qBAAa,KAAK,CAAC,KAAK,CAAC;AAAA,MAC3B;AAAA,IACF,OAAO;AACL,2BAAqB;AACrB,mBAAa,KAAK,KAAK;AAAA,IACzB;AACA,mBAAe;AAAA,EACjB;AACA,uBAAqB;AAErB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
File without changes
|
|
File without changes
|
package/dist/esm/Headings.js
CHANGED
|
File without changes
|
package/dist/esm/Headings.js.map
CHANGED
|
File without changes
|
package/dist/esm/Paragraph.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/esm/SizableText.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/esm/index.js
CHANGED
|
File without changes
|
package/dist/esm/index.js.map
CHANGED
|
File without changes
|
package/dist/esm/types.js
CHANGED
|
File without changes
|
package/dist/esm/types.js.map
CHANGED
|
File without changes
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
function wrapChildrenInText(TextComponent, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
function wrapChildrenInText(TextComponent, propsIn) {
|
|
3
|
+
const {
|
|
4
|
+
children,
|
|
5
|
+
textProps,
|
|
6
|
+
size,
|
|
7
|
+
noTextWrap,
|
|
8
|
+
color,
|
|
9
|
+
fontFamily,
|
|
10
|
+
fontSize,
|
|
11
|
+
fontWeight,
|
|
12
|
+
letterSpacing,
|
|
13
|
+
textAlign
|
|
14
|
+
} = propsIn;
|
|
14
15
|
if (noTextWrap || !children) {
|
|
15
16
|
return children;
|
|
16
17
|
}
|
|
17
18
|
const allChildren = React.Children.toArray(children);
|
|
18
19
|
const nextChildren = [];
|
|
19
20
|
let lastIsString = false;
|
|
20
|
-
const
|
|
21
|
+
const props = {};
|
|
21
22
|
if (color)
|
|
22
|
-
|
|
23
|
+
props.color = color;
|
|
23
24
|
if (fontFamily)
|
|
24
|
-
|
|
25
|
+
props.fontFamily = fontFamily;
|
|
25
26
|
if (fontSize)
|
|
26
|
-
|
|
27
|
+
props.fontSize = fontSize;
|
|
27
28
|
if (fontWeight)
|
|
28
|
-
|
|
29
|
+
props.fontWeight = fontWeight;
|
|
29
30
|
if (letterSpacing)
|
|
30
|
-
|
|
31
|
+
props.letterSpacing = letterSpacing;
|
|
31
32
|
if (textAlign)
|
|
32
|
-
|
|
33
|
+
props.textAlign = textAlign;
|
|
33
34
|
function concatStringChildren() {
|
|
34
35
|
if (!lastIsString)
|
|
35
36
|
return;
|
|
@@ -37,7 +38,7 @@ function wrapChildrenInText(TextComponent, {
|
|
|
37
38
|
const childrenStrings = nextChildren[index];
|
|
38
39
|
nextChildren[index] = /* @__PURE__ */ React.createElement(TextComponent, {
|
|
39
40
|
key: index,
|
|
40
|
-
...
|
|
41
|
+
...props,
|
|
41
42
|
size,
|
|
42
43
|
...textProps
|
|
43
44
|
}, childrenStrings);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapChildrenInText.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(
|
|
5
|
-
"mappings": "AACA;AASO,
|
|
4
|
+
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(TextComponent: any, propsIn: Props) {\n const {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n } = propsIn\n\n if (noTextWrap || !children) {\n return children\n }\n\n // in the case of using variables, like so:\n // <ListItem>Hello, {name}</ListItem>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n const allChildren = React.Children.toArray(children)\n const nextChildren: any[] = []\n let lastIsString = false\n const props: any = {}\n // to avoid setting undefined\n if (color) props.color = color\n if (fontFamily) props.fontFamily = fontFamily\n if (fontSize) props.fontSize = fontSize\n if (fontWeight) props.fontWeight = fontWeight\n if (letterSpacing) props.letterSpacing = letterSpacing\n if (textAlign) props.textAlign = textAlign\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <TextComponent key={index} {...props} size={size} {...textProps}>\n {childrenStrings}\n </TextComponent>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n return nextChildren\n}\n"],
|
|
5
|
+
"mappings": "AACA;AASO,4BAA4B,eAAoB,SAAgB;AACrE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,QAAM,cAAc,MAAM,SAAS,QAAQ,QAAQ;AACnD,QAAM,eAAsB,CAAC;AAC7B,MAAI,eAAe;AACnB,QAAM,QAAa,CAAC;AAEpB,MAAI;AAAO,UAAM,QAAQ;AACzB,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAU,UAAM,WAAW;AAC/B,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAe,UAAM,gBAAgB;AACzC,MAAI;AAAW,UAAM,YAAY;AAEjC,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,oCAAC;AAAA,MAAc,KAAK;AAAA,MAAQ,GAAG;AAAA,MAAO;AAAA,MAAa,GAAG;AAAA,OACnD,eACH;AAAA,EAEJ;AAEA,aAAW,SAAS,aAAa;AAC/B,UAAM,OAAO,aAAa,aAAa,SAAS;AAChD,UAAM,WAAW,OAAO,UAAU;AAClC,QAAI,UAAU;AACZ,UAAI,cAAc;AAChB,aAAK,KAAK,KAAK;AAAA,MACjB,OAAO;AACL,qBAAa,KAAK,CAAC,KAAK,CAAC;AAAA,MAC3B;AAAA,IACF,OAAO;AACL,2BAAqB;AACrB,mBAAa,KAAK,KAAK;AAAA,IACzB;AACA,mBAAe;AAAA,EACjB;AACA,uBAAqB;AAErB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
File without changes
|
|
File without changes
|
package/dist/jsx/Headings.js
CHANGED
|
File without changes
|
package/dist/jsx/Headings.js.map
CHANGED
|
File without changes
|
package/dist/jsx/Paragraph.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/jsx/SizableText.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/jsx/index.js
CHANGED
|
File without changes
|
package/dist/jsx/index.js.map
CHANGED
|
File without changes
|
package/dist/jsx/types.js
CHANGED
|
File without changes
|
package/dist/jsx/types.js.map
CHANGED
|
File without changes
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
function wrapChildrenInText(TextComponent, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
function wrapChildrenInText(TextComponent, propsIn) {
|
|
3
|
+
const {
|
|
4
|
+
children,
|
|
5
|
+
textProps,
|
|
6
|
+
size,
|
|
7
|
+
noTextWrap,
|
|
8
|
+
color,
|
|
9
|
+
fontFamily,
|
|
10
|
+
fontSize,
|
|
11
|
+
fontWeight,
|
|
12
|
+
letterSpacing,
|
|
13
|
+
textAlign
|
|
14
|
+
} = propsIn;
|
|
14
15
|
if (noTextWrap || !children) {
|
|
15
16
|
return children;
|
|
16
17
|
}
|
|
17
18
|
const allChildren = React.Children.toArray(children);
|
|
18
19
|
const nextChildren = [];
|
|
19
20
|
let lastIsString = false;
|
|
20
|
-
const
|
|
21
|
+
const props = {};
|
|
21
22
|
if (color)
|
|
22
|
-
|
|
23
|
+
props.color = color;
|
|
23
24
|
if (fontFamily)
|
|
24
|
-
|
|
25
|
+
props.fontFamily = fontFamily;
|
|
25
26
|
if (fontSize)
|
|
26
|
-
|
|
27
|
+
props.fontSize = fontSize;
|
|
27
28
|
if (fontWeight)
|
|
28
|
-
|
|
29
|
+
props.fontWeight = fontWeight;
|
|
29
30
|
if (letterSpacing)
|
|
30
|
-
|
|
31
|
+
props.letterSpacing = letterSpacing;
|
|
31
32
|
if (textAlign)
|
|
32
|
-
|
|
33
|
+
props.textAlign = textAlign;
|
|
33
34
|
function concatStringChildren() {
|
|
34
35
|
if (!lastIsString)
|
|
35
36
|
return;
|
|
36
37
|
const index = nextChildren.length - 1;
|
|
37
38
|
const childrenStrings = nextChildren[index];
|
|
38
|
-
nextChildren[index] = <TextComponent key={index} {...
|
|
39
|
+
nextChildren[index] = <TextComponent key={index} {...props} size={size} {...textProps}>{childrenStrings}</TextComponent>;
|
|
39
40
|
}
|
|
40
41
|
for (const child of allChildren) {
|
|
41
42
|
const last = nextChildren[nextChildren.length - 1];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapChildrenInText.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(
|
|
5
|
-
"mappings": "AACA;AASO,
|
|
4
|
+
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(TextComponent: any, propsIn: Props) {\n const {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n } = propsIn\n\n if (noTextWrap || !children) {\n return children\n }\n\n // in the case of using variables, like so:\n // <ListItem>Hello, {name}</ListItem>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n const allChildren = React.Children.toArray(children)\n const nextChildren: any[] = []\n let lastIsString = false\n const props: any = {}\n // to avoid setting undefined\n if (color) props.color = color\n if (fontFamily) props.fontFamily = fontFamily\n if (fontSize) props.fontSize = fontSize\n if (fontWeight) props.fontWeight = fontWeight\n if (letterSpacing) props.letterSpacing = letterSpacing\n if (textAlign) props.textAlign = textAlign\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <TextComponent key={index} {...props} size={size} {...textProps}>\n {childrenStrings}\n </TextComponent>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n return nextChildren\n}\n"],
|
|
5
|
+
"mappings": "AACA;AASO,4BAA4B,eAAoB,SAAgB;AACrE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,QAAM,cAAc,MAAM,SAAS,QAAQ,QAAQ;AACnD,QAAM,eAAsB,CAAC;AAC7B,MAAI,eAAe;AACnB,QAAM,QAAa,CAAC;AAEpB,MAAI;AAAO,UAAM,QAAQ;AACzB,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAU,UAAM,WAAW;AAC/B,MAAI;AAAY,UAAM,aAAa;AACnC,MAAI;AAAe,UAAM,gBAAgB;AACzC,MAAI;AAAW,UAAM,YAAY;AAEjC,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,CAAC,cAAc,KAAK,WAAW,OAAO,MAAM,UAAU,YACnD,gBACH,EAFC;AAAA,EAIL;AAEA,aAAW,SAAS,aAAa;AAC/B,UAAM,OAAO,aAAa,aAAa,SAAS;AAChD,UAAM,WAAW,OAAO,UAAU;AAClC,QAAI,UAAU;AACZ,UAAI,cAAc;AAChB,aAAK,KAAK,KAAK;AAAA,MACjB,OAAO;AACL,qBAAa,KAAK,CAAC,KAAK,CAAC;AAAA,MAC3B;AAAA,IACF,OAAO;AACL,2BAAqB;AACrB,mBAAa,KAAK,KAAK;AAAA,IACzB;AACA,mBAAe;AAAA,EACjB;AACA,uBAAqB;AAErB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/text",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.141",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"test": "vitest --config ../vite-plugin-internal/vite.config.ts --run"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
28
|
-
"@tamagui/helpers-tamagui": "^1.0.1-beta.
|
|
27
|
+
"@tamagui/core": "^1.0.1-beta.141",
|
|
28
|
+
"@tamagui/helpers-tamagui": "^1.0.1-beta.141"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "*",
|
|
32
32
|
"react-dom": "*"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
35
|
+
"@tamagui/build": "^1.0.1-beta.141",
|
|
36
36
|
"react": "*",
|
|
37
37
|
"react-dom": "*",
|
|
38
38
|
"vitest": "^0.20.3"
|
|
@@ -8,9 +8,8 @@ type Props = TextParentStyles & {
|
|
|
8
8
|
size?: SizeTokens
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function wrapChildrenInText(
|
|
12
|
-
|
|
13
|
-
{
|
|
11
|
+
export function wrapChildrenInText(TextComponent: any, propsIn: Props) {
|
|
12
|
+
const {
|
|
14
13
|
children,
|
|
15
14
|
textProps,
|
|
16
15
|
size,
|
|
@@ -21,8 +20,8 @@ export function wrapChildrenInText(
|
|
|
21
20
|
fontWeight,
|
|
22
21
|
letterSpacing,
|
|
23
22
|
textAlign,
|
|
24
|
-
}
|
|
25
|
-
|
|
23
|
+
} = propsIn
|
|
24
|
+
|
|
26
25
|
if (noTextWrap || !children) {
|
|
27
26
|
return children
|
|
28
27
|
}
|
|
@@ -35,21 +34,21 @@ export function wrapChildrenInText(
|
|
|
35
34
|
const allChildren = React.Children.toArray(children)
|
|
36
35
|
const nextChildren: any[] = []
|
|
37
36
|
let lastIsString = false
|
|
38
|
-
const
|
|
37
|
+
const props: any = {}
|
|
39
38
|
// to avoid setting undefined
|
|
40
|
-
if (color)
|
|
41
|
-
if (fontFamily)
|
|
42
|
-
if (fontSize)
|
|
43
|
-
if (fontWeight)
|
|
44
|
-
if (letterSpacing)
|
|
45
|
-
if (textAlign)
|
|
39
|
+
if (color) props.color = color
|
|
40
|
+
if (fontFamily) props.fontFamily = fontFamily
|
|
41
|
+
if (fontSize) props.fontSize = fontSize
|
|
42
|
+
if (fontWeight) props.fontWeight = fontWeight
|
|
43
|
+
if (letterSpacing) props.letterSpacing = letterSpacing
|
|
44
|
+
if (textAlign) props.textAlign = textAlign
|
|
46
45
|
|
|
47
46
|
function concatStringChildren() {
|
|
48
47
|
if (!lastIsString) return
|
|
49
48
|
const index = nextChildren.length - 1
|
|
50
49
|
const childrenStrings = nextChildren[index]
|
|
51
50
|
nextChildren[index] = (
|
|
52
|
-
<TextComponent key={index} {...
|
|
51
|
+
<TextComponent key={index} {...props} size={size} {...textProps}>
|
|
53
52
|
{childrenStrings}
|
|
54
53
|
</TextComponent>
|
|
55
54
|
)
|
|
@@ -5,6 +5,6 @@ declare type Props = TextParentStyles & {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
size?: SizeTokens;
|
|
7
7
|
};
|
|
8
|
-
export declare function wrapChildrenInText(TextComponent: any,
|
|
8
|
+
export declare function wrapChildrenInText(TextComponent: any, propsIn: Props): string | number | boolean | any[] | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null | undefined;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=wrapChildrenInText.d.ts.map
|