@tamagui/core 1.0.1-beta.212 → 1.0.1-beta.214
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/createFont.js +5 -4
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/helpers/getTokens.js +30 -0
- package/dist/cjs/helpers/getTokens.js.map +7 -0
- package/dist/cjs/views/Text.js +2 -1
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/esm/createFont.js +5 -4
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/helpers/getTokens.js +6 -0
- package/dist/esm/helpers/getTokens.js.map +7 -0
- package/dist/esm/views/Text.js +2 -1
- package/dist/esm/views/Text.js.map +2 -2
- package/package.json +12 -12
- package/reset.css +1 -9
- package/src/createFont.ts +5 -4
- package/src/views/Text.tsx +1 -0
- package/types/helpers/getTokens.d.ts +2 -0
package/dist/cjs/createFont.js
CHANGED
|
@@ -35,9 +35,10 @@ const fontWeights = [
|
|
|
35
35
|
const processSection = (section, keys) => {
|
|
36
36
|
if (typeof section === "string")
|
|
37
37
|
return section;
|
|
38
|
-
|
|
38
|
+
const sectionKeys = Object.keys(section);
|
|
39
|
+
let fillValue = section[sectionKeys[0]];
|
|
39
40
|
return Object.fromEntries(
|
|
40
|
-
keys.map((key) => {
|
|
41
|
+
[.../* @__PURE__ */ new Set([...keys, ...sectionKeys])].map((key) => {
|
|
41
42
|
const value = section[key] ?? fillValue;
|
|
42
43
|
fillValue = value;
|
|
43
44
|
return [key, value];
|
|
@@ -46,13 +47,13 @@ const processSection = (section, keys) => {
|
|
|
46
47
|
};
|
|
47
48
|
const createFont = (font) => {
|
|
48
49
|
const sizeKeys = Object.keys(font.size);
|
|
49
|
-
Object.fromEntries(
|
|
50
|
+
const processedFont = Object.fromEntries(
|
|
50
51
|
Object.entries(font).map(([key, section]) => {
|
|
51
52
|
const fillKeys = key === "face" ? fontWeights : sizeKeys;
|
|
52
53
|
return [key, processSection(section, fillKeys)];
|
|
53
54
|
})
|
|
54
55
|
);
|
|
55
|
-
return Object.freeze(
|
|
56
|
+
return Object.freeze(processedFont);
|
|
56
57
|
};
|
|
57
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
59
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createFont.ts"],
|
|
4
|
-
"sourcesContent": ["import { FontWeightSteps, GenericFont } from './types'\n\nconst fontWeights: FontWeightSteps[] = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n]\n\nconst processSection = <T>(\n section: string | Record<string, T>,\n keys: string[]\n): string | Record<string, T> => {\n if (typeof section === 'string') return section\n\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,cAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CACrB,SACA,SAC+B;AAC/B,MAAI,OAAO,YAAY;AAAU,WAAO;AAExC,
|
|
4
|
+
"sourcesContent": ["import { FontWeightSteps, GenericFont } from './types'\n\nconst fontWeights: FontWeightSteps[] = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n]\n\nconst processSection = <T>(\n section: string | Record<string, T>,\n keys: string[]\n): string | Record<string, T> => {\n if (typeof section === 'string') return section\n\n const sectionKeys = Object.keys(section)\n let fillValue = section[sectionKeys[0]]\n\n return Object.fromEntries(\n [...new Set([...keys, ...sectionKeys])].map((key) => {\n const value = section[key] ?? fillValue\n fillValue = value\n return [key, value]\n })\n )\n}\n\nexport const createFont = <A extends GenericFont>(font: A): A => {\n const sizeKeys = Object.keys(font.size)\n\n const processedFont = Object.fromEntries(\n Object.entries(font).map(([key, section]) => {\n const fillKeys = key === 'face' ? fontWeights : sizeKeys\n\n return [key, processSection(section, fillKeys)]\n })\n )\n\n return Object.freeze(processedFont) as A\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,cAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CACrB,SACA,SAC+B;AAC/B,MAAI,OAAO,YAAY;AAAU,WAAO;AAExC,QAAM,cAAc,OAAO,KAAK,OAAO;AACvC,MAAI,YAAY,QAAQ,YAAY;AAEpC,SAAO,OAAO;AAAA,IACZ,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ;AACnD,YAAM,QAAQ,QAAQ,QAAQ;AAC9B,kBAAY;AACZ,aAAO,CAAC,KAAK,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AACF;AAEO,MAAM,aAAa,CAAwB,SAAe;AAC/D,QAAM,WAAW,OAAO,KAAK,KAAK,IAAI;AAEtC,QAAM,gBAAgB,OAAO;AAAA,IAC3B,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,OAAO,MAAM;AAC3C,YAAM,WAAW,QAAQ,SAAS,cAAc;AAEhD,aAAO,CAAC,KAAK,eAAe,SAAS,QAAQ,CAAC;AAAA,IAChD,CAAC;AAAA,EACH;AAEA,SAAO,OAAO,OAAO,aAAa;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getTokens_exports = {};
|
|
20
|
+
__export(getTokens_exports, {
|
|
21
|
+
getTokens: () => getTokens
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getTokens_exports);
|
|
24
|
+
var import_config = require("../config");
|
|
25
|
+
const getTokens = () => (0, import_config.getConfig)().tokensParsed;
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
getTokens
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=getTokens.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/getTokens.tsx"],
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../config'\nimport { Tokens } from '../types'\n\nexport const getTokens = () => getConfig().tokensParsed as Tokens\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAGnB,MAAM,YAAY,UAAM,yBAAU,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/views/Text.js
CHANGED
|
@@ -39,7 +39,8 @@ const Text = (0, import_createComponent.createComponent)({
|
|
|
39
39
|
...import_constants.isWeb && {
|
|
40
40
|
display: "inline",
|
|
41
41
|
boxSizing: "border-box",
|
|
42
|
-
wordWrap: "break-word"
|
|
42
|
+
wordWrap: "break-word",
|
|
43
|
+
margin: 0
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n inlineWhenUnflattened: new Set(['fontFamily']),\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n // ??\n ellipsizeMode: {\n '...': () => null,\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AACtB,qBAAgD;AAGhD,6BAAgC;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,WAAO,wCAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,0BAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n margin: 0,\n }),\n },\n\n inlineWhenUnflattened: new Set(['fontFamily']),\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n // ??\n ellipsizeMode: {\n '...': () => null,\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AACtB,qBAAgD;AAGhD,6BAAgC;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,WAAO,wCAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,0BAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,uBAAuB,oBAAI,IAAI,CAAC,YAAY,CAAC;AAAA,EAE7C,UAAU;AAAA,IACR,GAAI,0BAAS;AAAA,MACX,eAAe;AAAA,QACb,GAAG;AAAA,QAEH,WAAW,CAAC,kBACV,iBAAiB,IACb;AAAA,UACE,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,UAAU;AAAA,QACZ,IACA;AAAA,MACR;AAAA,IACF;AAAA,IAGA,eAAe;AAAA,MACb,OAAO,MAAM;AAAA,IACf;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,yBACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,yBAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/createFont.js
CHANGED
|
@@ -12,9 +12,10 @@ const fontWeights = [
|
|
|
12
12
|
const processSection = (section, keys) => {
|
|
13
13
|
if (typeof section === "string")
|
|
14
14
|
return section;
|
|
15
|
-
|
|
15
|
+
const sectionKeys = Object.keys(section);
|
|
16
|
+
let fillValue = section[sectionKeys[0]];
|
|
16
17
|
return Object.fromEntries(
|
|
17
|
-
keys.map((key) => {
|
|
18
|
+
[.../* @__PURE__ */ new Set([...keys, ...sectionKeys])].map((key) => {
|
|
18
19
|
const value = section[key] ?? fillValue;
|
|
19
20
|
fillValue = value;
|
|
20
21
|
return [key, value];
|
|
@@ -23,13 +24,13 @@ const processSection = (section, keys) => {
|
|
|
23
24
|
};
|
|
24
25
|
const createFont = (font) => {
|
|
25
26
|
const sizeKeys = Object.keys(font.size);
|
|
26
|
-
Object.fromEntries(
|
|
27
|
+
const processedFont = Object.fromEntries(
|
|
27
28
|
Object.entries(font).map(([key, section]) => {
|
|
28
29
|
const fillKeys = key === "face" ? fontWeights : sizeKeys;
|
|
29
30
|
return [key, processSection(section, fillKeys)];
|
|
30
31
|
})
|
|
31
32
|
);
|
|
32
|
-
return Object.freeze(
|
|
33
|
+
return Object.freeze(processedFont);
|
|
33
34
|
};
|
|
34
35
|
export {
|
|
35
36
|
createFont
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createFont.ts"],
|
|
4
|
-
"sourcesContent": ["import { FontWeightSteps, GenericFont } from './types'\n\nconst fontWeights: FontWeightSteps[] = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n]\n\nconst processSection = <T>(\n section: string | Record<string, T>,\n keys: string[]\n): string | Record<string, T> => {\n if (typeof section === 'string') return section\n\n
|
|
5
|
-
"mappings": "AAEA,MAAM,cAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CACrB,SACA,SAC+B;AAC/B,MAAI,OAAO,YAAY;AAAU,WAAO;AAExC,
|
|
4
|
+
"sourcesContent": ["import { FontWeightSteps, GenericFont } from './types'\n\nconst fontWeights: FontWeightSteps[] = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n]\n\nconst processSection = <T>(\n section: string | Record<string, T>,\n keys: string[]\n): string | Record<string, T> => {\n if (typeof section === 'string') return section\n\n const sectionKeys = Object.keys(section)\n let fillValue = section[sectionKeys[0]]\n\n return Object.fromEntries(\n [...new Set([...keys, ...sectionKeys])].map((key) => {\n const value = section[key] ?? fillValue\n fillValue = value\n return [key, value]\n })\n )\n}\n\nexport const createFont = <A extends GenericFont>(font: A): A => {\n const sizeKeys = Object.keys(font.size)\n\n const processedFont = Object.fromEntries(\n Object.entries(font).map(([key, section]) => {\n const fillKeys = key === 'face' ? fontWeights : sizeKeys\n\n return [key, processSection(section, fillKeys)]\n })\n )\n\n return Object.freeze(processedFont) as A\n}\n"],
|
|
5
|
+
"mappings": "AAEA,MAAM,cAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CACrB,SACA,SAC+B;AAC/B,MAAI,OAAO,YAAY;AAAU,WAAO;AAExC,QAAM,cAAc,OAAO,KAAK,OAAO;AACvC,MAAI,YAAY,QAAQ,YAAY;AAEpC,SAAO,OAAO;AAAA,IACZ,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ;AACnD,YAAM,QAAQ,QAAQ,QAAQ;AAC9B,kBAAY;AACZ,aAAO,CAAC,KAAK,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AACF;AAEO,MAAM,aAAa,CAAwB,SAAe;AAC/D,QAAM,WAAW,OAAO,KAAK,KAAK,IAAI;AAEtC,QAAM,gBAAgB,OAAO;AAAA,IAC3B,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,OAAO,MAAM;AAC3C,YAAM,WAAW,QAAQ,SAAS,cAAc;AAEhD,aAAO,CAAC,KAAK,eAAe,SAAS,QAAQ,CAAC;AAAA,IAChD,CAAC;AAAA,EACH;AAEA,SAAO,OAAO,OAAO,aAAa;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/getTokens.tsx"],
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../config'\nimport { Tokens } from '../types'\n\nexport const getTokens = () => getConfig().tokensParsed as Tokens\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,YAAY,MAAM,UAAU,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/views/Text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n inlineWhenUnflattened: new Set(['fontFamily']),\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n // ??\n ellipsizeMode: {\n '...': () => null,\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,oBAAoB,mBAAmB;AAGhD,SAAS,uBAAuB;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,SAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n margin: 0,\n }),\n },\n\n inlineWhenUnflattened: new Set(['fontFamily']),\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n // ??\n ellipsizeMode: {\n '...': () => null,\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,oBAAoB,mBAAmB;AAGhD,SAAS,uBAAuB;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,SAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,uBAAuB,oBAAI,IAAI,CAAC,YAAY,CAAC;AAAA,EAE7C,UAAU;AAAA,IACR,GAAI,SAAS;AAAA,MACX,eAAe;AAAA,QACb,GAAG;AAAA,QAEH,WAAW,CAAC,kBACV,iBAAiB,IACb;AAAA,UACE,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,UAAU;AAAA,QACZ,IACA;AAAA,MACR;AAAA,IACF;AAAA,IAGA,eAAe;AAAA,MACb,OAAO,MAAM;AAAA,IACf;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.214",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@expo/match-media": "^0.3.0",
|
|
31
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/constants": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/react-native-use-pressable": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/react-native-use-responder-events": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/types-react-native": "^1.0.1-beta.
|
|
38
|
-
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.
|
|
39
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
40
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
31
|
+
"@tamagui/compose-refs": "^1.0.1-beta.214",
|
|
32
|
+
"@tamagui/constants": "^1.0.1-beta.214",
|
|
33
|
+
"@tamagui/helpers": "^1.0.1-beta.214",
|
|
34
|
+
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.214",
|
|
35
|
+
"@tamagui/react-native-use-pressable": "^1.0.1-beta.214",
|
|
36
|
+
"@tamagui/react-native-use-responder-events": "^1.0.1-beta.214",
|
|
37
|
+
"@tamagui/types-react-native": "^1.0.1-beta.214",
|
|
38
|
+
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.214",
|
|
39
|
+
"@tamagui/use-event": "^1.0.1-beta.214",
|
|
40
|
+
"@tamagui/use-force-update": "^1.0.1-beta.214"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "*",
|
|
44
44
|
"react-dom": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
47
|
+
"@tamagui/build": "^1.0.1-beta.214",
|
|
48
48
|
"@types/node": "^16.11.9",
|
|
49
49
|
"@types/react": "^18.0.15",
|
|
50
50
|
"@types/react-native": "^0.69.2",
|
package/reset.css
CHANGED
|
@@ -23,15 +23,7 @@ li, select, input, button, [role="slider"], [role="listbox"] {
|
|
|
23
23
|
outline: none;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
p,
|
|
27
|
-
input,
|
|
28
|
-
textarea,
|
|
29
|
-
button,
|
|
30
|
-
ul,
|
|
31
|
-
ol,
|
|
32
|
-
li,
|
|
33
|
-
pre,
|
|
34
|
-
dialog {
|
|
26
|
+
p, input, textarea, button, ul, ol, li, pre, dialog {
|
|
35
27
|
all: unset;
|
|
36
28
|
box-sizing: border-box;
|
|
37
29
|
}
|
package/src/createFont.ts
CHANGED
|
@@ -18,10 +18,11 @@ const processSection = <T>(
|
|
|
18
18
|
): string | Record<string, T> => {
|
|
19
19
|
if (typeof section === 'string') return section
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const sectionKeys = Object.keys(section)
|
|
22
|
+
let fillValue = section[sectionKeys[0]]
|
|
22
23
|
|
|
23
24
|
return Object.fromEntries(
|
|
24
|
-
keys.map((key) => {
|
|
25
|
+
[...new Set([...keys, ...sectionKeys])].map((key) => {
|
|
25
26
|
const value = section[key] ?? fillValue
|
|
26
27
|
fillValue = value
|
|
27
28
|
return [key, value]
|
|
@@ -32,7 +33,7 @@ const processSection = <T>(
|
|
|
32
33
|
export const createFont = <A extends GenericFont>(font: A): A => {
|
|
33
34
|
const sizeKeys = Object.keys(font.size)
|
|
34
35
|
|
|
35
|
-
Object.fromEntries(
|
|
36
|
+
const processedFont = Object.fromEntries(
|
|
36
37
|
Object.entries(font).map(([key, section]) => {
|
|
37
38
|
const fillKeys = key === 'face' ? fontWeights : sizeKeys
|
|
38
39
|
|
|
@@ -40,5 +41,5 @@ export const createFont = <A extends GenericFont>(font: A): A => {
|
|
|
40
41
|
})
|
|
41
42
|
)
|
|
42
43
|
|
|
43
|
-
return Object.freeze(
|
|
44
|
+
return Object.freeze(processedFont) as A
|
|
44
45
|
}
|
package/src/views/Text.tsx
CHANGED