@tamagui/helpers 1.0.0-beta.9 → 1.0.1-beta.101

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 (70) hide show
  1. package/dist/cjs/clamp.js +30 -0
  2. package/dist/cjs/clamp.js.map +7 -0
  3. package/dist/cjs/composeEventHandlers.js +2 -4
  4. package/dist/cjs/composeEventHandlers.js.map +1 -1
  5. package/dist/cjs/concatClassName.js +0 -2
  6. package/dist/cjs/concatClassName.js.map +2 -2
  7. package/dist/cjs/index.js +2 -0
  8. package/dist/cjs/index.js.map +2 -2
  9. package/dist/cjs/log.js +2 -3
  10. package/dist/cjs/log.js.map +1 -1
  11. package/dist/cjs/simpleHash.js +2 -3
  12. package/dist/cjs/simpleHash.js.map +1 -1
  13. package/dist/cjs/types.js.map +1 -1
  14. package/dist/cjs/validStyleProps.js +4 -20
  15. package/dist/cjs/validStyleProps.js.map +2 -2
  16. package/dist/esm/clamp.js +7 -0
  17. package/dist/esm/clamp.js.map +7 -0
  18. package/dist/esm/composeEventHandlers.js +2 -5
  19. package/dist/esm/composeEventHandlers.js.map +1 -1
  20. package/dist/esm/concatClassName.js +0 -3
  21. package/dist/esm/concatClassName.js.map +2 -2
  22. package/dist/esm/index.js +2 -0
  23. package/dist/esm/index.js.map +2 -2
  24. package/dist/esm/log.js +2 -4
  25. package/dist/esm/log.js.map +1 -1
  26. package/dist/esm/simpleHash.js +2 -4
  27. package/dist/esm/simpleHash.js.map +1 -1
  28. package/dist/esm/validStyleProps.js +40 -47
  29. package/dist/esm/validStyleProps.js.map +2 -2
  30. package/dist/jsx/clamp.js +7 -0
  31. package/dist/jsx/clamp.js.map +7 -0
  32. package/dist/jsx/composeEventHandlers.js +3 -5
  33. package/dist/jsx/composeEventHandlers.js.map +7 -0
  34. package/dist/jsx/concatClassName.js +1 -3
  35. package/dist/jsx/concatClassName.js.map +7 -0
  36. package/dist/jsx/index.js +3 -0
  37. package/dist/jsx/index.js.map +7 -0
  38. package/dist/jsx/log.js +3 -4
  39. package/dist/jsx/log.js.map +7 -0
  40. package/dist/jsx/simpleHash.js +3 -4
  41. package/dist/jsx/simpleHash.js.map +7 -0
  42. package/dist/jsx/types.js +1 -0
  43. package/dist/jsx/types.js.map +7 -0
  44. package/dist/jsx/validStyleProps.js +5 -18
  45. package/dist/jsx/validStyleProps.js.map +7 -0
  46. package/package.json +6 -3
  47. package/src/clamp.ts +3 -0
  48. package/src/composeEventHandlers.ts +17 -0
  49. package/src/concatClassName.ts +92 -0
  50. package/src/index.ts +7 -0
  51. package/src/log.ts +4 -0
  52. package/src/simpleHash.ts +9 -0
  53. package/src/types.ts +7 -0
  54. package/src/validStyleProps.ts +163 -0
  55. package/types/clamp.d.ts +2 -0
  56. package/types/clamp.d.ts.map +1 -0
  57. package/types/composeEventHandlers.d.ts +0 -0
  58. package/types/composeEventHandlers.d.ts.map +0 -0
  59. package/types/concatClassName.d.ts +0 -0
  60. package/types/concatClassName.d.ts.map +0 -0
  61. package/types/index.d.ts +2 -0
  62. package/types/index.d.ts.map +1 -1
  63. package/types/log.d.ts +0 -0
  64. package/types/log.d.ts.map +0 -0
  65. package/types/simpleHash.d.ts +0 -0
  66. package/types/simpleHash.d.ts.map +0 -0
  67. package/types/types.d.ts +1 -1
  68. package/types/types.d.ts.map +1 -1
  69. package/types/validStyleProps.d.ts +497 -502
  70. package/types/validStyleProps.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/validStyleProps.ts"],
