@tamagui/helpers 1.0.10 → 1.0.12

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 (52) hide show
  1. package/dist/cjs/clamp.js +0 -0
  2. package/dist/cjs/clamp.js.map +0 -0
  3. package/dist/cjs/composeEventHandlers.js +0 -0
  4. package/dist/cjs/composeEventHandlers.js.map +0 -0
  5. package/dist/cjs/concatClassName.js +4 -3
  6. package/dist/cjs/concatClassName.js.map +2 -2
  7. package/dist/cjs/index.js +1 -0
  8. package/dist/cjs/index.js.map +2 -2
  9. package/dist/cjs/types.js +0 -0
  10. package/dist/cjs/types.js.map +0 -0
  11. package/dist/cjs/validStyleProps.js +0 -0
  12. package/dist/cjs/validStyleProps.js.map +0 -0
  13. package/dist/esm/clamp.js +0 -0
  14. package/dist/esm/clamp.js.map +0 -0
  15. package/dist/esm/composeEventHandlers.js +0 -0
  16. package/dist/esm/composeEventHandlers.js.map +0 -0
  17. package/dist/esm/concatClassName.js +3 -3
  18. package/dist/esm/concatClassName.js.map +2 -2
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +2 -2
  21. package/dist/esm/types.js +0 -0
  22. package/dist/esm/types.js.map +0 -0
  23. package/dist/esm/validStyleProps.js +0 -0
  24. package/dist/esm/validStyleProps.js.map +0 -0
  25. package/package.json +3 -3
  26. package/src/concatClassName.ts +97 -0
  27. package/src/index.ts +1 -0
  28. package/types/index.d.ts +1 -0
  29. package/dist/cjs/log.js +0 -31
  30. package/dist/cjs/log.js.map +0 -7
  31. package/dist/cjs/simpleHash.js +0 -36
  32. package/dist/cjs/simpleHash.js.map +0 -7
  33. package/dist/esm/log.js +0 -8
  34. package/dist/esm/log.js.map +0 -7
  35. package/dist/esm/simpleHash.js +0 -13
  36. package/dist/esm/simpleHash.js.map +0 -7
  37. package/dist/jsx/clamp.js +0 -7
  38. package/dist/jsx/clamp.js.map +0 -7
  39. package/dist/jsx/composeEventHandlers.js +0 -12
  40. package/dist/jsx/composeEventHandlers.js.map +0 -7
  41. package/dist/jsx/concatClassName.js +0 -66
  42. package/dist/jsx/concatClassName.js.map +0 -7
  43. package/dist/jsx/index.js +0 -6
  44. package/dist/jsx/index.js.map +0 -7
  45. package/dist/jsx/log.js +0 -8
  46. package/dist/jsx/log.js.map +0 -7
  47. package/dist/jsx/simpleHash.js +0 -13
  48. package/dist/jsx/simpleHash.js.map +0 -7
  49. package/dist/jsx/types.js +0 -1
  50. package/dist/jsx/types.js.map +0 -7
  51. package/dist/jsx/validStyleProps.js +0 -173
  52. package/dist/jsx/validStyleProps.js.map +0 -7
package/dist/cjs/clamp.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -21,13 +22,13 @@ __export(concatClassName_exports, {
21
22
  });
22
23
  module.exports = __toCommonJS(concatClassName_exports);
