@tamagui/helpers 1.0.1-rc.1.4 → 1.0.1-rc.2

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/index.js CHANGED
@@ -17,7 +17,6 @@ var src_exports = {};
17
17
  module.exports = __toCommonJS(src_exports);
18
18
  __reExport(src_exports, require("./clamp"), module.exports);
19
19
  __reExport(src_exports, require("./composeEventHandlers"), module.exports);
20
- __reExport(src_exports, require("./concatClassName"), module.exports);
21
20
  __reExport(src_exports, require("./validStyleProps"), module.exports);
22
21
  __reExport(src_exports, require("./types"), module.exports);
23
22
  __reExport(src_exports, require("@tamagui/simple-hash"), module.exports);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './clamp'\nexport * from './composeEventHandlers'\nexport * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,oBAAd;AACA,wBAAc,mCADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,8BAHd;AAIA,wBAAc,oBAJd;AAKA,wBAAc,iCALd;",
4
+ "sourcesContent": ["export * from './clamp'\nexport * from './composeEventHandlers'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,oBAAd;AACA,wBAAc,mCADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,oBAHd;AAIA,wBAAc,iCAJd;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from "./clamp";
2
2
  export * from "./composeEventHandlers";
3
- export * from "./concatClassName";
4
3
  export * from "./validStyleProps";
5
4
  export * from "./types";
6
5
  export * from "@tamagui/simple-hash";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './clamp'\nexport * from './composeEventHandlers'\nexport * from './concatClassName'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["export * from './clamp'\nexport * from './composeEventHandlers'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/helpers",
3
- "version": "1.0.1-rc.1.4",
3
+ "version": "1.0.1-rc.2",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -19,10 +19,10 @@
19
19
  "clean:build": "tamagui-build clean:build"
20
20
  },
21
21
  "dependencies": {
22
- "@tamagui/simple-hash": "^1.0.1-rc.1.4"
22
+ "@tamagui/simple-hash": "^1.0.1-rc.2"
23
23
  },
24
24
  "devDependencies": {
25
- "@tamagui/build": "^1.0.1-rc.1.4"
25
+ "@tamagui/build": "^1.0.1-rc.2"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './clamp'
2
2
  export * from './composeEventHandlers'
3
- export * from './concatClassName'
4
3
  export * from './validStyleProps'
5
4
  export * from './types'
6
5
  export * from '@tamagui/simple-hash'
package/types/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './clamp';
2
2
  export * from './composeEventHandlers';
3
- export * from './concatClassName';
4
3
  export * from './validStyleProps';
5
4
  export * from './types';
6
5
  export * from '@tamagui/simple-hash';
@@ -1,97 +0,0 @@
1
- // perf sensitive so doing some weird stuff
2
-
3
- /**
4
- * next - take objects:
5
- *
6
- * { _shorthand: 'postfix' }
7
- *
8
- */
9
-
10
- export function concatClassName(...args: any[]): any
11
- export function concatClassName(_cn: Record<string, any> | null | undefined): string {
12
- const args = arguments
13
- const usedPrefixes: string[] = []
14
- let final = ''
15
-
16
- const len = args.length
17
- let propObjects: any = null
18
- for (let x = len; x >= 0; x--) {
19
- const cns = args[x]
20
-
21
- if (!cns) continue
22
- if (!Array.isArray(cns) && typeof cns !== 'string') {
23
- // is prop object
24
- propObjects = propObjects || []
25
- propObjects.push(cns)
26
- continue
27
- }
28
-
29
- const names = Array.isArray(cns) ? cns : cns.split(' ')
30
- const numNames = names.length
31
- for (let i = numNames - 1; i >= 0; i--) {
32
- const name = names[i]
33
-
34
- if (!name || name === ' ') continue
35
- if (name[0] !== '_') {
36
- // not snack style (todo slightly stronger heuristic)
37
- final = name + ' ' + final
38
- continue
39
- }
40
-
41
- const splitIndex = name.indexOf('-')
42
- if (splitIndex < 1) {
43
- final = name + ' ' + final
44
- // if (shouldDebug) console.log('debug exclude:', name, final)
45
- continue
46
- }
47
-
48
- const nextChar = name[splitIndex + 1]
49
- // synced to static-ui constants
50
- // MEDIA_SEP
51
- const isMediaQuery = nextChar === '_'
52
- // PSEUDO_SEP
53
- // commenting out three things to make pseudos override properly
54
- // (leave in for a bit to see if other bugs pop up later):
55
- // 1. const isPseudoQuery = nextChar === '0'
56
- const styleKey = name.slice(1, name.lastIndexOf('-'))
57
- // 2. isMediaQuery || isPseudoQuery
58
- const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null
59
- const uid = mediaKey ? styleKey + mediaKey : styleKey
60
- // 3. && !isPseudoQuery
61
-
62
- if (usedPrefixes.indexOf(uid) > -1) {
63
- // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)
64
- continue
65
- }
66
- usedPrefixes.push(uid)
67
-
68
- // overrides for full safety
69
- const propName = styleKey
70
- if (propName && propObjects) {
71
- if (
72
- propObjects.some((po) => {
73
- if (mediaKey) {
74
- const propKey = pseudoInvert[mediaKey]
75
- return po && po[propKey] && propName in po[propKey] && po[propKey] !== null
76
- }
77
- const res = po && propName in po && po[propName] !== null
78
- return res
79
- })
80
- ) {
81
- // if (shouldDebug) console.log('debug exclude:', name)
82
- continue
83
- }
84
- }
85
-
86
- final = name + ' ' + final
87
- }
88
- }
89
-
90
- return final
91
- }
92
-
93
- const pseudoInvert = {
94
- hover: 'hoverStyle',
95
- focus: 'focusStyle',
96
- press: 'pressStyle',
97
- }