4
- "sourcesContent": ["import { ViewStyle } from 'react-native'\n\n// 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 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 ...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 }),\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 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\nexport const mapTransformKeys = {\n x: 'translateX',\n y: 'translateY',\n}\n\nexport const invertMapTransformKeys = {\n translateX: 'x',\n translateY: 'y',\n}\n\nexport const mergeTransform = (obj: ViewStyle, key: string, val: any) => {\n obj.transform ||= []\n // @ts-ignore\n obj.transform.push({ [mapTransformKeys[key] || key]: val })\n}\n"],
5
- "mappings": ";;AAGO,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,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,mB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,MAAM,IAAI,CAAC;AAC5D,GAJ8B;",
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 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 ...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 }),\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 }),\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,iBAAiB,OAAO,OAAO;AAAA,EAC1C,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iB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AO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,GACX,sBAGC,QAAQ,IAAI,mBAAmB,SAAS;AAAA,EAC1C,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,eAAe;AAAA,EACf,WAAW;AAAA,EACX,WAAW;AACb,EACD;AAEM,MAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,eAAe;AAAA,GAGX,QAAQ,IAAI,mBAAmB,SAAS;AAAA,EAC1C,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,wBAAwB;AAAA,EACxB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,QAAQ;AACV,EACD;AAEM,MAAM,iBAAiB,OAAO,OAAO,kCACvC,iBACA,mBACJ;AAEM,MAAM,gBAAgB;AAEtB,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd,CAAC;AAEM,MAAM,cAAc,OAAO,OAAO,kCACpC,kBACA,eACJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,7 @@
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,14 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  function composeEventHandlers(og, next, { checkDefaultPrevented = true } = {}) {
4
- return /* @__PURE__ */ __name(function composedEventHandler(event) {
2
+ return function composedEventHandler(event) {
5
3
  og == null ? void 0 : og(event);
6
4
  if (!checkDefaultPrevented || !event.defaultPrevented) {
7
5
  return next == null ? void 0 : next(event);
8
6
  }
9
- }, "composedEventHandler");
7
+ };
10
8
  }
11
- __name(composeEventHandlers, "composeEventHandlers");
12
9
  export {
13
10
  composeEventHandlers
14
11
  };
12
+ //# sourceMappingURL=composeEventHandlers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/composeEventHandlers.ts"],
4
+ "sourcesContent": ["import { FocusEvent } from 'react'\nimport { GestureResponderEvent } from 'react-native'\n\nexport type EventHandler<E extends Event | GestureResponderEvent | FocusEvent> = (event: E) => void\n\nexport function composeEventHandlers<E extends Event | GestureResponderEvent | FocusEvent>(\n og?: EventHandler<E>,\n next?: EventHandler<E>,\n { checkDefaultPrevented = true } = {}\n) {\n return function composedEventHandler(event: E) {\n og?.(event)\n if (!checkDefaultPrevented || !event.defaultPrevented) {\n return next?.(event)\n }\n }\n}\n"],
5
+ "mappings": "AAKO,8BACL,IACA,MACA,EAAE,wBAAwB,SAAS,CAAC,GACpC;AACA,SAAO,8BAA8B,OAAU;AAC7C,6BAAK;AACL,QAAI,CAAC,yBAAyB,CAAC,MAAM,kBAAkB;AACrD,aAAO,6BAAO;AAAA,IAChB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1,5 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  function concatClassName(_cn) {
4
2
  const cnOrPropObjcet = arguments;
5
3
  const usedPrefixes = [];
