react-native-skelo 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -20
  3. package/lib/commonjs/Skelo.js +104 -0
  4. package/lib/commonjs/Skelo.js.map +1 -0
  5. package/lib/commonjs/animations/AnimationWrapper.js +76 -0
  6. package/lib/commonjs/animations/AnimationWrapper.js.map +1 -0
  7. package/lib/commonjs/animations/PulseAnimation.js +76 -0
  8. package/lib/commonjs/animations/PulseAnimation.js.map +1 -0
  9. package/lib/commonjs/animations/ShimmerAnimation.js +103 -0
  10. package/lib/commonjs/animations/ShimmerAnimation.js.map +1 -0
  11. package/lib/commonjs/animations/index.js +27 -0
  12. package/lib/commonjs/animations/index.js.map +1 -0
  13. package/lib/commonjs/components/MeasuredBlock.js +64 -0
  14. package/lib/commonjs/components/MeasuredBlock.js.map +1 -0
  15. package/lib/commonjs/components/Skeleton.js +144 -0
  16. package/lib/commonjs/components/Skeleton.js.map +1 -0
  17. package/lib/commonjs/components/SkeletonIgnore.js +30 -0
  18. package/lib/commonjs/components/SkeletonIgnore.js.map +1 -0
  19. package/lib/commonjs/components/SkeletonRenderer.js +270 -0
  20. package/lib/commonjs/components/SkeletonRenderer.js.map +1 -0
  21. package/lib/commonjs/components/primitives/SkeletonBox.js +47 -0
  22. package/lib/commonjs/components/primitives/SkeletonBox.js.map +1 -0
  23. package/lib/commonjs/components/primitives/SkeletonCircle.js +44 -0
  24. package/lib/commonjs/components/primitives/SkeletonCircle.js.map +1 -0
  25. package/lib/commonjs/components/primitives/SkeletonImage.js +46 -0
  26. package/lib/commonjs/components/primitives/SkeletonImage.js.map +1 -0
  27. package/lib/commonjs/components/primitives/SkeletonText.js +60 -0
  28. package/lib/commonjs/components/primitives/SkeletonText.js.map +1 -0
  29. package/lib/commonjs/components/primitives/index.js +34 -0
  30. package/lib/commonjs/components/primitives/index.js.map +1 -0
  31. package/lib/commonjs/components/withSkeleton.js +45 -0
  32. package/lib/commonjs/components/withSkeleton.js.map +1 -0
  33. package/lib/commonjs/constants/defaults.js +43 -0
  34. package/lib/commonjs/constants/defaults.js.map +1 -0
  35. package/lib/commonjs/core/deepRegistry.js +18 -0
  36. package/lib/commonjs/core/deepRegistry.js.map +1 -0
  37. package/lib/commonjs/core/generator/StyleSkeleton.js +101 -0
  38. package/lib/commonjs/core/generator/StyleSkeleton.js.map +1 -0
  39. package/lib/commonjs/core/parser/Parser.js +84 -0
  40. package/lib/commonjs/core/parser/Parser.js.map +1 -0
  41. package/lib/commonjs/core/parser/expandOffline.js +83 -0
  42. package/lib/commonjs/core/parser/expandOffline.js.map +1 -0
  43. package/lib/commonjs/core/parser/hostTreeReconciler.js +228 -0
  44. package/lib/commonjs/core/parser/hostTreeReconciler.js.map +1 -0
  45. package/lib/commonjs/core/parser/index.js +13 -0
  46. package/lib/commonjs/core/parser/index.js.map +1 -0
  47. package/lib/commonjs/core/registry/SkeletonRegistry.js +113 -0
  48. package/lib/commonjs/core/registry/SkeletonRegistry.js.map +1 -0
  49. package/lib/commonjs/core/registry/index.js +19 -0
  50. package/lib/commonjs/core/registry/index.js.map +1 -0
  51. package/lib/commonjs/core/resolver/StyleResolver.js +83 -0
  52. package/lib/commonjs/core/resolver/StyleResolver.js.map +1 -0
  53. package/lib/commonjs/core/resolver/index.js +13 -0
  54. package/lib/commonjs/core/resolver/index.js.map +1 -0
  55. package/lib/commonjs/deep.js +18 -0
  56. package/lib/commonjs/deep.js.map +1 -0
  57. package/lib/commonjs/index.js +66 -0
  58. package/lib/commonjs/index.js.map +1 -0
  59. package/lib/commonjs/plugins/ImagePlugin.js +60 -0
  60. package/lib/commonjs/plugins/ImagePlugin.js.map +1 -0
  61. package/lib/commonjs/plugins/TextPlugin.js +70 -0
  62. package/lib/commonjs/plugins/TextPlugin.js.map +1 -0
  63. package/lib/commonjs/plugins/ViewPlugin.js +71 -0
  64. package/lib/commonjs/plugins/ViewPlugin.js.map +1 -0
  65. package/lib/commonjs/plugins/index.js +27 -0
  66. package/lib/commonjs/plugins/index.js.map +1 -0
  67. package/lib/commonjs/types/index.js +2 -0
  68. package/lib/commonjs/types/index.js.map +1 -0
  69. package/lib/commonjs/types/plugin.js +6 -0
  70. package/lib/commonjs/types/plugin.js.map +1 -0
  71. package/lib/commonjs/types/skeleton.js +6 -0
  72. package/lib/commonjs/types/skeleton.js.map +1 -0
  73. package/lib/commonjs/utils/componentUtils.js +138 -0
  74. package/lib/commonjs/utils/componentUtils.js.map +1 -0
  75. package/lib/commonjs/utils/index.js +62 -0
  76. package/lib/commonjs/utils/index.js.map +1 -0
  77. package/lib/commonjs/utils/styleUtils.js +76 -0
  78. package/lib/commonjs/utils/styleUtils.js.map +1 -0
  79. package/lib/module/Skelo.js +98 -0
  80. package/lib/module/Skelo.js.map +1 -0
  81. package/lib/module/animations/AnimationWrapper.js +69 -0
  82. package/lib/module/animations/AnimationWrapper.js.map +1 -0
  83. package/lib/module/animations/PulseAnimation.js +69 -0
  84. package/lib/module/animations/PulseAnimation.js.map +1 -0
  85. package/lib/module/animations/ShimmerAnimation.js +96 -0
  86. package/lib/module/animations/ShimmerAnimation.js.map +1 -0
  87. package/lib/module/animations/index.js +4 -0
  88. package/lib/module/animations/index.js.map +1 -0
  89. package/lib/module/components/MeasuredBlock.js +57 -0
  90. package/lib/module/components/MeasuredBlock.js.map +1 -0
  91. package/lib/module/components/Skeleton.js +138 -0
  92. package/lib/module/components/Skeleton.js.map +1 -0
  93. package/lib/module/components/SkeletonIgnore.js +23 -0
  94. package/lib/module/components/SkeletonIgnore.js.map +1 -0
  95. package/lib/module/components/SkeletonRenderer.js +264 -0
  96. package/lib/module/components/SkeletonRenderer.js.map +1 -0
  97. package/lib/module/components/primitives/SkeletonBox.js +40 -0
  98. package/lib/module/components/primitives/SkeletonBox.js.map +1 -0
  99. package/lib/module/components/primitives/SkeletonCircle.js +37 -0
  100. package/lib/module/components/primitives/SkeletonCircle.js.map +1 -0
  101. package/lib/module/components/primitives/SkeletonImage.js +39 -0
  102. package/lib/module/components/primitives/SkeletonImage.js.map +1 -0
  103. package/lib/module/components/primitives/SkeletonText.js +53 -0
  104. package/lib/module/components/primitives/SkeletonText.js.map +1 -0
  105. package/lib/module/components/primitives/index.js +5 -0
  106. package/lib/module/components/primitives/index.js.map +1 -0
  107. package/lib/module/components/withSkeleton.js +38 -0
  108. package/lib/module/components/withSkeleton.js.map +1 -0
  109. package/lib/module/constants/defaults.js +37 -0
  110. package/lib/module/constants/defaults.js.map +1 -0
  111. package/lib/module/core/deepRegistry.js +11 -0
  112. package/lib/module/core/deepRegistry.js.map +1 -0
  113. package/lib/module/core/generator/StyleSkeleton.js +95 -0
  114. package/lib/module/core/generator/StyleSkeleton.js.map +1 -0
  115. package/lib/module/core/parser/Parser.js +77 -0
  116. package/lib/module/core/parser/Parser.js.map +1 -0
  117. package/lib/module/core/parser/expandOffline.js +77 -0
  118. package/lib/module/core/parser/expandOffline.js.map +1 -0
  119. package/lib/module/core/parser/hostTreeReconciler.js +222 -0
  120. package/lib/module/core/parser/hostTreeReconciler.js.map +1 -0
  121. package/lib/module/core/parser/index.js +2 -0
  122. package/lib/module/core/parser/index.js.map +1 -0
  123. package/lib/module/core/registry/SkeletonRegistry.js +106 -0
  124. package/lib/module/core/registry/SkeletonRegistry.js.map +1 -0
  125. package/lib/module/core/registry/index.js +2 -0
  126. package/lib/module/core/registry/index.js.map +1 -0
  127. package/lib/module/core/resolver/StyleResolver.js +77 -0
  128. package/lib/module/core/resolver/StyleResolver.js.map +1 -0
  129. package/lib/module/core/resolver/index.js +2 -0
  130. package/lib/module/core/resolver/index.js.map +1 -0
  131. package/lib/module/deep.js +11 -0
  132. package/lib/module/deep.js.map +1 -0
  133. package/lib/module/index.js +21 -0
  134. package/lib/module/index.js.map +1 -0
  135. package/lib/module/plugins/ImagePlugin.js +53 -0
  136. package/lib/module/plugins/ImagePlugin.js.map +1 -0
  137. package/lib/module/plugins/TextPlugin.js +63 -0
  138. package/lib/module/plugins/TextPlugin.js.map +1 -0
  139. package/lib/module/plugins/ViewPlugin.js +64 -0
  140. package/lib/module/plugins/ViewPlugin.js.map +1 -0
  141. package/lib/module/plugins/index.js +4 -0
  142. package/lib/module/plugins/index.js.map +1 -0
  143. package/lib/module/types/index.js +2 -0
  144. package/lib/module/types/index.js.map +1 -0
  145. package/lib/module/types/plugin.js +2 -0
  146. package/lib/module/types/plugin.js.map +1 -0
  147. package/lib/module/types/skeleton.js +2 -0
  148. package/lib/module/types/skeleton.js.map +1 -0
  149. package/lib/module/utils/componentUtils.js +123 -0
  150. package/lib/module/utils/componentUtils.js.map +1 -0
  151. package/lib/module/utils/index.js +3 -0
  152. package/lib/module/utils/index.js.map +1 -0
  153. package/lib/module/utils/styleUtils.js +66 -0
  154. package/lib/module/utils/styleUtils.js.map +1 -0
  155. package/lib/typescript/Skelo.d.ts +76 -0
  156. package/lib/typescript/Skelo.d.ts.map +1 -0
  157. package/lib/typescript/animations/AnimationWrapper.d.ts +66 -0
  158. package/lib/typescript/animations/AnimationWrapper.d.ts.map +1 -0
  159. package/lib/typescript/animations/PulseAnimation.d.ts +59 -0
  160. package/lib/typescript/animations/PulseAnimation.d.ts.map +1 -0
  161. package/lib/typescript/animations/ShimmerAnimation.d.ts +59 -0
  162. package/lib/typescript/animations/ShimmerAnimation.d.ts.map +1 -0
  163. package/lib/typescript/animations/index.d.ts +5 -0
  164. package/lib/typescript/animations/index.d.ts.map +1 -0
  165. package/lib/typescript/components/MeasuredBlock.d.ts +32 -0
  166. package/lib/typescript/components/MeasuredBlock.d.ts.map +1 -0
  167. package/lib/typescript/components/Skeleton.d.ts +37 -0
  168. package/lib/typescript/components/Skeleton.d.ts.map +1 -0
  169. package/lib/typescript/components/SkeletonIgnore.d.ts +26 -0
  170. package/lib/typescript/components/SkeletonIgnore.d.ts.map +1 -0
  171. package/lib/typescript/components/SkeletonRenderer.d.ts +39 -0
  172. package/lib/typescript/components/SkeletonRenderer.d.ts.map +1 -0
  173. package/lib/typescript/components/primitives/SkeletonBox.d.ts +21 -0
  174. package/lib/typescript/components/primitives/SkeletonBox.d.ts.map +1 -0
  175. package/lib/typescript/components/primitives/SkeletonCircle.d.ts +21 -0
  176. package/lib/typescript/components/primitives/SkeletonCircle.d.ts.map +1 -0
  177. package/lib/typescript/components/primitives/SkeletonImage.d.ts +21 -0
  178. package/lib/typescript/components/primitives/SkeletonImage.d.ts.map +1 -0
  179. package/lib/typescript/components/primitives/SkeletonText.d.ts +21 -0
  180. package/lib/typescript/components/primitives/SkeletonText.d.ts.map +1 -0
  181. package/lib/typescript/components/primitives/index.d.ts +5 -0
  182. package/lib/typescript/components/primitives/index.d.ts.map +1 -0
  183. package/lib/typescript/components/withSkeleton.d.ts +37 -0
  184. package/lib/typescript/components/withSkeleton.d.ts.map +1 -0
  185. package/lib/typescript/constants/defaults.d.ts +29 -0
  186. package/lib/typescript/constants/defaults.d.ts.map +1 -0
  187. package/lib/typescript/core/deepRegistry.d.ts +7 -0
  188. package/lib/typescript/core/deepRegistry.d.ts.map +1 -0
  189. package/lib/typescript/core/generator/StyleSkeleton.d.ts +36 -0
  190. package/lib/typescript/core/generator/StyleSkeleton.d.ts.map +1 -0
  191. package/lib/typescript/core/parser/Parser.d.ts +30 -0
  192. package/lib/typescript/core/parser/Parser.d.ts.map +1 -0
  193. package/lib/typescript/core/parser/expandOffline.d.ts +10 -0
  194. package/lib/typescript/core/parser/expandOffline.d.ts.map +1 -0
  195. package/lib/typescript/core/parser/hostTreeReconciler.d.ts +28 -0
  196. package/lib/typescript/core/parser/hostTreeReconciler.d.ts.map +1 -0
  197. package/lib/typescript/core/parser/index.d.ts +2 -0
  198. package/lib/typescript/core/parser/index.d.ts.map +1 -0
  199. package/lib/typescript/core/registry/SkeletonRegistry.d.ts +57 -0
  200. package/lib/typescript/core/registry/SkeletonRegistry.d.ts.map +1 -0
  201. package/lib/typescript/core/registry/index.d.ts +2 -0
  202. package/lib/typescript/core/registry/index.d.ts.map +1 -0
  203. package/lib/typescript/core/resolver/StyleResolver.d.ts +54 -0
  204. package/lib/typescript/core/resolver/StyleResolver.d.ts.map +1 -0
  205. package/lib/typescript/core/resolver/index.d.ts +2 -0
  206. package/lib/typescript/core/resolver/index.d.ts.map +1 -0
  207. package/lib/typescript/deep.d.ts +2 -0
  208. package/lib/typescript/deep.d.ts.map +1 -0
  209. package/lib/typescript/index.d.ts +17 -0
  210. package/lib/typescript/index.d.ts.map +1 -0
  211. package/lib/typescript/plugins/ImagePlugin.d.ts +11 -0
  212. package/lib/typescript/plugins/ImagePlugin.d.ts.map +1 -0
  213. package/lib/typescript/plugins/TextPlugin.d.ts +12 -0
  214. package/lib/typescript/plugins/TextPlugin.d.ts.map +1 -0
  215. package/lib/typescript/plugins/ViewPlugin.d.ts +11 -0
  216. package/lib/typescript/plugins/ViewPlugin.d.ts.map +1 -0
  217. package/lib/typescript/plugins/index.d.ts +4 -0
  218. package/lib/typescript/plugins/index.d.ts.map +1 -0
  219. package/lib/typescript/types/index.d.ts +3 -0
  220. package/lib/typescript/types/index.d.ts.map +1 -0
  221. package/lib/typescript/types/plugin.d.ts +144 -0
  222. package/lib/typescript/types/plugin.d.ts.map +1 -0
  223. package/lib/typescript/types/skeleton.d.ts +176 -0
  224. package/lib/typescript/types/skeleton.d.ts.map +1 -0
  225. package/lib/typescript/utils/componentUtils.d.ts +40 -0
  226. package/lib/typescript/utils/componentUtils.d.ts.map +1 -0
  227. package/lib/typescript/utils/index.d.ts +3 -0
  228. package/lib/typescript/utils/index.d.ts.map +1 -0
  229. package/lib/typescript/utils/styleUtils.d.ts +41 -0
  230. package/lib/typescript/utils/styleUtils.d.ts.map +1 -0
  231. package/package.json +171 -11
  232. package/src/Skelo.ts +103 -0
  233. package/src/animations/AnimationWrapper.tsx +139 -0
  234. package/src/animations/PulseAnimation.tsx +138 -0
  235. package/src/animations/ShimmerAnimation.tsx +169 -0
  236. package/src/animations/index.ts +4 -0
  237. package/src/components/MeasuredBlock.tsx +85 -0
  238. package/src/components/Skeleton.tsx +149 -0
  239. package/src/components/SkeletonIgnore.tsx +27 -0
  240. package/src/components/SkeletonRenderer.tsx +341 -0
  241. package/src/components/primitives/SkeletonBox.tsx +53 -0
  242. package/src/components/primitives/SkeletonCircle.tsx +48 -0
  243. package/src/components/primitives/SkeletonImage.tsx +50 -0
  244. package/src/components/primitives/SkeletonText.tsx +69 -0
  245. package/src/components/primitives/index.ts +4 -0
  246. package/src/components/withSkeleton.tsx +62 -0
  247. package/src/constants/defaults.ts +38 -0
  248. package/src/core/deepRegistry.ts +16 -0
  249. package/src/core/generator/StyleSkeleton.tsx +138 -0
  250. package/src/core/parser/Parser.ts +86 -0
  251. package/src/core/parser/expandOffline.tsx +83 -0
  252. package/src/core/parser/hostTreeReconciler.tsx +271 -0
  253. package/src/core/parser/index.ts +1 -0
  254. package/src/core/registry/SkeletonRegistry.ts +111 -0
  255. package/src/core/registry/index.ts +1 -0
  256. package/src/core/resolver/StyleResolver.ts +80 -0
  257. package/src/core/resolver/index.ts +1 -0
  258. package/src/deep.ts +12 -0
  259. package/src/index.ts +30 -0
  260. package/src/plugins/ImagePlugin.tsx +65 -0
  261. package/src/plugins/TextPlugin.tsx +71 -0
  262. package/src/plugins/ViewPlugin.tsx +67 -0
  263. package/src/plugins/index.ts +3 -0
  264. package/src/types/index.ts +14 -0
  265. package/src/types/plugin.ts +164 -0
  266. package/src/types/skeleton.ts +197 -0
  267. package/src/utils/componentUtils.ts +166 -0
  268. package/src/utils/index.ts +9 -0
  269. package/src/utils/styleUtils.ts +72 -0
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { ShimmerAnimation } from './ShimmerAnimation';
4
+ import { PulseAnimation } from './PulseAnimation';
5
+ /**
6
+ * Animation wrapper that selects the appropriate animation type
7
+ *
8
+ * Provides a unified interface for all skeleton animations:
9
+ * - shimmer: Left-to-right shimmer effect
10
+ * - pulse: Breathing/pulsing opacity
11
+ * - none: Static skeleton (no animation)
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <AnimationWrapper
16
+ * animation="shimmer"
17
+ * width={200}
18
+ * height={20}
19
+ * />
20
+ * ```
21
+ */
22
+ export function AnimationWrapper({
23
+ animation = 'shimmer',
24
+ width,
25
+ height,
26
+ baseColor = '#E1E9EE',
27
+ highlightColor = '#F2F8FC',
28
+ duration,
29
+ borderRadius = 4,
30
+ style,
31
+ children
32
+ }) {
33
+ // No animation - static skeleton
34
+ if (animation === 'none') {
35
+ return /*#__PURE__*/React.createElement(View, {
36
+ style: [{
37
+ width,
38
+ height,
39
+ borderRadius,
40
+ backgroundColor: baseColor
41
+ }, style]
42
+ }, children);
43
+ }
44
+
45
+ // Shimmer animation
46
+ if (animation === 'shimmer') {
47
+ return /*#__PURE__*/React.createElement(ShimmerAnimation, {
48
+ width: width,
49
+ height: height,
50
+ baseColor: baseColor,
51
+ highlightColor: highlightColor,
52
+ duration: duration ?? 1500,
53
+ borderRadius: borderRadius,
54
+ style: style
55
+ }, children);
56
+ }
57
+
58
+ // Pulse animation
59
+ return /*#__PURE__*/React.createElement(PulseAnimation, {
60
+ width: width,
61
+ height: height,
62
+ baseColor: baseColor,
63
+ highlightColor: highlightColor,
64
+ duration: duration ?? 1000,
65
+ borderRadius: borderRadius,
66
+ style: style
67
+ }, children);
68
+ }
69
+ //# sourceMappingURL=AnimationWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","ShimmerAnimation","PulseAnimation","AnimationWrapper","animation","width","height","baseColor","highlightColor","duration","borderRadius","style","children","createElement","backgroundColor"],"sourceRoot":"../../../src","sources":["animations/AnimationWrapper.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AAwDjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,SAAS,GAAG,SAAS;EACrBC,KAAK;EACLC,MAAM;EACNC,SAAS,GAAG,SAAS;EACrBC,cAAc,GAAG,SAAS;EAC1BC,QAAQ;EACRC,YAAY,GAAG,CAAC;EAChBC,KAAK;EACLC;AACqB,CAAC,EAAE;EACxB;EACA,IAAIR,SAAS,KAAK,MAAM,EAAE;IACxB,oBACEL,KAAA,CAAAc,aAAA,CAACb,IAAI;MACHW,KAAK,EAAE,CACL;QACEN,KAAK;QACLC,MAAM;QACNI,YAAY;QACZI,eAAe,EAAEP;MACnB,CAAC,EACDI,KAAK;IACL,GAEDC,QACG,CAAC;EAEX;;EAEA;EACA,IAAIR,SAAS,KAAK,SAAS,EAAE;IAC3B,oBACEL,KAAA,CAAAc,aAAA,CAACZ,gBAAgB;MACfI,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA,MAAO;MACfC,SAAS,EAAEA,SAAU;MACrBC,cAAc,EAAEA,cAAe;MAC/BC,QAAQ,EAAEA,QAAQ,IAAI,IAAK;MAC3BC,YAAY,EAAEA,YAAa;MAC3BC,KAAK,EAAEA;IAAM,GAEZC,QACe,CAAC;EAEvB;;EAEA;EACA,oBACEb,KAAA,CAAAc,aAAA,CAACX,cAAc;IACbG,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA,SAAU;IACrBC,cAAc,EAAEA,cAAe;IAC/BC,QAAQ,EAAEA,QAAQ,IAAI,IAAK;IAC3BC,YAAY,EAAEA,YAAa;IAC3BC,KAAK,EAAEA;EAAM,GAEZC,QACa,CAAC;AAErB","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ import React, { useEffect } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withSequence, withTiming, Easing } from 'react-native-reanimated';
4
+ /**
5
+ * Pulse animation component using Reanimated 3
6
+ *
7
+ * Creates a subtle breathing/pulsing effect using:
8
+ * - Shared values for performance
9
+ * - Worklets for 60 FPS on UI thread
10
+ * - Opacity animation for pulse effect
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * <PulseAnimation
15
+ * width={200}
16
+ * height={20}
17
+ * borderRadius={4}
18
+ * />
19
+ * ```
20
+ */
21
+ export function PulseAnimation({
22
+ width,
23
+ height,
24
+ baseColor = '#E1E9EE',
25
+ duration = 1000,
26
+ borderRadius = 4,
27
+ style,
28
+ children
29
+ }) {
30
+ // Shared value for opacity (0 to 1)
31
+ const opacity = useSharedValue(1);
32
+ useEffect(() => {
33
+ // Start infinite pulse animation
34
+ // Sequence: fade out -> fade in
35
+ opacity.value = withRepeat(withSequence(withTiming(0.5, {
36
+ duration: duration / 2,
37
+ easing: Easing.inOut(Easing.ease)
38
+ }), withTiming(1, {
39
+ duration: duration / 2,
40
+ easing: Easing.inOut(Easing.ease)
41
+ })), -1,
42
+ // Infinite repeat
43
+ false // Don't reverse
44
+ );
45
+ }, [duration, opacity]);
46
+
47
+ // Animated style for pulse effect
48
+ const animatedStyle = useAnimatedStyle(() => {
49
+ 'worklet';
50
+
51
+ return {
52
+ opacity: opacity.value
53
+ };
54
+ }, []);
55
+ return /*#__PURE__*/React.createElement(Animated.View, {
56
+ style: [styles.container, {
57
+ width,
58
+ height,
59
+ borderRadius,
60
+ backgroundColor: baseColor
61
+ }, animatedStyle, style]
62
+ }, children);
63
+ }
64
+ const styles = StyleSheet.create({
65
+ container: {
66
+ overflow: 'hidden'
67
+ }
68
+ });
69
+ //# sourceMappingURL=PulseAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","StyleSheet","Animated","useSharedValue","useAnimatedStyle","withRepeat","withSequence","withTiming","Easing","PulseAnimation","width","height","baseColor","duration","borderRadius","style","children","opacity","value","easing","inOut","ease","animatedStyle","createElement","View","styles","container","backgroundColor","create","overflow"],"sourceRoot":"../../../src","sources":["animations/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I;IACZT,KAAK,EAAE,CACLU,MAAM,CAACC,SAAS,EAChB;MACEhB,KAAK;MACLC,MAAM;MACNG,YAAY;MACZa,eAAe,EAAEf;IACnB,CAAC,EACDU,aAAa,EACbP,KAAK;EACL,GAEDC,QACY,CAAC;AAEpB;AAEA,MAAMS,MAAM,GAAGxB,UAAU,CAAC2B,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,96 @@
1
+ import React, { useEffect } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withTiming, interpolate, Easing } from 'react-native-reanimated';
4
+ import { LinearGradient } from 'react-native-linear-gradient';
5
+ /**
6
+ * Shimmer animation component using Reanimated 3
7
+ *
8
+ * Creates a smooth left-to-right shimmer effect using:
9
+ * - Shared values for performance
10
+ * - Worklets for 60 FPS on UI thread
11
+ * - Linear gradient for shimmer effect
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <ShimmerAnimation
16
+ * width={200}
17
+ * height={20}
18
+ * borderRadius={4}
19
+ * />
20
+ * ```
21
+ */
22
+ export function ShimmerAnimation({
23
+ width,
24
+ height,
25
+ baseColor = '#E1E9EE',
26
+ highlightColor = '#F2F8FC',
27
+ duration = 1500,
28
+ borderRadius = 4,
29
+ style,
30
+ children
31
+ }) {
32
+ // Shared value for animation progress (0 to 1)
33
+ const progress = useSharedValue(0);
34
+ useEffect(() => {
35
+ // Start infinite shimmer animation
36
+ progress.value = withRepeat(withTiming(1, {
37
+ duration,
38
+ easing: Easing.linear
39
+ }), -1,
40
+ // Infinite repeat
41
+ false // Don't reverse
42
+ );
43
+ }, [duration, progress]);
44
+
45
+ // Animated style for shimmer overlay
46
+ const animatedStyle = useAnimatedStyle(() => {
47
+ 'worklet';
48
+
49
+ // Calculate shimmer position
50
+ // Interpolate from -100% to 100% to create left-to-right sweep
51
+ const translateX = interpolate(progress.value, [0, 1], [-1, 1]);
52
+ return {
53
+ transform: [{
54
+ translateX: translateX * (typeof width === 'number' ? width : 200)
55
+ }]
56
+ };
57
+ }, [width]);
58
+ return /*#__PURE__*/React.createElement(View, {
59
+ style: [styles.container, {
60
+ width,
61
+ height,
62
+ borderRadius,
63
+ backgroundColor: baseColor
64
+ }, style]
65
+ }, /*#__PURE__*/React.createElement(Animated.View, {
66
+ style: [StyleSheet.absoluteFill, {
67
+ overflow: 'hidden',
68
+ borderRadius
69
+ }]
70
+ }, /*#__PURE__*/React.createElement(Animated.View, {
71
+ style: [styles.shimmer, {
72
+ width: typeof width === 'number' ? width : '100%',
73
+ height: '100%'
74
+ }, animatedStyle]
75
+ }, /*#__PURE__*/React.createElement(LinearGradient, {
76
+ colors: [baseColor, highlightColor, highlightColor, baseColor],
77
+ start: {
78
+ x: 0,
79
+ y: 0
80
+ },
81
+ end: {
82
+ x: 1,
83
+ y: 0
84
+ },
85
+ style: StyleSheet.absoluteFill
86
+ }))), children);
87
+ }
88
+ const styles = StyleSheet.create({
89
+ container: {
90
+ overflow: 'hidden'
91
+ },
92
+ shimmer: {
93
+ position: 'absolute'
94
+ }
95
+ });
96
+ //# sourceMappingURL=ShimmerAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","StyleSheet","View","Animated","useSharedValue","useAnimatedStyle","withRepeat","withTiming","interpolate","Easing","LinearGradient","ShimmerAnimation","width","height","baseColor","highlightColor","duration","borderRadius","style","children","progress","value","easing","linear","animatedStyle","translateX","transform","createElement","styles","container","backgroundColor","absoluteFill","overflow","shimmer","colors","start","x","y","end","create","position"],"sourceRoot":"../../../src","sources":["animations/ShimmerAnimation.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,OAAOC,QAAQ,IACbC,cAAc,EACdC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,WAA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;IACnB,CAAC,EACDI,KAAK;EACL,gBAGFnB,KAAA,CAAA4B,aAAA,CAACxB,QAAQ,CAACD,IAAI;IACZgB,KAAK,EAAE,CACLjB,UAAU,CAAC8B,YAAY,EACvB;MACEC,QAAQ,EAAE,QAAQ;MAClBf;IACF,CAAC;EACD,gBAEFlB,KAAA,CAAA4B,aAAA,CAACxB,QAAQ,CAACD,IAAI;IACZgB,KAAK,EAAE,CACLU,MAAM,CAACK,OAAO,EACd;MACErB,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,MAAM;MACjDC,MAAM,EAAE;IACV,CAAC,EACDW,aAAa;EACb,gBAEFzB,KAAA,CAAA4B,aAAA,CAACjB,cAAc;IACbwB,MAAM,EAAE,CAACpB,SAAS,EAAEC,cAAc,EAAEA,cAAc,EAAED,SAAS,CAAE;IAC/DqB,KAAK,EAAE;MAAEC,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IACtBC,GAAG,EAAE;MAAEF,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IACpBnB,KAAK,EAAEjB,UAAU,CAAC8B;EAAa,CAChC,CACY,CACF,CAAC,EAGfZ,QACG,CAAC;AAEX;AAEA,MAAMS,MAAM,GAAG3B,UAAU,CAACsC,MAAM,CAAC;EAC/BV,SAAS,EAAE;IACTG,QAAQ,EAAE;EACZ,CAAC;EACDC,OAAO,EAAE;IACPO,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export { ShimmerAnimation } from './ShimmerAnimation';
2
+ export { PulseAnimation } from './PulseAnimation';
3
+ export { AnimationWrapper } from './AnimationWrapper';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ShimmerAnimation","PulseAnimation","AnimationWrapper"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,gBAAgB,QAAQ,oBAAoB","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ import React, { useState } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { AnimationWrapper } from '../animations';
4
+ /**
5
+ * Renders an opaque (non-host) component hidden so it lays out at its real
6
+ * size, measures that size via `onLayout`, then overlays a shimmer block of
7
+ * exactly those dimensions.
8
+ *
9
+ * This is Skelo's runtime-measurement fallback: when the parser can't
10
+ * introspect a component (e.g. a user-defined function component), we can't
11
+ * know its internal View/Text/Image structure without native view-tree access,
12
+ * but we *can* render it off-screen and reproduce its footprint accurately.
13
+ *
14
+ * The result is a single, correctly-sized skeleton block rather than a
15
+ * misleading fixed-size placeholder.
16
+ */
17
+ export function MeasuredBlock({
18
+ children,
19
+ config
20
+ }) {
21
+ const [size, setSize] = useState(null);
22
+ const handleLayout = event => {
23
+ const {
24
+ width,
25
+ height
26
+ } = event.nativeEvent.layout;
27
+ setSize(prev => prev && prev.width === width && prev.height === height ? prev : {
28
+ width,
29
+ height
30
+ });
31
+ };
32
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
33
+ style: styles.hidden,
34
+ pointerEvents: "none",
35
+ importantForAccessibility: "no-hide-descendants",
36
+ accessibilityElementsHidden: true,
37
+ onLayout: handleLayout
38
+ }, children), size && size.width > 0 && size.height > 0 && /*#__PURE__*/React.createElement(View, {
39
+ style: StyleSheet.absoluteFill,
40
+ pointerEvents: "none"
41
+ }, /*#__PURE__*/React.createElement(AnimationWrapper, {
42
+ animation: config.animation,
43
+ width: size.width,
44
+ height: size.height,
45
+ baseColor: config.baseColor,
46
+ highlightColor: config.highlightColor,
47
+ duration: config.duration,
48
+ borderRadius: config.borderRadius
49
+ })));
50
+ }
51
+ const styles = StyleSheet.create({
52
+ hidden: {
53
+ opacity: 0
54
+ }
55
+ });
56
+ MeasuredBlock.displayName = 'Skeleton.MeasuredBlock';
57
+ //# sourceMappingURL=MeasuredBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","StyleSheet","View","AnimationWrapper","MeasuredBlock","children","config","size","setSize","handleLayout","event","width","height","nativeEvent","layout","prev","createElement","style","styles","hidden","pointerEvents","importantForAccessibility","accessibilityElementsHidden","onLayout","absoluteFill","animation","baseColor","highlightColor","duration","borderRadius","create","opacity","displayName"],"sourceRoot":"../../../src","sources":["components/MeasuredBlock.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAG/C,SAASC,gBAAgB,QAAQ,eAAe;AAmBhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAC;EAAEC,QAAQ;EAAEC;AAA2B,CAAC,EAAE;EACtE,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGR,QAAQ,CAAc,IAAI,CAAC;EAEnD,MAAMS,YAAY,GAAIC,KAAwB,IAAK;IACjD,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGF,KAAK,CAACG,WAAW,CAACC,MAAM;IAClDN,OAAO,CAACO,IAAI,IACVA,IAAI,IAAIA,IAAI,CAACJ,KAAK,KAAKA,KAAK,IAAII,IAAI,CAACH,MAAM,KAAKA,MAAM,GAAGG,IAAI,GAAG;MAAEJ,KAAK;MAAEC;IAAO,CAClF,CAAC;EACH,CAAC;EAED,oBACEb,KAAA,CAAAiB,aAAA,CAACd,IAAI,qBAEHH,KAAA,CAAAiB,aAAA,CAACd,IAAI;IACHe,KAAK,EAAEC,MAAM,CAACC,MAAO;IACrBC,aAAa,EAAC,MAAM;IACpBC,yBAAyB,EAAC,qBAAqB;IAC/CC,2BAA2B;IAC3BC,QAAQ,EAAEd;EAAa,GAEtBJ,QACG,CAAC,EAGNE,IAAI,IAAIA,IAAI,CAACI,KAAK,GAAG,CAAC,IAAIJ,IAAI,CAACK,MAAM,GAAG,CAAC,iBACxCb,KAAA,CAAAiB,aAAA,CAACd,IAAI;IAACe,KAAK,EAAEhB,UAAU,CAACuB,YAAa;IAACJ,aAAa,EAAC;EAAM,gBACxDrB,KAAA,CAAAiB,aAAA,CAACb,gBAAgB;IACfsB,SAAS,EAAEnB,MAAM,CAACmB,SAAU;IAC5Bd,KAAK,EAAEJ,IAAI,CAACI,KAAM;IAClBC,MAAM,EAAEL,IAAI,CAACK,MAAO;IACpBc,SAAS,EAAEpB,MAAM,CAACoB,SAAU;IAC5BC,cAAc,EAAErB,MAAM,CAACqB,cAAe;IACtCC,QAAQ,EAAEtB,MAAM,CAACsB,QAAS;IAC1BC,YAAY,EAAEvB,MAAM,CAACuB;EAAa,CACnC,CACG,CAEJ,CAAC;AAEX;AAEA,MAAMX,MAAM,GAAGjB,UAAU,CAAC6B,MAAM,CAAC;EAC/BX,MAAM,EAAE;IACNY,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF3B,aAAa,CAAC4B,WAAW,GAAG,wBAAwB","ignoreList":[]}
@@ -0,0 +1,138 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Parser } from '../core/parser';
3
+ import { SkeletonRenderer } from './SkeletonRenderer';
4
+ import { SkeletonIgnore } from './SkeletonIgnore';
5
+ import { StyleSkeleton } from '../core/generator/StyleSkeleton';
6
+ import { getDeepExpander } from '../core/deepRegistry';
7
+ import { DEFAULT_CONFIG } from '../constants/defaults';
8
+
9
+ /**
10
+ * Main Skeleton component
11
+ *
12
+ * Automatically generates skeleton loading states for your React Native components.
13
+ * Wraps your UI and shows skeleton placeholders while loading.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <Skeleton loading={isLoading}>
18
+ * <ProfileScreen />
19
+ * </Skeleton>
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <Skeleton
25
+ * loading={isLoading}
26
+ * animation="pulse"
27
+ * baseColor="#f0f0f0"
28
+ * highlightColor="#ffffff"
29
+ * >
30
+ * <View>
31
+ * <Text>Hello World</Text>
32
+ * <Image source={avatar} />
33
+ * </View>
34
+ * </Skeleton>
35
+ * ```
36
+ */
37
+ export function Skeleton({
38
+ loading,
39
+ children,
40
+ styles,
41
+ excludeStyles,
42
+ deep = false,
43
+ animation = DEFAULT_CONFIG.animation,
44
+ duration = DEFAULT_CONFIG.duration,
45
+ baseColor = DEFAULT_CONFIG.baseColor,
46
+ highlightColor = DEFAULT_CONFIG.highlightColor,
47
+ borderRadius = DEFAULT_CONFIG.borderRadius,
48
+ accessible = true,
49
+ accessibilityLabel = 'Loading content',
50
+ debug = false
51
+ }) {
52
+ // Parse component tree and generate skeleton.
53
+ // Hooks must run unconditionally (rules of hooks), but parsing stays lazy:
54
+ // we skip the work entirely when not loading or in styles-driven mode.
55
+ const skeletonTree = useMemo(() => {
56
+ if (!loading || styles) {
57
+ return [];
58
+ }
59
+ if (__DEV__ && debug) {
60
+ console.log('[Skelo] Parsing component tree...');
61
+ }
62
+ try {
63
+ // Deep mode: expand opaque components into their real host tree via the
64
+ // opt-in expander (registered by importing 'react-native-skelo/deep').
65
+ // Falls back to static parsing if unavailable or it returns nothing.
66
+ if (deep) {
67
+ const expand = getDeepExpander();
68
+ if (expand) {
69
+ const expanded = expand(/*#__PURE__*/React.createElement(React.Fragment, null, children));
70
+ if (expanded && expanded.length > 0) {
71
+ return expanded;
72
+ }
73
+ if (__DEV__) {
74
+ console.warn('[Skelo] deep expansion returned nothing; falling back to static parsing.');
75
+ }
76
+ } else if (__DEV__) {
77
+ console.warn("[Skelo] `deep` requires react-reconciler. Install it and add `import 'react-native-skelo/deep';` in your app entry.");
78
+ }
79
+ }
80
+ const parsed = Parser.parse(children);
81
+ if (__DEV__ && debug) {
82
+ // Log a lightweight summary: the raw nodes hold React elements
83
+ // (`element`) and arbitrary props that aren't safely serializable.
84
+ const summarize = nodes => nodes.map(node => ({
85
+ type: node.type,
86
+ style: node.style,
87
+ children: summarize(node.children)
88
+ }));
89
+ console.log('[Skelo] Parsed tree:', JSON.stringify(summarize(parsed), null, 2));
90
+ }
91
+ return parsed;
92
+ } catch (error) {
93
+ if (__DEV__) {
94
+ console.error('[Skelo] Failed to parse component tree:', error);
95
+ }
96
+ return [];
97
+ }
98
+ }, [loading, styles, deep, children, debug]);
99
+
100
+ // Create skeleton config
101
+ const config = useMemo(() => ({
102
+ animation,
103
+ duration,
104
+ baseColor,
105
+ highlightColor,
106
+ borderRadius
107
+ }), [animation, duration, baseColor, highlightColor, borderRadius]);
108
+
109
+ // If not loading, render the real children directly.
110
+ if (!loading) {
111
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
112
+ }
113
+
114
+ // Styles-driven mode: derive the skeleton from the provided styles instead of
115
+ // introspecting the child tree (useful when children are opaque components).
116
+ if (styles) {
117
+ return /*#__PURE__*/React.createElement(StyleSkeleton, {
118
+ styles: styles,
119
+ config: config,
120
+ exclude: excludeStyles
121
+ });
122
+ }
123
+ return /*#__PURE__*/React.createElement(SkeletonRenderer, {
124
+ tree: skeletonTree,
125
+ config: config,
126
+ accessible: accessible,
127
+ accessibilityLabel: accessibilityLabel,
128
+ debug: debug
129
+ });
130
+ }
131
+ Skeleton.displayName = 'Skeleton';
132
+
133
+ /**
134
+ * Escape hatch to keep children as real content inside a loading `<Skeleton>`.
135
+ * @see SkeletonIgnore
136
+ */
137
+ Skeleton.Ignore = SkeletonIgnore;
138
+ //# sourceMappingURL=Skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","Parser","SkeletonRenderer","SkeletonIgnore","StyleSkeleton","getDeepExpander","DEFAULT_CONFIG","Skeleton","loading","children","styles","excludeStyles","deep","animation","duration","baseColor","highlightColor","borderRadius","accessible","accessibilityLabel","debug","skeletonTree","__DEV__","console","log","expand","expanded","createElement","Fragment","length","warn","parsed","parse","summarize","nodes","map","node","type","style","JSON","stringify","error","config","exclude","tree","displayName","Ignore"],"sourceRoot":"../../../src","s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C,YAAY,CAC/D,CAAC;;EAED;EACA,IAAI,CAACT,OAAO,EAAE;IACZ,oBAAOT,KAAA,CAAA4B,aAAA,CAAA5B,KAAA,CAAA6B,QAAA,QAAGnB,QAAW,CAAC;EACxB;;EAEA;EACA;EACA,IAAIC,MAAM,EAAE;IACV,oBAAOX,KAAA,CAAA4B,aAAA,CAACvB,aAAa;MAACM,MAAM,EAAEA,MAAO;MAACgC,MAAM,EAAEA,MAAO;MAACC,OAAO,EAAEhC;IAAc,CAAE,CAAC;EAClF;EAEA,oBACEZ,KAAA,CAAA4B,aAAA,CAACzB,gBAAgB;IACf0C,IAAI,EAAEvB,YAAa;IACnBqB,MAAM,EAAEA,MAAO;IACfxB,UAAU,EAAEA,UAAW;IACvBC,kBAAkB,EAAEA,kBAAmB;IACvCC,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN;AAEAb,QAAQ,CAACsC,WAAW,GAAG,UAAU;;AAEjC;AACA;AACA;AACA;AACAtC,QAAQ,CAACuC,MAAM,GAAG3C,cAAc","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ /**
3
+ * Escape hatch that renders its children as real content, even inside a
4
+ * loading `<Skeleton>`. Use it for elements that should stay visible during
5
+ * loading — section headings, static labels, action buttons, etc.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <Skeleton loading={loading}>
10
+ * <Skeleton.Ignore>
11
+ * <Text>Profile</Text> // stays as real text
12
+ * </Skeleton.Ignore>
13
+ * <ProfileCard /> // becomes a skeleton
14
+ * </Skeleton>
15
+ * ```
16
+ */
17
+ export function SkeletonIgnore({
18
+ children
19
+ }) {
20
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
21
+ }
22
+ SkeletonIgnore.displayName = 'Skeleton.Ignore';
23
+ //# sourceMappingURL=SkeletonIgnore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","SkeletonIgnore","children","createElement","Fragment","displayName"],"sourceRoot":"../../../src","sources":["components/SkeletonIgnore.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAOzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EAChE,oBAAOF,KAAA,CAAAG,aAAA,CAAAH,KAAA,CAAAI,QAAA,QAAGF,QAAW,CAAC;AACxB;AAEAD,cAAc,CAACI,WAAW,GAAG,iBAAiB","ignoreList":[]}