@tamagui/helpers 1.0.0-alpha.2 → 1.0.0-alpha.22

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.
Files changed (66) hide show
  1. package/dist/allRules.js +1 -1
  2. package/dist/allRules.js.map +1 -1
  3. package/dist/cjs/allRules.js +15 -0
  4. package/dist/cjs/allRules.js.map +7 -0
  5. package/dist/cjs/concatClassName.js +78 -0
  6. package/dist/cjs/concatClassName.js.map +7 -0
  7. package/dist/cjs/index.js +24 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/simpleHash.js +21 -0
  10. package/dist/cjs/simpleHash.js.map +7 -0
  11. package/dist/cjs/types.js +4 -0
  12. package/dist/cjs/types.js.map +7 -0
  13. package/dist/cjs/validStyleProps.js +163 -0
  14. package/dist/cjs/validStyleProps.js.map +7 -0
  15. package/dist/esm/allRules.js +9 -0
  16. package/dist/esm/allRules.js.map +7 -0
  17. package/dist/esm/concatClassName.js +72 -0
  18. package/dist/esm/concatClassName.js.map +7 -0
  19. package/dist/esm/index.js +5 -0
  20. package/dist/esm/index.js.map +7 -0
  21. package/dist/esm/simpleHash.js +15 -0
  22. package/dist/esm/simpleHash.js.map +7 -0
  23. package/dist/esm/types.js +1 -0
  24. package/dist/esm/types.js.map +7 -0
  25. package/dist/esm/validStyleProps.js +150 -0
  26. package/dist/esm/validStyleProps.js.map +7 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.cjs.map +2 -2
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/jsx/allRules.js +8 -0
  32. package/dist/jsx/concatClassName.js +71 -0
  33. package/dist/jsx/index.js +4 -0
  34. package/dist/jsx/simpleHash.js +14 -0
  35. package/dist/jsx/types.js +0 -0
  36. package/dist/jsx/validStyleProps.js +149 -0
  37. package/package.json +11 -8
  38. package/src/allRules.d.ts +2 -0
  39. package/src/allRules.d.ts.map +1 -0
  40. package/src/allRules.js +2 -0
  41. package/src/{AllRules.ts → allRules.ts} +0 -0
  42. package/src/concatClassName.d.ts +1 -0
  43. package/src/concatClassName.d.ts.map +1 -0
  44. package/src/concatClassName.js +65 -0
  45. package/src/index.d.ts +4 -0
  46. package/src/index.d.ts.map +1 -0
  47. package/src/index.js +4 -0
  48. package/src/index.ts +1 -1
  49. package/src/types.d.ts +7 -0
  50. package/src/types.d.ts.map +1 -0
  51. package/src/types.js +1 -0
  52. package/src/validStyleProps.d.ts +474 -0
  53. package/src/validStyleProps.d.ts.map +1 -0
  54. package/src/validStyleProps.js +140 -0
  55. package/types/allRules.d.ts +3 -0
  56. package/types/allRules.d.ts.map +1 -0
  57. package/types/concatClassName.d.ts +2 -0
  58. package/types/concatClassName.d.ts.map +1 -0
  59. package/types/index.d.ts +5 -0
  60. package/types/index.d.ts.map +1 -0
  61. package/types/simpleHash.d.ts +2 -0
  62. package/types/simpleHash.d.ts.map +1 -0
  63. package/types/types.d.ts +8 -0
  64. package/types/types.d.ts.map +1 -0
  65. package/types/validStyleProps.d.ts +475 -0
  66. package/types/validStyleProps.d.ts.map +1 -0