@@ -57,7 +55,6 @@ function concatClassName(_cn) {
57
55
  }
58
56
  return final;
59
57
  }
60
- __name(concatClassName, "concatClassName");
61
58
  const pseudoInvert = {
62
59
  hover: "hoverStyle",
63
60
  focus: "focusStyle",
@@ -66,3 +63,4 @@ const pseudoInvert = {
66
63
  export {
67
64
  concatClassName
68
65
  };
66
+ //# sourceMappingURL=concatClassName.js.map
@@ -0,0 +1,7 @@
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,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;AAC7B,UAAM,MAAM,eAAe;AAE3B,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
+ "names": []
7
+ }
package/dist/jsx/index.js CHANGED
@@ -1,5 +1,8 @@
1
+ export * from "./clamp";
1
2
  export * from "./composeEventHandlers";
2
3
  export * from "./concatClassName";
3
4
  export * from "./validStyleProps";
4
5
  export * from "./types";
5
6
  export * from "./log";
7
+ export * from "./simpleHash";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 './log'\nexport * from './simpleHash'\n"],
5
+ "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
package/dist/jsx/log.js CHANGED
@@ -1,9 +1,8 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const log = /* @__PURE__ */ __name((...args) => {
1
+ const log = (...args) => {
4
2
  console.log(...args);
5
3
  return args[0];
6
- }, "log");
4
+ };
7
5
  export {
8
6
  log
9
7
  };
8
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1,7 @@
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,6 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const simpleHash = /* @__PURE__ */ __name((str) => {
1
+ const simpleHash = (str) => {
4
2
  let hash = 0;
5
3
  for (let i = 0; i < str.length; i++) {
6
4
  const char = str.charCodeAt(i);
@@ -8,7 +6,8 @@ const simpleHash = /* @__PURE__ */ __name((str) => {
8
6
  hash &= hash;
9
7
  }
10
8
  return new Uint32Array([hash])[0].toString(36);
11
- }, "simpleHash");
9
+ };
12
10
  export {
13
11
  simpleHash
14
12
  };
13
+ //# sourceMappingURL=simpleHash.js.map
@@ -0,0 +1,7 @@
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 CHANGED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,5 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  const stylePropsTransform = Object.freeze({
4
2
  x: true,
5
3
  y: true,
@@ -130,7 +128,10 @@ const stylePropsTextOnly = Object.freeze({
130
128
  whiteSpace: true,
131
129
  wordWrap: true,
132
130
  textOverflow: true,
133
- textDecorationDistance: true
131
+ textDecorationDistance: true,
132
+ userSelect: true,
133
+ selectable: true,
134
+ cursor: true
134
135
  }
135
136
  });
136
137
  const stylePropsText = Object.freeze({
@@ -149,22 +150,7 @@ const validStyles = Object.freeze({
149
150
  ...validPseudoKeys,
150
151
  ...stylePropsView
151
152
  });
152
- const mapTransformKeys = {
153
- x: "translateX",
154
- y: "translateY"
155
- };
156
- const invertMapTransformKeys = {
157
- translateX: "x",
158
- translateY: "y"
159
- };
160
- const mergeTransform = /* @__PURE__ */ __name((obj, key, val) => {
161
- obj.transform || (obj.transform = []);
162
- obj.transform.push({ [mapTransformKeys[key] || key]: val });
163
- }, "mergeTransform");
164
153
  export {
165
- invertMapTransformKeys,
166
- mapTransformKeys,
167
- mergeTransform,
168
154
  stylePropsAll,
169
155
  stylePropsText,
170
156
  stylePropsTextOnly,
@@ -173,3 +159,4 @@ export {
173
159
  validPseudoKeys,
174
160
  validStyles
175
161
  };
162
+ //# 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 = 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 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 ...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 }),\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 }),\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,QAA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OAAO;AAAA,EAC3C,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd,CAAC;AAEM,MAAM,cAAc,OAAO,OAAO;AAAA,EACvC,GAAG;AAAA,EACH,GAAG;AACL,CAAC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@tamagui/helpers",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.1-beta.101",
4
4
  "source": "src/index.ts",
5
- "types": "types",
5
+ "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
7
7
  "module": "dist/esm",
8
8
  "module:jsx": "dist/jsx",
9
9
  "files": [
10
+ "src",
10
11
  "types",
11
12
  "dist"
12
13
  ],
@@ -17,10 +18,12 @@
17
18
  "clean:build": "tamagui-build clean:build"
18
19
  },
19
20
  "devDependencies": {
20
- "@tamagui/build": "^1.0.0-beta.9",
21
+ "@tamagui/build": "^1.0.1-beta.101",
22
+ "react": "*",
21
23
  "react-native": "*"
22
24
  },
23
25
  "peerDependencies": {
26
+ "react": "*",
24
27
  "react-native": "*"
25
28
  },
26
29
  "publishConfig": {
package/src/clamp.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function clamp(value: number, [min, max]: [number, number]): number {
2
+ return Math.min(max, Math.max(min, value))
3
+ }
@@ -0,0 +1,17 @@
1
+ import { FocusEvent } from 'react'
2
+ import { GestureResponderEvent } from 'react-native'
3
+
4
+ export type EventHandler<E extends Event | GestureResponderEvent | FocusEvent> = (event: E) => void
5
+
6
+ export function composeEventHandlers<E extends Event | GestureResponderEvent | FocusEvent>(
7
+ og?: EventHandler<E>,
8
+ next?: EventHandler<E>,
9
+ { checkDefaultPrevented = true } = {}
10
+ ) {
11
+ return function composedEventHandler(event: E) {
12
+ og?.(event)
13
+ if (!checkDefaultPrevented || !event.defaultPrevented) {
14
+ return next?.(event)
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,92 @@
1
+ // perf sensitive so doing some weird stuff
2
+
3
+ import { ViewStyle } from 'react-native'
4
+
5
+ export function concatClassName(...args: any[]): any
6
+ export function concatClassName(_cn: ViewStyle | null | undefined): string {
7
+ const cnOrPropObjcet = arguments
8
+ const usedPrefixes: string[] = []
9
+ let final = ''
10
+
11
+ const len = cnOrPropObjcet.length
12
+ let propObjects: any = null
13
+ for (let x = len; x >= 0; x--) {
14
+ const cns = cnOrPropObjcet[x]
15
+
16
+ if (!cns) continue
17
+ if (!Array.isArray(cns) && typeof cns !== 'string') {
18
+ // is prop object
19
+ propObjects = propObjects || []
20
+ propObjects.push(cns)
21
+ continue
22
+ }
23
+
24
+ const names = Array.isArray(cns) ? cns : cns.split(' ')
25
+ const numNames = names.length
26
+ for (let i = numNames - 1; i >= 0; i--) {
27
+ const name = names[i]
28
+
29
+ if (!name || name === ' ') continue
30
+ if (name[0] !== '_') {
31
+ // not snack style (todo slightly stronger heuristic)
32
+ final = name + ' ' + final
33
+ continue
34
+ }
35
+
36
+ const splitIndex = name.indexOf('-')
37
+ if (splitIndex < 1) {
38
+ final = name + ' ' + final
39
+ // if (shouldDebug) console.log('debug exclude:', name, final)
40
+ continue
41
+ }
42
+
43
+ const nextChar = name[splitIndex + 1]
44
+ // synced to static-ui constants
45
+ // MEDIA_SEP
46
+ const isMediaQuery = nextChar === '_'
47
+ // PSEUDO_SEP
48
+ // commenting out three things to make pseudos override properly
49
+ // (leave in for a bit to see if other bugs pop up later):
50
+ // 1. const isPseudoQuery = nextChar === '0'
51
+ const styleKey = name.slice(1, name.lastIndexOf('-'))
52
+ // 2. isMediaQuery || isPseudoQuery
53
+ const mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null
54
+ const uid = mediaKey ? styleKey + mediaKey : styleKey
55
+ // 3. && !isPseudoQuery
56
+
57
+ if (usedPrefixes.indexOf(uid) > -1) {
58
+ // if (shouldDebug) console.log('debug exclude:', usedPrefixes, name)
59
+ continue
60
+ }
61
+ usedPrefixes.push(uid)
62
+
63
+ // overrides for full safety
64
+ const propName = styleKey
65
+ if (propName && propObjects) {
66
+ if (
67
+ propObjects.some((po) => {
68
+ if (mediaKey) {
69
+ const propKey = pseudoInvert[mediaKey]
70
+ return po && po[propKey] && propName in po[propKey] && po[propKey] !== null
71
+ }
72
+ const res = po && propName in po && po[propName] !== null
73
+ return res
74
+ })
75
+ ) {
76
+ // if (shouldDebug) console.log('debug exclude:', name)
77
+ continue
78
+ }
79
+ }
80
+
81
+ final = name + ' ' + final
82
+ }
83
+ }
84
+
85
+ return final
86
+ }
87
+
88
+ const pseudoInvert = {
89
+ hover: 'hoverStyle',
90
+ focus: 'focusStyle',
91
+ press: 'pressStyle',
92
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './clamp'
2
+ export * from './composeEventHandlers'
3
+ export * from './concatClassName'
4
+ export * from './validStyleProps'
5
+ export * from './types'
6
+ export * from './log'
7
+ export * from './simpleHash'
package/src/log.ts ADDED
@@ -0,0 +1,4 @@
1
+ export const log = (...args: any) => {
2
+ console.log(...args)
3
+ return args[0]
4
+ }
@@ -0,0 +1,9 @@
1
+ export const simpleHash = (str: string) => {
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 // Convert to 32bit integer
7
+ }
8
+ return new Uint32Array([hash])[0].toString(36)
9
+ }
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ export type StyleObject = {
2
+ property: string
3
+ pseudo?: 'hover' | 'focus' | 'active'
4
+ value: string
5
+ identifier: string
6
+ rules: string[]
7
+ }
@@ -0,0 +1,163 @@
1
+ // flat transform props
2
+ export const stylePropsTransform = Object.freeze({
3
+ x: true,
4
+ y: true,
5
+ scale: true,
6
+ perspective: true,
7
+ scaleX: true,
8
+ scaleY: true,
9
+ skewX: true,
10
+ skewY: true,
11
+ matrix: true,
12
+ rotate: true,
13
+ rotateY: true,
14
+ rotateX: true,
15
+ rotateZ: true,
16
+ })
17
+
18
+ export const stylePropsView = Object.freeze({
19
+ backfaceVisibility: true,
20
+ backgroundColor: true,
21
+ borderBottomColor: true,
22
+ borderBottomStyle: true,
23
+ borderTopStyle: true,
24
+ borderLeftStyle: true,
25
+ borderRightStyle: true,
26
+ borderBottomEndRadius: true,
27
+ borderBottomLeftRadius: true,
28
+ borderBottomRightRadius: true,
29
+ borderBottomStartRadius: true,
30
+ borderBottomWidth: true,
31
+ borderColor: true,
32
+ borderEndColor: true,
33
+ borderLeftColor: true,
34
+ borderLeftWidth: true,
35
+ borderRadius: true,
36
+ borderRightColor: true,
37
+ borderRightWidth: true,
38
+ borderStartColor: true,
39
+ borderStyle: true,
40
+ borderTopColor: true,
41
+ borderTopEndRadius: true,
42
+ borderTopLeftRadius: true,
43
+ borderTopRightRadius: true,
44
+ borderTopStartRadius: true,
45
+ borderTopWidth: true,
46
+ borderWidth: true,
47
+ opacity: true,
48
+ transform: true,
49
+ alignContent: true,
50
+ alignItems: true,
51
+ alignSelf: true,
52
+ aspectRatio: true,
53
+ borderEndWidth: true,
54
+ borderStartWidth: true,
55
+ bottom: true,
56
+ display: true,
57
+ end: true,
58
+ flex: true,
59
+ flexBasis: true,
60
+ flexDirection: true,
61
+ flexGrow: true,
62
+ flexShrink: true,
63
+ flexWrap: true,
64
+ height: true,
65
+ justifyContent: true,
66
+ left: true,
67
+ margin: true,
68
+ marginBottom: true,
69
+ marginEnd: true,
70
+ marginHorizontal: true,
71
+ marginLeft: true,
72
+ marginRight: true,
73
+ marginStart: true,
74
+ marginTop: true,
75
+ marginVertical: true,
76
+ maxHeight: true,
77
+ maxWidth: true,
78
+ minHeight: true,
79
+ minWidth: true,
80
+ overflow: true,
81
+ padding: true,
82
+ paddingBottom: true,
83
+ paddingEnd: true,
84
+ paddingHorizontal: true,
85
+ paddingLeft: true,
86
+ paddingRight: true,
87
+ paddingStart: true,
88
+ paddingTop: true,
89
+ paddingVertical: true,
90
+ position: true,
91
+ right: true,
92
+ start: true,
93
+ top: true,
94
+ width: true,
95
+ zIndex: true,
96
+ direction: true,
97
+ shadowColor: true,
98
+ shadowOffset: true,
99
+ shadowOpacity: true,
100
+ shadowRadius: true,
101
+ ...stylePropsTransform,
102
+
103
+ // allow a few web only ones
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
+ }),
114
+ })
115
+
116
+ export const stylePropsTextOnly = Object.freeze({
117
+ color: true,
118
+ fontFamily: true,
119
+ fontSize: true,
120
+ fontStyle: true,
121
+ fontWeight: true,
122
+ letterSpacing: true,
123
+ lineHeight: true,
124
+ textAlign: true,
125
+ textDecorationLine: true,
126
+ textDecorationStyle: true,
127
+ textDecorationColor: true,
128
+ textShadowColor: true,
129
+ textShadowOffset: true,
130
+ textShadowRadius: true,
131
+ textTransform: true,
132
+
133
+ // allow some web only ones
134
+ ...(process.env.TAMAGUI_TARGET === 'web' && {
135
+ whiteSpace: true,
136
+ wordWrap: true,
137
+ textOverflow: true,
138
+ textDecorationDistance: true,
139
+ userSelect: true,
140
+ selectable: true,
141
+ cursor: true,
142
+ }),
143
+ })
144
+
145
+ export const stylePropsText = Object.freeze({
146
+ ...stylePropsView,
147
+ ...stylePropsTextOnly,
148
+ })
149
+
150
+ export const stylePropsAll = stylePropsText
151
+
152
+ export const validPseudoKeys = Object.freeze({
153
+ enterStyle: true,
154
+ exitStyle: true,
155
+ hoverStyle: true,
156
+ pressStyle: true,
157
+ focusStyle: true,
158
+ })
159
+
160
+ export const validStyles = Object.freeze({
161
+ ...validPseudoKeys,
162
+ ...stylePropsView,
163
+ })
@@ -0,0 +1,2 @@
1
+ export declare function clamp(value: number, [min, max]: [number, number]): number;
2
+ //# sourceMappingURL=clamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEzE"}
File without changes
File without changes
File without changes
File without changes
package/types/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ export * from './clamp';
1
2
  export * from './composeEventHandlers';
2
3
  export * from './concatClassName';
3
4
  export * from './validStyleProps';
4
5
  export * from './types';
5
6
  export * from './log';
7
+ export * from './simpleHash';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA"}
package/types/log.d.ts CHANGED
File without changes
File without changes
File without changes
File without changes