@tamagui/text 1.0.0-beta.7 → 1.0.1-beta.100
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 +79 -0
- package/dist/cjs/Headings.js.map +7 -0
- package/dist/cjs/SizableText.js +3 -1
- 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/wrapChildrenInText.js +108 -0
- package/dist/cjs/wrapChildrenInText.js.map +7 -0
- package/dist/cjs/wrapChildrenInText.test.js +47 -0
- package/dist/cjs/wrapChildrenInText.test.js.map +7 -0
- package/dist/esm/Headings.js +50 -0
- package/dist/esm/Headings.js.map +7 -0
- package/dist/esm/SizableText.js +4 -2
- package/dist/esm/SizableText.js.map +2 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/wrapChildrenInText.js +84 -0
- package/dist/esm/wrapChildrenInText.js.map +7 -0
- package/dist/esm/wrapChildrenInText.test.js +32 -0
- package/dist/esm/wrapChildrenInText.test.js.map +7 -0
- package/dist/jsx/Headings.js +50 -0
- package/dist/jsx/Headings.js.map +7 -0
- package/dist/jsx/Paragraph.js +1 -0
- package/dist/jsx/Paragraph.js.map +7 -0
- package/dist/jsx/SizableText.js +5 -2
- package/dist/jsx/SizableText.js.map +7 -0
- package/dist/jsx/Texts.js +1 -0
- package/dist/jsx/Texts.js.map +7 -0
- package/dist/jsx/index.js +3 -0
- package/dist/jsx/index.js.map +7 -0
- package/dist/jsx/wrapChildrenInText.js +61 -0
- package/dist/jsx/wrapChildrenInText.js.map +7 -0
- package/dist/jsx/wrapChildrenInText.test.js +29 -0
- package/dist/jsx/wrapChildrenInText.test.js.map +7 -0
- package/package.json +15 -7
- package/src/Headings.tsx +48 -0
- package/src/Paragraph.tsx +12 -0
- package/src/SizableText.tsx +22 -0
- package/src/Texts.tsx +0 -0
- package/src/index.tsx +4 -0
- package/src/wrapChildrenInText.test.tsx +40 -0
- package/src/wrapChildrenInText.tsx +88 -0
- package/types/Headings.d.ts +1210 -0
- package/types/Headings.d.ts.map +1 -0
- package/types/Paragraph.d.ts +0 -0
- package/types/Paragraph.d.ts.map +0 -0
- package/types/SizableText.d.ts +0 -0
- package/types/SizableText.d.ts.map +1 -1
- package/types/Texts.d.ts +0 -0
- package/types/Texts.d.ts.map +0 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/wrapChildrenInText.d.ts +20 -0
- package/types/wrapChildrenInText.d.ts.map +1 -0
- package/types/wrapChildrenInText.test.d.ts +2 -0
- package/types/wrapChildrenInText.test.d.ts.map +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var Headings_exports = {};
|
|
19
|
+
__export(Headings_exports, {
|
|
20
|
+
H1: () => H1,
|
|
21
|
+
H2: () => H2,
|
|
22
|
+
H3: () => H3,
|
|
23
|
+
H4: () => H4,
|
|
24
|
+
H5: () => H5,
|
|
25
|
+
H6: () => H6,
|
|
26
|
+
Heading: () => Heading
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(Headings_exports);
|
|
29
|
+
var import_core = require("@tamagui/core");
|
|
30
|
+
var import_Paragraph = require("./Paragraph");
|
|
31
|
+
const Heading = (0, import_core.styled)(import_Paragraph.Paragraph, {
|
|
32
|
+
tag: "span",
|
|
33
|
+
name: "Heading",
|
|
34
|
+
accessibilityRole: "header",
|
|
35
|
+
fontFamily: "$heading",
|
|
36
|
+
size: "$8",
|
|
37
|
+
margin: 0
|
|
38
|
+
});
|
|
39
|
+
const H1 = (0, import_core.styled)(Heading, {
|
|
40
|
+
name: "H1",
|
|
41
|
+
tag: "h1",
|
|
42
|
+
size: "$10"
|
|
43
|
+
});
|
|
44
|
+
const H2 = (0, import_core.styled)(Heading, {
|
|
45
|
+
name: "H2",
|
|
46
|
+
tag: "h2",
|
|
47
|
+
size: "$9"
|
|
48
|
+
});
|
|
49
|
+
const H3 = (0, import_core.styled)(Heading, {
|
|
50
|
+
name: "H3",
|
|
51
|
+
tag: "h3",
|
|
52
|
+
size: "$8"
|
|
53
|
+
});
|
|
54
|
+
const H4 = (0, import_core.styled)(Heading, {
|
|
55
|
+
name: "H4",
|
|
56
|
+
tag: "h4",
|
|
57
|
+
size: "$7"
|
|
58
|
+
});
|
|
59
|
+
const H5 = (0, import_core.styled)(Heading, {
|
|
60
|
+
name: "H5",
|
|
61
|
+
tag: "h5",
|
|
62
|
+
size: "$6"
|
|
63
|
+
});
|
|
64
|
+
const H6 = (0, import_core.styled)(Heading, {
|
|
65
|
+
name: "H6",
|
|
66
|
+
tag: "h6",
|
|
67
|
+
size: "$5"
|
|
68
|
+
});
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
H1,
|
|
72
|
+
H2,
|
|
73
|
+
H3,
|
|
74
|
+
H4,
|
|
75
|
+
H5,
|
|
76
|
+
H6,
|
|
77
|
+
Heading
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=Headings.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Headings.tsx"],
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AAEvB,uBAA0B;AAEnB,MAAM,UAAU,wBAAO,4BAAW;AAAA,EACvC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;AAEM,MAAM,KAAK,wBAAO,SAAS;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/SizableText.js
CHANGED
|
@@ -25,11 +25,13 @@ const SizableText = (0, import_core.styled)(import_core.Text, {
|
|
|
25
25
|
name: "SizableText",
|
|
26
26
|
fontFamily: "$body",
|
|
27
27
|
variants: {
|
|
28
|
-
size: import_core.
|
|
28
|
+
size: import_core.getFont
|
|
29
29
|
},
|
|
30
30
|
defaultVariants: {
|
|
31
31
|
size: "$4"
|
|
32
32
|
}
|
|
33
|
+
}, {
|
|
34
|
+
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"])
|
|
33
35
|
});
|
|
34
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { GetProps, Text, getFont, styled } from '@tamagui/core'\n\nexport const SizableText = styled(\n Text,\n {\n name: 'SizableText',\n fontFamily: '$body',\n\n variants: {\n size: getFont,\n },\n\n defaultVariants: {\n size: '$4',\n },\n },\n {\n inlineWhenUnflattened: new Set(['fontFamily']),\n }\n)\n\nexport type SizableTextProps = GetProps<typeof SizableText>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,cAAc,wBACzB,kBACA;AAAA,EACE,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,GACA;AAAA,EACE,uBAAuB,oBAAI,IAAI,CAAC,YAAY,CAAC;AAC/C,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,4 +16,6 @@ var src_exports = {};
|
|
|
16
16
|
module.exports = __toCommonJS(src_exports);
|
|
17
17
|
__reExport(src_exports, require("./SizableText"), module.exports);
|
|
18
18
|
__reExport(src_exports, require("./Paragraph"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./Headings"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./wrapChildrenInText"), module.exports);
|
|
19
21
|
//# 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'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,wBAAc,wBADd;",
|
|
4
|
+
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,wBAAc,wBADd;AAEA,wBAAc,uBAFd;AAGA,wBAAc,iCAHd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
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
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
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));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var wrapChildrenInText_exports = {};
|
|
39
|
+
__export(wrapChildrenInText_exports, {
|
|
40
|
+
wrapChildrenInText: () => wrapChildrenInText
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(wrapChildrenInText_exports);
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
function wrapChildrenInText(TextComponent, {
|
|
45
|
+
children,
|
|
46
|
+
textProps,
|
|
47
|
+
size,
|
|
48
|
+
noTextWrap,
|
|
49
|
+
color,
|
|
50
|
+
fontFamily,
|
|
51
|
+
fontSize,
|
|
52
|
+
fontWeight,
|
|
53
|
+
letterSpacing,
|
|
54
|
+
textAlign
|
|
55
|
+
}) {
|
|
56
|
+
if (noTextWrap || !children) {
|
|
57
|
+
return children;
|
|
58
|
+
}
|
|
59
|
+
let allChildren = import_react.default.Children.toArray(children);
|
|
60
|
+
let nextChildren = [];
|
|
61
|
+
let lastIsString = false;
|
|
62
|
+
const directTextProps = {};
|
|
63
|
+
if (color)
|
|
64
|
+
directTextProps.color = color;
|
|
65
|
+
if (fontFamily)
|
|
66
|
+
directTextProps.fontFamily = fontFamily;
|
|
67
|
+
if (fontSize)
|
|
68
|
+
directTextProps.fontSize = fontSize;
|
|
69
|
+
if (fontWeight)
|
|
70
|
+
directTextProps.fontWeight = fontWeight;
|
|
71
|
+
if (letterSpacing)
|
|
72
|
+
directTextProps.letterSpacing = letterSpacing;
|
|
73
|
+
if (textAlign)
|
|
74
|
+
directTextProps.textAlign = textAlign;
|
|
75
|
+
function concatStringChildren() {
|
|
76
|
+
if (!lastIsString)
|
|
77
|
+
return;
|
|
78
|
+
const index = nextChildren.length - 1;
|
|
79
|
+
const childrenStrings = nextChildren[index];
|
|
80
|
+
nextChildren[index] = /* @__PURE__ */ import_react.default.createElement(TextComponent, __spreadValues(__spreadProps(__spreadValues({
|
|
81
|
+
key: index
|
|
82
|
+
}, directTextProps), {
|
|
83
|
+
size
|
|
84
|
+
}), textProps), childrenStrings);
|
|
85
|
+
}
|
|
86
|
+
for (const child of allChildren) {
|
|
87
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
88
|
+
const isString = typeof child === "string";
|
|
89
|
+
if (isString) {
|
|
90
|
+
if (lastIsString) {
|
|
91
|
+
last.push(child);
|
|
92
|
+
} else {
|
|
93
|
+
nextChildren.push([child]);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
concatStringChildren();
|
|
97
|
+
nextChildren.push(child);
|
|
98
|
+
}
|
|
99
|
+
lastIsString = isString;
|
|
100
|
+
}
|
|
101
|
+
concatStringChildren();
|
|
102
|
+
return nextChildren;
|
|
103
|
+
}
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
wrapChildrenInText
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=wrapChildrenInText.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wrapChildrenInText.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { 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\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(\n TextComponent: any,\n {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n }: Props\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 let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n const directTextProps: any = {}\n // to avoid setting undefined\n if (color) directTextProps.color = color\n if (fontFamily) directTextProps.fontFamily = fontFamily\n if (fontSize) directTextProps.fontSize = fontSize\n if (fontWeight) directTextProps.fontWeight = fontWeight\n if (letterSpacing) directTextProps.letterSpacing = letterSpacing\n if (textAlign) directTextProps.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} {...directTextProps} 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;AAqBX,4BACL,eACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAEF;AACA,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,MAAI,cAAc,qBAAM,SAAS,QAAQ,QAAQ;AACjD,MAAI,eAAsB,CAAC;AAC3B,MAAI,eAAe;AACnB,QAAM,kBAAuB,CAAC;AAE9B,MAAI;AAAO,oBAAgB,QAAQ;AACnC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAU,oBAAgB,WAAW;AACzC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAe,oBAAgB,gBAAgB;AACnD,MAAI;AAAW,oBAAgB,YAAY;AAE3C,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,mDAAC;AAAA,MAAc,KAAK;AAAA,OAAW,kBAA9B;AAAA,MAA+C;AAAA,QAAgB,YAC7D,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
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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"));
|
|
17
|
+
var import_vitest = require("vitest");
|
|
18
|
+
var import_wrapChildrenInText = require("./wrapChildrenInText");
|
|
19
|
+
const Comp = () => {
|
|
20
|
+
};
|
|
21
|
+
const re = /* @__PURE__ */ import_react.default.createElement("div", {
|
|
22
|
+
"data-id": Math.random()
|
|
23
|
+
});
|
|
24
|
+
const reID = re.props["data-id"];
|
|
25
|
+
(0, import_vitest.test)("should wrap all string children, not wrap others", () => {
|
|
26
|
+
const out = (0, import_wrapChildrenInText.wrapChildrenInText)(Comp, {
|
|
27
|
+
children: [re, "a", "b", re, "c", re, "d"]
|
|
28
|
+
});
|
|
29
|
+
(0, import_vitest.expect)(out[0].props["data-id"]).toBe(reID);
|
|
30
|
+
(0, import_vitest.expect)(out[1].type).toBe(Comp);
|
|
31
|
+
(0, import_vitest.expect)(out[1].props.children).toStrictEqual(["a", "b"]);
|
|
32
|
+
(0, import_vitest.expect)(out[2].props["data-id"]).toBe(reID);
|
|
33
|
+
(0, import_vitest.expect)(out[3].type).toBe(Comp);
|
|
34
|
+
(0, import_vitest.expect)(out[3].props.children).toStrictEqual(["c"]);
|
|
35
|
+
(0, import_vitest.expect)(out[4].props["data-id"]).toBe(reID);
|
|
36
|
+
(0, import_vitest.expect)(out[5].type).toBe(Comp);
|
|
37
|
+
(0, import_vitest.expect)(out[5].props.children).toStrictEqual(["d"]);
|
|
38
|
+
});
|
|
39
|
+
(0, import_vitest.test)("should first child string", () => {
|
|
40
|
+
const out = (0, import_wrapChildrenInText.wrapChildrenInText)(Comp, {
|
|
41
|
+
children: ["a", re]
|
|
42
|
+
});
|
|
43
|
+
(0, import_vitest.expect)(out[0].type).toBe(Comp);
|
|
44
|
+
(0, import_vitest.expect)(out[0].props.children).toStrictEqual(["a"]);
|
|
45
|
+
(0, import_vitest.expect)(out[1].props["data-id"]).toBe(reID);
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=wrapChildrenInText.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wrapChildrenInText.test.tsx"],
|
|
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": ";;;;;;;;;;;;;;;AAAA,mBAAkB;AAClB,oBAA6B;AAE7B,gCAAmC;AAEnC,MAAM,OAAO,MAAM;AAAC;AACpB,MAAM,KAAK,mDAAC;AAAA,EAAI,WAAS,KAAK,OAAO;AAAA,CAAG;AACxC,MAAM,OAAO,GAAG,MAAM;AAEtB,wBAAK,oDAAoD,MAAM;AAC7D,QAAM,MAAM,kDAAmB,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;AAED,wBAAK,6BAA6B,MAAM;AACtC,QAAM,MAAM,kDAAmB,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
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { styled } from "@tamagui/core";
|
|
2
|
+
import { Paragraph } from "./Paragraph";
|
|
3
|
+
const Heading = styled(Paragraph, {
|
|
4
|
+
tag: "span",
|
|
5
|
+
name: "Heading",
|
|
6
|
+
accessibilityRole: "header",
|
|
7
|
+
fontFamily: "$heading",
|
|
8
|
+
size: "$8",
|
|
9
|
+
margin: 0
|
|
10
|
+
});
|
|
11
|
+
const H1 = styled(Heading, {
|
|
12
|
+
name: "H1",
|
|
13
|
+
tag: "h1",
|
|
14
|
+
size: "$10"
|
|
15
|
+
});
|
|
16
|
+
const H2 = styled(Heading, {
|
|
17
|
+
name: "H2",
|
|
18
|
+
tag: "h2",
|
|
19
|
+
size: "$9"
|
|
20
|
+
});
|
|
21
|
+
const H3 = styled(Heading, {
|
|
22
|
+
name: "H3",
|
|
23
|
+
tag: "h3",
|
|
24
|
+
size: "$8"
|
|
25
|
+
});
|
|
26
|
+
const H4 = styled(Heading, {
|
|
27
|
+
name: "H4",
|
|
28
|
+
tag: "h4",
|
|
29
|
+
size: "$7"
|
|
30
|
+
});
|
|
31
|
+
const H5 = styled(Heading, {
|
|
32
|
+
name: "H5",
|
|
33
|
+
tag: "h5",
|
|
34
|
+
size: "$6"
|
|
35
|
+
});
|
|
36
|
+
const H6 = styled(Heading, {
|
|
37
|
+
name: "H6",
|
|
38
|
+
tag: "h6",
|
|
39
|
+
size: "$5"
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
H1,
|
|
43
|
+
H2,
|
|
44
|
+
H3,
|
|
45
|
+
H4,
|
|
46
|
+
H5,
|
|
47
|
+
H6,
|
|
48
|
+
Heading
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=Headings.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Headings.tsx"],
|
|
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;AAEA;AAEO,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
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/SizableText.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { Text,
|
|
1
|
+
import { Text, getFont, styled } from "@tamagui/core";
|
|
2
2
|
const SizableText = styled(Text, {
|
|
3
3
|
name: "SizableText",
|
|
4
4
|
fontFamily: "$body",
|
|
5
5
|
variants: {
|
|
6
|
-
size:
|
|
6
|
+
size: getFont
|
|
7
7
|
},
|
|
8
8
|
defaultVariants: {
|
|
9
9
|
size: "$4"
|
|
10
10
|
}
|
|
11
|
+
}, {
|
|
12
|
+
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"])
|
|
11
13
|
});
|
|
12
14
|
export {
|
|
13
15
|
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;AAEO,MAAM,cAAc,
|
|
4
|
+
"sourcesContent": ["import { GetProps, Text, getFont, styled } from '@tamagui/core'\n\nexport const SizableText = styled(\n Text,\n {\n name: 'SizableText',\n fontFamily: '$body',\n\n variants: {\n size: getFont,\n },\n\n defaultVariants: {\n size: '$4',\n },\n },\n {\n inlineWhenUnflattened: new Set(['fontFamily']),\n }\n)\n\nexport type SizableTextProps = GetProps<typeof SizableText>\n"],
|
|
5
|
+
"mappings": "AAAA;AAEO,MAAM,cAAc,OACzB,MACA;AAAA,EACE,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,GACA;AAAA,EACE,uBAAuB,oBAAI,IAAI,CAAC,YAAY,CAAC;AAC/C,CACF;",
|
|
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'\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;",
|
|
4
|
+
"sourcesContent": ["export * from './SizableText'\nexport * from './Paragraph'\nexport * from './Headings'\nexport * from './wrapChildrenInText'\n"],
|
|
5
|
+
"mappings": "AAAA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
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));
|
|
20
|
+
import React from "react";
|
|
21
|
+
function wrapChildrenInText(TextComponent, {
|
|
22
|
+
children,
|
|
23
|
+
textProps,
|
|
24
|
+
size,
|
|
25
|
+
noTextWrap,
|
|
26
|
+
color,
|
|
27
|
+
fontFamily,
|
|
28
|
+
fontSize,
|
|
29
|
+
fontWeight,
|
|
30
|
+
letterSpacing,
|
|
31
|
+
textAlign
|
|
32
|
+
}) {
|
|
33
|
+
if (noTextWrap || !children) {
|
|
34
|
+
return children;
|
|
35
|
+
}
|
|
36
|
+
let allChildren = React.Children.toArray(children);
|
|
37
|
+
let nextChildren = [];
|
|
38
|
+
let lastIsString = false;
|
|
39
|
+
const directTextProps = {};
|
|
40
|
+
if (color)
|
|
41
|
+
directTextProps.color = color;
|
|
42
|
+
if (fontFamily)
|
|
43
|
+
directTextProps.fontFamily = fontFamily;
|
|
44
|
+
if (fontSize)
|
|
45
|
+
directTextProps.fontSize = fontSize;
|
|
46
|
+
if (fontWeight)
|
|
47
|
+
directTextProps.fontWeight = fontWeight;
|
|
48
|
+
if (letterSpacing)
|
|
49
|
+
directTextProps.letterSpacing = letterSpacing;
|
|
50
|
+
if (textAlign)
|
|
51
|
+
directTextProps.textAlign = textAlign;
|
|
52
|
+
function concatStringChildren() {
|
|
53
|
+
if (!lastIsString)
|
|
54
|
+
return;
|
|
55
|
+
const index = nextChildren.length - 1;
|
|
56
|
+
const childrenStrings = nextChildren[index];
|
|
57
|
+
nextChildren[index] = /* @__PURE__ */ React.createElement(TextComponent, __spreadValues(__spreadProps(__spreadValues({
|
|
58
|
+
key: index
|
|
59
|
+
}, directTextProps), {
|
|
60
|
+
size
|
|
61
|
+
}), textProps), childrenStrings);
|
|
62
|
+
}
|
|
63
|
+
for (const child of allChildren) {
|
|
64
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
65
|
+
const isString = typeof child === "string";
|
|
66
|
+
if (isString) {
|
|
67
|
+
if (lastIsString) {
|
|
68
|
+
last.push(child);
|
|
69
|
+
} else {
|
|
70
|
+
nextChildren.push([child]);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
concatStringChildren();
|
|
74
|
+
nextChildren.push(child);
|
|
75
|
+
}
|
|
76
|
+
lastIsString = isString;
|
|
77
|
+
}
|
|
78
|
+
concatStringChildren();
|
|
79
|
+
return nextChildren;
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
wrapChildrenInText
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=wrapChildrenInText.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wrapChildrenInText.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { 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\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapChildrenInText(\n TextComponent: any,\n {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n }: Props\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 let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n const directTextProps: any = {}\n // to avoid setting undefined\n if (color) directTextProps.color = color\n if (fontFamily) directTextProps.fontFamily = fontFamily\n if (fontSize) directTextProps.fontSize = fontSize\n if (fontWeight) directTextProps.fontWeight = fontWeight\n if (letterSpacing) directTextProps.letterSpacing = letterSpacing\n if (textAlign) directTextProps.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} {...directTextProps} 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;AAqBO,4BACL,eACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAEF;AACA,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,MAAI,cAAc,MAAM,SAAS,QAAQ,QAAQ;AACjD,MAAI,eAAsB,CAAC;AAC3B,MAAI,eAAe;AACnB,QAAM,kBAAuB,CAAC;AAE9B,MAAI;AAAO,oBAAgB,QAAQ;AACnC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAU,oBAAgB,WAAW;AACzC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAe,oBAAgB,gBAAgB;AACnD,MAAI;AAAW,oBAAgB,YAAY;AAE3C,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,oCAAC;AAAA,MAAc,KAAK;AAAA,OAAW,kBAA9B;AAAA,MAA+C;AAAA,QAAgB,YAC7D,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
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { expect, test } from "vitest";
|
|
3
|
+
import { wrapChildrenInText } from "./wrapChildrenInText";
|
|
4
|
+
const Comp = () => {
|
|
5
|
+
};
|
|
6
|
+
const re = /* @__PURE__ */ React.createElement("div", {
|
|
7
|
+
"data-id": Math.random()
|
|
8
|
+
});
|
|
9
|
+
const reID = re.props["data-id"];
|
|
10
|
+
test("should wrap all string children, not wrap others", () => {
|
|
11
|
+
const out = wrapChildrenInText(Comp, {
|
|
12
|
+
children: [re, "a", "b", re, "c", re, "d"]
|
|
13
|
+
});
|
|
14
|
+
expect(out[0].props["data-id"]).toBe(reID);
|
|
15
|
+
expect(out[1].type).toBe(Comp);
|
|
16
|
+
expect(out[1].props.children).toStrictEqual(["a", "b"]);
|
|
17
|
+
expect(out[2].props["data-id"]).toBe(reID);
|
|
18
|
+
expect(out[3].type).toBe(Comp);
|
|
19
|
+
expect(out[3].props.children).toStrictEqual(["c"]);
|
|
20
|
+
expect(out[4].props["data-id"]).toBe(reID);
|
|
21
|
+
expect(out[5].type).toBe(Comp);
|
|
22
|
+
expect(out[5].props.children).toStrictEqual(["d"]);
|
|
23
|
+
});
|
|
24
|
+
test("should first child string", () => {
|
|
25
|
+
const out = wrapChildrenInText(Comp, {
|
|
26
|
+
children: ["a", re]
|
|
27
|
+
});
|
|
28
|
+
expect(out[0].type).toBe(Comp);
|
|
29
|
+
expect(out[0].props.children).toStrictEqual(["a"]);
|
|
30
|
+
expect(out[1].props["data-id"]).toBe(reID);
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=wrapChildrenInText.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wrapChildrenInText.test.tsx"],
|
|
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": "AAAA;AACA;AAEA;AAEA,MAAM,OAAO,MAAM;AAAC;AACpB,MAAM,KAAK,oCAAC;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
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { styled } from "@tamagui/core";
|
|
2
|
+
import { Paragraph } from "./Paragraph";
|
|
3
|
+
const Heading = styled(Paragraph, {
|
|
4
|
+
tag: "span",
|
|
5
|
+
name: "Heading",
|
|
6
|
+
accessibilityRole: "header",
|
|
7
|
+
fontFamily: "$heading",
|
|
8
|
+
size: "$8",
|
|
9
|
+
margin: 0
|
|
10
|
+
});
|
|
11
|
+
const H1 = styled(Heading, {
|
|
12
|
+
name: "H1",
|
|
13
|
+
tag: "h1",
|
|
14
|
+
size: "$10"
|
|
15
|
+
});
|
|
16
|
+
const H2 = styled(Heading, {
|
|
17
|
+
name: "H2",
|
|
18
|
+
tag: "h2",
|
|
19
|
+
size: "$9"
|
|
20
|
+
});
|
|
21
|
+
const H3 = styled(Heading, {
|
|
22
|
+
name: "H3",
|
|
23
|
+
tag: "h3",
|
|
24
|
+
size: "$8"
|
|
25
|
+
});
|
|
26
|
+
const H4 = styled(Heading, {
|
|
27
|
+
name: "H4",
|
|
28
|
+
tag: "h4",
|
|
29
|
+
size: "$7"
|
|
30
|
+
});
|
|
31
|
+
const H5 = styled(Heading, {
|
|
32
|
+
name: "H5",
|
|
33
|
+
tag: "h5",
|
|
34
|
+
size: "$6"
|
|
35
|
+
});
|
|
36
|
+
const H6 = styled(Heading, {
|
|
37
|
+
name: "H6",
|
|
38
|
+
tag: "h6",
|
|
39
|
+
size: "$5"
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
H1,
|
|
43
|
+
H2,
|
|
44
|
+
H3,
|
|
45
|
+
H4,
|
|
46
|
+
H5,
|
|
47
|
+
H6,
|
|
48
|
+
Heading
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=Headings.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Headings.tsx"],
|
|
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;AAEA;AAEO,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
|
+
"names": []
|
|
7
|
+
}
|
package/dist/jsx/Paragraph.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Paragraph.tsx"],
|
|
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;AAEA;AAEO,MAAM,YAAY,OAAO,aAAa;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,QAAQ;AACV,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|