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,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SkeletonImage = SkeletonImage;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _animations = require("../../animations");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Image skeleton primitive
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <SkeletonImage width={80} height={80} borderRadius={40} />
17
+ * ```
18
+ */
19
+ function SkeletonImage({
20
+ width = 100,
21
+ height = 100,
22
+ borderRadius = 0,
23
+ style,
24
+ animation = 'shimmer',
25
+ baseColor,
26
+ highlightColor,
27
+ duration
28
+ }) {
29
+ return /*#__PURE__*/_react.default.createElement(_animations.AnimationWrapper, {
30
+ animation: animation,
31
+ width: width,
32
+ height: height,
33
+ borderRadius: borderRadius,
34
+ baseColor: baseColor,
35
+ highlightColor: highlightColor,
36
+ duration: duration,
37
+ style: [styles.image, style]
38
+ });
39
+ }
40
+ const styles = _reactNative.StyleSheet.create({
41
+ image: {
42
+ overflow: 'hidden'
43
+ }
44
+ });
45
+ SkeletonImage.displayName = 'Skeleton.Image';
46
+ //# sourceMappingURL=SkeletonImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_animations","e","__esModule","default","SkeletonImage","width","height","borderRadius","style","animation","baseColor","highlightColor","duration","createElement","AnimationWrapper","styles","image","StyleSheet","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,aAAaA,CAAC;EAC5BC,KAAK,GAAG,GAAG;EACXC,MAAM,GAAG,GAAG;EACZC,YAAY,GAAG,CAAC;EAChBC,KAAK;EACLC,SAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,cAAc;EACdC;AAMF,CAAC,EAAE;EACD,oBACEhB,MAAA,CAAAO,OAAA,CAAAU,aAAA,CAACb,WAAA,CAAAc,gBAAgB;IACfL,SAAS,EAAEA,SAAU;IACrBJ,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfC,YAAY,EAAEA,YAAa;IAC3BG,SAAS,EAAEA,SAAU;IACrBC,cAAc,EAAEA,cAAe;IAC/BC,QAAQ,EAAEA,QAAS;IACnBJ,KAAK,EAAE,CAACO,MAAM,CAACC,KAAK,EAAER,KAAK;EAAE,CAC9B,CAAC;AAEN;AAEA,MAAMO,MAAM,GAAGE,uBAAU,CAACC,MAAM,CAAC;EAC/BF,KAAK,EAAE;IACLG,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFf,aAAa,CAACgB,WAAW,GAAG,gBAAgB","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SkeletonText = SkeletonText;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _animations = require("../../animations");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Text skeleton primitive with multiple lines
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <SkeletonText lines={3} fontSize={16} lastLineWidth="70%" />
17
+ * ```
18
+ */
19
+ function SkeletonText({
20
+ lines = 1,
21
+ fontSize = 14,
22
+ lineHeight,
23
+ width = '100%',
24
+ lastLineWidth = '60%',
25
+ style,
26
+ animation = 'shimmer',
27
+ baseColor,
28
+ highlightColor,
29
+ duration
30
+ }) {
31
+ const calculatedLineHeight = lineHeight || fontSize * 1.4;
32
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
33
+ style: style
34
+ }, Array.from({
35
+ length: lines
36
+ }).map((_, index) => {
37
+ const isLastLine = index === lines - 1;
38
+ const lineWidth = isLastLine && lines > 1 ? lastLineWidth : width;
39
+ return /*#__PURE__*/_react.default.createElement(_animations.AnimationWrapper, {
40
+ key: index,
41
+ animation: animation,
42
+ width: lineWidth,
43
+ height: fontSize,
44
+ borderRadius: 4,
45
+ baseColor: baseColor,
46
+ highlightColor: highlightColor,
47
+ duration: duration,
48
+ style: [styles.line, {
49
+ marginBottom: index < lines - 1 ? calculatedLineHeight - fontSize : 0
50
+ }]
51
+ });
52
+ }));
53
+ }
54
+ const styles = _reactNative.StyleSheet.create({
55
+ line: {
56
+ overflow: 'hidden'
57
+ }
58
+ });
59
+ SkeletonText.displayName = 'Skeleton.Text';
60
+ //# sourceMappingURL=SkeletonText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_animations","e","__esModule","default","SkeletonText","lines","fontSize","lineHeight","width","lastLineWidth","style","animation","baseColor","highlightColor","duration","calculatedLineHeight","createElement","View","Array","from","length","map","_","index","isLastLine","lineWidth","AnimationWrapper","key","height","borderRadius","styles","line","marginBottom","StyleSheet","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonText.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAAC;EAC3BC,KAAK,GAAG,CAAC;EACTC,QAAQ,GAAG,EAAE;EACbC,UAAU;EACVC,KAAK,GAAG,MAAM;EACdC,aAAa,GAAG,KAAK;EACrBC,KAAK;EACLC,SAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,cAAc;EACdC;AAMF,CAAC,EAAE;EACD,MAAMC,oBAAoB,GAAGR,UAAU,IAAID,QAAQ,GAAG,GAAG;EAEzD,oBACEV,MAAA,CAAAO,OAAA,CAAAa,aAAA,CAACjB,YAAA,CAAAkB,IAAI;IAACP,KAAK,EAAEA;EAAM,GAChBQ,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEf;EAAM,CAAC,CAAC,CAACgB,GAAG,CAAC,CAACC,CAAC,EAAEC,KAAK,KAAK;IAC/C,MAAMC,UAAU,GAAGD,KAAK,KAAKlB,KAAK,GAAG,CAAC;IACtC,MAAMoB,SAAS,GAAGD,UAAU,IAAInB,KAAK,GAAG,CAAC,GAAGI,aAAa,GAAGD,KAAK;IAEjE,oBACEZ,MAAA,CAAAO,OAAA,CAAAa,aAAA,CAAChB,WAAA,CAAA0B,gBAAgB;MACfC,GAAG,EAAEJ,KAAM;MACXZ,SAAS,EAAEA,SAAU;MACrBH,KAAK,EAAEiB,SAAU;MACjBG,MAAM,EAAEtB,QAAS;MACjBuB,YAAY,EAAE,CAAE;MAChBjB,SAAS,EAAEA,SAAU;MACrBC,cAAc,EAAEA,cAAe;MAC/BC,QAAQ,EAAEA,QAAS;MACnBJ,KAAK,EAAE,CACLoB,MAAM,CAACC,IAAI,EACX;QACEC,YAAY,EAAET,KAAK,GAAGlB,KAAK,GAAG,CAAC,GAAGU,oBAAoB,GAAGT,QAAQ,GAAG;MACtE,CAAC;IACD,CACH,CAAC;EAEN,CAAC,CACG,CAAC;AAEX;AAEA,MAAMwB,MAAM,GAAGG,uBAAU,CAACC,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF/B,YAAY,CAACgC,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SkeletonBox", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SkeletonBox.SkeletonBox;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SkeletonCircle", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _SkeletonCircle.SkeletonCircle;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "SkeletonImage", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _SkeletonImage.SkeletonImage;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "SkeletonText", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _SkeletonText.SkeletonText;
28
+ }
29
+ });
30
+ var _SkeletonBox = require("./SkeletonBox");
31
+ var _SkeletonText = require("./SkeletonText");
32
+ var _SkeletonImage = require("./SkeletonImage");
33
+ var _SkeletonCircle = require("./SkeletonCircle");
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_SkeletonBox","require","_SkeletonText","_SkeletonImage","_SkeletonCircle"],"sourceRoot":"../../../../src","sources":["components/primitives/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withSkeleton = withSkeleton;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Skeleton = require("./Skeleton");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Higher-order component that adds a loading skeleton to any component.
12
+ *
13
+ * The returned component accepts a `loading` prop (plus the wrapped
14
+ * component's own props). While `loading` is true it renders a skeleton
15
+ * derived from `options.styles`; otherwise it renders the real component.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const Home = withSkeleton(HomeScreen, { styles });
20
+ *
21
+ * <Home loading={isLoading} user={user} />
22
+ * ```
23
+ */
24
+ function withSkeleton(Component, options = {}) {
25
+ const WithSkeleton = props => {
26
+ const {
27
+ loading,
28
+ ...componentProps
29
+ } = props;
30
+ return /*#__PURE__*/_react.default.createElement(_Skeleton.Skeleton, {
31
+ loading: loading,
32
+ styles: options.styles,
33
+ excludeStyles: options.excludeStyles,
34
+ animation: options.animation,
35
+ duration: options.duration,
36
+ baseColor: options.baseColor,
37
+ highlightColor: options.highlightColor,
38
+ borderRadius: options.borderRadius
39
+ }, /*#__PURE__*/_react.default.createElement(Component, componentProps));
40
+ };
41
+ const name = Component.displayName || Component.name || 'Component';
42
+ WithSkeleton.displayName = `withSkeleton(${name})`;
43
+ return WithSkeleton;
44
+ }
45
+ //# sourceMappingURL=withSkeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Skeleton","e","__esModule","default","withSkeleton","Component","options","WithSkeleton","props","loading","componentProps","createElement","Skeleton","styles","excludeStyles","animation","duration","baseColor","highlightColor","borderRadius","name","displayName"],"sourceRoot":"../../../src","sources":["components/withSkeleton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAgBtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAC1BC,SAA2B,EAC3BC,OAA4B,GAAG,CAAC,CAAC,EACjC;EACA,MAAMC,YAAY,GAAIC,KAA+B,IAAK;IACxD,MAAM;MAAEC,OAAO;MAAE,GAAGC;IAAe,CAAC,GAAGF,KAAK;IAE5C,oBACEX,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,SAAA,CAAAY,QAAQ;MACPH,OAAO,EAAEA,OAAQ;MACjBI,MAAM,EAAEP,OAAO,CAACO,MAAO;MACvBC,aAAa,EAAER,OAAO,CAACQ,aAAc;MACrCC,SAAS,EAAET,OAAO,CAACS,SAAU;MAC7BC,QAAQ,EAAEV,OAAO,CAACU,QAAS;MAC3BC,SAAS,EAAEX,OAAO,CAACW,SAAU;MAC7BC,cAAc,EAAEZ,OAAO,CAACY,cAAe;MACvCC,YAAY,EAAEb,OAAO,CAACa;IAAa,gBAEnCtB,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACN,SAAS,EAAMK,cAAkC,CAC1C,CAAC;EAEf,CAAC;EAED,MAAMU,IAAI,GAAGf,SAAS,CAACgB,WAAW,IAAIhB,SAAS,CAACe,IAAI,IAAI,WAAW;EACnEb,YAAY,CAACc,WAAW,GAAG,gBAAgBD,IAAI,GAAG;EAElD,OAAOb,YAAY;AACrB","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_DIMENSIONS = exports.DEFAULT_CONFIG = exports.DARK_MODE_COLORS = void 0;
7
+ /**
8
+ * Default skeleton configuration
9
+ */
10
+ const DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
11
+ animation: 'shimmer',
12
+ duration: 1200,
13
+ baseColor: '#E1E9EE',
14
+ highlightColor: '#F0F4F8',
15
+ borderRadius: 4,
16
+ debug: false
17
+ };
18
+
19
+ /**
20
+ * Dark mode colors
21
+ */
22
+ const DARK_MODE_COLORS = exports.DARK_MODE_COLORS = {
23
+ baseColor: '#2A3F4F',
24
+ highlightColor: '#3A5364'
25
+ };
26
+
27
+ /**
28
+ * Default dimensions for components without explicit sizing
29
+ */
30
+ const DEFAULT_DIMENSIONS = exports.DEFAULT_DIMENSIONS = {
31
+ image: {
32
+ width: 100,
33
+ height: 100
34
+ },
35
+ text: {
36
+ fontSize: 14,
37
+ lineHeight: 20
38
+ },
39
+ box: {
40
+ height: 50
41
+ }
42
+ };
43
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_CONFIG","exports","animation","duration","baseColor","highlightColor","borderRadius","debug","DARK_MODE_COLORS","DEFAULT_DIMENSIONS","image","width","height","text","fontSize","lineHeight","box"],"sourceRoot":"../../../src","sources":["constants/defaults.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,MAAMA,cAAwC,GAAAC,OAAA,CAAAD,cAAA,GAAG;EACtDE,SAAS,EAAE,SAAS;EACpBC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE,SAAS;EACpBC,cAAc,EAAE,SAAS;EACzBC,YAAY,EAAE,CAAC;EACfC,KAAK,EAAE;AACT,CAAC;;AAED;AACA;AACA;AACO,MAAMC,gBAAgB,GAAAP,OAAA,CAAAO,gBAAA,GAAG;EAC9BJ,SAAS,EAAE,SAAS;EACpBC,cAAc,EAAE;AAClB,CAAC;;AAED;AACA;AACA;AACO,MAAMI,kBAAkB,GAAAR,OAAA,CAAAQ,kBAAA,GAAG;EAChCC,KAAK,EAAE;IACLC,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDC,GAAG,EAAE;IACHJ,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDeepExpander = getDeepExpander;
7
+ exports.setDeepExpander = setDeepExpander;
8
+ // Deep expansion is opt-in so the core bundle never depends on react-reconciler.
9
+ // `react-native-skelo/deep` registers the expander; Skeleton reads it here.
10
+
11
+ let expander = null;
12
+ function setDeepExpander(fn) {
13
+ expander = fn;
14
+ }
15
+ function getDeepExpander() {
16
+ return expander;
17
+ }
18
+ //# sourceMappingURL=deepRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["expander","setDeepExpander","fn","getDeepExpander"],"sourceRoot":"../../../src","sources":["core/deepRegistry.ts"],"mappings":";;;;;;;AAGA;AACA;;AAGA,IAAIA,QAA6B,GAAG,IAAI;AAEjC,SAASC,eAAeA,CAACC,EAAgB,EAAQ;EACtDF,QAAQ,GAAGE,EAAE;AACf;AAEO,SAASC,eAAeA,CAAA,EAAwB;EACrD,OAAOH,QAAQ;AACjB","ignoreList":[]}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyleSkeleton = StyleSkeleton;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _primitives = require("../../components/primitives");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
12
+ /**
13
+ * A single named style, or an ordered list of styles, or a whole StyleSheet
14
+ * object as returned by `StyleSheet.create`.
15
+ */
16
+
17
+ /**
18
+ * Turn one flattened style into the most appropriate skeleton primitive.
19
+ *
20
+ * Heuristics:
21
+ * - a `fontSize` with no explicit height → text bar
22
+ * - square with radius ≥ half its size → circle (avatar)
23
+ * - anything with width and/or height → box
24
+ * - a pure layout container (no visual dimensions) → skipped (returns null)
25
+ */
26
+ function styleToSkeleton(rawStyle, key, config) {
27
+ const flat = _reactNative.StyleSheet.flatten(rawStyle) || {};
28
+ const {
29
+ width,
30
+ height,
31
+ borderRadius,
32
+ fontSize
33
+ } = flat;
34
+ const anim = {
35
+ animation: config.animation,
36
+ baseColor: config.baseColor,
37
+ highlightColor: config.highlightColor,
38
+ duration: config.duration
39
+ };
40
+ const spacing = {
41
+ marginTop: flat.marginTop ?? 0,
42
+ marginBottom: flat.marginBottom ?? 12
43
+ };
44
+
45
+ // Text-like: has a font size but isn't a fixed-height box.
46
+ if (fontSize != null && height == null) {
47
+ return /*#__PURE__*/_react.default.createElement(_primitives.SkeletonText, _extends({
48
+ key: key,
49
+ lines: 1,
50
+ fontSize: fontSize,
51
+ lineHeight: flat.lineHeight,
52
+ width: width ?? '60%',
53
+ style: spacing
54
+ }, anim));
55
+ }
56
+
57
+ // Circle / avatar: square with a radius that rounds it fully.
58
+ if (typeof width === 'number' && width === height && typeof borderRadius === 'number' && borderRadius >= width / 2) {
59
+ return /*#__PURE__*/_react.default.createElement(_primitives.SkeletonCircle, _extends({
60
+ key: key,
61
+ size: width,
62
+ style: spacing
63
+ }, anim));
64
+ }
65
+
66
+ // Box: anything with an explicit dimension.
67
+ if (width != null || height != null) {
68
+ return /*#__PURE__*/_react.default.createElement(_primitives.SkeletonBox, _extends({
69
+ key: key,
70
+ width: width ?? '100%',
71
+ height: height ?? 20,
72
+ borderRadius: borderRadius ?? config.borderRadius ?? 4,
73
+ style: spacing
74
+ }, anim));
75
+ }
76
+
77
+ // Pure layout container (no visual footprint) — nothing to draw.
78
+ return null;
79
+ }
80
+
81
+ /**
82
+ * Generates a skeleton directly from a set of styles.
83
+ *
84
+ * Because a StyleSheet is flat (no element hierarchy), the output is a vertical
85
+ * stack of skeleton shapes — one per style that has visual dimensions — sized
86
+ * from each style's own props. Layout-only styles are skipped.
87
+ */
88
+ function StyleSkeleton({
89
+ styles,
90
+ config,
91
+ exclude
92
+ }) {
93
+ const entries = Array.isArray(styles) ? styles.map((s, i) => [i, s]) : Object.entries(styles || {}).filter(([name]) => !exclude || !exclude.includes(name));
94
+ const nodes = entries.map(([key, style]) => styleToSkeleton(style, key, config)).filter(n => n !== null);
95
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
96
+ accessibilityRole: "progressbar",
97
+ accessible: true
98
+ }, nodes);
99
+ }
100
+ StyleSkeleton.displayName = 'Skeleton.FromStyles';
101
+ //# sourceMappingURL=StyleSkeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_primitives","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","styleToSkeleton","rawStyle","key","config","flat","StyleSheet","flatten","width","height","borderRadius","fontSize","anim","animation","baseColor","highlightColor","duration","spacing","marginTop","marginBottom","createElement","SkeletonText","lines","lineHeight","style","SkeletonCircle","size","SkeletonBox","StyleSkeleton","styles","exclude","entries","Array","isArray","map","s","i","filter","name","includes","nodes","View","accessibilityRole","accessible","displayName"],"sourceRoot":"../../../../src","sources":["core/generator/StyleSkeleton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AAAwF,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAExF;AACA;AACA;AACA;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,eAAeA,CACtBC,QAAiB,EACjBC,GAAoB,EACpBC,MAAsB,EACK;EAC3B,MAAMC,IAAI,GAAIC,uBAAU,CAACC,OAAO,CAACL,QAAiB,CAAC,IAAI,CAAC,CAAe;EACvE,MAAM;IAAEM,KAAK;IAAEC,MAAM;IAAEC,YAAY;IAAE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ser = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _resolver = require("../resolver");
9
+ var _utils = require("../../utils");
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ /**
12
+ * Parser class for traversing and analyzing React component trees
13
+ */
14
+ class Parser {
15
+ /**
16
+ * Parse a React element tree into a component node tree
17
+ *
18
+ * @param children - React children to parse
19
+ * @returns Array of component nodes
20
+ */
21
+ static parse(children) {
22
+ const flattened = (0, _utils.flattenChildren)(children);
23
+ const nodes = [];
24
+ flattened.forEach(child => {
25
+ if (! /*#__PURE__*/(0, _react.isValidElement)(child)) {
26
+ // Skip non-element children (strings, numbers, null, etc.)
27
+ return;
28
+ }
29
+ const node = this.parseElement(child);
30
+ if (node) {
31
+ nodes.push(node);
32
+ }
33
+ });
34
+ return nodes;
35
+ }
36
+
37
+ /**
38
+ * Parse a single React element
39
+ *
40
+ * @param element - React element
41
+ * @returns Component node or null
42
+ */
43
+ static parseElement(element) {
44
+ const type = (0, _utils.getComponentName)(element);
45
+ const props = element.props || {};
46
+ const style = _resolver.StyleResolver.resolve(element);
47
+
48
+ // Parse children recursively
49
+ const children = props.children ? this.parse(props.children) : [];
50
+ return {
51
+ type,
52
+ props,
53
+ style,
54
+ children,
55
+ element
56
+ };
57
+ }
58
+
59
+ /**
60
+ * Estimate number of text lines from content and style
61
+ *
62
+ * @param children - Text content
63
+ * @param style - Resolved style
64
+ * @returns Estimated number of lines
65
+ */
66
+ static estimateTextLines(children, _style) {
67
+ if (!children) {
68
+ return 1;
69
+ }
70
+
71
+ // Convert children to string
72
+ const text = _react.default.Children.toArray(children).filter(child => typeof child === 'string' || typeof child === 'number').join('');
73
+ if (!text) {
74
+ return 1;
75
+ }
76
+
77
+ // Simple heuristic: ~40 characters per line
78
+ const avgCharsPerLine = 40;
79
+ const estimatedLines = Math.ceil(text.length / avgCharsPerLine);
80
+ return Math.max(1, Math.min(estimatedLines, 5)); // Cap at 5 lines
81
+ }
82
+ }
83
+ exports.Parser = Parser;
84
+ //# sourceMappingURL=Parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_resolver","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Parser","parse","children","flattened","flattenChildren","nodes","forEach","child","isValidElement","node","parseElement","push","element","type","getComponentName","props","style","StyleResolver","resolve","estimateTextLines","_style","text","React","Children","toArray","filter","join","avgCharsPerLine","estimatedLines","Math","ceil","length","max","min","exports"],"sourceRoot":"../../../../src","sources":["core/parser/Parser.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAgE,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,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jC,MAAMC,KAAK,GAAGC,uBAAa,CAACC,OAAO,CAACN,OAAO,CAAC;;IAE5C;IACA,MAAMV,QAAQ,GAAGa,KAAK,CAACb,QAAQ,GAAG,IAAI,CAACD,KAAK,CAACc,KAAK,CAACb,QAAQ,CAAC,GAAG,EAAE;IAEjE,OAAO;MACLW,IAAI;MACJE,KAAK;MACLC,KAAK;MACLd,QAAQ;MACRU;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOO,iBAAiBA,CAACjB,QAAmB,EAAEkB,MAAY,EAAU;IAClE,IAAI,CAAClB,QAAQ,EAAE;MACb,OAAO,CAAC;IACV;;IAEA;IACA,MAAMmB,IAAI,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACtB,QAAQ,CAAC,CAC1CuB,MAAM,CAAClB,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,CAAC,CACvEmB,IAAI,CAAC,EAAE,CAAC;IAEX,IAAI,CAACL,IAAI,EAAE;MACT,OAAO,CAAC;IACV;;IAEA;IACA,MAAMM,eAAe,GAAG,EAAE;IAC1B,MAAMC,cAAc,GAAGC,IAAI,CAACC,IAAI,CAACT,IAAI,CAACU,MAAM,GAAGJ,eAAe,CAAC;IAE/D,OAAOE,IAAI,CAACG,GAAG,CAAC,CAAC,EAAEH,IAAI,CAACI,GAAG,CAACL,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;EACnD;AACF;AAACM,OAAA,CAAAlC,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expandToComponentNodes = expandToComponentNodes;
7
+ var _styleUtils = require("../../utils/styleUtils");
8
+ var _hostTreeReconciler = require("./hostTreeReconciler");
9
+ /**
10
+ * Offline structural expansion.
11
+ *
12
+ * Renders an element (including opaque function/class components) through a
13
+ * JS-only `react-reconciler` renderer to recover its underlying host-element
14
+ * tree (View / Text / Image + resolved styles), then converts it to Skelo's
15
+ * `ComponentNode` tree.
16
+ *
17
+ * This is what lets `<Skeleton><AnyComponent/></Skeleton>` produce a *structured*
18
+ * skeleton without the developer inlining host elements — the core DX. No
19
+ * deprecated APIs, no `act()`.
20
+ *
21
+ * Caveats (inherent to rendering the real component):
22
+ * - The component's mount effects run during expansion. Effectful screens
23
+ * should be guarded or given an explicit skeleton via `Skelo.register`.
24
+ * - It renders outside the app's providers, so context-dependent components may
25
+ * throw — caught, returning null so the caller falls back to static parsing.
26
+ */
27
+
28
+ /**
29
+ * Normalize a host instance type to a canonical name the renderer understands.
30
+ * On device, RN host components may surface as native names (e.g. RCTView,
31
+ * RCTSinglelineTextInputView); map them to View/Text/Image/etc.
32
+ */
33
+ function normalizeType(type) {
34
+ if (/image/i.test(type)) return 'Image';
35
+ if (/textinput/i.test(type)) return 'TextInput';
36
+ if (/text/i.test(type)) return 'Text';
37
+ if (/scroll/i.test(type)) return 'ScrollView';
38
+ if (/(flat|section|virtualized)list/i.test(type)) return 'FlatList';
39
+ // Everything else is treated as a plain container view.
40
+ return 'View';
41
+ }
42
+ function toComponentNode(node) {
43
+ if (node.type === '#text') {
44
+ return null; // text is folded into its parent's props.children
45
+ }
46
+ const textParts = [];
47
+ const elementChildren = [];
48
+ for (const child of node.children) {
49
+ if (child.type === '#text') {
50
+ if (child.text) textParts.push(child.text);
51
+ } else {
52
+ elementChildren.push(child);
53
+ }
54
+ }
55
+ const props = {
56
+ ...node.props
57
+ };
58
+ if (textParts.length > 0 && props.children == null) {
59
+ props.children = textParts.join('');
60
+ }
61
+ const style = (0, _styleUtils.resolveStyle)(node.props.style);
62
+ return {
63
+ type: normalizeType(node.type),
64
+ props,
65
+ style,
66
+ children: elementChildren.map(toComponentNode).filter(n => n !== null)
67
+ };
68
+ }
69
+
70
+ /**
71
+ * Expand an element to a `ComponentNode[]` via offline rendering.
72
+ *
73
+ * @returns the host-tree nodes, or `null` if offline rendering is unavailable
74
+ * (react-reconciler not installed) or the render failed.
75
+ */
76
+ function expandToComponentNodes(element) {
77
+ const tree = (0, _hostTreeReconciler.renderToHostTree)(element);
78
+ if (!tree) {
79
+ return null;
80
+ }
81
+ return tree.map(toComponentNode).filter(n => n !== null);
82
+ }
83
+ //# sourceMappingURL=expandOffline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_styleUtils","require","_hostTreeReconciler","normalizeType","type","test","toComponentNode","node","textParts","elementChildren","child","children","text","push","props","length","join","style","resolveStyle","map","filter","n","expandToComponentNodes","element","tree","renderToHostTree"],"sourceRoot":"../../../../src","sources":["core/parser/expandOffline.tsx"],"mappings":";;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASE,aAAaA,CAACC,IAAY,EAAU;EAC3C,IAAI,QAAQ,CAACC,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,OAAO;EACvC,IAAI,YAAY,CAACC,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,WAAW;EAC/C,IAAI,OAAO,CAACC,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,MAAM;EACrC,IAAI,SAAS,CAACC,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,YAAY;EAC7C,IAAI,iCAAiC,CAACC,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,UAAU;EACnE;EACA,OAAO,MAAM;AACf;AAEA,SAASE,eAAeA,CAACC,IAAkB,EAAwB;EACjE,IAAIA,IAAI,CAACH,IAAI,KAAK,OAAO,EAAE;IACzB,OAAO,IAAI,CAAC,CAAC;EACf;EAEA,MAAMI,SAAmB,GAAG,EAAE;EAC9B,MAAMC,eAA+B,GAAG,EAAE;EAC1C,K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