@@ -0,0 +1,150 @@
1
+ const stylePropsTransform = {
2
+ x: true,
3
+ y: true,
4
+ scale: true,
5
+ perspective: true,
6
+ scaleX: true,
7
+ scaleY: true,
8
+ skewX: true,
9
+ skewY: true,
10
+ matrix: true,
11
+ rotate: true,
12
+ rotateY: true,
13
+ rotateX: true,
14
+ rotateZ: true
15
+ };
16
+ const stylePropsView = Object.freeze({
17
+ backfaceVisibility: true,
18
+ backgroundColor: true,
19
+ borderBottomColor: true,
20
+ borderBottomEndRadius: true,
21
+ borderBottomLeftRadius: true,
22
+ borderBottomRightRadius: true,
23
+ borderBottomStartRadius: true,
24
+ borderBottomWidth: true,
25
+ borderColor: true,
26
+ borderEndColor: true,
27
+ borderLeftColor: true,
28
+ borderLeftWidth: true,
29
+ borderRadius: true,
30
+ borderRightColor: true,
31
+ borderRightWidth: true,
32
+ borderStartColor: true,
33
+ borderStyle: true,
34
+ borderTopColor: true,
35
+ borderTopEndRadius: true,
36
+ borderTopLeftRadius: true,
37
+ borderTopRightRadius: true,
38
+ borderTopStartRadius: true,
39
+ borderTopWidth: true,
40
+ borderWidth: true,
41
+ opacity: true,
42
+ transform: true,
43
+ alignContent: true,
44
+ alignItems: true,
45
+ alignSelf: true,
46
+ aspectRatio: true,
47
+ borderEndWidth: true,
48
+ borderStartWidth: true,
49
+ bottom: true,
50
+ display: true,
51
+ end: true,
52
+ flex: true,
53
+ flexBasis: true,
54
+ flexDirection: true,
55
+ flexGrow: true,
56
+ flexShrink: true,
57
+ flexWrap: true,
58
+ height: true,
59
+ justifyContent: true,
60
+ left: true,
61
+ margin: true,
62
+ marginBottom: true,
63
+ marginEnd: true,
64
+ marginHorizontal: true,
65
+ marginLeft: true,
66
+ marginRight: true,
67
+ marginStart: true,
68
+ marginTop: true,
69
+ marginVertical: true,
70
+ maxHeight: true,
71
+ maxWidth: true,
72
+ minHeight: true,
73
+ minWidth: true,
74
+ overflow: true,
75
+ padding: true,
76
+ paddingBottom: true,
77
+ paddingEnd: true,
78
+ paddingHorizontal: true,
79
+ paddingLeft: true,
80
+ paddingRight: true,
81
+ paddingStart: true,
82
+ paddingTop: true,
83
+ paddingVertical: true,
84
+ position: true,
85
+ right: true,
86
+ start: true,
87
+ top: true,
88
+ width: true,
89
+ zIndex: true,
90
+ direction: true,
91
+ shadowColor: true,
92
+ shadowOffset: true,
93
+ shadowOpacity: true,
94
+ shadowRadius: true,
95
+ ...stylePropsTransform,
96
+ ...process.env.TAMAGUI_TARGET === "web" && {
97
+ userSelect: true,
98
+ cursor: true,
99
+ contain: true,
100
+ pointerEvents: true,
101
+ boxSizing: true
102
+ }
103
+ });
104
+ const stylePropsTextOnly = Object.freeze({
105
+ color: true,
106
+ fontFamily: true,
107
+ fontSize: true,
108
+ fontStyle: true,
109
+ fontWeight: true,
110
+ letterSpacing: true,
111
+ lineHeight: true,
112
+ textAlign: true,
113
+ textDecorationLine: true,
114
+ textDecorationStyle: true,
115
+ textDecorationColor: true,
116
+ textShadowColor: true,
117
+ textShadowOffset: true,
118
+ textShadowRadius: true,
119
+ textTransform: true,
120
+ ...process.env.TAMAGUI_TARGET === "web" && {
121
+ whiteSpace: true,
122
+ wordWrap: true,
123
+ textOverflow: true,
124
+ textDecorationDistance: true
125
+ }
126
+ });
127
+ const stylePropsText = Object.freeze({
128
+ ...stylePropsView,
129
+ ...stylePropsTextOnly
130
+ });
131
+ const stylePropsAll = stylePropsText;
132
+ const validStylesPseudo = {
133
+ hoverStyle: true,
134
+ pressStyle: true,
135
+ focusStyle: true
136
+ };
137
+ const validStyles = {
138
+ ...validStylesPseudo,
139
+ ...stylePropsView
140
+ };
141
+ export {
142
+ stylePropsAll,
143
+ stylePropsText,
144
+ stylePropsTextOnly,
145
+ stylePropsTransform,
146
+ stylePropsView,
147
+ validStyles,
148
+ validStylesPseudo
149
+ };
150
+ //# sourceMappingURL=validStyleProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validStyleProps.ts"],
4
+ "sourcesContent": ["// flat transform props\nexport const stylePropsTransform = {\n x: true,\n y: true,\n scale: true,\n perspective: true,\n scaleX: true,\n scaleY: true,\n skewX: true,\n skewY: true,\n matrix: true,\n rotate: true,\n rotateY: true,\n rotateX: true,\n rotateZ: true,\n}\n\nexport const stylePropsView = Object.freeze({\n backfaceVisibility: true,\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomEndRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomStartRadius: true,\n borderBottomWidth: true,\n borderColor: true,\n borderEndColor: true,\n borderLeftColor: true,\n borderLeftWidth: true,\n borderRadius: true,\n borderRightColor: true,\n borderRightWidth: true,\n borderStartColor: true,\n borderStyle: true,\n borderTopColor: true,\n borderTopEndRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopStartRadius: true,\n borderTopWidth: true,\n borderWidth: true,\n opacity: true,\n transform: true,\n alignContent: true,\n alignItems: true,\n alignSelf: true,\n aspectRatio: true,\n borderEndWidth: true,\n borderStartWidth: true,\n bottom: true,\n display: true,\n end: true,\n flex: true,\n flexBasis: true,\n flexDirection: true,\n flexGrow: true,\n flexShrink: true,\n flexWrap: true,\n height: true,\n justifyContent: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginEnd: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginStart: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n overflow: true,\n padding: true,\n paddingBottom: true,\n paddingEnd: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingStart: true,\n paddingTop: true,\n paddingVertical: true,\n position: true,\n right: true,\n start: true,\n top: true,\n width: true,\n zIndex: true,\n direction: true,\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n ...stylePropsTransform,\n\n // allow a few web only ones\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n userSelect: true,\n cursor: true,\n contain: true,\n pointerEvents: true,\n boxSizing: true,\n }),\n})\n\nexport const stylePropsTextOnly = Object.freeze({\n color: true,\n fontFamily: true,\n fontSize: true,\n fontStyle: true,\n fontWeight: true,\n letterSpacing: true,\n lineHeight: true,\n textAlign: true,\n textDecorationLine: true,\n textDecorationStyle: true,\n textDecorationColor: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n textTransform: true,\n\n // allow a few web only ones\n // TODO\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n }),\n})\n\nexport const stylePropsText = Object.freeze({\n ...stylePropsView,\n ...stylePropsTextOnly,\n})\n\nexport const stylePropsAll = stylePropsText\n\nexport const validStylesPseudo = {\n hoverStyle: true,\n pressStyle: true,\n focusStyle: true,\n}\n\nexport const validStyles = {\n ...validStylesPseudo,\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Z,YAAY;AAAA,EACZ,YAAY;AAAA;AAGP,MAAM,cAAc;AAAA,KACtB;AAAA,KACA;AAAA;",
6
+ "names": []
7
+ }
package/dist/index.cjs CHANGED
@@ -237,7 +237,7 @@ var validStylesPseudo = {
237
237
  };
