@tamagui/shorthands 1.138.6 → 1.139.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1 @@
1
-
2
- built @tamagui/shorthands in 1223 ms
1
+ built @tamagui/shorthands in 552 ms
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/shorthands",
3
- "version": "1.138.6",
3
+ "version": "1.139.0",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -43,13 +43,22 @@
43
43
  "types": "./types/v4.d.ts",
44
44
  "import": "./dist/esm/v4.mjs",
45
45
  "require": "./dist/cjs/v4.cjs"
46
+ },
47
+ "./v5": {
48
+ "react-native": {
49
+ "import": "./dist/esm/v5.native.js",
50
+ "require": "./dist/cjs/v5.native.js"
51
+ },
52
+ "types": "./types/v5.d.ts",
53
+ "import": "./dist/esm/v5.mjs",
54
+ "require": "./dist/cjs/v5.cjs"
46
55
  }
47
56
  },
48
57
  "dependencies": {
49
- "@tamagui/web": "1.138.6"
58
+ "@tamagui/web": "1.139.0"
50
59
  },
51
60
  "devDependencies": {
52
- "@tamagui/build": "1.138.6"
61
+ "@tamagui/build": "1.139.0"
53
62
  },
54
63
  "publishConfig": {
55
64
  "access": "public"
package/src/v5.ts ADDED
@@ -0,0 +1,93 @@
1
+ import type { TextStyle } from '@tamagui/web'
2
+
3
+ export const shorthands = createShorthands({
4
+ // text
5
+ text: 'textAlign',
6
+
7
+ // view
8
+ b: 'bottom',
9
+ bg: 'backgroundColor',
10
+ content: 'alignContent',
11
+ grow: 'flexGrow',
12
+ items: 'alignItems',
13
+ justify: 'justifyContent',
14
+ l: 'left',
15
+ m: 'margin',
16
+ maxH: 'maxHeight',
17
+ maxW: 'maxWidth',
18
+ mb: 'marginBottom',
19
+ minH: 'minHeight',
20
+ minW: 'minWidth',
21
+ ml: 'marginLeft',
22
+ mr: 'marginRight',
23
+ mt: 'marginTop',
24
+ mx: 'marginHorizontal',
25
+ my: 'marginVertical',
26
+ p: 'padding',
27
+ pb: 'paddingBottom',
28
+ pl: 'paddingLeft',
29
+ pr: 'paddingRight',
30
+ pt: 'paddingTop',
31
+ px: 'paddingHorizontal',
32
+ py: 'paddingVertical',
33
+ r: 'right',
34
+ rounded: 'borderRadius',
35
+ select: 'userSelect',
36
+ self: 'alignSelf',
37
+ shrink: 'flexShrink',
38
+ t: 'top',
39
+ z: 'zIndex',
40
+ })
41
+
42
+ // type helper
43
+ function createShorthands<A extends Record<string, keyof TextStyle>>(a: A) {
44
+ return a
45
+ }
46
+
47
+ export type Shorthands = typeof shorthands
48
+ export type ShorthandKeys = keyof Shorthands
49
+
50
+ type NonDefinedShorthandValues = Exclude<keyof TextStyle, Shorthands[ShorthandKeys]>
51
+
52
+ // we want no types but compiler/runtime uses it for short classname generation
53
+ const nonCompilerShorthands: [string, NonDefinedShorthandValues][] = [
54
+ ['fwr', 'flexWrap'],
55
+ ['col', 'color'],
56
+ ['ff', 'fontFamily'],
57
+ ['fst', 'fontStyle'],
58
+ ['tt', 'textTransform'],
59
+ ['td', 'textDecorationLine'],
60
+ ['va', 'verticalAlign'],
61
+ ['ws', 'whiteSpace'],
62
+ // @ts-ignore
63
+ ['wb', 'wordBreak'],
64
+ ['ww', 'wordWrap'],
65
+ ['brc', 'borderRightColor'],
66
+ ['brw', 'borderRightWidth'],
67
+ ['bs', 'borderStyle'],
68
+ ['btc', 'borderTopColor'],
69
+ ['btlr', 'borderTopLeftRadius'],
70
+ ['btrr', 'borderTopRightRadius'],
71
+ ['btw', 'borderTopWidth'],
72
+ ['bw', 'borderWidth'],
73
+ ['o', 'opacity'],
74
+ ['cur', 'cursor'],
75
+ ['pe', 'pointerEvents'],
76
+ ['ov', 'overflow'],
77
+ ['pos', 'position'],
78
+ ['dsp', 'display'],
79
+ ['fw', 'fontWeight'],
80
+ ['fs', 'fontSize'],
81
+ ['ls', 'letterSpacing'],
82
+ ['lh', 'lineHeight'],
83
+ // @ts-ignore
84
+ ['bxs', 'boxSizing'],
85
+ ['bxsh', 'boxShadow'],
86
+ // @ts-ignore
87
+ ['ox', 'overflowX'],
88
+ // @ts-ignore
89
+ ['oy', 'overflowY'],
90
+ ]
91
+
92
+ // Merge the non-compiler shorthands into the main object
93
+ Object.assign(shorthands, Object.fromEntries(nonCompilerShorthands))
package/tsconfig.json CHANGED
@@ -11,6 +11,8 @@
11
11
  "v2.cjs",
12
12
  "v2.d.ts",
13
13
  "v4.cjs",
14
- "v4.d.ts"
14
+ "v4.d.ts",
15
+ "v5.cjs",
16
+ "v5.d.ts"
15
17
  ]
16
18
  }
package/types/v5.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ export declare const shorthands: {
2
+ text: "textAlign";
3
+ b: "bottom";
4
+ bg: "backgroundColor";
5
+ content: "alignContent";
6
+ grow: "flexGrow";
7
+ items: "alignItems";
8
+ justify: "justifyContent";
9
+ l: "left";
10
+ m: "margin";
11
+ maxH: "maxHeight";
12
+ maxW: "maxWidth";
13
+ mb: "marginBottom";
14
+ minH: "minHeight";
15
+ minW: "minWidth";
16
+ ml: "marginLeft";
17
+ mr: "marginRight";
18
+ mt: "marginTop";
19
+ mx: "marginHorizontal";
20
+ my: "marginVertical";
21
+ p: "padding";
22
+ pb: "paddingBottom";
23
+ pl: "paddingLeft";
24
+ pr: "paddingRight";
25
+ pt: "paddingTop";
26
+ px: "paddingHorizontal";
27
+ py: "paddingVertical";
28
+ r: "right";
29
+ rounded: "borderRadius";
30
+ select: "userSelect";
31
+ self: "alignSelf";
32
+ shrink: "flexShrink";
33
+ t: "top";
34
+ z: "zIndex";
35
+ };
36
+ export type Shorthands = typeof shorthands;
37
+ export type ShorthandKeys = keyof Shorthands;
38
+ //# sourceMappingURL=v5.d.ts.map
package/v5.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types/v5'
package/v5.js ADDED
@@ -0,0 +1 @@
1
+ Object.assign(module.exports, require('./dist/cjs/v5'))