23
24
  function concatClassName(_cn) {
24
- const cnOrPropObjcet = arguments;
25
+ const args = arguments;
25
26
  const usedPrefixes = [];
26
27
  let final = "";
27
- const len = cnOrPropObjcet.length;
28
+ const len = args.length;
28
29
  let propObjects = null;
29
30
  for (let x = len; x >= 0; x--) {
30
- const cns = cnOrPropObjcet[x];
31
+ const cns = args[x];
31
32
  if (!cns)
32
33
  continue;
33
34
  if (!Array.isArray(cns) && typeof cns !== "string") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/concatClassName.ts"],
4
- "sourcesContent": ["// perf sensitive so doing some weird stuff\n\nimport { ViewStyle } from 'react-native'\n\nexport function concatClassName(...args: any[]): any\nexport function concatClassName(_cn: ViewStyle | null | undefined): string {\n const cnOrPropObjcet = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = cnOrPropObjcet.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = cnOrPropObjcet[x]\n\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\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n\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\n const splitIndex = name.indexOf('-')\n if (splitIndex < 1) {\n final = name + ' ' + final\n // if (shouldDebug) console.log('debug exclude:', name, final)\n continue\n }\n\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n // commenting out three things to make pseudos override properly\n // (leave in for a bit to see if other bugs pop up later):\n // 1. const isPseudoQuery = nextChar === '0'\n const styleKey = name.slice(1, name.lastIndexOf('-'))\n // 2. isMediaQuery || isPseudoQuery\n const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n // 3. && !isPseudoQuery\n\n if (usedPrefixes.indexOf(uid) > -1) {\n // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)\n continue\n }\n usedPrefixes.push(uid)\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 // if (shouldDebug) console.log('debug exclude:', name)\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,yBAAyB,K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gBAAM,MAAM,MAAM,YAAY,MAAM,GAAG,cAAc;AACrD,iBAAO;AAAA,QACT,CAAC,GACD;AAEA;AAAA,QACF;AAAA,MACF;AAEA,cAAQ,OAAO,MAAM;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
4
+ "sourcesContent": ["// perf sensitive so doing some weird stuff\n\n/**\n * next - take objects:\n *\n * { _shorthand: 'postfix' }\n *\n */\n\nexport function concatClassName(...args: any[]): any\nexport function concatClassName(_cn: Record<string, any> | null | undefined): string {\n const args = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = args.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = args[x]\n\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\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n\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\n const splitIndex = name.indexOf('-')\n if (splitIndex < 1) {\n final = name + ' ' + final\n // if (shouldDebug) console.log('debug exclude:', name, final)\n continue\n }\n\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n // commenting out three things to make pseudos override properly\n // (leave in for a bit to see if other bugs pop up later):\n // 1. const isPseudoQuery = nextChar === '0'\n const styleKey = name.slice(1, name.lastIndexOf('-'))\n // 2. isMediaQuery || isPseudoQuery\n const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n // 3. && !isPseudoQuery\n\n if (usedPrefixes.indexOf(uid) > -1) {\n // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)\n continue\n }\n usedPrefixes.push(uid)\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 // if (shouldDebug) console.log('debug exclude:', name)\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,gBAAgB,KAAqD;AACnF,QAAM,OAAO;AACb,QAAM,eAAyB,CAAC;AAChC,MAAI,QAAQ;AAEZ,QAAM,MAAM,KAAK;AACjB,MAAI,cAAmB;AACvB,WAAS,IAAI,KAAK,KAAK,GAAG,KAAK;AAC7B,UAAM,MAAM,KAAK;AAEjB,QAAI,CAAC;AAAK;AACV,QAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,OAAO,QAAQ,UAAU;AAElD,oBAAc,eAAe,CAAC;AAC9B,kBAAY,KAAK,GAAG;AACpB;AAAA,IACF;AAEA,UAAM,QAAQ,MAAM,QAAQ,GAAG,IAAI,MAAM,IAAI,MAAM,GAAG;AACtD,UAAM,WAAW,MAAM;AACvB,aAAS,IAAI,WAAW,GAAG,KAAK,GAAG,KAAK;AACtC,YAAM,OAAO,MAAM;AAEnB,UAAI,CAAC,QAAQ,SAAS;AAAK;AAC3B,UAAI,KAAK,OAAO,KAAK;AAEnB,gBAAQ,OAAO,MAAM;AACrB;AAAA,MACF;AAEA,YAAM,aAAa,KAAK,QAAQ,GAAG;AACnC,UAAI,aAAa,GAAG;AAClB,gBAAQ,OAAO,MAAM;AAErB;AAAA,MACF;AAEA,YAAM,WAAW,KAAK,aAAa;AAGnC,YAAM,eAAe,aAAa;AAKlC,YAAM,WAAW,KAAK,MAAM,GAAG,KAAK,YAAY,GAAG,CAAC;AAEpD,YAAM,WAAW,eAAe,KAAK,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI;AAC7E,YAAM,MAAM,WAAW,WAAW,WAAW;AAG7C,UAAI,aAAa,QAAQ,GAAG,IAAI,IAAI;AAElC;AAAA,MACF;AACA,mBAAa,KAAK,GAAG;AAGrB,YAAM,WAAW;AACjB,UAAI,YAAY,aAAa;AAC3B,YACE,YAAY,KAAK,CAAC,OAAO;AACvB,cAAI,UAAU;AACZ,kBAAM,UAAU,aAAa;AAC7B,mBAAO,MAAM,GAAG,YAAY,YAAY,GAAG,YAAY,GAAG,aAAa;AAAA,UACzE;AACA,gBAAM,MAAM,MAAM,YAAY,MAAM,GAAG,cAAc;AACrD,iBAAO;AAAA,QACT,CAAC,GACD;AAEA;AAAA,QACF;AAAA,MACF;AAEA,cAAQ,OAAO,MAAM;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -17,6 +17,7 @@ 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);
20
21
  __reExport(src_exports, require("./validStyleProps"), module.exports);
21
22
  __reExport(src_exports, require("./types"), module.exports);
22
23
  __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 './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;",
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;",
6
6
  "names": []
7
7
  }
package/dist/cjs/types.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/dist/esm/clamp.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1,11 +1,11 @@
1
1
  function concatClassName(_cn) {
2
- const cnOrPropObjcet = arguments;
2
+ const args = arguments;
3
3
  const usedPrefixes = [];
4
4
  let final = "";
5
- const len = cnOrPropObjcet.length;
5
+ const len = args.length;
6
6
  let propObjects = null;
7
7
  for (let x = len; x >= 0; x--) {
8
- const cns = cnOrPropObjcet[x];
8
+ const cns = args[x];
9
9
  if (!cns)
10
10
  continue;
11
11
  if (!Array.isArray(cns) && typeof cns !== "string") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/concatClassName.ts"],
4
- "sourcesContent": ["// perf sensitive so doing some weird stuff\n\nimport { ViewStyle } from 'react-native'\n\nexport function concatClassName(...args: any[]): any\nexport function concatClassName(_cn: ViewStyle | null | undefined): string {\n const cnOrPropObjcet = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = cnOrPropObjcet.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = cnOrPropObjcet[x]\n\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\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n\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\n const splitIndex = name.indexOf('-')\n if (splitIndex < 1) {\n final = name + ' ' + final\n // if (shouldDebug) console.log('debug exclude:', name, final)\n continue\n }\n\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n // commenting out three things to make pseudos override properly\n // (leave in for a bit to see if other bugs pop up later):\n // 1. const isPseudoQuery = nextChar === '0'\n const styleKey = name.slice(1, name.lastIndexOf('-'))\n // 2. isMediaQuery || isPseudoQuery\n const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n // 3. && !isPseudoQuery\n\n if (usedPrefixes.indexOf(uid) > -1) {\n // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)\n continue\n }\n usedPrefixes.push(uid)\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 // if (shouldDebug) console.log('debug exclude:', name)\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n"],
5
- "mappings": "AAKO,yBAAyB,KAA2C;AACzE,QAAM,iBAAiB;AACvB,QAAM,eAAyB,CAAC;AAChC,MAAI,QAAQ;AAEZ,QAAM,MAAM,eAAe;AAC3B,MAAI,cAAmB;AACvB,WAAS,IAAI,KAAK,KAAK,GAAG,KAAK;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,SAAO;AACT;AAEA,MAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
4
+ "sourcesContent": ["// perf sensitive so doing some weird stuff\n\n/**\n * next - take objects:\n *\n * { _shorthand: 'postfix' }\n *\n */\n\nexport function concatClassName(...args: any[]): any\nexport function concatClassName(_cn: Record<string, any> | null | undefined): string {\n const args = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = args.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = args[x]\n\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\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n\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\n const splitIndex = name.indexOf('-')\n if (splitIndex < 1) {\n final = name + ' ' + final\n // if (shouldDebug) console.log('debug exclude:', name, final)\n continue\n }\n\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n // commenting out three things to make pseudos override properly\n // (leave in for a bit to see if other bugs pop up later):\n // 1. const isPseudoQuery = nextChar === '0'\n const styleKey = name.slice(1, name.lastIndexOf('-'))\n // 2. isMediaQuery || isPseudoQuery\n const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n // 3. && !isPseudoQuery\n\n if (usedPrefixes.indexOf(uid) > -1) {\n // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)\n continue\n }\n usedPrefixes.push(uid)\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 // if (shouldDebug) console.log('debug exclude:', name)\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n"],
5
+ "mappings": "AAUO,SAAS,gBAAgB,KAAqD;AACnF,QAAM,OAAO;AACb,QAAM,eAAyB,CAAC;AAChC,MAAI,QAAQ;AAEZ,QAAM,MAAM,KAAK;AACjB,MAAI,cAAmB;AACvB,WAAS,IAAI,KAAK,KAAK,GAAG,KAAK;AAC7B,UAAM,MAAM,KAAK;AAEjB,QAAI,CAAC;AAAK;AACV,QAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,OAAO,QAAQ,UAAU;AAElD,oBAAc,eAAe,CAAC;AAC9B,kBAAY,KAAK,GAAG;AACpB;AAAA,IACF;AAEA,UAAM,QAAQ,MAAM,QAAQ,GAAG,IAAI,MAAM,IAAI,MAAM,GAAG;AACtD,UAAM,WAAW,MAAM;AACvB,aAAS,IAAI,WAAW,GAAG,KAAK,GAAG,KAAK;AACtC,YAAM,OAAO,MAAM;AAEnB,UAAI,CAAC,QAAQ,SAAS;AAAK;AAC3B,UAAI,KAAK,OAAO,KAAK;AAEnB,gBAAQ,OAAO,MAAM;AACrB;AAAA,MACF;AAEA,YAAM,aAAa,KAAK,QAAQ,GAAG;AACnC,UAAI,aAAa,GAAG;AAClB,gBAAQ,OAAO,MAAM;AAErB;AAAA,MACF;AAEA,YAAM,WAAW,KAAK,aAAa;AAGnC,YAAM,eAAe,aAAa;AAKlC,YAAM,WAAW,KAAK,MAAM,GAAG,KAAK,YAAY,GAAG,CAAC;AAEpD,YAAM,WAAW,eAAe,KAAK,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI;AAC7E,YAAM,MAAM,WAAW,WAAW,WAAW;AAG7C,UAAI,aAAa,QAAQ,GAAG,IAAI,IAAI;AAElC;AAAA,MACF;AACA,mBAAa,KAAK,GAAG;AAGrB,YAAM,WAAW;AACjB,UAAI,YAAY,aAAa;AAC3B,YACE,YAAY,KAAK,CAAC,OAAO;AACvB,cAAI,UAAU;AACZ,kBAAM,UAAU,aAAa;AAC7B,mBAAO,MAAM,GAAG,YAAY,YAAY,GAAG,YAAY,GAAG,aAAa;AAAA,UACzE;AACA,gBAAM,MAAM,MAAM,YAAY,MAAM,GAAG,cAAc;AACrD,iBAAO;AAAA,QACT,CAAC,GACD;AAEA;AAAA,QACF;AAAA,MACF;AAEA,cAAQ,OAAO,MAAM;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./clamp";
2
2
  export * from "./composeEventHandlers";
3
+ export * from "./concatClassName";
3
4
  export * from "./validStyleProps";
4
5
  export * from "./types";
5
6
  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 './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
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;",
6
6
  "names": []
7
7
  }
package/dist/esm/types.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/helpers",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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.10"
22
+ "@tamagui/simple-hash": "^1.0.12"
23
23
  },
24
24
  "devDependencies": {
25
- "@tamagui/build": "^1.0.10"
25
+ "@tamagui/build": "^1.0.12"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
@@ -0,0 +1,97 @@
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
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './clamp'
2
2
  export * from './composeEventHandlers'
3
+ export * from './concatClassName'
3
4
  export * from './validStyleProps'
4
5
  export * from './types'
5
6
  export * from '@tamagui/simple-hash'
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './clamp';
2
2
  export * from './composeEventHandlers';
3
+ export * from './concatClassName';
3
4
  export * from './validStyleProps';
4
5
  export * from './types';
5
6
  export * from '@tamagui/simple-hash';
package/dist/cjs/log.js DELETED
@@ -1,31 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var log_exports = {};
19
- __export(log_exports, {
20
- log: () => log
21
- });
22
- module.exports = __toCommonJS(log_exports);
23
- const log = (...args) => {
24
- console.log(...args);
25
- return args[0];
26
- };
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- log
30
- });
31
- //# sourceMappingURL=log.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/log.ts"],
4
- "sourcesContent": ["export const log = (...args: any) => {\n console.log(...args)\n return args[0]\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,MAAM,IAAI,SAAc;AACnC,UAAQ,IAAI,GAAG,IAAI;AACnB,SAAO,KAAK;AACd;",
6
- "names": []
7
- }
@@ -1,36 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var simpleHash_exports = {};
19
- __export(simpleHash_exports, {
20
- simpleHash: () => simpleHash
21
- });
22
- module.exports = __toCommonJS(simpleHash_exports);
23
- const simpleHash = (str) => {
24
- let hash = 0;
25
- for (let i = 0; i < str.length; i++) {
26
- const char = str.charCodeAt(i);
27
- hash = (hash << 5) - hash + char;
28
- hash &= hash;
29
- }
30
- return new Uint32Array([hash])[0].toString(36);
31
- };
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- simpleHash
35
- });
36
- //# sourceMappingURL=simpleHash.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/simpleHash.ts"],
4
- "sourcesContent": ["export const simpleHash = (str: string) => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash &= hash // Convert to 32bit integer\n }\n return new Uint32Array([hash])[0].toString(36)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CAAC,QAAgB;AACzC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,UAAM,OAAO,IAAI,WAAW,CAAC;AAC7B,WAAQ,SAAQ,KAAK,OAAO;AAC5B,YAAQ;AAAA,EACV;AACA,SAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE;AAC/C;",
6
- "names": []
7
- }
package/dist/esm/log.js DELETED
@@ -1,8 +0,0 @@
1
- const log = (...args) => {
2
- console.log(...args);
3
- return args[0];
4
- };
5
- export {
6
- log
7
- };
8
- //# sourceMappingURL=log.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/log.ts"],
4
- "sourcesContent": ["export const log = (...args: any) => {\n console.log(...args)\n return args[0]\n}\n"],
5
- "mappings": "AAAO,MAAM,MAAM,IAAI,SAAc;AACnC,UAAQ,IAAI,GAAG,IAAI;AACnB,SAAO,KAAK;AACd;",
6
- "names": []
7
- }
@@ -1,13 +0,0 @@
1
- const simpleHash = (str) => {
2
- let hash = 0;
3
- for (let i = 0; i < str.length; i++) {
4
- const char = str.charCodeAt(i);
5
- hash = (hash << 5) - hash + char;
6
- hash &= hash;
7
- }
8
- return new Uint32Array([hash])[0].toString(36);
9
- };
10
- export {
11
- simpleHash
12
- };
13
- //# sourceMappingURL=simpleHash.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/simpleHash.ts"],
4
- "sourcesContent": ["export const simpleHash = (str: string) => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash &= hash // Convert to 32bit integer\n }\n return new Uint32Array([hash])[0].toString(36)\n}\n"],
5
- "mappings": "AAAO,MAAM,aAAa,CAAC,QAAgB;AACzC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,UAAM,OAAO,IAAI,WAAW,CAAC;AAC7B,WAAQ,SAAQ,KAAK,OAAO;AAC5B,YAAQ;AAAA,EACV;AACA,SAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE;AAC/C;",
6
- "names": []
7
- }
package/dist/jsx/clamp.js DELETED
@@ -1,7 +0,0 @@
1
- function clamp(value, [min, max]) {
2
- return Math.min(max, Math.max(min, value));
3
- }
4
- export {
5
- clamp
6
- };
7
- //# sourceMappingURL=clamp.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/clamp.ts"],
4
- "sourcesContent": ["export function clamp(value: number, [min, max]: [number, number]): number {\n return Math.min(max, Math.max(min, value))\n}\n"],
5
- "mappings": "AAAO,eAAe,OAAe,CAAC,KAAK,MAAgC;AACzE,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- function composeEventHandlers(og, next, { checkDefaultPrevented = true } = {}) {
2
- return function composedEventHandler(event) {
3
- og == null ? void 0 : og(event);
4
- if (!(checkDefaultPrevented && "defaultPrevented" in event) || "defaultPrevented" in event && !event.defaultPrevented) {
5
- return next == null ? void 0 : next(event);
6
- }
7
- };
8
- }
9
- export {
10
- composeEventHandlers
11
- };
12
- //# sourceMappingURL=composeEventHandlers.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/composeEventHandlers.ts"],
4
- "sourcesContent": ["type Events = Object\n\nexport type EventHandler<E extends Events> = (event: E) => void\n\nexport function composeEventHandlers<E extends Events>(\n og?: EventHandler<E>,\n next?: EventHandler<E>,\n { checkDefaultPrevented = true } = {},\n) {\n return function composedEventHandler(event: E) {\n og?.(event)\n if (\n !(checkDefaultPrevented && 'defaultPrevented' in event) ||\n // @ts-ignore\n ('defaultPrevented' in event && !event.defaultPrevented)\n ) {\n return next?.(event)\n }\n }\n}\n"],
5
- "mappings": "AAIO,8BACL,IACA,MACA,EAAE,wBAAwB,SAAS,CAAC,GACpC;AACA,SAAO,8BAA8B,OAAU;AAC7C,6BAAK;AACL,QACE,CAAE,0BAAyB,sBAAsB,UAEhD,sBAAsB,SAAS,CAAC,MAAM,kBACvC;AACA,aAAO,6BAAO;AAAA,IAChB;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,66 +0,0 @@
1
- function concatClassName(_cn) {
2
- const cnOrPropObjcet = arguments;
3
- const usedPrefixes = [];
4
- let final = "";
5
- const len = cnOrPropObjcet.length;
6
- let propObjects = null;
7
- for (let x = len; x >= 0; x--) {
8
- const cns = cnOrPropObjcet[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 styleKey = name.slice(1, name.lastIndexOf("-"));
34
- const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null;
35
- const uid = mediaKey ? styleKey + mediaKey : styleKey;
36
- if (usedPrefixes.indexOf(uid) > -1) {
37
- continue;
38
- }
39
- usedPrefixes.push(uid);
40
- const propName = styleKey;
41
- if (propName && propObjects) {
42
- if (propObjects.some((po) => {
43
- if (mediaKey) {
44
- const propKey = pseudoInvert[mediaKey];
45
- return po && po[propKey] && propName in po[propKey] && po[propKey] !== null;
46
- }
47
- const res = po && propName in po && po[propName] !== null;
48
- return res;
49
- })) {
50
- continue;
51
- }
52
- }
53
- final = name + " " + final;
54
- }
55
- }
56
- return final;
57
- }
58
- const pseudoInvert = {
59
- hover: "hoverStyle",
60
- focus: "focusStyle",
61
- press: "pressStyle"
62
- };
63
- export {
64
- concatClassName
65
- };
66
- //# sourceMappingURL=concatClassName.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/concatClassName.ts"],
4
- "sourcesContent": ["// perf sensitive so doing some weird stuff\n\nimport { ViewStyle } from 'react-native'\n\nexport function concatClassName(...args: any[]): any\nexport function concatClassName(_cn: ViewStyle | null | undefined): string {\n const cnOrPropObjcet = arguments\n const usedPrefixes: string[] = []\n let final = ''\n\n const len = cnOrPropObjcet.length\n let propObjects: any = null\n for (let x = len; x >= 0; x--) {\n const cns = cnOrPropObjcet[x]\n\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\n const names = Array.isArray(cns) ? cns : cns.split(' ')\n const numNames = names.length\n for (let i = numNames - 1; i >= 0; i--) {\n const name = names[i]\n\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\n const splitIndex = name.indexOf('-')\n if (splitIndex < 1) {\n final = name + ' ' + final\n // if (shouldDebug) console.log('debug exclude:', name, final)\n continue\n }\n\n const nextChar = name[splitIndex + 1]\n // synced to static-ui constants\n // MEDIA_SEP\n const isMediaQuery = nextChar === '_'\n // PSEUDO_SEP\n // commenting out three things to make pseudos override properly\n // (leave in for a bit to see if other bugs pop up later):\n // 1. const isPseudoQuery = nextChar === '0'\n const styleKey = name.slice(1, name.lastIndexOf('-'))\n // 2. isMediaQuery || isPseudoQuery\n const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null\n const uid = mediaKey ? styleKey + mediaKey : styleKey\n // 3. && !isPseudoQuery\n\n if (usedPrefixes.indexOf(uid) > -1) {\n // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)\n continue\n }\n usedPrefixes.push(uid)\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 // if (shouldDebug) console.log('debug exclude:', name)\n continue\n }\n }\n\n final = name + ' ' + final\n }\n }\n\n return final\n}\n\nconst pseudoInvert = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n"],
5
- "mappings": "AAKO,yBAAyB,KAA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AAM,MAAM,MAAM,YAAY,MAAM,GAAG,cAAc;AACrD,iBAAO;AAAA,QACT,CAAC,GACD;AAEA;AAAA,QACF;AAAA,MACF;AAEA,cAAQ,OAAO,MAAM;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
6
- "names": []
7
- }
package/dist/jsx/index.js DELETED
@@ -1,6 +0,0 @@
1
- export * from "./clamp";
2
- export * from "./composeEventHandlers";
3
- export * from "./validStyleProps";
4
- export * from "./types";
5
- export * from "@tamagui/simple-hash";
6
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './clamp'\nexport * from './composeEventHandlers'\nexport * from './validStyleProps'\nexport * from './types'\nexport * from '@tamagui/simple-hash'\n"],
5
- "mappings": "AAAA;AACA;AACA;AACA;AACA;",
6
- "names": []
7
- }
package/dist/jsx/log.js DELETED
@@ -1,8 +0,0 @@
1
- const log = (...args) => {
2
- console.log(...args);
3
- return args[0];
4
- };
5
- export {
6
- log
7
- };
8
- //# sourceMappingURL=log.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/log.ts"],
4
- "sourcesContent": ["export const log = (...args: any) => {\n console.log(...args)\n return args[0]\n}\n"],
5
- "mappings": "AAAO,MAAM,MAAM,IAAI,SAAc;AACnC,UAAQ,IAAI,GAAG,IAAI;AACnB,SAAO,KAAK;AACd;",
6
- "names": []
7
- }
@@ -1,13 +0,0 @@
1
- const simpleHash = (str) => {
2
- let hash = 0;
3
- for (let i = 0; i < str.length; i++) {
4
- const char = str.charCodeAt(i);
5
- hash = (hash << 5) - hash + char;
6
- hash &= hash;
7
- }
8
- return new Uint32Array([hash])[0].toString(36);
9
- };
10
- export {
11
- simpleHash
12
- };
13
- //# sourceMappingURL=simpleHash.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/simpleHash.ts"],
4
- "sourcesContent": ["export const simpleHash = (str: string) => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash &= hash // Convert to 32bit integer\n }\n return new Uint32Array([hash])[0].toString(36)\n}\n"],
5
- "mappings": "AAAO,MAAM,aAAa,CAAC,QAAgB;AACzC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,UAAM,OAAO,IAAI,WAAW,CAAC;AAC7B,WAAQ,SAAQ,KAAK,OAAO;AAC5B,YAAQ;AAAA,EACV;AACA,SAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE;AAC/C;",
6
- "names": []
7
- }
package/dist/jsx/types.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,173 +0,0 @@
1
- const stylePropsTransform = Object.freeze({
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 validStylesOnBaseProps = Object.freeze({
17
- placeholderTextColor: true
18
- });
19
- const stylePropsView = Object.freeze({
20
- backfaceVisibility: true,
21
- backgroundColor: true,
22
- borderBottomColor: true,
23
- borderBottomStyle: true,
24
- borderTopStyle: true,
25
- borderLeftStyle: true,
26
- borderRightStyle: true,
27
- borderBottomEndRadius: true,
28
- borderBottomLeftRadius: true,
29
- borderBottomRightRadius: true,
30
- borderBottomStartRadius: true,
31
- borderBottomWidth: true,
32
- borderColor: true,
33
- borderEndColor: true,
34
- borderLeftColor: true,
35
- borderLeftWidth: true,
36
- borderRadius: true,
37
- borderRightColor: true,
38
- borderRightWidth: true,
39
- borderStartColor: true,
40
- borderStyle: true,
41
- borderTopColor: true,
42
- borderTopEndRadius: true,
43
- borderTopLeftRadius: true,
44
- borderTopRightRadius: true,
45
- borderTopStartRadius: true,
46
- borderTopWidth: true,
47
- borderWidth: true,
48
- opacity: true,
49
- transform: true,
50
- alignContent: true,
51
- alignItems: true,
52
- alignSelf: true,
53
- aspectRatio: true,
54
- borderEndWidth: true,
55
- borderStartWidth: true,
56
- bottom: true,
57
- display: true,
58
- end: true,
59
- flex: true,
60
- flexBasis: true,
61
- flexDirection: true,
62
- flexGrow: true,
63
- flexShrink: true,
64
- flexWrap: true,
65
- height: true,
66
- justifyContent: true,
67
- left: true,
68
- margin: true,
69
- marginBottom: true,
70
- marginEnd: true,
71
- marginHorizontal: true,
72
- marginLeft: true,
73
- marginRight: true,
74
- marginStart: true,
75
- marginTop: true,
76
- marginVertical: true,
77
- maxHeight: true,
78
- maxWidth: true,
79
- minHeight: true,
80
- minWidth: true,
81
- overflow: true,
82
- padding: true,
83
- paddingBottom: true,
84
- paddingEnd: true,
85
- paddingHorizontal: true,
86
- paddingLeft: true,
87
- paddingRight: true,
88
- paddingStart: true,
89
- paddingTop: true,
90
- paddingVertical: true,
91
- position: true,
92
- right: true,
93
- start: true,
94
- top: true,
95
- width: true,
96
- zIndex: true,
97
- direction: true,
98
- shadowColor: true,
99
- shadowOffset: true,
100
- shadowOpacity: true,
101
- shadowRadius: true,
102
- ...validStylesOnBaseProps,
103
- ...stylePropsTransform,
104
- ...process.env.TAMAGUI_TARGET === "web" && {
105
- overflowX: true,
106
- overflowY: true,
107
- userSelect: true,
108
- cursor: true,
109
- contain: true,
110
- pointerEvents: true,
111
- boxSizing: true,
112
- boxShadow: true,
113
- outlineColor: true,
114
- outlineStyle: true,
115
- outlineOffset: true,
116
- outlineWidth: true
117
- }
118
- });
119
- const stylePropsTextOnly = Object.freeze({
120
- color: true,
121
- fontFamily: true,
122
- fontSize: true,
123
- fontStyle: true,
124
- fontWeight: true,
125
- letterSpacing: true,
126
- lineHeight: true,
127
- textAlign: true,
128
- textDecorationLine: true,
129
- textDecorationStyle: true,
130
- textDecorationColor: true,
131
- textShadowColor: true,
132
- textShadowOffset: true,
133
- textShadowRadius: true,
134
- textTransform: true,
135
- ...process.env.TAMAGUI_TARGET === "web" && {
136
- whiteSpace: true,
137
- wordWrap: true,
138
- textOverflow: true,
139
- textDecorationDistance: true,
140
- userSelect: true,
141
- selectable: true,
142
- cursor: true,
143
- WebkitLineClamp: true,
144
- WebkitBoxOrient: true
145
- }
146
- });
147
- const stylePropsText = Object.freeze({
148
- ...stylePropsView,
149
- ...stylePropsTextOnly
150
- });
151
- const stylePropsAll = stylePropsText;
152
- const validPseudoKeys = Object.freeze({
153
- enterStyle: true,
154
- exitStyle: true,
155
- hoverStyle: true,
156
- pressStyle: true,
157
- focusStyle: true
158
- });
159
- const validStyles = Object.freeze({
160
- ...validPseudoKeys,
161
- ...stylePropsView
162
- });
163
- export {
164
- stylePropsAll,
165
- stylePropsText,
166
- stylePropsTextOnly,
167
- stylePropsTransform,
168
- stylePropsView,
169
- validPseudoKeys,
170
- validStyles,
171
- validStylesOnBaseProps
172
- };
173
- //# sourceMappingURL=validStyleProps.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/validStyleProps.ts"],
4
- "sourcesContent": ["// flat transform props\nexport const stylePropsTransform = Object.freeze({\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 validStylesOnBaseProps = Object.freeze({\n placeholderTextColor: true,\n})\n\nexport const stylePropsView = Object.freeze({\n backfaceVisibility: true,\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomStyle: true,\n borderTopStyle: true,\n borderLeftStyle: true,\n borderRightStyle: 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 ...validStylesOnBaseProps,\n ...stylePropsTransform,\n\n // allow a few web only ones\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n overflowX: true,\n overflowY: true,\n userSelect: true,\n cursor: true,\n contain: true,\n pointerEvents: true,\n boxSizing: true,\n boxShadow: true,\n outlineColor: true,\n outlineStyle: true,\n outlineOffset: true,\n outlineWidth: 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 some web only ones\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n userSelect: true,\n selectable: true,\n cursor: true,\n WebkitLineClamp: true,\n WebkitBoxOrient: true,\n }),\n})\n\nexport const stylePropsText = Object.freeze({\n ...stylePropsView,\n ...stylePropsTextOnly,\n})\n\nexport const stylePropsAll = stylePropsText\n\nexport const validPseudoKeys = Object.freeze({\n enterStyle: true,\n exitStyle: true,\n hoverStyle: true,\n pressStyle: true,\n focusStyle: true,\n})\n\nexport const validStyles = Object.freeze({\n ...validPseudoKeys,\n ...stylePropsView,\n})\n"],
5
- "mappings": "AACO,MAAM,sBAAsB,OAAO,OAAO;AAAA,EAC/C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACX,CAAC;AAEM,MAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD,sBAAsB;AACxB,CAAC;AAEM,MAAM,iBAAiB,OAAO,OAAO;AAAA,EAC1C,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,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