238
238
  var validStyles = __spreadValues(__spreadValues({}, validStylesPseudo), stylePropsView);
239
239
 
240
- // src/AllRules.ts
240
+ // src/allRules.ts
241
241
  var AllRules = new Set();
242
242
  var getStyleRules = /* @__PURE__ */ __name(() => AllRules, "getStyleRules");
243
243
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/concatClassName.ts", "../src/validStyleProps.ts", "../src/AllRules.ts"],
4
- "sourcesContent": ["export * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from './AllRules'\n", "// perf sensitive so doing some weird stuff\n\n// testing caching\n// because we can hit these recent ones a ton of times in common cases\n// we're caching the simple case, this shouldn't be bad on memory either\n// const recently = new Map()\n// setInterval(() => {\n// recently.clear()\n// }, 1000)\n\nexport function concatClassName(_cn: any) {\n // if (arguments.length === 1) {\n // if (recently.has(arguments[0])) {\n // return recently.get(arguments[0])\n // }\n // }\n\n const classNamesOrPropObjects = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = classNamesOrPropObjects.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = classNamesOrPropObjects[x]\n if (!cns) continue\n if (!Array.isArray(cns) && typeof cns !== 'string') {\n // is prop object\n propObjects = propObjects || []\n propObjects.push(cns)\n continue\n }\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n if (!name || name === ' ') continue\n if (name[0] !== '_') {\n // not snack style (todo slightly stronger heuristic)\n final = name + ' ' + final\n continue\n }\n const splitIndex = name.indexOf('-')\n\n if (splitIndex < 1) {\n final = name + ' ' + final\n continue\n }\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n const isPsuedoQuery = nextChar === '-'\n\n const styleKey = name.slice(1, splitIndex)\n const mediaKey =\n isMediaQuery || isPsuedoQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n\n if (!isMediaQuery && !isPsuedoQuery) {\n if (usedPrefixes.indexOf(uid) > -1) {\n continue\n }\n usedPrefixes.push(uid)\n }\n\n // overrides for full safety\n const propName = styleKey\n if (propName && propObjects) {\n if (\n propObjects.some((po) => {\n if (mediaKey) {\n const propKey = pseudoInvert[mediaKey]\n return po && po[propKey] && propName in po[propKey] && po[propKey] !== null\n }\n const res = po && propName in po && po[propName] !== null\n return res\n })\n ) {\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n // if (arguments.length === 1) {\n // recently.set(arguments[0], final)\n // }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n", "// flat transform props\nexport const stylePropsTransform = {\n x: true,\n y: true,\n scale: true,\n perspective: true,\n scaleX: true,\n scaleY: true,\n skewX: true,\n skewY: true,\n matrix: true,\n rotate: true,\n rotateY: true,\n rotateX: true,\n rotateZ: true,\n}\n\nexport const stylePropsView = Object.freeze({\n backfaceVisibility: true,\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomEndRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomStartRadius: true,\n borderBottomWidth: true,\n borderColor: true,\n borderEndColor: true,\n borderLeftColor: true,\n borderLeftWidth: true,\n borderRadius: true,\n borderRightColor: true,\n borderRightWidth: true,\n borderStartColor: true,\n borderStyle: true,\n borderTopColor: true,\n borderTopEndRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopStartRadius: true,\n borderTopWidth: true,\n borderWidth: true,\n opacity: true,\n transform: true,\n alignContent: true,\n alignItems: true,\n alignSelf: true,\n aspectRatio: true,\n borderEndWidth: true,\n borderStartWidth: true,\n bottom: true,\n display: true,\n end: true,\n flex: true,\n flexBasis: true,\n flexDirection: true,\n flexGrow: true,\n flexShrink: true,\n flexWrap: true,\n height: true,\n justifyContent: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginEnd: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginStart: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n overflow: true,\n padding: true,\n paddingBottom: true,\n paddingEnd: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingStart: true,\n paddingTop: true,\n paddingVertical: true,\n position: true,\n right: true,\n start: true,\n top: true,\n width: true,\n zIndex: true,\n direction: true,\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n ...stylePropsTransform,\n\n // allow a few web only ones\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n userSelect: true,\n cursor: true,\n contain: true,\n pointerEvents: true,\n boxSizing: true,\n }),\n})\n\nexport const stylePropsTextOnly = Object.freeze({\n color: true,\n fontFamily: true,\n fontSize: true,\n fontStyle: true,\n fontWeight: true,\n letterSpacing: true,\n lineHeight: true,\n textAlign: true,\n textDecorationLine: true,\n textDecorationStyle: true,\n textDecorationColor: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n textTransform: true,\n\n // allow a few web only ones\n // TODO\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n }),\n})\n\nexport const stylePropsText = Object.freeze({\n ...stylePropsView,\n ...stylePropsTextOnly,\n})\n\nexport const stylePropsAll = stylePropsText\n\nexport const validStylesPseudo = {\n hoverStyle: true,\n pressStyle: true,\n focusStyle: true,\n}\n\nexport const validStyles = {\n ...validStylesPseudo,\n ...stylePropsView,\n}\n", "// ssr only\n\nexport const AllRules = new Set()\n\nexport const getStyleRules = () => AllRules\n"],
3
+ "sources": ["../src/index.ts", "../src/concatClassName.ts", "../src/validStyleProps.ts", "../src/allRules.ts"],
4
+ "sourcesContent": ["export * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from './allRules'\n", "// perf sensitive so doing some weird stuff\n\n// testing caching\n// because we can hit these recent ones a ton of times in common cases\n// we're caching the simple case, this shouldn't be bad on memory either\n// const recently = new Map()\n// setInterval(() => {\n// recently.clear()\n// }, 1000)\n\nexport function concatClassName(_cn: any) {\n // if (arguments.length === 1) {\n // if (recently.has(arguments[0])) {\n // return recently.get(arguments[0])\n // }\n // }\n\n const classNamesOrPropObjects = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = classNamesOrPropObjects.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = classNamesOrPropObjects[x]\n if (!cns) continue\n if (!Array.isArray(cns) && typeof cns !== 'string') {\n // is prop object\n propObjects = propObjects || []\n propObjects.push(cns)\n continue\n }\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n if (!name || name === ' ') continue\n if (name[0] !== '_') {\n // not snack style (todo slightly stronger heuristic)\n final = name + ' ' + final\n continue\n }\n const splitIndex = name.indexOf('-')\n\n if (splitIndex < 1) {\n final = name + ' ' + final\n continue\n }\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n const isPsuedoQuery = nextChar === '-'\n\n const styleKey = name.slice(1, splitIndex)\n const mediaKey =\n isMediaQuery || isPsuedoQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n\n if (!isMediaQuery && !isPsuedoQuery) {\n if (usedPrefixes.indexOf(uid) > -1) {\n continue\n }\n usedPrefixes.push(uid)\n }\n\n // overrides for full safety\n const propName = styleKey\n if (propName && propObjects) {\n if (\n propObjects.some((po) => {\n if (mediaKey) {\n const propKey = pseudoInvert[mediaKey]\n return po && po[propKey] && propName in po[propKey] && po[propKey] !== null\n }\n const res = po && propName in po && po[propName] !== null\n return res\n })\n ) {\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n // if (arguments.length === 1) {\n // recently.set(arguments[0], final)\n // }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n", "// flat transform props\nexport const stylePropsTransform = {\n x: true,\n y: true,\n scale: true,\n perspective: true,\n scaleX: true,\n scaleY: true,\n skewX: true,\n skewY: true,\n matrix: true,\n rotate: true,\n rotateY: true,\n rotateX: true,\n rotateZ: true,\n}\n\nexport const stylePropsView = Object.freeze({\n backfaceVisibility: true,\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomEndRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomStartRadius: true,\n borderBottomWidth: true,\n borderColor: true,\n borderEndColor: true,\n borderLeftColor: true,\n borderLeftWidth: true,\n borderRadius: true,\n borderRightColor: true,\n borderRightWidth: true,\n borderStartColor: true,\n borderStyle: true,\n borderTopColor: true,\n borderTopEndRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopStartRadius: true,\n borderTopWidth: true,\n borderWidth: true,\n opacity: true,\n transform: true,\n alignContent: true,\n alignItems: true,\n alignSelf: true,\n aspectRatio: true,\n borderEndWidth: true,\n borderStartWidth: true,\n bottom: true,\n display: true,\n end: true,\n flex: true,\n flexBasis: true,\n flexDirection: true,\n flexGrow: true,\n flexShrink: true,\n flexWrap: true,\n height: true,\n justifyContent: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginEnd: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginStart: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n overflow: true,\n padding: true,\n paddingBottom: true,\n paddingEnd: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingStart: true,\n paddingTop: true,\n paddingVertical: true,\n position: true,\n right: true,\n start: true,\n top: true,\n width: true,\n zIndex: true,\n direction: true,\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n ...stylePropsTransform,\n\n // allow a few web only ones\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n userSelect: true,\n cursor: true,\n contain: true,\n pointerEvents: true,\n boxSizing: true,\n }),\n})\n\nexport const stylePropsTextOnly = Object.freeze({\n color: true,\n fontFamily: true,\n fontSize: true,\n fontStyle: true,\n fontWeight: true,\n letterSpacing: true,\n lineHeight: true,\n textAlign: true,\n textDecorationLine: true,\n textDecorationStyle: true,\n textDecorationColor: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n textTransform: true,\n\n // allow a few web only ones\n // TODO\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n }),\n})\n\nexport const stylePropsText = Object.freeze({\n ...stylePropsView,\n ...stylePropsTextOnly,\n})\n\nexport const stylePropsAll = stylePropsText\n\nexport const validStylesPseudo = {\n hoverStyle: true,\n pressStyle: true,\n focusStyle: true,\n}\n\nexport const validStyles = {\n ...validStylesPseudo,\n ...stylePropsView,\n}\n", "// ssr only\n\nexport const AllRules = new Set()\n\nexport const getStyleRules = () => AllRules\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,yBAAyB,KAAU;AAOxC,QAAM,0BAA0B;AAChC,QAAM,eAAyB;AAC/B,MAAI,QAAQ;AAEZ,QAAM,MAAM,wBAAwB;AACpC,MAAI,cAAmB;AACvB,WAAS,IA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C/B,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA;AAGP,IAAM,cAAc,kCACtB,oBACA;;;ACpJE,IAAM,WAAW,IAAI;AAErB,IAAM,gBAAgB,6BAAM,UAAN;",
6
6
  "names": []
7
7
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./concatClassName";
2
2
  export * from "./validStyleProps";
3
3
  export * from "./types";
4
- export * from "./AllRules";
4
+ export * from "./allRules";
5
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from './AllRules'\n"],
4
+ "sourcesContent": ["export * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from './allRules'\n"],
5
5
  "mappings": "AAAA;AACA;AACA;AACA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,8 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const AllRules = new Set();
4
+ const getStyleRules = /* @__PURE__ */ __name(() => AllRules, "getStyleRules");
5
+ export {
6
+ AllRules,
7
+ getStyleRules
8
+ };
@@ -0,0 +1,71 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function concatClassName(_cn) {
4
+ const classNamesOrPropObjects = arguments;
5
+ const usedPrefixes = [];
6
+ let final = "";
7
+ const len = classNamesOrPropObjects.length;
8
+ let propObjects = null;
9
+ for (let x = len; x >= 0; x--) {
10
+ const cns = classNamesOrPropObjects[x];
11
+ if (!cns)
12
+ continue;
13
+ if (!Array.isArray(cns) && typeof cns !== "string") {
14
+ propObjects = propObjects || [];
15
+ propObjects.push(cns);
16
+ continue;
17
+ }
18
+ const names = Array.isArray(cns) ? cns : cns.split(" ");
19
+ const numNames = names.length;
20
+ for (let i = numNames - 1; i >= 0; i--) {
21
+ const name = names[i];
22
+ if (!name || name === " ")
23
+ continue;
24
+ if (name[0] !== "_") {
25
+ final = name + " " + final;
26
+ continue;
27
+ }
28
+ const splitIndex = name.indexOf("-");
29
+ if (splitIndex < 1) {
30
+ final = name + " " + final;
31
+ continue;
32
+ }
33
+ const nextChar = name[splitIndex + 1];
34
+ const isMediaQuery = nextChar === "_";
35
+ const isPsuedoQuery = nextChar === "-";
36
+ const styleKey = name.slice(1, splitIndex);
37
+ const mediaKey = isMediaQuery || isPsuedoQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null;
38
+ const uid = mediaKey ? styleKey + mediaKey : styleKey;
39
+ if (!isMediaQuery && !isPsuedoQuery) {
40
+ if (usedPrefixes.indexOf(uid) > -1) {
41
+ continue;
42
+ }
43
+ usedPrefixes.push(uid);
44
+ }
45
+ const propName = styleKey;
46
+ if (propName && propObjects) {
47
+ if (propObjects.some((po) => {
48
+ if (mediaKey) {
49
+ const propKey = pseudoInvert[mediaKey];
50
+ return po && po[propKey] && propName in po[propKey] && po[propKey] !== null;
51
+ }
52
+ const res = po && propName in po && po[propName] !== null;
53
+ return res;
54
+ })) {
55
+ continue;
56
+ }
57
+ }
58
+ final = name + " " + final;
59
+ }
60
+ }
61
+ return final;
62
+ }
63
+ __name(concatClassName, "concatClassName");
64
+ const pseudoInvert = {
65
+ hover: "hoverStyle",
66
+ focus: "focusStyle",
67
+ press: "pressStyle"
68
+ };
69
+ export {
70
+ concatClassName
71
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./concatClassName";
2
+ export * from "./validStyleProps";
3
+ export * from "./types";
4
+ export * from "./allRules";
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const simpleHash = /* @__PURE__ */ __name((str) => {
4
+ let hash = 0;
5
+ for (let i = 0; i < str.length; i++) {
6
+ const char = str.charCodeAt(i);
7
+ hash = (hash << 5) - hash + char;
8
+ hash &= hash;
9
+ }
10
+ return new Uint32Array([hash])[0].toString(36);
11
+ }, "simpleHash");
12
+ export {
13
+ simpleHash
14
+ };
File without changes
@@ -0,0 +1,149 @@
1
+ const stylePropsTransform = {
2
+ x: true,
3
+ y: true,
4
+ scale: true,
5
+ perspective: true,
6
+ scaleX: true,
7
+ scaleY: true,
8
+ skewX: true,
9
+ skewY: true,
10
+ matrix: true,
11
+ rotate: true,
12
+ rotateY: true,
13
+ rotateX: true,
14
+ rotateZ: true
15
+ };
16
+ const stylePropsView = Object.freeze({
17
+ backfaceVisibility: true,
18
+ backgroundColor: true,
19
+ borderBottomColor: true,
20
+ borderBottomEndRadius: true,
21
+ borderBottomLeftRadius: true,
22
+ borderBottomRightRadius: true,
23
+ borderBottomStartRadius: true,
24
+ borderBottomWidth: true,
25
+ borderColor: true,
26
+ borderEndColor: true,
27
+ borderLeftColor: true,
28
+ borderLeftWidth: true,
29
+ borderRadius: true,
30
+ borderRightColor: true,
31
+ borderRightWidth: true,
32
+ borderStartColor: true,
33
+ borderStyle: true,
34
+ borderTopColor: true,
35
+ borderTopEndRadius: true,
36
+ borderTopLeftRadius: true,
37
+ borderTopRightRadius: true,
38
+ borderTopStartRadius: true,
39
+ borderTopWidth: true,
40
+ borderWidth: true,
41
+ opacity: true,
42
+ transform: true,
43
+ alignContent: true,
44
+ alignItems: true,
45
+ alignSelf: true,
46
+ aspectRatio: true,
47
+ borderEndWidth: true,
48
+ borderStartWidth: true,
49
+ bottom: true,
50
+ display: true,
51
+ end: true,
52
+ flex: true,
53
+ flexBasis: true,
54
+ flexDirection: true,
55
+ flexGrow: true,
56
+ flexShrink: true,
57
+ flexWrap: true,
58
+ height: true,
59
+ justifyContent: true,
60
+ left: true,
61
+ margin: true,
62
+ marginBottom: true,
63
+ marginEnd: true,
64
+ marginHorizontal: true,
65
+ marginLeft: true,
66
+ marginRight: true,
67
+ marginStart: true,
68
+ marginTop: true,
69
+ marginVertical: true,
70
+ maxHeight: true,
71
+ maxWidth: true,
72
+ minHeight: true,
73
+ minWidth: true,
74
+ overflow: true,
75
+ padding: true,
76
+ paddingBottom: true,
77
+ paddingEnd: true,
78
+ paddingHorizontal: true,
79
+ paddingLeft: true,
80
+ paddingRight: true,
81
+ paddingStart: true,
82
+ paddingTop: true,
83
+ paddingVertical: true,
84
+ position: true,
85
+ right: true,
86
+ start: true,
87
+ top: true,
88
+ width: true,
89
+ zIndex: true,
90
+ direction: true,
91
+ shadowColor: true,
92
+ shadowOffset: true,
93
+ shadowOpacity: true,
94
+ shadowRadius: true,
95
+ ...stylePropsTransform,
96
+ ...process.env.TAMAGUI_TARGET === "web" && {
97
+ userSelect: true,
98
+ cursor: true,
99
+ contain: true,
100
+ pointerEvents: true,
101
+ boxSizing: true
102
+ }
103
+ });
104
+ const stylePropsTextOnly = Object.freeze({
105
+ color: true,
106
+ fontFamily: true,
107
+ fontSize: true,
108
+ fontStyle: true,
109
+ fontWeight: true,
110
+ letterSpacing: true,
111
+ lineHeight: true,
112
+ textAlign: true,
113
+ textDecorationLine: true,
114
+ textDecorationStyle: true,
115
+ textDecorationColor: true,
116
+ textShadowColor: true,
117
+ textShadowOffset: true,
118
+ textShadowRadius: true,
119
+ textTransform: true,
120
+ ...process.env.TAMAGUI_TARGET === "web" && {
121
+ whiteSpace: true,
122
+ wordWrap: true,
123
+ textOverflow: true,
124
+ textDecorationDistance: true
125
+ }
126
+ });
127
+ const stylePropsText = Object.freeze({
128
+ ...stylePropsView,
129
+ ...stylePropsTextOnly
130
+ });
131
+ const stylePropsAll = stylePropsText;
132
+ const validStylesPseudo = {
133
+ hoverStyle: true,
134
+ pressStyle: true,
135
+ focusStyle: true
136
+ };
137
+ const validStyles = {
138
+ ...validStylesPseudo,
139
+ ...stylePropsView
140
+ };
141
+ export {
142
+ stylePropsAll,
143
+ stylePropsText,
144
+ stylePropsTextOnly,
145
+ stylePropsTransform,
146
+ stylePropsView,
147
+ validStyles,
148
+ validStylesPseudo
149
+ };
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@tamagui/helpers",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.22",
4
4
  "source": "src/index.ts",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
7
- "typings": "types.d.ts",
5
+ "typings": "types",
6
+ "main": "dist/cjs",
7
+ "module": "dist/esm",
8
+ "module:jsx": "dist/jsx",
8
9
  "files": [
9
- "dist",
10
- "src"
10
+ "types",
11
+ "src",
12
+ "dist"
11
13
  ],
12
14
  "scripts": {
13
15
  "build": "tamagui-build",
14
16
  "watch": "tamagui-build --watch"
15
17
  },
16
18
  "devDependencies": {
17
- "@tamagui/build": "^1.0.0-alpha.2"
19
+ "@tamagui/build": "^1.0.0-alpha.22",
20
+ "react-native": "*"
18
21
  },
19
22
  "peerDependencies": {
20
23
  "react-native": "*"
@@ -22,5 +25,5 @@
22
25
  "publishConfig": {
23
26
  "access": "public"
24
27
  },
25
- "gitHead": "a9f30fdf4ebd448961a6e133741cd4b903185559"
28
+ "gitHead": "f247aca6f00c201efbc317bb24b22a62b08d1033"
26
29
  }
@@ -0,0 +1,2 @@
1
+ export declare const AllRules: Set<unknown>;
2
+ export declare const getStyleRules: () => Set<unknown>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allRules.d.ts","sourceRoot":"","sources":["allRules.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,cAAY,CAAA;AAEjC,eAAO,MAAM,aAAa,oBAAiB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export const AllRules = new Set();
2
+ export const getStyleRules = () => AllRules;
File without changes
@@ -0,0 +1 @@
1
+ export declare function concatClassName(_cn: any): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concatClassName.d.ts","sourceRoot":"","sources":["concatClassName.ts"],"names":[],"mappings":"AAUA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,UAoFvC"}
@@ -0,0 +1,65 @@
1
+ export function concatClassName(_cn) {
2
+ const classNamesOrPropObjects = arguments;
3
+ const usedPrefixes = [];
4
+ let final = '';
5
+ const len = classNamesOrPropObjects.length;
6
+ let propObjects = null;
7
+ for (let x = len; x >= 0; x--) {
8
+ const cns = classNamesOrPropObjects[x];
9
+ if (!cns)
10
+ continue;
11
+ if (!Array.isArray(cns) && typeof cns !== 'string') {
12
+ propObjects = propObjects || [];
13
+ propObjects.push(cns);
14
+ continue;
15
+ }
16
+ const names = Array.isArray(cns) ? cns : cns.split(' ');
17
+ const numNames = names.length;
18
+ for (let i = numNames - 1; i >= 0; i--) {
19
+ const name = names[i];
20
+ if (!name || name === ' ')
21
+ continue;
22
+ if (name[0] !== '_') {
23
+ final = name + ' ' + final;
24
+ continue;
25
+ }
26
+ const splitIndex = name.indexOf('-');
27
+ if (splitIndex < 1) {
28
+ final = name + ' ' + final;
29
+ continue;
30
+ }
31
+ const nextChar = name[splitIndex + 1];
32
+ const isMediaQuery = nextChar === '_';
33
+ const isPsuedoQuery = nextChar === '-';
34
+ const styleKey = name.slice(1, splitIndex);
35
+ const mediaKey = isMediaQuery || isPsuedoQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null;
36
+ const uid = mediaKey ? styleKey + mediaKey : styleKey;
37
+ if (!isMediaQuery && !isPsuedoQuery) {
38
+ if (usedPrefixes.indexOf(uid) > -1) {
39
+ continue;
40
+ }
41
+ usedPrefixes.push(uid);
42
+ }
43
+ const propName = styleKey;
44
+ if (propName && propObjects) {
45
+ if (propObjects.some((po) => {
46
+ if (mediaKey) {
47
+ const propKey = pseudoInvert[mediaKey];
48
+ return po && po[propKey] && propName in po[propKey] && po[propKey] !== null;
49
+ }
50
+ const res = po && propName in po && po[propName] !== null;
51
+ return res;
52
+ })) {
53
+ continue;
54
+ }
55
+ }
56
+ final = name + ' ' + final;
57
+ }
58
+ }
59
+ return final;
60
+ }
61
+ const pseudoInvert = {
62
+ hover: 'hoverStyle',
63
+ focus: 'focusStyle',
64
+ press: 'pressStyle',
65
+ };
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './concatClassName';
2
+ export * from './validStyleProps';
3
+ export * from './types';
4
+ export * from './allRules';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA"}
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './concatClassName';
2
+ export * from './validStyleProps';
3
+ export * from './types';
4
+ export * from './allRules';
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './concatClassName'
2
2
  export * from './validStyleProps'
3
3
  export * from './types'
4
- export * from './AllRules'
4
+ export * from './allRules'
package/src/types.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare type StyleObject = {
2
+ property: string;
3
+ value: string;
4
+ className: string;
5
+ identifier: string;
6
+ rules: string[];
7
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA"}
package/src/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};