@tamagui/stacks 1.5.7 → 1.5.9
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/Stacks.js +4 -40
- package/dist/cjs/Stacks.js.map +3 -3
- package/dist/cjs/ThemeableStack.js +2 -2
- package/dist/cjs/ThemeableStack.js.map +1 -1
- package/dist/cjs/getElevation.js +64 -0
- package/dist/cjs/getElevation.js.map +7 -0
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/variants.js +2 -2
- package/dist/cjs/variants.js.map +2 -2
- package/dist/esm/Stacks.js +3 -42
- package/dist/esm/Stacks.js.map +3 -3
- package/dist/esm/Stacks.mjs +3 -42
- package/dist/esm/Stacks.mjs.map +3 -3
- package/dist/esm/ThemeableStack.js +2 -2
- package/dist/esm/ThemeableStack.js.map +1 -1
- package/dist/esm/ThemeableStack.mjs +2 -2
- package/dist/esm/ThemeableStack.mjs.map +1 -1
- package/dist/esm/getElevation.js +42 -0
- package/dist/esm/getElevation.js.map +7 -0
- package/dist/esm/getElevation.mjs +42 -0
- package/dist/esm/getElevation.mjs.map +7 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/variants.js +1 -1
- package/dist/esm/variants.js.map +1 -1
- package/dist/esm/variants.mjs +1 -1
- package/dist/esm/variants.mjs.map +1 -1
- package/dist/jsx/Stacks.js +3 -42
- package/dist/jsx/Stacks.js.map +3 -3
- package/dist/jsx/Stacks.mjs +3 -42
- package/dist/jsx/Stacks.mjs.map +3 -3
- package/dist/jsx/ThemeableStack.js +2 -2
- package/dist/jsx/ThemeableStack.js.map +1 -1
- package/dist/jsx/ThemeableStack.mjs +2 -2
- package/dist/jsx/ThemeableStack.mjs.map +1 -1
- package/dist/jsx/getElevation.js +42 -0
- package/dist/jsx/getElevation.js.map +7 -0
- package/dist/jsx/getElevation.mjs +42 -0
- package/dist/jsx/getElevation.mjs.map +7 -0
- package/dist/jsx/index.js +3 -3
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +3 -3
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/variants.js +1 -1
- package/dist/jsx/variants.js.map +1 -1
- package/dist/jsx/variants.mjs +1 -1
- package/dist/jsx/variants.mjs.map +1 -1
- package/package.json +4 -4
- package/src/Stacks.tsx +3 -49
- package/src/ThemeableStack.tsx +2 -2
- package/src/getElevation.tsx +46 -0
- package/src/index.ts +3 -3
- package/src/variants.tsx +1 -1
- package/types/Stacks.d.ts +32 -41
- package/types/ThemeableStack.d.ts +4 -4
- package/types/getElevation.d.ts +11 -0
- package/types/index.d.ts +3 -3
- package/types/variants.d.ts +69 -69
- package/types/SizableStack.d.ts.map +0 -1
- package/types/Stacks.d.ts.map +0 -1
- package/types/ThemeableStack.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/variants.d.ts.map +0 -1
package/dist/cjs/Stacks.js
CHANGED
|
@@ -20,20 +20,11 @@ var Stacks_exports = {};
|
|
|
20
20
|
__export(Stacks_exports, {
|
|
21
21
|
XStack: () => XStack,
|
|
22
22
|
YStack: () => YStack,
|
|
23
|
-
ZStack: () => ZStack
|
|
24
|
-
getElevation: () => getElevation,
|
|
25
|
-
getSizedElevation: () => getSizedElevation
|
|
23
|
+
ZStack: () => ZStack
|
|
26
24
|
});
|
|
27
25
|
module.exports = __toCommonJS(Stacks_exports);
|
|
28
26
|
var import_core = require("@tamagui/core");
|
|
29
|
-
|
|
30
|
-
if (!size)
|
|
31
|
-
return;
|
|
32
|
-
const { tokens } = extras;
|
|
33
|
-
const token = tokens.size[size];
|
|
34
|
-
const sizeNum = (0, import_core.isVariable)(token) ? +token.val : size;
|
|
35
|
-
return getSizedElevation(sizeNum, extras);
|
|
36
|
-
};
|
|
27
|
+
var import_getElevation = require("./getElevation.js");
|
|
37
28
|
const fullscreenStyle = {
|
|
38
29
|
position: "absolute",
|
|
39
30
|
top: 0,
|
|
@@ -46,7 +37,7 @@ const variants = {
|
|
|
46
37
|
true: fullscreenStyle
|
|
47
38
|
},
|
|
48
39
|
elevation: {
|
|
49
|
-
"...size": getElevation
|
|
40
|
+
"...size": import_getElevation.getElevation
|
|
50
41
|
}
|
|
51
42
|
};
|
|
52
43
|
const YStack = (0, import_core.styled)(import_core.Stack, {
|
|
@@ -70,37 +61,10 @@ const ZStack = (0, import_core.styled)(
|
|
|
70
61
|
isZStack: true
|
|
71
62
|
}
|
|
72
63
|
);
|
|
73
|
-
const getSizedElevation = (val, { theme, tokens }) => {
|
|
74
|
-
let num = 0;
|
|
75
|
-
if (val === true) {
|
|
76
|
-
const val2 = (0, import_core.getVariableValue)(tokens.size["true"]);
|
|
77
|
-
if (typeof val2 === "number") {
|
|
78
|
-
num = val2;
|
|
79
|
-
} else {
|
|
80
|
-
num = 10;
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
num = +val;
|
|
84
|
-
}
|
|
85
|
-
if (process.env.NODE_ENV === "development") {
|
|
86
|
-
if (num !== null && isNaN(num)) {
|
|
87
|
-
console.warn("NaN shadow", num, val);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
91
|
-
const shadow = {
|
|
92
|
-
shadowColor: theme.shadowColor,
|
|
93
|
-
shadowRadius,
|
|
94
|
-
shadowOffset: { height, width: 0 }
|
|
95
|
-
};
|
|
96
|
-
return shadow;
|
|
97
|
-
};
|
|
98
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
65
|
0 && (module.exports = {
|
|
100
66
|
XStack,
|
|
101
67
|
YStack,
|
|
102
|
-
ZStack
|
|
103
|
-
getElevation,
|
|
104
|
-
getSizedElevation
|
|
68
|
+
ZStack
|
|
105
69
|
});
|
|
106
70
|
//# sourceMappingURL=Stacks.js.map
|
package/dist/cjs/Stacks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Stacks.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { GetProps, Stack, styled } from '@tamagui/core'\n\nimport { getElevation } from './getElevation.js'\n\nexport type YStackProps = GetProps<typeof YStack>\nexport type XStackProps = YStackProps\nexport type ZStackProps = YStackProps\n\nconst fullscreenStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n} as const\n\nconst variants = {\n fullscreen: {\n true: fullscreenStyle,\n },\n elevation: {\n '...size': getElevation,\n },\n} as const\n\nexport const YStack = styled(Stack, {\n flexDirection: 'column',\n name: 'YStack',\n variants,\n})\n\nexport const XStack = styled(Stack, {\n flexDirection: 'row',\n name: 'XStack',\n variants,\n})\n\nexport const ZStack = styled(\n YStack,\n {\n name: 'ZStack',\n position: 'relative',\n },\n {\n neverFlatten: true,\n isZStack: true,\n }\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AAExC,0BAA6B;AAM7B,MAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,WAAW;AAAA,EACf,YAAY;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,EACb;AACF;AAEO,MAAM,aAAS,oBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,aAAS,oBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,aAAS;AAAA,EACpB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,UAAU;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -22,8 +22,8 @@ __export(ThemeableStack_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(ThemeableStack_exports);
|
|
24
24
|
var import_core = require("@tamagui/core");
|
|
25
|
-
var import_Stacks = require("./Stacks");
|
|
26
|
-
var import_variants = require("./variants");
|
|
25
|
+
var import_Stacks = require("./Stacks.js");
|
|
26
|
+
var import_variants = require("./variants.js");
|
|
27
27
|
const chromelessStyle = {
|
|
28
28
|
backgroundColor: "transparent",
|
|
29
29
|
borderColor: "transparent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ThemeableStack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks.js'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants.js'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,oBAAuB;AACvB,sBASO;AAEP,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,MAAM,qBAAiB,oBAAO,sBAAQ;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,QACH,GAAG;AAAA,QACH,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 getElevation_exports = {};
|
|
20
|
+
__export(getElevation_exports, {
|
|
21
|
+
getElevation: () => getElevation,
|
|
22
|
+
getSizedElevation: () => getSizedElevation
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getElevation_exports);
|
|
25
|
+
var import_core = require("@tamagui/core");
|
|
26
|
+
const getElevation = (size, extras) => {
|
|
27
|
+
if (!size)
|
|
28
|
+
return;
|
|
29
|
+
const { tokens } = extras;
|
|
30
|
+
const token = tokens.size[size];
|
|
31
|
+
const sizeNum = (0, import_core.isVariable)(token) ? +token.val : size;
|
|
32
|
+
return getSizedElevation(sizeNum, extras);
|
|
33
|
+
};
|
|
34
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
35
|
+
let num = 0;
|
|
36
|
+
if (val === true) {
|
|
37
|
+
const val2 = (0, import_core.getVariableValue)(tokens.size["true"]);
|
|
38
|
+
if (typeof val2 === "number") {
|
|
39
|
+
num = val2;
|
|
40
|
+
} else {
|
|
41
|
+
num = 10;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
num = +val;
|
|
45
|
+
}
|
|
46
|
+
if (process.env.NODE_ENV === "development") {
|
|
47
|
+
if (num !== null && isNaN(num)) {
|
|
48
|
+
console.warn("NaN shadow", num, val);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
52
|
+
const shadow = {
|
|
53
|
+
shadowColor: theme.shadowColor,
|
|
54
|
+
shadowRadius,
|
|
55
|
+
shadowOffset: { height, width: 0 }
|
|
56
|
+
};
|
|
57
|
+
return shadow;
|
|
58
|
+
};
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
getElevation,
|
|
62
|
+
getSizedElevation
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=getElevation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getElevation.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n SizeTokens,\n SizeVariantSpreadFunction,\n StackProps,\n VariantSpreadExtras,\n getVariableValue,\n isVariable,\n} from '@tamagui/core'\n\nexport const getElevation: SizeVariantSpreadFunction<StackProps> = (size, extras) => {\n if (!size) return\n const { tokens } = extras\n const token = tokens.size[size]\n const sizeNum = (isVariable(token) ? +token.val : size) as number\n return getSizedElevation(sizeNum, extras)\n}\n\nexport const getSizedElevation = (\n val: SizeTokens | number | boolean,\n { theme, tokens }: VariantSpreadExtras<any>\n) => {\n let num = 0\n if (val === true) {\n const val = getVariableValue(tokens.size['true'])\n if (typeof val === 'number') {\n num = val\n } else {\n num = 10\n }\n } else {\n num = +val\n }\n if (process.env.NODE_ENV === 'development') {\n if (num !== null && isNaN(num)) {\n // eslint-disable-next-line no-console\n console.warn('NaN shadow', num, val)\n }\n }\n const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)]\n const shadow = {\n shadowColor: theme.shadowColor,\n shadowRadius,\n shadowOffset: { height, width: 0 },\n }\n return shadow\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAOO;AAEA,MAAM,eAAsD,CAAC,MAAM,WAAW;AACnF,MAAI,CAAC;AAAM;AACX,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,QAAM,cAAW,wBAAW,KAAK,IAAI,CAAC,MAAM,MAAM;AAClD,SAAO,kBAAkB,SAAS,MAAM;AAC1C;AAEO,MAAM,oBAAoB,CAC/B,KACA,EAAE,OAAO,OAAO,MACb;AACH,MAAI,MAAM;AACV,MAAI,QAAQ,MAAM;AAChB,UAAMA,WAAM,8BAAiB,OAAO,KAAK,MAAM,CAAC;AAChD,QAAI,OAAOA,SAAQ,UAAU;AAC3B,YAAMA;AAAA,IACR,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF,OAAO;AACL,UAAM,CAAC;AAAA,EACT;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAE9B,cAAQ,KAAK,cAAc,KAAK,GAAG;AAAA,IACrC;AAAA,EACF;AACA,QAAM,CAAC,QAAQ,YAAY,IAAI,CAAC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC;AAChF,QAAM,SAAS;AAAA,IACb,aAAa,MAAM;AAAA,IACnB;AAAA,IACA,cAAc,EAAE,QAAQ,OAAO,EAAE;AAAA,EACnC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["val"]
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var src_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(src_exports);
|
|
18
|
-
__reExport(src_exports, require("./Stacks"), module.exports);
|
|
19
|
-
__reExport(src_exports, require("./SizableStack"), module.exports);
|
|
20
|
-
__reExport(src_exports, require("./ThemeableStack"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./Stacks.js"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./SizableStack.js"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./ThemeableStack.js"), module.exports);
|
|
21
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.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Stacks'\nexport * from './SizableStack'\nexport * from './ThemeableStack'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,
|
|
4
|
+
"sourcesContent": ["export * from './Stacks.js'\nexport * from './SizableStack.js'\nexport * from './ThemeableStack.js'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,wBAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,gCAFd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/variants.js
CHANGED
|
@@ -28,10 +28,10 @@ __export(variants_exports, {
|
|
|
28
28
|
radiused: () => radiused
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(variants_exports);
|
|
31
|
-
var
|
|
31
|
+
var import_getElevation = require("./getElevation");
|
|
32
32
|
const elevate = {
|
|
33
33
|
true: (_, extras) => {
|
|
34
|
-
return (0,
|
|
34
|
+
return (0, import_getElevation.getElevation)(extras.props["size"], extras);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
const bordered = (val, { props }) => {
|
package/dist/cjs/variants.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/variants.tsx"],
|
|
4
|
-
"sourcesContent": ["import { getElevation } from './
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { getElevation } from './getElevation'\n\nexport const elevate = {\n true: (_: boolean, extras: any) => {\n return getElevation(extras.props['size'], extras)\n },\n}\n\nexport const bordered = (val: boolean | number, { props }) => {\n return {\n // TODO size it with size in '...size'\n borderWidth: typeof val === 'number' ? val : 1,\n borderColor: '$borderColor',\n\n ...(props.hoverTheme && {\n hoverStyle: {\n borderColor: '$borderColorHover',\n },\n }),\n\n ...(props.pressTheme && {\n pressStyle: {\n borderColor: '$borderColorPress',\n },\n }),\n\n ...(props.focusTheme && {\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n }),\n }\n}\n\nexport const padded = {\n true: (_, extras) => {\n const { tokens, props } = extras\n return {\n padding: tokens.space[props.size] || tokens.space['$true'],\n }\n },\n}\n\nexport const radiused = {\n true: (_, extras) => {\n const { tokens, props } = extras\n return {\n borderRadius: tokens.radius[props.size] || tokens.radius['$true'],\n }\n },\n}\n\nexport const circular = {\n true: (_, { props, tokens }) => {\n const size = tokens.size[props.size]\n return {\n width: size,\n height: size,\n maxWidth: size,\n maxHeight: size,\n minWidth: size,\n minHeight: size,\n borderRadius: 100_000,\n padding: 0,\n }\n },\n}\n\nexport const hoverTheme = {\n true: {\n hoverStyle: {\n backgroundColor: '$backgroundHover',\n borderColor: '$borderColorHover',\n },\n },\n false: {},\n}\n\nexport const pressTheme = {\n true: {\n cursor: 'pointer',\n pressStyle: {\n backgroundColor: '$backgroundPress',\n borderColor: '$borderColorPress',\n },\n },\n false: {},\n}\n\nexport const focusTheme = {\n true: {\n focusStyle: {\n backgroundColor: '$backgroundFocus',\n borderColor: '$borderColorFocus',\n },\n },\n false: {},\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAEtB,MAAM,UAAU;AAAA,EACrB,MAAM,CAAC,GAAY,WAAgB;AACjC,eAAO,kCAAa,OAAO,MAAM,MAAM,GAAG,MAAM;AAAA,EAClD;AACF;AAEO,MAAM,WAAW,CAAC,KAAuB,EAAE,MAAM,MAAM;AAC5D,SAAO;AAAA;AAAA,IAEL,aAAa,OAAO,QAAQ,WAAW,MAAM;AAAA,IAC7C,aAAa;AAAA,IAEb,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IAEA,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IAEA,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,SAAS;AAAA,EACpB,MAAM,CAAC,GAAG,WAAW;AACnB,UAAM,EAAE,QAAQ,MAAM,IAAI;AAC1B,WAAO;AAAA,MACL,SAAS,OAAO,MAAM,MAAM,IAAI,KAAK,OAAO,MAAM,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,MAAM,WAAW;AAAA,EACtB,MAAM,CAAC,GAAG,WAAW;AACnB,UAAM,EAAE,QAAQ,MAAM,IAAI;AAC1B,WAAO;AAAA,MACL,cAAc,OAAO,OAAO,MAAM,IAAI,KAAK,OAAO,OAAO,OAAO;AAAA,IAClE;AAAA,EACF;AACF;AAEO,MAAM,WAAW;AAAA,EACtB,MAAM,CAAC,GAAG,EAAE,OAAO,OAAO,MAAM;AAC9B,UAAM,OAAO,OAAO,KAAK,MAAM,IAAI;AACnC,WAAO;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,WAAW;AAAA,MACX,UAAU;AAAA,MACV,WAAW;AAAA,MACX,cAAc;AAAA,MACd,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Stacks.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
getVariableValue,
|
|
4
|
-
isVariable,
|
|
5
|
-
styled
|
|
6
|
-
} from "@tamagui/core";
|
|
7
|
-
const getElevation = (size, extras) => {
|
|
8
|
-
if (!size)
|
|
9
|
-
return;
|
|
10
|
-
const { tokens } = extras;
|
|
11
|
-
const token = tokens.size[size];
|
|
12
|
-
const sizeNum = isVariable(token) ? +token.val : size;
|
|
13
|
-
return getSizedElevation(sizeNum, extras);
|
|
14
|
-
};
|
|
1
|
+
import { Stack, styled } from "@tamagui/core";
|
|
2
|
+
import { getElevation } from "./getElevation.js";
|
|
15
3
|
const fullscreenStyle = {
|
|
16
4
|
position: "absolute",
|
|
17
5
|
top: 0,
|
|
@@ -48,36 +36,9 @@ const ZStack = styled(
|
|
|
48
36
|
isZStack: true
|
|
49
37
|
}
|
|
50
38
|
);
|
|
51
|
-
const getSizedElevation = (val, { theme, tokens }) => {
|
|
52
|
-
let num = 0;
|
|
53
|
-
if (val === true) {
|
|
54
|
-
const val2 = getVariableValue(tokens.size["true"]);
|
|
55
|
-
if (typeof val2 === "number") {
|
|
56
|
-
num = val2;
|
|
57
|
-
} else {
|
|
58
|
-
num = 10;
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
num = +val;
|
|
62
|
-
}
|
|
63
|
-
if (process.env.NODE_ENV === "development") {
|
|
64
|
-
if (num !== null && isNaN(num)) {
|
|
65
|
-
console.warn("NaN shadow", num, val);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
69
|
-
const shadow = {
|
|
70
|
-
shadowColor: theme.shadowColor,
|
|
71
|
-
shadowRadius,
|
|
72
|
-
shadowOffset: { height, width: 0 }
|
|
73
|
-
};
|
|
74
|
-
return shadow;
|
|
75
|
-
};
|
|
76
39
|
export {
|
|
77
40
|
XStack,
|
|
78
41
|
YStack,
|
|
79
|
-
ZStack
|
|
80
|
-
getElevation,
|
|
81
|
-
getSizedElevation
|
|
42
|
+
ZStack
|
|
82
43
|
};
|
|
83
44
|
//# sourceMappingURL=Stacks.js.map
|
package/dist/esm/Stacks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Stacks.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { GetProps, Stack, styled } from '@tamagui/core'\n\nimport { getElevation } from './getElevation.js'\n\nexport type YStackProps = GetProps<typeof YStack>\nexport type XStackProps = YStackProps\nexport type ZStackProps = YStackProps\n\nconst fullscreenStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n} as const\n\nconst variants = {\n fullscreen: {\n true: fullscreenStyle,\n },\n elevation: {\n '...size': getElevation,\n },\n} as const\n\nexport const YStack = styled(Stack, {\n flexDirection: 'column',\n name: 'YStack',\n variants,\n})\n\nexport const XStack = styled(Stack, {\n flexDirection: 'row',\n name: 'XStack',\n variants,\n})\n\nexport const ZStack = styled(\n YStack,\n {\n name: 'ZStack',\n position: 'relative',\n },\n {\n neverFlatten: true,\n isZStack: true,\n }\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,OAAO,cAAc;AAExC,SAAS,oBAAoB;AAM7B,MAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,WAAW;AAAA,EACf,YAAY;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,EACb;AACF;AAEO,MAAM,SAAS,OAAO,OAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS,OAAO,OAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,UAAU;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/Stacks.mjs
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
getVariableValue,
|
|
4
|
-
isVariable,
|
|
5
|
-
styled
|
|
6
|
-
} from "@tamagui/core";
|
|
7
|
-
const getElevation = (size, extras) => {
|
|
8
|
-
if (!size)
|
|
9
|
-
return;
|
|
10
|
-
const { tokens } = extras;
|
|
11
|
-
const token = tokens.size[size];
|
|
12
|
-
const sizeNum = isVariable(token) ? +token.val : size;
|
|
13
|
-
return getSizedElevation(sizeNum, extras);
|
|
14
|
-
};
|
|
1
|
+
import { Stack, styled } from "@tamagui/core";
|
|
2
|
+
import { getElevation } from "./getElevation.js";
|
|
15
3
|
const fullscreenStyle = {
|
|
16
4
|
position: "absolute",
|
|
17
5
|
top: 0,
|
|
@@ -48,36 +36,9 @@ const ZStack = styled(
|
|
|
48
36
|
isZStack: true
|
|
49
37
|
}
|
|
50
38
|
);
|
|
51
|
-
const getSizedElevation = (val, { theme, tokens }) => {
|
|
52
|
-
let num = 0;
|
|
53
|
-
if (val === true) {
|
|
54
|
-
const val2 = getVariableValue(tokens.size["true"]);
|
|
55
|
-
if (typeof val2 === "number") {
|
|
56
|
-
num = val2;
|
|
57
|
-
} else {
|
|
58
|
-
num = 10;
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
num = +val;
|
|
62
|
-
}
|
|
63
|
-
if (process.env.NODE_ENV === "development") {
|
|
64
|
-
if (num !== null && isNaN(num)) {
|
|
65
|
-
console.warn("NaN shadow", num, val);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
69
|
-
const shadow = {
|
|
70
|
-
shadowColor: theme.shadowColor,
|
|
71
|
-
shadowRadius,
|
|
72
|
-
shadowOffset: { height, width: 0 }
|
|
73
|
-
};
|
|
74
|
-
return shadow;
|
|
75
|
-
};
|
|
76
39
|
export {
|
|
77
40
|
XStack,
|
|
78
41
|
YStack,
|
|
79
|
-
ZStack
|
|
80
|
-
getElevation,
|
|
81
|
-
getSizedElevation
|
|
42
|
+
ZStack
|
|
82
43
|
};
|
|
83
44
|
//# sourceMappingURL=Stacks.mjs.map
|
package/dist/esm/Stacks.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Stacks.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { GetProps, Stack, styled } from '@tamagui/core'\n\nimport { getElevation } from './getElevation.js'\n\nexport type YStackProps = GetProps<typeof YStack>\nexport type XStackProps = YStackProps\nexport type ZStackProps = YStackProps\n\nconst fullscreenStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n} as const\n\nconst variants = {\n fullscreen: {\n true: fullscreenStyle,\n },\n elevation: {\n '...size': getElevation,\n },\n} as const\n\nexport const YStack = styled(Stack, {\n flexDirection: 'column',\n name: 'YStack',\n variants,\n})\n\nexport const XStack = styled(Stack, {\n flexDirection: 'row',\n name: 'XStack',\n variants,\n})\n\nexport const ZStack = styled(\n YStack,\n {\n name: 'ZStack',\n position: 'relative',\n },\n {\n neverFlatten: true,\n isZStack: true,\n }\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,OAAO,cAAc;AAExC,SAAS,oBAAoB;AAM7B,MAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,WAAW;AAAA,EACf,YAAY;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,EACb;AACF;AAEO,MAAM,SAAS,OAAO,OAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS,OAAO,OAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,UAAU;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled } from "@tamagui/core";
|
|
2
|
-
import { YStack } from "./Stacks";
|
|
2
|
+
import { YStack } from "./Stacks.js";
|
|
3
3
|
import {
|
|
4
4
|
bordered,
|
|
5
5
|
circular,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
padded,
|
|
10
10
|
pressTheme,
|
|
11
11
|
radiused
|
|
12
|
-
} from "./variants";
|
|
12
|
+
} from "./variants.js";
|
|
13
13
|
const chromelessStyle = {
|
|
14
14
|
backgroundColor: "transparent",
|
|
15
15
|
borderColor: "transparent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ThemeableStack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks.js'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants.js'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
5
5
|
"mappings": "AAAA,SAAmB,cAAc;AAEjC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,MAAM,iBAAiB,OAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,QACH,GAAG;AAAA,QACH,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled } from "@tamagui/core";
|
|
2
|
-
import { YStack } from "./Stacks";
|
|
2
|
+
import { YStack } from "./Stacks.js";
|
|
3
3
|
import {
|
|
4
4
|
bordered,
|
|
5
5
|
circular,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
padded,
|
|
10
10
|
pressTheme,
|
|
11
11
|
radiused
|
|
12
|
-
} from "./variants";
|
|
12
|
+
} from "./variants.js";
|
|
13
13
|
const chromelessStyle = {
|
|
14
14
|
backgroundColor: "transparent",
|
|
15
15
|
borderColor: "transparent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ThemeableStack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks.js'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants.js'\n\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
5
5
|
"mappings": "AAAA,SAAmB,cAAc;AAEjC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,MAAM,iBAAiB,OAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,cAAc;AAAA,MACZ,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,QACH,GAAG;AAAA,QACH,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getVariableValue,
|
|
3
|
+
isVariable
|
|
4
|
+
} from "@tamagui/core";
|
|
5
|
+
const getElevation = (size, extras) => {
|
|
6
|
+
if (!size)
|
|
7
|
+
return;
|
|
8
|
+
const { tokens } = extras;
|
|
9
|
+
const token = tokens.size[size];
|
|
10
|
+
const sizeNum = isVariable(token) ? +token.val : size;
|
|
11
|
+
return getSizedElevation(sizeNum, extras);
|
|
12
|
+
};
|
|
13
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
14
|
+
let num = 0;
|
|
15
|
+
if (val === true) {
|
|
16
|
+
const val2 = getVariableValue(tokens.size["true"]);
|
|
17
|
+
if (typeof val2 === "number") {
|
|
18
|
+
num = val2;
|
|
19
|
+
} else {
|
|
20
|
+
num = 10;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
num = +val;
|
|
24
|
+
}
|
|
25
|
+
if (process.env.NODE_ENV === "development") {
|
|
26
|
+
if (num !== null && isNaN(num)) {
|
|
27
|
+
console.warn("NaN shadow", num, val);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
31
|
+
const shadow = {
|
|
32
|
+
shadowColor: theme.shadowColor,
|
|
33
|
+
shadowRadius,
|
|
34
|
+
shadowOffset: { height, width: 0 }
|
|
35
|
+
};
|
|
36
|
+
return shadow;
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
getElevation,
|
|
40
|
+
getSizedElevation
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=getElevation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getElevation.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n SizeTokens,\n SizeVariantSpreadFunction,\n StackProps,\n VariantSpreadExtras,\n getVariableValue,\n isVariable,\n} from '@tamagui/core'\n\nexport const getElevation: SizeVariantSpreadFunction<StackProps> = (size, extras) => {\n if (!size) return\n const { tokens } = extras\n const token = tokens.size[size]\n const sizeNum = (isVariable(token) ? +token.val : size) as number\n return getSizedElevation(sizeNum, extras)\n}\n\nexport const getSizedElevation = (\n val: SizeTokens | number | boolean,\n { theme, tokens }: VariantSpreadExtras<any>\n) => {\n let num = 0\n if (val === true) {\n const val = getVariableValue(tokens.size['true'])\n if (typeof val === 'number') {\n num = val\n } else {\n num = 10\n }\n } else {\n num = +val\n }\n if (process.env.NODE_ENV === 'development') {\n if (num !== null && isNaN(num)) {\n // eslint-disable-next-line no-console\n console.warn('NaN shadow', num, val)\n }\n }\n const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)]\n const shadow = {\n shadowColor: theme.shadowColor,\n shadowRadius,\n shadowOffset: { height, width: 0 },\n }\n return shadow\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,eAAsD,CAAC,MAAM,WAAW;AACnF,MAAI,CAAC;AAAM;AACX,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,QAAM,UAAW,WAAW,KAAK,IAAI,CAAC,MAAM,MAAM;AAClD,SAAO,kBAAkB,SAAS,MAAM;AAC1C;AAEO,MAAM,oBAAoB,CAC/B,KACA,EAAE,OAAO,OAAO,MACb;AACH,MAAI,MAAM;AACV,MAAI,QAAQ,MAAM;AAChB,UAAMA,OAAM,iBAAiB,OAAO,KAAK,MAAM,CAAC;AAChD,QAAI,OAAOA,SAAQ,UAAU;AAC3B,YAAMA;AAAA,IACR,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF,OAAO;AACL,UAAM,CAAC;AAAA,EACT;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAE9B,cAAQ,KAAK,cAAc,KAAK,GAAG;AAAA,IACrC;AAAA,EACF;AACA,QAAM,CAAC,QAAQ,YAAY,IAAI,CAAC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC;AAChF,QAAM,SAAS;AAAA,IACb,aAAa,MAAM;AAAA,IACnB;AAAA,IACA,cAAc,EAAE,QAAQ,OAAO,EAAE;AAAA,EACnC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["val"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getVariableValue,
|
|
3
|
+
isVariable
|
|
4
|
+
} from "@tamagui/core";
|
|
5
|
+
const getElevation = (size, extras) => {
|
|
6
|
+
if (!size)
|
|
7
|
+
return;
|
|
8
|
+
const { tokens } = extras;
|
|
9
|
+
const token = tokens.size[size];
|
|
10
|
+
const sizeNum = isVariable(token) ? +token.val : size;
|
|
11
|
+
return getSizedElevation(sizeNum, extras);
|
|
12
|
+
};
|
|
13
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
14
|
+
let num = 0;
|
|
15
|
+
if (val === true) {
|
|
16
|
+
const val2 = getVariableValue(tokens.size["true"]);
|
|
17
|
+
if (typeof val2 === "number") {
|
|
18
|
+
num = val2;
|
|
19
|
+
} else {
|
|
20
|
+
num = 10;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
num = +val;
|
|
24
|
+
}
|
|
25
|
+
if (process.env.NODE_ENV === "development") {
|
|
26
|
+
if (num !== null && isNaN(num)) {
|
|
27
|
+
console.warn("NaN shadow", num, val);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
31
|
+
const shadow = {
|
|
32
|
+
shadowColor: theme.shadowColor,
|
|
33
|
+
shadowRadius,
|
|
34
|
+
shadowOffset: { height, width: 0 }
|
|
35
|
+
};
|
|
36
|
+
return shadow;
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
getElevation,
|
|
40
|
+
getSizedElevation
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=getElevation.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getElevation.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n SizeTokens,\n SizeVariantSpreadFunction,\n StackProps,\n VariantSpreadExtras,\n getVariableValue,\n isVariable,\n} from '@tamagui/core'\n\nexport const getElevation: SizeVariantSpreadFunction<StackProps> = (size, extras) => {\n if (!size) return\n const { tokens } = extras\n const token = tokens.size[size]\n const sizeNum = (isVariable(token) ? +token.val : size) as number\n return getSizedElevation(sizeNum, extras)\n}\n\nexport const getSizedElevation = (\n val: SizeTokens | number | boolean,\n { theme, tokens }: VariantSpreadExtras<any>\n) => {\n let num = 0\n if (val === true) {\n const val = getVariableValue(tokens.size['true'])\n if (typeof val === 'number') {\n num = val\n } else {\n num = 10\n }\n } else {\n num = +val\n }\n if (process.env.NODE_ENV === 'development') {\n if (num !== null && isNaN(num)) {\n // eslint-disable-next-line no-console\n console.warn('NaN shadow', num, val)\n }\n }\n const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)]\n const shadow = {\n shadowColor: theme.shadowColor,\n shadowRadius,\n shadowOffset: { height, width: 0 },\n }\n return shadow\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,eAAsD,CAAC,MAAM,WAAW;AACnF,MAAI,CAAC;AAAM;AACX,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,QAAM,UAAW,WAAW,KAAK,IAAI,CAAC,MAAM,MAAM;AAClD,SAAO,kBAAkB,SAAS,MAAM;AAC1C;AAEO,MAAM,oBAAoB,CAC/B,KACA,EAAE,OAAO,OAAO,MACb;AACH,MAAI,MAAM;AACV,MAAI,QAAQ,MAAM;AAChB,UAAMA,OAAM,iBAAiB,OAAO,KAAK,MAAM,CAAC;AAChD,QAAI,OAAOA,SAAQ,UAAU;AAC3B,YAAMA;AAAA,IACR,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF,OAAO;AACL,UAAM,CAAC;AAAA,EACT;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAE9B,cAAQ,KAAK,cAAc,KAAK,GAAG;AAAA,IACrC;AAAA,EACF;AACA,QAAM,CAAC,QAAQ,YAAY,IAAI,CAAC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC;AAChF,QAAM,SAAS;AAAA,IACb,aAAa,MAAM;AAAA,IACnB;AAAA,IACA,cAAc,EAAE,QAAQ,OAAO,EAAE;AAAA,EACnC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["val"]
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./Stacks";
|
|
2
|
-
export * from "./SizableStack";
|
|
3
|
-
export * from "./ThemeableStack";
|
|
1
|
+
export * from "./Stacks.js";
|
|
2
|
+
export * from "./SizableStack.js";
|
|
3
|
+
export * from "./ThemeableStack.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Stacks'\nexport * from './SizableStack'\nexport * from './ThemeableStack'\n"],
|
|
4
|
+
"sourcesContent": ["export * from './Stacks.js'\nexport * from './SizableStack.js'\nexport * from './ThemeableStack.js'\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./Stacks";
|
|
2
|
-
export * from "./SizableStack";
|
|
3
|
-
export * from "./ThemeableStack";
|
|
1
|
+
export * from "./Stacks.js";
|
|
2
|
+
export * from "./SizableStack.js";
|
|
3
|
+
export * from "./ThemeableStack.js";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Stacks'\nexport * from './SizableStack'\nexport * from './ThemeableStack'\n"],
|
|
4
|
+
"sourcesContent": ["export * from './Stacks.js'\nexport * from './SizableStack.js'\nexport * from './ThemeableStack.js'\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/variants.js
CHANGED