@tamagui/text 1.0.1-beta.99 → 1.0.1-rc.0
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 +1 -0
- package/dist/cjs/Headings.js.map +1 -1
- package/dist/cjs/Paragraph.js +1 -0
- package/dist/cjs/Paragraph.js.map +1 -1
- package/dist/cjs/SizableText.js +3 -3
- package/dist/cjs/SizableText.js.map +2 -2
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/wrapChildrenInText.js +35 -44
- package/dist/cjs/wrapChildrenInText.js.map +3 -3
- package/dist/cjs/wrapChildrenInText.test.js +3 -17
- package/dist/cjs/wrapChildrenInText.test.js.map +1 -1
- package/dist/esm/Headings.js +0 -0
- package/dist/esm/Headings.js.map +1 -1
- package/dist/esm/Paragraph.js +0 -0
- package/dist/esm/Paragraph.js.map +1 -1
- package/dist/esm/SizableText.js +3 -4
- package/dist/esm/SizableText.js.map +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/types.js +1 -0
- package/dist/{cjs/Texts.js.map → esm/types.js.map} +0 -0
- package/dist/esm/wrapChildrenInText.js +30 -45
- package/dist/esm/wrapChildrenInText.js.map +2 -2
- package/dist/esm/wrapChildrenInText.test.js +2 -2
- package/dist/esm/wrapChildrenInText.test.js.map +1 -1
- package/dist/jsx/Headings.js +0 -0
- package/dist/jsx/Headings.js.map +1 -1
- package/dist/jsx/Paragraph.js +0 -0
- package/dist/jsx/Paragraph.js.map +1 -1
- package/dist/jsx/SizableText.js +3 -4
- package/dist/jsx/SizableText.js.map +2 -2
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +2 -2
- package/dist/jsx/types.js +1 -0
- package/dist/{esm/Texts.js.map → jsx/types.js.map} +0 -0
- package/dist/jsx/wrapChildrenInText.js +25 -22
- package/dist/jsx/wrapChildrenInText.js.map +2 -2
- package/dist/jsx/wrapChildrenInText.test.js +0 -0
- package/dist/jsx/wrapChildrenInText.test.js.map +1 -1
- package/package.json +13 -10
- package/src/SizableText.tsx +11 -16
- package/src/index.tsx +1 -0
- package/src/types.ts +13 -0
- package/src/wrapChildrenInText.tsx +16 -28
- package/types/Headings.d.ts +689 -447
- package/types/Paragraph.d.ts +17 -15
- package/types/SizableText.d.ts +8 -8
- package/types/index.d.ts +1 -0
- package/types/types.d.ts +12 -0
- package/types/wrapChildrenInText.d.ts +2 -12
- package/types/wrapChildrenInText.test.d.ts +0 -0
- package/dist/cjs/Texts.js +0 -1
- package/dist/esm/Texts.js +0 -1
- package/dist/jsx/Texts.js +0 -1
- package/dist/jsx/Texts.js.map +0 -7
- package/src/Texts.tsx +0 -0
- package/types/Headings.d.ts.map +0 -1
- package/types/Paragraph.d.ts.map +0 -1
- package/types/SizableText.d.ts.map +0 -1
- package/types/Texts.d.ts +0 -1
- package/types/Texts.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/wrapChildrenInText.d.ts.map +0 -1
- package/types/wrapChildrenInText.test.d.ts.map +0 -1
package/dist/cjs/Headings.js
CHANGED
package/dist/cjs/Headings.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Headings.tsx"],
|
|
4
4
|
"sourcesContent": ["import { styled } from '@tamagui/core'\n\nimport { Paragraph } from './Paragraph'\n\nexport const Heading = styled(Paragraph, {\n tag: 'span',\n name: 'Heading',\n accessibilityRole: 'header',\n fontFamily: '$heading',\n size: '$8',\n margin: 0,\n})\n\nexport const H1 = styled(Heading, {\n name: 'H1',\n tag: 'h1',\n size: '$10',\n})\n\nexport const H2 = styled(Heading, {\n name: 'H2',\n tag: 'h2',\n size: '$9',\n})\n\nexport const H3 = styled(Heading, {\n name: 'H3',\n tag: 'h3',\n size: '$8',\n})\n\nexport const H4 = styled(Heading, {\n name: 'H4',\n tag: 'h4',\n size: '$7',\n})\n\nexport const H5 = styled(Heading, {\n name: 'H5',\n tag: 'h5',\n size: '$6',\n})\n\nexport const H6 = styled(Heading, {\n name: 'H6',\n tag: 'h6',\n size: '$5',\n})\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AAEvB,uBAA0B;AAEnB,MAAM,cAAU,oBAAO,4BAAW;AAAA,EACvC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,SAAK,oBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/Paragraph.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Paragraph.tsx"],
|
|
4
4
|
"sourcesContent": ["import { PropTypes, styled } from '@tamagui/core'\n\nimport { SizableText } from './SizableText'\n\nexport const Paragraph = styled(SizableText, {\n name: 'Paragraph',\n tag: 'p',\n selectable: true,\n cursor: 'text',\n})\n\nexport type ParagraphProps = PropTypes<typeof Paragraph>\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAkC;AAElC,yBAA4B;AAErB,MAAM,gBAAY,oBAAO,gCAAa;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,QAAQ;AACV,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/SizableText.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,17 +22,16 @@ __export(SizableText_exports, {
|
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(SizableText_exports);
|
|
23
24
|
var import_core = require("@tamagui/core");
|
|
25
|
+
var import_get_font_sized = require("@tamagui/get-font-sized");
|
|
24
26
|
const SizableText = (0, import_core.styled)(import_core.Text, {
|
|
25
27
|
name: "SizableText",
|
|
26
28
|
fontFamily: "$body",
|
|
27
29
|
variants: {
|
|
28
|
-
size:
|
|
30
|
+
size: import_get_font_sized.getFontSized
|
|
29
31
|
},
|
|
30
32
|
defaultVariants: {
|
|
31
33
|
size: "$4"
|
|
32
34
|
}
|
|
33
|
-
}, {
|
|
34
|
-
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"])
|
|
35
35
|
});
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SizableText.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, Text,
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { GetProps, Text, styled } from '@tamagui/core'\nimport { getFontSized } from '@tamagui/get-font-sized'\n\nexport const SizableText = styled(Text, {\n name: 'SizableText',\n fontFamily: '$body',\n\n variants: {\n size: getFontSized,\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport type SizableTextProps = GetProps<typeof SizableText>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,4BAA6B;AAEtB,MAAM,kBAAc,oBAAO,kBAAM;AAAA,EACtC,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -18,4 +19,5 @@ __reExport(src_exports, require("./SizableText"), module.exports);
|
|
|
18
19
|
__reExport(src_exports, require("./Paragraph"), module.exports);
|
|
19
20
|
__reExport(src_exports, require("./Headings"), module.exports);
|
|
20
21
|
__reExport(src_exports, require("./wrapChildrenInText"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\nexport * from './types'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,wBAAc,wBADd;AAEA,wBAAc,uBAFd;AAGA,wBAAc,iCAHd;AAIA,wBAAc,oBAJd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["import { SizableTextProps } from './SizableText'\n\nexport type TextParentStyles = {\n color?: SizableTextProps['color']\n fontWeight?: SizableTextProps['fontWeight']\n fontSize?: SizableTextProps['fontSize']\n fontFamily?: SizableTextProps['fontFamily']\n letterSpacing?: SizableTextProps['letterSpacing']\n textAlign?: SizableTextProps['textAlign']\n // all the other text controls\n textProps?: Partial<SizableTextProps>\n noTextWrap?: boolean\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
8
|
var __export = (target, all) => {
|
|
25
9
|
for (var name in all)
|
|
26
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -33,55 +17,62 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
17
|
}
|
|
34
18
|
return to;
|
|
35
19
|
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
37
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
25
|
var wrapChildrenInText_exports = {};
|
|
39
26
|
__export(wrapChildrenInText_exports, {
|
|
40
27
|
wrapChildrenInText: () => wrapChildrenInText
|
|
41
28
|
});
|
|
42
29
|
module.exports = __toCommonJS(wrapChildrenInText_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
31
|
var import_react = __toESM(require("react"));
|
|
44
|
-
function wrapChildrenInText(TextComponent, {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
function wrapChildrenInText(TextComponent, propsIn) {
|
|
33
|
+
const {
|
|
34
|
+
children,
|
|
35
|
+
textProps,
|
|
36
|
+
size,
|
|
37
|
+
noTextWrap,
|
|
38
|
+
color,
|
|
39
|
+
fontFamily,
|
|
40
|
+
fontSize,
|
|
41
|
+
fontWeight,
|
|
42
|
+
letterSpacing,
|
|
43
|
+
textAlign
|
|
44
|
+
} = propsIn;
|
|
56
45
|
if (noTextWrap || !children) {
|
|
57
46
|
return children;
|
|
58
47
|
}
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const allChildren = import_react.default.Children.toArray(children);
|
|
49
|
+
const nextChildren = [];
|
|
61
50
|
let lastIsString = false;
|
|
62
|
-
const
|
|
51
|
+
const props = {};
|
|
63
52
|
if (color)
|
|
64
|
-
|
|
53
|
+
props.color = color;
|
|
65
54
|
if (fontFamily)
|
|
66
|
-
|
|
55
|
+
props.fontFamily = fontFamily;
|
|
67
56
|
if (fontSize)
|
|
68
|
-
|
|
57
|
+
props.fontSize = fontSize;
|
|
69
58
|
if (fontWeight)
|
|
70
|
-
|
|
59
|
+
props.fontWeight = fontWeight;
|
|
71
60
|
if (letterSpacing)
|
|
72
|
-
|
|
61
|
+
props.letterSpacing = letterSpacing;
|
|
73
62
|
if (textAlign)
|
|
74
|
-
|
|
63
|
+
props.textAlign = textAlign;
|
|
64
|
+
if (size)
|
|
65
|
+
props.size = size;
|
|
75
66
|
function concatStringChildren() {
|
|
76
67
|
if (!lastIsString)
|
|
77
68
|
return;
|
|
78
69
|
const index = nextChildren.length - 1;
|
|
79
70
|
const childrenStrings = nextChildren[index];
|
|
80
|
-
nextChildren[index] = /* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
71
|
+
nextChildren[index] = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextComponent, {
|
|
72
|
+
...props,
|
|
73
|
+
...textProps,
|
|
74
|
+
children: childrenStrings
|
|
75
|
+
}, index);
|
|
85
76
|
}
|
|
86
77
|
for (const child of allChildren) {
|
|
87
78
|
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 {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
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 if (size) props.size = size\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} {...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;AAmDM;AAlDN,mBAAkB;AASX,SAAS,mBAAmB,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,EACF,IAAI;AAEJ,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,QAAM,cAAc,aAAAA,QAAM,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;AACjC,MAAI;AAAM,UAAM,OAAO;AAEvB,WAAS,uBAAuB;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,4CAAC;AAAA,MAA2B,GAAG;AAAA,MAAQ,GAAG;AAAA,MACvC;AAAA,OADiB,KAEpB;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
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
}
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
16
|
-
var import_react = __toESM(require("react"));
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
17
3
|
var import_vitest = require("vitest");
|
|
18
4
|
var import_wrapChildrenInText = require("./wrapChildrenInText");
|
|
19
5
|
const Comp = () => {
|
|
20
6
|
};
|
|
21
|
-
const re = /* @__PURE__ */
|
|
7
|
+
const re = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
22
8
|
"data-id": Math.random()
|
|
23
9
|
});
|
|
24
10
|
const reID = re.props["data-id"];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapChildrenInText.test.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\nimport { expect, test } from 'vitest'\n\nimport { wrapChildrenInText } from './wrapChildrenInText'\n\nconst Comp = () => {}\nconst re = <div data-id={Math.random()} />\nconst reID = re.props['data-id']\n\ntest('should wrap all string children, not wrap others', () => {\n const out = wrapChildrenInText(Comp, {\n children: [re, 'a', 'b', re, 'c', re, 'd'],\n }) as any\n\n expect(out[0].props['data-id']).toBe(reID)\n\n expect(out[1].type).toBe(Comp)\n expect(out[1].props.children).toStrictEqual(['a', 'b'])\n\n expect(out[2].props['data-id']).toBe(reID)\n\n expect(out[3].type).toBe(Comp)\n expect(out[3].props.children).toStrictEqual(['c'])\n\n expect(out[4].props['data-id']).toBe(reID)\n\n expect(out[5].type).toBe(Comp)\n expect(out[5].props.children).toStrictEqual(['d'])\n})\n\ntest('should first child string', () => {\n const out = wrapChildrenInText(Comp, {\n children: ['a', re],\n }) as any\n\n expect(out[0].type).toBe(Comp)\n expect(out[0].props.children).toStrictEqual(['a'])\n\n expect(out[1].props['data-id']).toBe(reID)\n})\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAMW;AALX,oBAA6B;AAE7B,gCAAmC;AAEnC,MAAM,OAAO,MAAM;AAAC;AACpB,MAAM,KAAK,4CAAC;AAAA,EAAI,WAAS,KAAK,OAAO;AAAA,CAAG;AACxC,MAAM,OAAO,GAAG,MAAM;AAAA,IAEtB,oBAAK,oDAAoD,MAAM;AAC7D,QAAM,UAAM,8CAAmB,MAAM;AAAA,IACnC,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,GAAG;AAAA,EAC3C,CAAC;AAED,4BAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,4BAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,4BAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,KAAK,GAAG,CAAC;AAEtD,4BAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,4BAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,4BAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AAEjD,4BAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,4BAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,4BAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AACnD,CAAC;AAAA,IAED,oBAAK,6BAA6B,MAAM;AACtC,QAAM,UAAM,8CAAmB,MAAM;AAAA,IACnC,UAAU,CAAC,KAAK,EAAE;AAAA,EACpB,CAAC;AAED,4BAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,4BAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AAEjD,4BAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAC3C,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Headings.js
CHANGED
|
File without changes
|
package/dist/esm/Headings.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Headings.tsx"],
|
|
4
4
|
"sourcesContent": ["import { styled } from '@tamagui/core'\n\nimport { Paragraph } from './Paragraph'\n\nexport const Heading = styled(Paragraph, {\n tag: 'span',\n name: 'Heading',\n accessibilityRole: 'header',\n fontFamily: '$heading',\n size: '$8',\n margin: 0,\n})\n\nexport const H1 = styled(Heading, {\n name: 'H1',\n tag: 'h1',\n size: '$10',\n})\n\nexport const H2 = styled(Heading, {\n name: 'H2',\n tag: 'h2',\n size: '$9',\n})\n\nexport const H3 = styled(Heading, {\n name: 'H3',\n tag: 'h3',\n size: '$8',\n})\n\nexport const H4 = styled(Heading, {\n name: 'H4',\n tag: 'h4',\n size: '$7',\n})\n\nexport const H5 = styled(Heading, {\n name: 'H5',\n tag: 'h5',\n size: '$6',\n})\n\nexport const H6 = styled(Heading, {\n name: 'H6',\n tag: 'h6',\n size: '$5',\n})\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAEnB,MAAM,UAAU,OAAO,WAAW;AAAA,EACvC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Paragraph.js
CHANGED
|
File without changes
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Paragraph.tsx"],
|
|
4
4
|
"sourcesContent": ["import { PropTypes, styled } from '@tamagui/core'\n\nimport { SizableText } from './SizableText'\n\nexport const Paragraph = styled(SizableText, {\n name: 'Paragraph',\n tag: 'p',\n selectable: true,\n cursor: 'text',\n})\n\nexport type ParagraphProps = PropTypes<typeof Paragraph>\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAoB,cAAc;AAElC,SAAS,mBAAmB;AAErB,MAAM,YAAY,OAAO,aAAa;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,QAAQ;AACV,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/SizableText.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Text,
|
|
1
|
+
import { Text, styled } from "@tamagui/core";
|
|
2
|
+
import { getFontSized } from "@tamagui/get-font-sized";
|
|
2
3
|
const SizableText = styled(Text, {
|
|
3
4
|
name: "SizableText",
|
|
4
5
|
fontFamily: "$body",
|
|
5
6
|
variants: {
|
|
6
|
-
size:
|
|
7
|
+
size: getFontSized
|
|
7
8
|
},
|
|
8
9
|
defaultVariants: {
|
|
9
10
|
size: "$4"
|
|
10
11
|
}
|
|
11
|
-
}, {
|
|
12
|
-
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"])
|
|
13
12
|
});
|
|
14
13
|
export {
|
|
15
14
|
SizableText
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SizableText.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, Text,
|
|
5
|
-
"mappings": "AAAA;
|
|
4
|
+
"sourcesContent": ["import { GetProps, Text, styled } from '@tamagui/core'\nimport { getFontSized } from '@tamagui/get-font-sized'\n\nexport const SizableText = styled(Text, {\n name: 'SizableText',\n fontFamily: '$body',\n\n variants: {\n size: getFontSized,\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport type SizableTextProps = GetProps<typeof SizableText>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,MAAM,cAAc;AACvC,SAAS,oBAAoB;AAEtB,MAAM,cAAc,OAAO,MAAM;AAAA,EACtC,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
4
|
+
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\nexport * from './types'\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
File without changes
|
|
@@ -1,64 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
2
|
import React from "react";
|
|
21
|
-
function wrapChildrenInText(TextComponent, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
function wrapChildrenInText(TextComponent, propsIn) {
|
|
4
|
+
const {
|
|
5
|
+
children,
|
|
6
|
+
textProps,
|
|
7
|
+
size,
|
|
8
|
+
noTextWrap,
|
|
9
|
+
color,
|
|
10
|
+
fontFamily,
|
|
11
|
+
fontSize,
|
|
12
|
+
fontWeight,
|
|
13
|
+
letterSpacing,
|
|
14
|
+
textAlign
|
|
15
|
+
} = propsIn;
|
|
33
16
|
if (noTextWrap || !children) {
|
|
34
17
|
return children;
|
|
35
18
|
}
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
const allChildren = React.Children.toArray(children);
|
|
20
|
+
const nextChildren = [];
|
|
38
21
|
let lastIsString = false;
|
|
39
|
-
const
|
|
22
|
+
const props = {};
|
|
40
23
|
if (color)
|
|
41
|
-
|
|
24
|
+
props.color = color;
|
|
42
25
|
if (fontFamily)
|
|
43
|
-
|
|
26
|
+
props.fontFamily = fontFamily;
|
|
44
27
|
if (fontSize)
|
|
45
|
-
|
|
28
|
+
props.fontSize = fontSize;
|
|
46
29
|
if (fontWeight)
|
|
47
|
-
|
|
30
|
+
props.fontWeight = fontWeight;
|
|
48
31
|
if (letterSpacing)
|
|
49
|
-
|
|
32
|
+
props.letterSpacing = letterSpacing;
|
|
50
33
|
if (textAlign)
|
|
51
|
-
|
|
34
|
+
props.textAlign = textAlign;
|
|
35
|
+
if (size)
|
|
36
|
+
props.size = size;
|
|
52
37
|
function concatStringChildren() {
|
|
53
38
|
if (!lastIsString)
|
|
54
39
|
return;
|
|
55
40
|
const index = nextChildren.length - 1;
|
|
56
41
|
const childrenStrings = nextChildren[index];
|
|
57
|
-
nextChildren[index] = /* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
42
|
+
nextChildren[index] = /* @__PURE__ */ jsx(TextComponent, {
|
|
43
|
+
...props,
|
|
44
|
+
...textProps,
|
|
45
|
+
children: childrenStrings
|
|
46
|
+
}, index);
|
|
62
47
|
}
|
|
63
48
|
for (const child of allChildren) {
|
|
64
49
|
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 {
|
|
5
|
-
"mappings": "
|
|
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 if (size) props.size = size\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} {...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": "AAmDM;AAlDN,OAAO,WAAW;AASX,SAAS,mBAAmB,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,EACF,IAAI;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;AACjC,MAAI;AAAM,UAAM,OAAO;AAEvB,WAAS,uBAAuB;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,oBAAC;AAAA,MAA2B,GAAG;AAAA,MAAQ,GAAG;AAAA,MACvC;AAAA,OADiB,KAEpB;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
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { expect, test } from "vitest";
|
|
3
3
|
import { wrapChildrenInText } from "./wrapChildrenInText";
|
|
4
4
|
const Comp = () => {
|
|
5
5
|
};
|
|
6
|
-
const re = /* @__PURE__ */
|
|
6
|
+
const re = /* @__PURE__ */ jsx("div", {
|
|
7
7
|
"data-id": Math.random()
|
|
8
8
|
});
|
|
9
9
|
const reID = re.props["data-id"];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapChildrenInText.test.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\nimport { expect, test } from 'vitest'\n\nimport { wrapChildrenInText } from './wrapChildrenInText'\n\nconst Comp = () => {}\nconst re = <div data-id={Math.random()} />\nconst reID = re.props['data-id']\n\ntest('should wrap all string children, not wrap others', () => {\n const out = wrapChildrenInText(Comp, {\n children: [re, 'a', 'b', re, 'c', re, 'd'],\n }) as any\n\n expect(out[0].props['data-id']).toBe(reID)\n\n expect(out[1].type).toBe(Comp)\n expect(out[1].props.children).toStrictEqual(['a', 'b'])\n\n expect(out[2].props['data-id']).toBe(reID)\n\n expect(out[3].type).toBe(Comp)\n expect(out[3].props.children).toStrictEqual(['c'])\n\n expect(out[4].props['data-id']).toBe(reID)\n\n expect(out[5].type).toBe(Comp)\n expect(out[5].props.children).toStrictEqual(['d'])\n})\n\ntest('should first child string', () => {\n const out = wrapChildrenInText(Comp, {\n children: ['a', re],\n }) as any\n\n expect(out[0].type).toBe(Comp)\n expect(out[0].props.children).toStrictEqual(['a'])\n\n expect(out[1].props['data-id']).toBe(reID)\n})\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAMW;AALX,SAAS,QAAQ,YAAY;AAE7B,SAAS,0BAA0B;AAEnC,MAAM,OAAO,MAAM;AAAC;AACpB,MAAM,KAAK,oBAAC;AAAA,EAAI,WAAS,KAAK,OAAO;AAAA,CAAG;AACxC,MAAM,OAAO,GAAG,MAAM;AAEtB,KAAK,oDAAoD,MAAM;AAC7D,QAAM,MAAM,mBAAmB,MAAM;AAAA,IACnC,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,GAAG;AAAA,EAC3C,CAAC;AAED,SAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,SAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,SAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,KAAK,GAAG,CAAC;AAEtD,SAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,SAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,SAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AAEjD,SAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAEzC,SAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,SAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AACnD,CAAC;AAED,KAAK,6BAA6B,MAAM;AACtC,QAAM,MAAM,mBAAmB,MAAM;AAAA,IACnC,UAAU,CAAC,KAAK,EAAE;AAAA,EACpB,CAAC;AAED,SAAO,IAAI,GAAG,IAAI,EAAE,KAAK,IAAI;AAC7B,SAAO,IAAI,GAAG,MAAM,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC;AAEjD,SAAO,IAAI,GAAG,MAAM,UAAU,EAAE,KAAK,IAAI;AAC3C,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Headings.js
CHANGED
|
File without changes
|
package/dist/jsx/Headings.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Headings.tsx"],
|
|
4
4
|
"sourcesContent": ["import { styled } from '@tamagui/core'\n\nimport { Paragraph } from './Paragraph'\n\nexport const Heading = styled(Paragraph, {\n tag: 'span',\n name: 'Heading',\n accessibilityRole: 'header',\n fontFamily: '$heading',\n size: '$8',\n margin: 0,\n})\n\nexport const H1 = styled(Heading, {\n name: 'H1',\n tag: 'h1',\n size: '$10',\n})\n\nexport const H2 = styled(Heading, {\n name: 'H2',\n tag: 'h2',\n size: '$9',\n})\n\nexport const H3 = styled(Heading, {\n name: 'H3',\n tag: 'h3',\n size: '$8',\n})\n\nexport const H4 = styled(Heading, {\n name: 'H4',\n tag: 'h4',\n size: '$7',\n})\n\nexport const H5 = styled(Heading, {\n name: 'H5',\n tag: 'h5',\n size: '$6',\n})\n\nexport const H6 = styled(Heading, {\n name: 'H6',\n tag: 'h6',\n size: '$5',\n})\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAEnB,MAAM,UAAU,OAAO,WAAW;AAAA,EACvC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,OAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Paragraph.js
CHANGED
|
File without changes
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Paragraph.tsx"],
|
|
4
4
|
"sourcesContent": ["import { PropTypes, styled } from '@tamagui/core'\n\nimport { SizableText } from './SizableText'\n\nexport const Paragraph = styled(SizableText, {\n name: 'Paragraph',\n tag: 'p',\n selectable: true,\n cursor: 'text',\n})\n\nexport type ParagraphProps = PropTypes<typeof Paragraph>\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAoB,cAAc;AAElC,SAAS,mBAAmB;AAErB,MAAM,YAAY,OAAO,aAAa;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,QAAQ;AACV,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/SizableText.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Text,
|
|
1
|
+
import { Text, styled } from "@tamagui/core";
|
|
2
|
+
import { getFontSized } from "@tamagui/get-font-sized";
|
|
2
3
|
const SizableText = styled(Text, {
|
|
3
4
|
name: "SizableText",
|
|
4
5
|
fontFamily: "$body",
|
|
5
6
|
variants: {
|
|
6
|
-
size:
|
|
7
|
+
size: getFontSized
|
|
7
8
|
},
|
|
8
9
|
defaultVariants: {
|
|
9
10
|
size: "$4"
|
|
10
11
|
}
|
|
11
|
-
}, {
|
|
12
|
-
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"])
|
|
13
12
|
});
|
|
14
13
|
export {
|
|
15
14
|
SizableText
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SizableText.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, Text,
|
|
5
|
-
"mappings": "AAAA;
|
|
4
|
+
"sourcesContent": ["import { GetProps, Text, styled } from '@tamagui/core'\nimport { getFontSized } from '@tamagui/get-font-sized'\n\nexport const SizableText = styled(Text, {\n name: 'SizableText',\n fontFamily: '$body',\n\n variants: {\n size: getFontSized,\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport type SizableTextProps = GetProps<typeof SizableText>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,MAAM,cAAc;AACvC,SAAS,oBAAoB;AAEtB,MAAM,cAAc,OAAO,MAAM;AAAA,EACtC,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|