@elliemae/ds-utilities 3.0.0-next.4 → 3.0.0-next.40

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 (241) hide show
  1. package/dist/cjs/capitalize.js.map +1 -1
  2. package/dist/cjs/compose.js.map +2 -2
  3. package/dist/cjs/deprecated/deprecatedMsg.js +35 -0
  4. package/dist/cjs/deprecated/deprecatedMsg.js.map +7 -0
  5. package/dist/cjs/deprecated/index.js +33 -0
  6. package/dist/cjs/deprecated/index.js.map +7 -0
  7. package/dist/cjs/deprecated/reactTypesUtility.js +60 -0
  8. package/dist/cjs/deprecated/reactTypesUtility.js.map +7 -0
  9. package/dist/cjs/{scrollingTimer.js → deprecated/scrollingTimer.js} +5 -3
  10. package/dist/cjs/deprecated/scrollingTimer.js.map +7 -0
  11. package/dist/cjs/{hooks → deprecated}/useParentElement.js +0 -0
  12. package/dist/cjs/deprecated/useParentElement.js.map +7 -0
  13. package/dist/cjs/{hooks → deprecated}/useSetRef.js +2 -0
  14. package/dist/cjs/deprecated/useSetRef.js.map +7 -0
  15. package/dist/cjs/deprecated/useUncontrolled.js +40 -0
  16. package/dist/cjs/deprecated/useUncontrolled.js.map +7 -0
  17. package/dist/cjs/{hooks → deprecated}/useWindowSize.js +6 -2
  18. package/dist/cjs/deprecated/useWindowSize.js.map +7 -0
  19. package/dist/cjs/getComponentFromProps.js +1 -1
  20. package/dist/cjs/getComponentFromProps.js.map +2 -2
  21. package/dist/cjs/hooks/index.js +4 -9
  22. package/dist/cjs/hooks/index.js.map +2 -2
  23. package/dist/cjs/hooks/useCallbackAfterRender.js.map +2 -2
  24. package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +2 -2
  25. package/dist/cjs/hooks/useDerivedStateFromProps.js.map +2 -2
  26. package/dist/cjs/hooks/useExecutionTimer.js +4 -2
  27. package/dist/cjs/hooks/useExecutionTimer.js.map +2 -2
  28. package/dist/cjs/hooks/useExpandState.js.map +2 -2
  29. package/dist/cjs/hooks/useFocusTrap.js +66 -12
  30. package/dist/cjs/hooks/useFocusTrap.js.map +2 -2
  31. package/dist/cjs/hooks/useHotkeys.js +1 -1
  32. package/dist/cjs/hooks/useHotkeys.js.map +2 -2
  33. package/dist/cjs/hooks/useHoverHandlersDelay.js +6 -4
  34. package/dist/cjs/hooks/useHoverHandlersDelay.js.map +2 -2
  35. package/dist/cjs/hooks/useIsMobile.js +57 -0
  36. package/dist/cjs/hooks/useIsMobile.js.map +7 -0
  37. package/dist/cjs/hooks/useIsShowingEllipsis.js.map +1 -1
  38. package/dist/cjs/hooks/useOnElementResize.js.map +1 -1
  39. package/dist/cjs/hooks/usePrevious.js.map +2 -2
  40. package/dist/cjs/hooks/useResizeObserver.js +3 -3
  41. package/dist/cjs/hooks/useResizeObserver.js.map +2 -2
  42. package/dist/cjs/hooks/useShouldRecalculate.js.map +2 -2
  43. package/dist/cjs/hooks/useWindowScrollerList.js +11 -9
  44. package/dist/cjs/hooks/useWindowScrollerList.js.map +2 -2
  45. package/dist/cjs/index.js +4 -11
  46. package/dist/cjs/index.js.map +2 -2
  47. package/dist/cjs/onClickHandlerForNonInteractiveElements.js +2 -2
  48. package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +2 -2
  49. package/dist/cjs/operators.js.map +2 -2
  50. package/dist/cjs/props-helpers/defaultProps/index.js +28 -0
  51. package/dist/cjs/props-helpers/defaultProps/index.js.map +7 -0
  52. package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js +62 -0
  53. package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
  54. package/dist/cjs/props-helpers/getProps/index.js +37 -0
  55. package/dist/cjs/props-helpers/getProps/index.js.map +7 -0
  56. package/dist/cjs/props-helpers/globalProps/constants.js +397 -0
  57. package/dist/cjs/props-helpers/globalProps/constants.js.map +7 -0
  58. package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js +398 -0
  59. package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js.map +7 -0
  60. package/dist/cjs/props-helpers/globalProps/index.js +29 -0
  61. package/dist/cjs/props-helpers/globalProps/index.js.map +7 -0
  62. package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js +56 -0
  63. package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js.map +7 -0
  64. package/dist/cjs/props-helpers/index.js +34 -0
  65. package/dist/cjs/props-helpers/index.js.map +7 -0
  66. package/dist/cjs/props-helpers/propTypes/PropTypes.js +151 -0
  67. package/dist/cjs/props-helpers/propTypes/PropTypes.js.map +7 -0
  68. package/dist/cjs/props-helpers/propTypes/customPropTypes.js +38 -0
  69. package/dist/cjs/props-helpers/propTypes/customPropTypes.js.map +7 -0
  70. package/dist/cjs/props-helpers/propTypes/describe.js +81 -0
  71. package/dist/cjs/props-helpers/propTypes/describe.js.map +7 -0
  72. package/dist/cjs/props-helpers/propTypes/describeConversions.js +96 -0
  73. package/dist/cjs/props-helpers/propTypes/describeConversions.js.map +7 -0
  74. package/dist/cjs/props-helpers/propTypes/describeGuards.js +49 -0
  75. package/dist/cjs/props-helpers/propTypes/describeGuards.js.map +7 -0
  76. package/dist/cjs/props-helpers/propTypes/index.js +37 -0
  77. package/dist/cjs/props-helpers/propTypes/index.js.map +7 -0
  78. package/dist/cjs/props-helpers/propTypes/toTypescript.js +154 -0
  79. package/dist/cjs/props-helpers/propTypes/toTypescript.js.map +7 -0
  80. package/dist/cjs/props-helpers/propTypes/types.js +27 -0
  81. package/dist/cjs/props-helpers/propTypes/types.js.map +7 -0
  82. package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js +54 -0
  83. package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js.map +7 -0
  84. package/dist/cjs/props-helpers/tests/validation/test.schema.js +69 -0
  85. package/dist/cjs/props-helpers/tests/validation/test.schema.js.map +7 -0
  86. package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js +60 -0
  87. package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js.map +7 -0
  88. package/dist/cjs/props-helpers/useDeprecateComponent/index.js +40 -0
  89. package/dist/cjs/props-helpers/useDeprecateComponent/index.js.map +7 -0
  90. package/dist/cjs/props-helpers/validation/errorTemplates.js +48 -0
  91. package/dist/cjs/props-helpers/validation/errorTemplates.js.map +7 -0
  92. package/dist/cjs/props-helpers/validation/index.js +29 -0
  93. package/dist/cjs/props-helpers/validation/index.js.map +7 -0
  94. package/dist/cjs/props-helpers/validation/typescriptGuards.js +83 -0
  95. package/dist/cjs/props-helpers/validation/typescriptGuards.js.map +7 -0
  96. package/dist/cjs/props-helpers/validation/typescriptParsers.js +76 -0
  97. package/dist/cjs/props-helpers/validation/typescriptParsers.js.map +7 -0
  98. package/dist/cjs/props-helpers/validation/typescriptValidator.js +177 -0
  99. package/dist/cjs/props-helpers/validation/typescriptValidator.js.map +7 -0
  100. package/dist/cjs/props-helpers/xstyledProps/constants.js +88 -0
  101. package/dist/cjs/props-helpers/xstyledProps/constants.js.map +7 -0
  102. package/dist/cjs/props-helpers/xstyledProps/index.js +29 -0
  103. package/dist/cjs/props-helpers/xstyledProps/index.js.map +7 -0
  104. package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js +48 -0
  105. package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js.map +7 -0
  106. package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js +92 -0
  107. package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js.map +7 -0
  108. package/dist/cjs/reactTypesUtility.js +3 -24
  109. package/dist/cjs/reactTypesUtility.js.map +2 -2
  110. package/dist/cjs/system.js +5 -10
  111. package/dist/cjs/system.js.map +2 -2
  112. package/dist/cjs/timeUtils.js.map +2 -2
  113. package/dist/cjs/utils.js +6 -3
  114. package/dist/cjs/utils.js.map +2 -2
  115. package/dist/cjs/validations.js +4 -6
  116. package/dist/cjs/validations.js.map +2 -2
  117. package/dist/esm/capitalize.js.map +1 -1
  118. package/dist/esm/compose.js.map +2 -2
  119. package/dist/esm/deprecated/deprecatedMsg.js +6 -0
  120. package/dist/esm/deprecated/deprecatedMsg.js.map +7 -0
  121. package/dist/esm/deprecated/index.js +8 -0
  122. package/dist/esm/deprecated/index.js.map +7 -0
  123. package/dist/esm/deprecated/reactTypesUtility.js +31 -0
  124. package/dist/esm/deprecated/reactTypesUtility.js.map +7 -0
  125. package/dist/esm/{scrollingTimer.js → deprecated/scrollingTimer.js} +5 -3
  126. package/dist/esm/deprecated/scrollingTimer.js.map +7 -0
  127. package/dist/esm/{hooks → deprecated}/useParentElement.js +0 -0
  128. package/dist/esm/deprecated/useParentElement.js.map +7 -0
  129. package/dist/esm/{hooks → deprecated}/useSetRef.js +2 -0
  130. package/dist/esm/deprecated/useSetRef.js.map +7 -0
  131. package/dist/esm/deprecated/useUncontrolled.js +11 -0
  132. package/dist/esm/deprecated/useUncontrolled.js.map +7 -0
  133. package/dist/esm/{hooks → deprecated}/useWindowSize.js +6 -2
  134. package/dist/esm/deprecated/useWindowSize.js.map +7 -0
  135. package/dist/esm/getComponentFromProps.js +1 -1
  136. package/dist/esm/getComponentFromProps.js.map +2 -2
  137. package/dist/esm/hooks/index.js +5 -10
  138. package/dist/esm/hooks/index.js.map +2 -2
  139. package/dist/esm/hooks/useCallbackAfterRender.js.map +2 -2
  140. package/dist/esm/hooks/useCancellableDelayedCallback.js.map +2 -2
  141. package/dist/esm/hooks/useDerivedStateFromProps.js.map +2 -2
  142. package/dist/esm/hooks/useExecutionTimer.js +4 -2
  143. package/dist/esm/hooks/useExecutionTimer.js.map +2 -2
  144. package/dist/esm/hooks/useExpandState.js.map +2 -2
  145. package/dist/esm/hooks/useFocusTrap.js +67 -13
  146. package/dist/esm/hooks/useFocusTrap.js.map +2 -2
  147. package/dist/esm/hooks/useHotkeys.js +1 -1
  148. package/dist/esm/hooks/useHotkeys.js.map +2 -2
  149. package/dist/esm/hooks/useHoverHandlersDelay.js +6 -4
  150. package/dist/esm/hooks/useHoverHandlersDelay.js.map +2 -2
  151. package/dist/esm/hooks/useIsMobile.js +28 -0
  152. package/dist/esm/hooks/useIsMobile.js.map +7 -0
  153. package/dist/esm/hooks/useIsShowingEllipsis.js.map +1 -1
  154. package/dist/esm/hooks/useOnElementResize.js.map +1 -1
  155. package/dist/esm/hooks/usePrevious.js.map +2 -2
  156. package/dist/esm/hooks/useResizeObserver.js +4 -4
  157. package/dist/esm/hooks/useResizeObserver.js.map +2 -2
  158. package/dist/esm/hooks/useShouldRecalculate.js.map +2 -2
  159. package/dist/esm/hooks/useWindowScrollerList.js +12 -10
  160. package/dist/esm/hooks/useWindowScrollerList.js.map +2 -2
  161. package/dist/esm/index.js +8 -24
  162. package/dist/esm/index.js.map +2 -2
  163. package/dist/esm/onClickHandlerForNonInteractiveElements.js +2 -2
  164. package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +2 -2
  165. package/dist/esm/operators.js.map +2 -2
  166. package/dist/esm/props-helpers/defaultProps/index.js +3 -0
  167. package/dist/esm/props-helpers/defaultProps/index.js.map +7 -0
  168. package/dist/esm/props-helpers/defaultProps/useMemoMergePropsWithDefault.js +35 -0
  169. package/dist/esm/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
  170. package/dist/esm/props-helpers/getProps/index.js +8 -0
  171. package/dist/esm/props-helpers/getProps/index.js.map +7 -0
  172. package/dist/esm/props-helpers/globalProps/constants.js +368 -0
  173. package/dist/esm/props-helpers/globalProps/constants.js.map +7 -0
  174. package/dist/esm/props-helpers/globalProps/globalAttributesPropTypes.js +369 -0
  175. package/dist/esm/props-helpers/globalProps/globalAttributesPropTypes.js.map +7 -0
  176. package/dist/esm/props-helpers/globalProps/index.js +4 -0
  177. package/dist/esm/props-helpers/globalProps/index.js.map +7 -0
  178. package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js +27 -0
  179. package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js.map +7 -0
  180. package/dist/esm/props-helpers/index.js +9 -0
  181. package/dist/esm/props-helpers/index.js.map +7 -0
  182. package/dist/esm/props-helpers/propTypes/PropTypes.js +124 -0
  183. package/dist/esm/props-helpers/propTypes/PropTypes.js.map +7 -0
  184. package/dist/esm/props-helpers/propTypes/customPropTypes.js +9 -0
  185. package/dist/esm/props-helpers/propTypes/customPropTypes.js.map +7 -0
  186. package/dist/esm/props-helpers/propTypes/describe.js +52 -0
  187. package/dist/esm/props-helpers/propTypes/describe.js.map +7 -0
  188. package/dist/esm/props-helpers/propTypes/describeConversions.js +76 -0
  189. package/dist/esm/props-helpers/propTypes/describeConversions.js.map +7 -0
  190. package/dist/esm/props-helpers/propTypes/describeGuards.js +20 -0
  191. package/dist/esm/props-helpers/propTypes/describeGuards.js.map +7 -0
  192. package/dist/esm/props-helpers/propTypes/index.js +8 -0
  193. package/dist/esm/props-helpers/propTypes/index.js.map +7 -0
  194. package/dist/esm/props-helpers/propTypes/toTypescript.js +127 -0
  195. package/dist/esm/props-helpers/propTypes/toTypescript.js.map +7 -0
  196. package/dist/esm/props-helpers/propTypes/types.js +2 -0
  197. package/dist/esm/props-helpers/propTypes/types.js.map +7 -0
  198. package/dist/esm/props-helpers/tests/globalProps/TestComponent.js +27 -0
  199. package/dist/esm/props-helpers/tests/globalProps/TestComponent.js.map +7 -0
  200. package/dist/esm/props-helpers/tests/validation/test.schema.js +40 -0
  201. package/dist/esm/props-helpers/tests/validation/test.schema.js.map +7 -0
  202. package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js +33 -0
  203. package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js.map +7 -0
  204. package/dist/esm/props-helpers/useDeprecateComponent/index.js +11 -0
  205. package/dist/esm/props-helpers/useDeprecateComponent/index.js.map +7 -0
  206. package/dist/esm/props-helpers/validation/errorTemplates.js +19 -0
  207. package/dist/esm/props-helpers/validation/errorTemplates.js.map +7 -0
  208. package/dist/esm/props-helpers/validation/index.js +4 -0
  209. package/dist/esm/props-helpers/validation/index.js.map +7 -0
  210. package/dist/esm/props-helpers/validation/typescriptGuards.js +54 -0
  211. package/dist/esm/props-helpers/validation/typescriptGuards.js.map +7 -0
  212. package/dist/esm/props-helpers/validation/typescriptParsers.js +47 -0
  213. package/dist/esm/props-helpers/validation/typescriptParsers.js.map +7 -0
  214. package/dist/esm/props-helpers/validation/typescriptValidator.js +159 -0
  215. package/dist/esm/props-helpers/validation/typescriptValidator.js.map +7 -0
  216. package/dist/esm/props-helpers/xstyledProps/constants.js +59 -0
  217. package/dist/esm/props-helpers/xstyledProps/constants.js.map +7 -0
  218. package/dist/esm/props-helpers/xstyledProps/index.js +4 -0
  219. package/dist/esm/props-helpers/xstyledProps/index.js.map +7 -0
  220. package/dist/esm/props-helpers/xstyledProps/useGetXstyledProps.js +19 -0
  221. package/dist/esm/props-helpers/xstyledProps/useGetXstyledProps.js.map +7 -0
  222. package/dist/esm/props-helpers/xstyledProps/xstyledPropTypes.js +63 -0
  223. package/dist/esm/props-helpers/xstyledProps/xstyledPropTypes.js.map +7 -0
  224. package/dist/esm/reactTypesUtility.js +3 -24
  225. package/dist/esm/reactTypesUtility.js.map +2 -2
  226. package/dist/esm/system.js +5 -10
  227. package/dist/esm/system.js.map +2 -2
  228. package/dist/esm/timeUtils.js.map +2 -2
  229. package/dist/esm/utils.js +6 -3
  230. package/dist/esm/utils.js.map +2 -2
  231. package/dist/esm/validations.js +4 -6
  232. package/dist/esm/validations.js.map +2 -2
  233. package/package.json +1 -1
  234. package/dist/cjs/hooks/useParentElement.js.map +0 -7
  235. package/dist/cjs/hooks/useSetRef.js.map +0 -7
  236. package/dist/cjs/hooks/useWindowSize.js.map +0 -7
  237. package/dist/cjs/scrollingTimer.js.map +0 -7
  238. package/dist/esm/hooks/useParentElement.js.map +0 -7
  239. package/dist/esm/hooks/useSetRef.js.map +0 -7
  240. package/dist/esm/hooks/useWindowSize.js.map +0 -7
  241. package/dist/esm/scrollingTimer.js.map +0 -7
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ const isPrimitiveType = (format) => ["string", "number", "boolean"].includes(format);
3
+ const isUndefined = (format) => format === '"undefined"';
4
+ const isNull = (format) => format === '"null"';
5
+ const isUnion = (format) => {
6
+ let depth = 0;
7
+ let satisfies = false;
8
+ format.split("").forEach((char) => {
9
+ if (["{", "("].includes(char))
10
+ depth += 1;
11
+ else if (["}", ")"].includes(char))
12
+ depth -= 1;
13
+ else if (char === "|" && depth === 0)
14
+ satisfies = true;
15
+ });
16
+ return satisfies;
17
+ };
18
+ const isString = (format) => !isUnion(format) && format[0] === '"' && format.slice(-1) === '"';
19
+ const isArray = (format) => !isUnion(format) && format.slice(-2) === "[]";
20
+ const isObject = (format) => format === "object" || !isUnion(format) && format[0] === "{" && format.slice(-1) === "}";
21
+ const isFunction = (format) => {
22
+ if (isUnion(format))
23
+ return false;
24
+ if (!format.startsWith("((") && format.slice(-1) !== ")")
25
+ return false;
26
+ let depth = 0;
27
+ let arrowOccursAtDepth1 = false;
28
+ for (let i = 0; i < format.length; i += 1) {
29
+ const char = format[i];
30
+ if (["{", "("].includes(char))
31
+ depth += 1;
32
+ else if (["}", ")"].includes(char))
33
+ depth -= 1;
34
+ else if (i < format.length - 1 && format.slice(i, i + 2) === "=>") {
35
+ arrowOccursAtDepth1 = arrowOccursAtDepth1 || depth === 1;
36
+ }
37
+ }
38
+ return arrowOccursAtDepth1;
39
+ };
40
+ const isJSXorNode = (format) => !isUnion(format) && ["React.ReactNode", "JSX.Element"].includes(format);
41
+ const isSomethingWithParenthesis = (format) => !isUnion(format) && format[0] === "(" && format.slice(-1) === ")";
42
+ export {
43
+ isArray,
44
+ isFunction,
45
+ isJSXorNode,
46
+ isNull,
47
+ isObject,
48
+ isPrimitiveType,
49
+ isSomethingWithParenthesis,
50
+ isString,
51
+ isUndefined,
52
+ isUnion
53
+ };
54
+ //# sourceMappingURL=typescriptGuards.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/validation/typescriptGuards.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "type GuardFn = (format: string) => boolean;\n\nexport const isPrimitiveType: GuardFn = (format) => ['string', 'number', 'boolean'].includes(format);\nexport const isUndefined: GuardFn = (format) => format === '\"undefined\"';\nexport const isNull: GuardFn = (format) => format === '\"null\"';\nexport const isUnion: GuardFn = (format) => {\n let depth = 0;\n let satisfies = false;\n format.split('').forEach((char) => {\n if (['{', '('].includes(char)) depth += 1;\n else if (['}', ')'].includes(char)) depth -= 1;\n else if (char === '|' && depth === 0) satisfies = true;\n });\n return satisfies;\n};\n\nexport const isString: GuardFn = (format) => !isUnion(format) && format[0] === '\"' && format.slice(-1) === '\"';\n\nexport const isArray: GuardFn = (format) => !isUnion(format) && format.slice(-2) === '[]';\n\nexport const isObject: GuardFn = (format) =>\n format === 'object' || (!isUnion(format) && format[0] === '{' && format.slice(-1) === '}');\n\nexport const isFunction: GuardFn = (format) => {\n // It's isn't an union\n if (isUnion(format)) return false;\n // Has to start with (( and end with )\n if (!format.startsWith('((') && format.slice(-1) !== ')') return false;\n\n // The arrow MUST occur at depth 1 (when couting parenthesis)\n // Otherwise the only possibility is that we have \"something with parenthesis\" (look down below)\n let depth = 0;\n let arrowOccursAtDepth1 = false;\n for (let i = 0; i < format.length; i += 1) {\n const char = format[i];\n if (['{', '('].includes(char)) depth += 1;\n else if (['}', ')'].includes(char)) depth -= 1;\n else if (i < format.length - 1 && format.slice(i, i + 2) === '=>') {\n arrowOccursAtDepth1 = arrowOccursAtDepth1 || depth === 1;\n }\n }\n return arrowOccursAtDepth1;\n};\n\nexport const isJSXorNode: GuardFn = (format) => !isUnion(format) && ['React.ReactNode', 'JSX.Element'].includes(format);\n\nexport const isSomethingWithParenthesis: GuardFn = (format) =>\n !isUnion(format) && format[0] === '(' && format.slice(-1) === ')';\n"],
5
+ "mappings": "AAAA;ACEO,MAAM,kBAA2B,CAAC,WAAW,CAAC,UAAU,UAAU,SAAS,EAAE,SAAS,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AAEO,MAAM,cAAuB,CAAC,WAAW,CAAC,QAAQ,MAAM,KAAK,CAAC,mBAAmB,aAAa,EAAE,SAAS,MAAM;AAE/G,MAAM,6BAAsC,CAAC,WAClD,CAAC,QAAQ,MAAM,KAAK,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE,MAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,47 @@
1
+ import * as React from "react";
2
+ const typescriptObjectParser = (format) => {
3
+ const keyValuePairs = [];
4
+ let lastKey = "";
5
+ let lastValue = "";
6
+ let shouldAppendToKey = true;
7
+ const pushPair = () => {
8
+ if (lastKey)
9
+ keyValuePairs.push([lastKey, lastValue]);
10
+ lastKey = "";
11
+ lastValue = "";
12
+ shouldAppendToKey = true;
13
+ };
14
+ let depth = 0;
15
+ format.split("").forEach((char) => {
16
+ if (char === "{") {
17
+ depth += 1;
18
+ if (depth > 1)
19
+ lastValue += char;
20
+ } else if (char === "}") {
21
+ if (depth > 1)
22
+ lastValue += char;
23
+ depth -= 1;
24
+ if (depth === 1)
25
+ pushPair();
26
+ } else if (char === ":") {
27
+ shouldAppendToKey = false;
28
+ if (depth > 1)
29
+ lastValue += char;
30
+ } else if (char === ",") {
31
+ if (depth === 1)
32
+ pushPair();
33
+ else
34
+ lastValue += char;
35
+ } else if (char === " ") {
36
+ } else if (shouldAppendToKey)
37
+ lastKey += char;
38
+ else
39
+ lastValue += char;
40
+ });
41
+ pushPair();
42
+ return keyValuePairs;
43
+ };
44
+ export {
45
+ typescriptObjectParser
46
+ };
47
+ //# sourceMappingURL=typescriptParsers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/validation/typescriptParsers.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nexport const typescriptObjectParser = (format: string): [string, string][] => {\n const keyValuePairs: [string, string][] = [];\n\n // State of the algorithm\n let lastKey = '';\n let lastValue = '';\n let shouldAppendToKey = true;\n\n const pushPair = () => {\n if (lastKey) keyValuePairs.push([lastKey, lastValue]);\n lastKey = '';\n lastValue = '';\n shouldAppendToKey = true;\n };\n\n // Complex -- but working -- logic\n let depth = 0;\n format.split('').forEach((char) => {\n if (char === '{') {\n depth += 1;\n if (depth > 1) lastValue += char;\n } else if (char === '}') {\n if (depth > 1) lastValue += char;\n depth -= 1;\n if (depth === 1) pushPair();\n } else if (char === ':') {\n shouldAppendToKey = false;\n if (depth > 1) lastValue += char;\n } else if (char === ',') {\n if (depth === 1) pushPair();\n else lastValue += char;\n } else if (char === ' ') {\n // Do nothing\n } else if (shouldAppendToKey) lastKey += char;\n else lastValue += char;\n });\n pushPair();\n\n return keyValuePairs;\n};\n"],
5
+ "mappings": "AAAA;ACCO,MAAM,yBAAyB,CAAC,WAAuC;AAC5E,QAAM,gBAAoC,CAAC;AAG3C,MAAI,UAAU;AACd,MAAI,YAAY;AAChB,MAAI,oBAAoB;AAExB,QAAM,WAAW,MAAM;AACrB,QAAI;AAAS,oBAAc,KAAK,CAAC,SAAS,SAAS,CAAC;AACpD,cAAU;AACV,gBAAY;AACZ,wBAAoB;AAAA,EACtB;AAGA,MAAI,QAAQ;AACZ,SAAO,MAAM,EAAE,EAAE,QAAQ,CAAC,SAAS;AACjC,QAAI,SAAS,KAAK;AAChB,eAAS;AACT,UAAI,QAAQ;AAAG,qBAAa;AAAA,IAC9B,WAAW,SAAS,KAAK;AACvB,UAAI,QAAQ;AAAG,qBAAa;AAC5B,eAAS;AACT,UAAI,UAAU;AAAG,iBAAS;AAAA,IAC5B,WAAW,SAAS,KAAK;AACvB,0BAAoB;AACpB,UAAI,QAAQ;AAAG,qBAAa;AAAA,IAC9B,WAAW,SAAS,KAAK;AACvB,UAAI,UAAU;AAAG,iBAAS;AAAA;AACrB,qBAAa;AAAA,IACpB,WAAW,SAAS,KAAK;AAAA,IAEzB,WAAW;AAAmB,iBAAW;AAAA;AACpC,mBAAa;AAAA,EACpB,CAAC;AACD,WAAS;AAET,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,159 @@
1
+ import * as React from "react";
2
+ import { useMemo, useRef } from "react";
3
+ import { describe } from "../propTypes";
4
+ import { throwRequiredError, throwTypeError } from "./errorTemplates";
5
+ import {
6
+ isArray,
7
+ isFunction,
8
+ isJSXorNode,
9
+ isObject,
10
+ isPrimitiveType,
11
+ isSomethingWithParenthesis,
12
+ isString,
13
+ isUnion,
14
+ isUndefined,
15
+ isNull
16
+ } from "./typescriptGuards";
17
+ import { typescriptObjectParser } from "./typescriptParsers";
18
+ const validateUndefined = (schemaName, key, value, format) => {
19
+ if (value !== void 0 || value === "undefined") {
20
+ throwTypeError(schemaName, key, value, format);
21
+ }
22
+ };
23
+ const validateNull = (schemaName, key, value, format) => {
24
+ if (value !== null || value === "null") {
25
+ throwTypeError(schemaName, key, value, format);
26
+ }
27
+ };
28
+ const validatePrimitiveType = (schemaName, key, value, format) => {
29
+ if (typeof value !== format) {
30
+ throwTypeError(schemaName, key, value, format);
31
+ }
32
+ };
33
+ const validateString = (schemaName, key, value, format) => {
34
+ if (value !== format.slice(1, -1)) {
35
+ throwTypeError(schemaName, key, value, format);
36
+ }
37
+ };
38
+ const validateArray = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
39
+ if (!Array.isArray(value)) {
40
+ throwTypeError(schemaName, key, value, format);
41
+ }
42
+ value.forEach((val, index) => {
43
+ validateValueWithFormat(schemaName, `${key}[${index}]`, val, format.slice(0, -2), validationsMemo, nextValidationsMemo);
44
+ });
45
+ };
46
+ function isObjectType(value) {
47
+ return !(typeof value !== "object" || Array.isArray(value));
48
+ }
49
+ const validateObject = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
50
+ const valuesIsObject = isObjectType(value);
51
+ if (!valuesIsObject) {
52
+ throwTypeError(schemaName, key, value, format);
53
+ return;
54
+ }
55
+ if (format === "object")
56
+ return;
57
+ const keyValuePairs = typescriptObjectParser(format);
58
+ keyValuePairs.forEach(([objectKey, objectValue]) => {
59
+ const trueKey = objectKey.slice(-1) === "?" ? objectKey.slice(0, -1) : objectKey;
60
+ if (trueKey === objectKey && !(trueKey in value)) {
61
+ throwRequiredError(schemaName, key);
62
+ }
63
+ if (trueKey in value) {
64
+ validateValueWithFormat(schemaName, `${key}[${trueKey}]`, value[trueKey], objectValue, validationsMemo, nextValidationsMemo);
65
+ }
66
+ });
67
+ };
68
+ const validateUnion = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
69
+ const possibilities = format.split(/\s?\|\s?/);
70
+ const errors = [];
71
+ possibilities.forEach((possibility) => {
72
+ try {
73
+ validateValueWithFormat(schemaName, key, value, possibility, validationsMemo, nextValidationsMemo);
74
+ } catch (e) {
75
+ errors.push(e);
76
+ }
77
+ });
78
+ if (errors.length === possibilities.length) {
79
+ throwTypeError(schemaName, key, value, format);
80
+ }
81
+ };
82
+ const validateFunction = (schemaName, key, value, format) => {
83
+ if (typeof value !== "function") {
84
+ throwTypeError(schemaName, key, value, format);
85
+ }
86
+ };
87
+ function isJSXElement(value) {
88
+ return value === null || typeof value === "object" && value !== null && "$$typeof" in value;
89
+ }
90
+ const validateJSXorNode = (schemaName, key, value, format) => {
91
+ const valueIsJSX = isJSXElement(value);
92
+ if (format === "JSX.Element" && !valueIsJSX) {
93
+ throwTypeError(schemaName, key, value, format);
94
+ }
95
+ };
96
+ const validateValueWithFormat = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
97
+ nextValidationsMemo[value] = format;
98
+ if (value in validationsMemo) {
99
+ return;
100
+ }
101
+ if (isUndefined(format)) {
102
+ validateUndefined(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
103
+ } else if (isNull(format)) {
104
+ validateNull(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
105
+ } else if (isPrimitiveType(format)) {
106
+ validatePrimitiveType(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
107
+ } else if (isUnion(format)) {
108
+ validateUnion(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
109
+ } else if (isString(format)) {
110
+ validateString(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
111
+ } else if (isArray(format)) {
112
+ validateArray(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
113
+ } else if (isObject(format)) {
114
+ validateObject(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
115
+ } else if (isFunction(format)) {
116
+ validateFunction(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
117
+ } else if (isJSXorNode(format)) {
118
+ validateJSXorNode(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
119
+ } else if (isSomethingWithParenthesis(format)) {
120
+ validateValueWithFormat(schemaName, key, value, format.slice(1, -1), validationsMemo, nextValidationsMemo);
121
+ }
122
+ };
123
+ const validateTypescriptPropTypesImplementation = (props, schema, validationsMemo = {}, nextValidationsMemo = {}) => {
124
+ const { properties, name: schemaName } = schema;
125
+ properties.forEach((property) => {
126
+ const { name, format, required, isRequiredIf } = property;
127
+ const requiredConditionally = isRequiredIf && isRequiredIf(props);
128
+ if (required && !(name in props)) {
129
+ throwRequiredError(schema.name, name);
130
+ }
131
+ if (requiredConditionally && !(name in props)) {
132
+ throwRequiredError(schema.name, name);
133
+ }
134
+ const shouldValidateProperty = props[name] !== void 0 || required || requiredConditionally;
135
+ if (name in props && format && shouldValidateProperty) {
136
+ validateValueWithFormat(schemaName, name, props[name], format, validationsMemo, nextValidationsMemo);
137
+ }
138
+ });
139
+ };
140
+ const useValidateTypescriptPropTypes = (props, propTypes) => {
141
+ const validationsMemo = useRef({});
142
+ const typescriptSchema = useMemo(() => {
143
+ const Component = () => {
144
+ };
145
+ const DescribedComponent = describe(Component);
146
+ DescribedComponent.propTypes = propTypes;
147
+ return DescribedComponent.toTypescript();
148
+ }, [propTypes]);
149
+ useMemo(() => {
150
+ const nextValidationsMemo = {};
151
+ validateTypescriptPropTypesImplementation(props, typescriptSchema, validationsMemo.current, nextValidationsMemo);
152
+ validationsMemo.current = nextValidationsMemo;
153
+ }, [props]);
154
+ };
155
+ export {
156
+ useValidateTypescriptPropTypes,
157
+ validateTypescriptPropTypesImplementation
158
+ };
159
+ //# sourceMappingURL=typescriptValidator.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/validation/typescriptValidator.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { PropsWithChildren, useMemo, useRef, WeakValidationMap } from 'react';\nimport { TypescriptDocumentation } from '../propTypes/types';\nimport { describe } from '../propTypes';\nimport { throwRequiredError, throwTypeError } from './errorTemplates';\nimport {\n isArray,\n isFunction,\n isJSXorNode,\n isObject,\n isPrimitiveType,\n isSomethingWithParenthesis,\n isString,\n isUnion,\n isUndefined,\n isNull,\n} from './typescriptGuards';\nimport { typescriptObjectParser } from './typescriptParsers';\n\ntype ValidatorFn = (\n schemaName: string,\n key: string,\n value: unknown,\n format: string,\n validationsMemo: Record<symbol, string>,\n nextValidationsMemo: Record<symbol, string>,\n) => void;\n\n// =============================================================================\n// Atom Validators\n// =============================================================================\n\n// This functions will validate something from the data\n// and optionally recursively apply `validateValueWithFormat`\n// in smaller parts\n\nconst validateUndefined: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== undefined || value === 'undefined') {\n throwTypeError(schemaName, key, value, format);\n }\n};\nconst validateNull: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== null || value === 'null') {\n throwTypeError(schemaName, key, value, format);\n }\n};\nconst validatePrimitiveType: ValidatorFn = (schemaName, key, value, format) => {\n if (typeof value !== format) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateString: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== format.slice(1, -1)) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateArray: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n // Check that we have an array\n if (!Array.isArray(value)) {\n throwTypeError(schemaName, key, value, format);\n }\n\n // Check that each element inside satisfies the format\n (value as unknown[]).forEach((val, index) => {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(\n schemaName,\n `${key}[${index}]`,\n val,\n format.slice(0, -2),\n validationsMemo,\n nextValidationsMemo,\n );\n });\n};\nfunction isObjectType(value: unknown | Record<string, unknown>): value is Record<string, unknown> {\n return !(typeof value !== 'object' || Array.isArray(value));\n}\nconst validateObject: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n const valuesIsObject = isObjectType(value);\n // Check that we have an object\n if (!valuesIsObject) {\n throwTypeError(schemaName, key, value, format);\n return;\n }\n\n if (format === 'object') return;\n\n const keyValuePairs = typescriptObjectParser(format);\n // Now we have the key - value pairs\n // Each key could either be required or not\n // Just recursively check the object\n\n keyValuePairs.forEach(([objectKey, objectValue]) => {\n const trueKey = objectKey.slice(-1) === '?' ? objectKey.slice(0, -1) : objectKey;\n\n if (trueKey === objectKey && !(trueKey in value)) {\n throwRequiredError(schemaName, key);\n }\n\n if (trueKey in value) {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(\n schemaName,\n `${key}[${trueKey}]`,\n value[trueKey],\n objectValue,\n validationsMemo,\n nextValidationsMemo,\n );\n }\n });\n};\n\nconst validateUnion: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n const possibilities = format.split(/\\s?\\|\\s?/);\n\n const errors = [];\n\n possibilities.forEach((possibility) => {\n try {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(schemaName, key, value, possibility, validationsMemo, nextValidationsMemo);\n } catch (e) {\n errors.push(e);\n }\n });\n\n if (errors.length === possibilities.length) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateFunction: ValidatorFn = (schemaName, key, value, format) => {\n // Check that we have a function\n if (typeof value !== 'function') {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nfunction isJSXElement(value: unknown | JSX.Element): value is JSX.Element {\n return value === null || (typeof value === 'object' && value !== null && '$$typeof' in value);\n}\nconst validateJSXorNode: ValidatorFn = (schemaName, key, value, format) => {\n const valueIsJSX = isJSXElement(value);\n if (format === 'JSX.Element' && !valueIsJSX) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\n// =============================================================================\n// Schema validator\n// =============================================================================\n\nconst validateValueWithFormat: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n nextValidationsMemo[value as symbol] = format;\n\n if ((value as symbol) in validationsMemo) {\n // We already validated this value on this format\n return;\n }\n\n if (isUndefined(format)) {\n validateUndefined(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isNull(format)) {\n validateNull(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isPrimitiveType(format)) {\n validatePrimitiveType(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isUnion(format)) {\n validateUnion(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isString(format)) {\n validateString(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isArray(format)) {\n validateArray(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isObject(format)) {\n validateObject(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isFunction(format)) {\n validateFunction(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isJSXorNode(format)) {\n validateJSXorNode(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isSomethingWithParenthesis(format)) {\n validateValueWithFormat(schemaName, key, value, format.slice(1, -1), validationsMemo, nextValidationsMemo);\n }\n};\n\nexport const validateTypescriptPropTypesImplementation = (\n props: PropsWithChildren<Record<string, unknown>>,\n schema: TypescriptDocumentation,\n validationsMemo: Record<string, string> = {},\n nextValidationsMemo: Record<string, string> = {},\n): void => {\n const { properties, name: schemaName } = schema;\n\n properties.forEach((property) => {\n const { name, format, required, isRequiredIf } = property;\n\n const requiredConditionally = isRequiredIf && isRequiredIf(props);\n\n if (required && !(name in props)) {\n throwRequiredError(schema.name, name);\n }\n\n if (requiredConditionally && !(name in props)) {\n throwRequiredError(schema.name, name);\n }\n\n const shouldValidateProperty = props[name] !== undefined || required || requiredConditionally;\n\n if (name in props && format && shouldValidateProperty) {\n validateValueWithFormat(schemaName, name, props[name], format, validationsMemo, nextValidationsMemo);\n }\n });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const useValidateTypescriptPropTypes = <T = Record<string, any>>(\n props: PropsWithChildren<T>,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n const validationsMemo = useRef<Record<string, string>>({});\n\n const typescriptSchema = useMemo(() => {\n const Component = () => {};\n\n const DescribedComponent = describe(Component);\n DescribedComponent.propTypes = propTypes;\n return DescribedComponent.toTypescript();\n }, [propTypes]);\n\n useMemo(() => {\n const nextValidationsMemo = {};\n\n validateTypescriptPropTypesImplementation(props, typescriptSchema, validationsMemo.current, nextValidationsMemo);\n validationsMemo.current = nextValidationsMemo;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props]);\n};\n"],
5
+ "mappings": "AAAA;ACGA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AAmBA,MAAM,oBAAiC,CAAC,YAAY,KAAK,OAAO,WAAW;AACzE,MAAI,UAAU,UAAa,UAAU,aAAa;AAChD,mBAAe,YAAY,KAAK,OAAO,MAAM;AAAA,EAC/C;AACF;AACA,MAAM,eAA4B,CAAC,YAAY,KAAK,OAAO,WAAW;AACpE,MAAI,UAAU,QAAQ,UAAU,QAAQ;AACtC,mBAAe,YAAY,KAAK,OAAO,MAAM;AAAA,EAC/C;AACF;AACA,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QAAQ,iBAAiB,mBAAmB;AAAA,IACrG;AAAA,EACF,CAAC;AACH;AAGO,MAAM,iCAAiC,CAC5C,OACA,cACS;AACT,QAAM,kBAAkB,OAA+B,CAAC,CAAC;AAEzD,QAAM,mBAAmB,QAAQ,MAAM;AACrC,UAAM,YAAY,MAAM;AAAA,IAAC;AAEzB,UAAM,qBAAqB,SAAS,SAAS;AAC7C,uBAAmB,YAAY;AAC/B,WAAO,mBAAmB,aAAa;AAAA,EACzC,GAAG,CAAC,SAAS,CAAC;AAEd,UAAQ,MAAM;AACZ,UAAM,sBAAsB,CAAC;AAE7B,8CAA0C,OAAO,kBAAkB,gBAAgB,SAAS,mBAAmB;AAC/G,oBAAgB,UAAU;AAAA,EAE5B,GAAG,CAAC,KAAK,CAAC;AACZ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ import * as React from "react";
2
+ const marginKeys = [
3
+ "margin",
4
+ "marginTop",
5
+ "marginRight",
6
+ "marginBottom",
7
+ "marginLeft",
8
+ "m",
9
+ "mt",
10
+ "mr",
11
+ "mb",
12
+ "ml",
13
+ "mx",
14
+ "my"
15
+ ];
16
+ const paddingKeys = [
17
+ "padding",
18
+ "p",
19
+ "paddingTop",
20
+ "pt",
21
+ "paddingRight",
22
+ "pr",
23
+ "paddingBottom",
24
+ "pb",
25
+ "paddingLeft",
26
+ "pl",
27
+ "px",
28
+ "py"
29
+ ];
30
+ const spaceKeys = ["spaceY", "spaceX", "spaceXReverse", "spaceYReverse"];
31
+ const widthKeys = ["w", "maxWidth", "maxW", "minWidth", "minW"];
32
+ const heightKeys = ["h", "maxHeight", "maxH", "minHeight", "minH"];
33
+ const maskSizeKeys = ["maskSize"];
34
+ const spacingKeys = [...marginKeys, ...paddingKeys, ...spaceKeys];
35
+ const sizingKeys = [...widthKeys, ...heightKeys, ...maskSizeKeys];
36
+ const layoutKeys = [
37
+ "display",
38
+ "float",
39
+ "boxSizing",
40
+ "container",
41
+ "overflow",
42
+ "overflowX",
43
+ "overflowY",
44
+ "zIndex",
45
+ "position",
46
+ "top",
47
+ "right",
48
+ "bottom",
49
+ "left",
50
+ "visibility",
51
+ "overscrollBehavior",
52
+ "objectFit"
53
+ ];
54
+ const xstyledKeys = Object.fromEntries([...spacingKeys, ...sizingKeys, ...layoutKeys].map((item) => [item, true]));
55
+ export {
56
+ layoutKeys,
57
+ xstyledKeys
58
+ };
59
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/xstyledProps/constants.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "const marginKeys = [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'm',\n 'mt',\n 'mr',\n 'mb',\n 'ml',\n 'mx',\n 'my',\n];\n\nconst paddingKeys = [\n 'padding',\n 'p',\n 'paddingTop',\n 'pt',\n 'paddingRight',\n 'pr',\n 'paddingBottom',\n 'pb',\n 'paddingLeft',\n 'pl',\n 'px',\n 'py',\n];\n\nconst spaceKeys = ['spaceY', 'spaceX', 'spaceXReverse', 'spaceYReverse'];\n\nconst widthKeys = ['w', 'maxWidth', 'maxW', 'minWidth', 'minW'];\n\nconst heightKeys = ['h', 'maxHeight', 'maxH', 'minHeight', 'minH'];\n\nconst maskSizeKeys = ['maskSize'];\n\nconst spacingKeys = [...marginKeys, ...paddingKeys, ...spaceKeys];\nconst sizingKeys = [...widthKeys, ...heightKeys, ...maskSizeKeys];\nexport const layoutKeys = [\n 'display',\n 'float',\n 'boxSizing',\n 'container',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'zIndex',\n 'position',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'overscrollBehavior',\n 'objectFit',\n];\n\nexport const xstyledKeys = Object.fromEntries(\n [...spacingKeys, ...sizingKeys, ...layoutKeys].map((item) => [item, true]),\n) as Record<string, true>;\n"],
5
+ "mappings": "AAAA;ACAA,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,YAAY,CAAC,UAAU,UAAU,iBAAiB,eAAe;AAEvE,MAAM,YAAY,CAAC,KAAK,YAAY,QAAQ,YAAY,MAAM;AAE9D,MAAM,aAAa,CAAC,KAAK,aAAa,QAAQ,aAAa,MAAM;AAEjE,MAAM,eAAe,CAAC,UAAU;AAEhC,MAAM,cAAc,CAAC,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS;AAChE,MAAM,aAAa,CAAC,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY;AACzD,MAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,cAAc,OAAO,YAChC,CAAC,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,CAC3E;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ export * from "./useGetXstyledProps";
3
+ export * from "./xstyledPropTypes";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/xstyledProps/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useGetXstyledProps';\nexport * from './xstyledPropTypes';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { useMemo } from "react";
3
+ import { xstyledKeys } from "./constants";
4
+ const useGetXstyledProps = (props) => {
5
+ const componentXstyledProps = useMemo(() => {
6
+ const xstyledPropsObject = {};
7
+ Object.entries(props).forEach(([key, value]) => {
8
+ if (key in xstyledKeys) {
9
+ xstyledPropsObject[key] = value;
10
+ }
11
+ });
12
+ return xstyledPropsObject;
13
+ }, [props]);
14
+ return componentXstyledProps;
15
+ };
16
+ export {
17
+ useGetXstyledProps
18
+ };
19
+ //# sourceMappingURL=useGetXstyledProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/xstyledProps/useGetXstyledProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport type { SizingProps, SpaceProps, LayoutProps } from '@xstyled/styled-components';\nimport { xstyledKeys } from './constants';\n\nexport type XstyledProps = SpaceProps & SizingProps & LayoutProps;\n\ntype PropsWithXstyled<T> = T & XstyledProps;\n\nexport const useGetXstyledProps = <T,>(props: PropsWithXstyled<T>): XstyledProps => {\n const componentXstyledProps = useMemo(() => {\n const xstyledPropsObject: Record<string, unknown> = {};\n Object.entries(props).forEach(([key, value]) => {\n if (key in xstyledKeys) {\n xstyledPropsObject[key] = value;\n }\n });\n return xstyledPropsObject;\n }, [props]);\n\n return componentXstyledProps as XstyledProps;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AAMO,MAAM,qBAAqB,CAAK,UAA6C;AAClF,QAAM,wBAAwB,QAAQ,MAAM;AAC1C,UAAM,qBAA8C,CAAC;AACrD,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,WAAW;AAC9C,UAAI,OAAO,aAAa;AACtB,2BAAmB,OAAO;AAAA,MAC5B;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "../propTypes";
3
+ const xstyledPropTypes = {
4
+ margin: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
5
+ m: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
6
+ marginTop: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
7
+ mt: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
8
+ marginRight: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
9
+ mr: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
10
+ marginBottom: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
11
+ mb: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
12
+ marginLeft: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
13
+ ml: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
14
+ mx: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
15
+ my: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
16
+ padding: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
17
+ p: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
18
+ paddingTop: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
19
+ pt: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
20
+ paddingRight: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
21
+ pr: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
22
+ paddingBottom: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
23
+ pb: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
24
+ paddingLeft: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
25
+ pl: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
26
+ px: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
27
+ py: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
28
+ spaceY: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
29
+ spaceX: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
30
+ spaceXReverse: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
31
+ spaceYReverse: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
32
+ w: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
33
+ maxWidth: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
34
+ maxW: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
35
+ minWidth: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
36
+ minW: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
37
+ h: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
38
+ maxHeight: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
39
+ maxH: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
40
+ minHeight: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
41
+ minH: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
42
+ maskSize: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
43
+ display: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
44
+ float: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
45
+ boxSizing: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
46
+ container: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
47
+ overflow: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
48
+ overflowX: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
49
+ overflowY: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
50
+ zIndex: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
51
+ position: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
52
+ top: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
53
+ right: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
54
+ bottom: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
55
+ left: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
56
+ visibility: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
57
+ overscrollBehavior: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled(),
58
+ objectFit: PropTypes.any.description("Applies to the root container. For more info read xstyled docs").xstyled()
59
+ };
60
+ export {
61
+ xstyledPropTypes
62
+ };
63
+ //# sourceMappingURL=xstyledPropTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/xstyledProps/xstyledPropTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '../propTypes';\n\nexport const xstyledPropTypes = {\n margin: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n m: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n marginTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n mt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n marginRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n mr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n marginBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n mb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n marginLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n ml: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n mx: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n my: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n padding: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n p: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n paddingTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n pt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n paddingRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n pr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n paddingBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n pb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n paddingLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n pl: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n px: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n py: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n spaceY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n spaceX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n spaceXReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n spaceYReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n w: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n maxWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n maxW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n minWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n minW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n h: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n maxHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n maxH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n minHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n minH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n maskSize: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n display: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n float: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n boxSizing: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n container: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n overflow: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n overflowX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n overflowY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n zIndex: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n position: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n top: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n right: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n bottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n left: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n visibility: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n overscrollBehavior: PropTypes.any\n .description('Applies to the root container. For more info read xstyled docs')\n .xstyled(),\n objectFit: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),\n};\n"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AAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC/G,WAAW,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC/G,UAAU,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC9G,WAAW,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC/G,WAAW,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC/G,QAAQ,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC5G,UAAU,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC9G,KAAK,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EACzG,OAAO,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC3G,QAAQ,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC5G,MAAM,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAC1G,YAAY,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AAAA,EAChH,oBAAoB,UAAU,IAC3B,YAAY,gEAAgE,EAC5E,QAAQ;AAAA,EACX,WAAW,UAAU,IAAI,YAAY,gEAAgE,EAAE,QAAQ;AACjH;",
6
+ "names": []
7
+ }
@@ -1,29 +1,8 @@
1
1
  import * as React from "react";
2
2
  import React2 from "react";
3
- function isClassComponent(component) {
4
- return !!(typeof component === "function" && !!component.prototype.isReactComponent);
5
- }
6
- function isFunctionComponent(component) {
7
- return typeof component === "function" && String(component).includes("return React.createElement");
8
- }
9
- function isReactComponent(component) {
10
- return !!(isClassComponent(component) || isFunctionComponent(component));
11
- }
12
- function isElement(element) {
13
- return React2.isValidElement(element);
14
- }
15
- function isDOMTypeElement(element) {
16
- return isElement(element) && typeof element.type === "string";
17
- }
18
- function isCompositeTypeElement(element) {
19
- return isElement(element) && typeof element.type === "function";
20
- }
3
+ const isElement = (element) => React2.isValidElement(element);
4
+ const isDOMTypeElement = (element) => isElement(element) && typeof element?.type === "string";
21
5
  export {
22
- isClassComponent,
23
- isCompositeTypeElement,
24
- isDOMTypeElement,
25
- isElement,
26
- isFunctionComponent,
27
- isReactComponent
6
+ isDOMTypeElement
28
7
  };
29
8
  //# sourceMappingURL=reactTypesUtility.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/reactTypesUtility.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nexport function isClassComponent(component) {\n return !!(typeof component === 'function' && !!component.prototype.isReactComponent);\n}\n\nexport function isFunctionComponent(component) {\n return typeof component === 'function' && String(component).includes('return React.createElement');\n}\n\nexport function isReactComponent(component) {\n return !!(isClassComponent(component) || isFunctionComponent(component));\n}\n\nexport function isElement(element) {\n return React.isValidElement(element);\n}\n\nexport function isDOMTypeElement(element) {\n return isElement(element) && typeof element.type === 'string';\n}\n\nexport function isCompositeTypeElement(element) {\n return isElement(element) && typeof element.type === 'function';\n}\n"],
5
- "mappings": "AAAA;ACAA;AAEO,0BAA0B,WAAW;AAC1C,SAAO,CAAC,CAAE,QAAO,cAAc,cAAc,CAAC,CAAC,UAAU,UAAU;AAAA;AAG9D,6BAA6B,WAAW;AAC7C,SAAO,OAAO,cAAc,cAAc,OAAO,WAAW,SAAS;AAAA;AAGhE,0BAA0B,WAAW;AAC1C,SAAO,CAAC,CAAE,kBAAiB,cAAc,oBAAoB;AAAA;AAGxD,mBAAmB,SAAS;AACjC,SAAO,OAAM,eAAe;AAAA;AAGvB,0BAA0B,SAAS;AACxC,SAAO,UAAU,YAAY,OAAO,QAAQ,SAAS;AAAA;AAGhD,gCAAgC,SAAS;AAC9C,SAAO,UAAU,YAAY,OAAO,QAAQ,SAAS;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nconst isElement = (element: Record<string, unknown> | null | undefined) => React.isValidElement(element);\n\nexport const isDOMTypeElement = (element: Record<string, unknown> | null | undefined) =>\n isElement(element) && typeof element?.type === 'string';\n"],
5
+ "mappings": "AAAA;ACAA;AAEA,MAAM,YAAY,CAAC,YAAwD,OAAM,eAAe,OAAO;AAEhG,MAAM,mBAAmB,CAAC,YAC/B,UAAU,OAAO,KAAK,OAAO,SAAS,SAAS;",
6
6
  "names": []
7
7
  }
@@ -7,19 +7,14 @@ const setRef = (ref, value) => {
7
7
  ref.current = value;
8
8
  }
9
9
  };
10
- function mergeRefs(...refs) {
11
- return (node) => {
10
+ const mergeRefs = (...refs) => {
11
+ const mergeRefsFunc = (node) => {
12
12
  if (!node)
13
13
  return;
14
- refs.forEach((ref) => {
15
- if (isFunction(ref)) {
16
- ref(node);
17
- } else if (ref) {
18
- ref.current = node;
19
- }
20
- });
14
+ refs.forEach((ref) => setRef(ref, node));
21
15
  };
22
- }
16
+ return mergeRefsFunc;
17
+ };
23
18
  function logger(...args) {
24
19
  console.log(...args);
25
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/system.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { isFunction } from './utils';\n\nexport const setRef = (ref, value) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport function mergeRefs(...refs) {\n return (node) => {\n if (!node) return;\n refs.forEach((ref) => {\n if (isFunction(ref)) {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\nexport function logger(...args) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n"],
5
- "mappings": "AAAA;ACAA;AAEO,MAAM,SAAS,CAAC,KAAK,UAAU;AACpC,MAAI,WAAW,MAAM;AACnB,QAAI;AAAA,aACK,KAAK;AACd,QAAI,UAAU;AAAA;AAAA;AAIX,sBAAsB,MAAM;AACjC,SAAO,CAAC,SAAS;AACf,QAAI,CAAC;AAAM;AACX,SAAK,QAAQ,CAAC,QAAQ;AACpB,UAAI,WAAW,MAAM;AACnB,YAAI;AAAA,iBACK,KAAK;AACd,YAAI,UAAU;AAAA;AAAA;AAAA;AAAA;AAMf,mBAAmB,MAAM;AAE9B,UAAQ,IAAI,GAAG;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { isFunction } from './utils';\n\ntype AnyRef<T extends HTMLElement> = React.MutableRefObject<T> | ((_ref: T) => void);\n\nexport const setRef = <T extends HTMLElement>(ref: AnyRef<T>, value: T) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport const mergeRefs = <T extends HTMLElement>(...refs: AnyRef<T>[]) => {\n const mergeRefsFunc = (node: T) => {\n if (!node) return;\n refs.forEach((ref) => setRef(ref, node));\n };\n return mergeRefsFunc;\n};\n\nexport function logger(...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n"],
5
+ "mappings": "AAAA;ACAA;AAIO,MAAM,SAAS,CAAwB,KAAgB,UAAa;AACzE,MAAI,WAAW,GAAG,GAAG;AACnB,QAAI,KAAK;AAAA,EACX,WAAW,KAAK;AACd,QAAI,UAAU;AAAA,EAChB;AACF;AAEO,MAAM,YAAY,IAA2B,SAAsB;AACxE,QAAM,gBAAgB,CAAC,SAAY;AACjC,QAAI,CAAC;AAAM;AACX,SAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAAA,EACzC;AACA,SAAO;AACT;AAEO,mBAAmB,MAAiB;AAEzC,UAAQ,IAAI,GAAG,IAAI;AACrB;",
6
6
  "names": []
7
7
  }