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,264 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { registry } from '../core/registry';
4
+ import { SkeletonBox, SkeletonText, SkeletonImage, SkeletonCircle } from './primitives';
5
+ import { MeasuredBlock } from './MeasuredBlock';
6
+ import { resolveStyle, extractDimensions } from '../utils/styleUtils';
7
+ import { randomWidth } from '../utils/componentUtils';
8
+
9
+ /**
10
+ * Host component types the renderer knows how to skeletonize directly.
11
+ * Anything else is treated as an opaque component and measured at runtime.
12
+ */
13
+ const HOST_CONTAINER_TYPES = new Set(['View', 'ScrollView', 'SafeAreaView', 'KeyboardAvoidingView', 'TouchableOpacity', 'TouchableHighlight', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'Pressable', 'Fragment']);
14
+ const HOST_LIST_TYPES = new Set(['FlatList', 'SectionList', 'VirtualizedList']);
15
+
16
+ // Track which opaque component names we've already warned about (dev only).
17
+ const warnedOpaqueTypes = new Set();
18
+ /**
19
+ * Renders skeleton from parsed component tree
20
+ *
21
+ * Uses plugins to transform components into skeleton equivalents:
22
+ * - View -> SkeletonBox
23
+ * - Text -> SkeletonText
24
+ * - Image -> SkeletonImage
25
+ * - Custom components -> Plugin strategies
26
+ */
27
+ export function SkeletonRenderer({
28
+ tree,
29
+ config,
30
+ accessible,
31
+ accessibilityLabel,
32
+ debug
33
+ }) {
34
+ /**
35
+ * Render a single component node
36
+ */
37
+ const renderNode = (node, index) => {
38
+ if (__DEV__ && debug) {
39
+ console.log(`[Skelo] Rendering node: ${node.type}`, node);
40
+ }
41
+
42
+ // Skeleton.Ignore escape hatch: render the real children untouched.
43
+ if (node.type === 'Skeleton.Ignore') {
44
+ return /*#__PURE__*/React.createElement(React.Fragment, {
45
+ key: index
46
+ }, node.props?.children);
47
+ }
48
+
49
+ // Check for registered plugin
50
+ const plugin = registry.getPluginByName(node.type);
51
+ if (plugin) {
52
+ try {
53
+ return /*#__PURE__*/React.createElement(React.Fragment, {
54
+ key: index
55
+ }, plugin.strategy(node.props, {
56
+ config,
57
+ theme: 'light',
58
+ // TODO: Add theme detection
59
+ parseChildren: children => {
60
+ const parsed = typeof children === 'object' && children !== null ? [children] : [];
61
+ return parsed.map((child, i) => renderNode(child, i));
62
+ },
63
+ primitives: {
64
+ Box: SkeletonBox,
65
+ Text: SkeletonText,
66
+ Image: SkeletonImage,
67
+ Circle: SkeletonCircle
68
+ },
69
+ utils: {
70
+ resolveStyle,
71
+ extractDimensions,
72
+ randomWidth
73
+ }
74
+ }));
75
+ } catch (error) {
76
+ if (__DEV__) {
77
+ console.error(`[Skelo] Plugin "${plugin.name}" failed:`, error);
78
+ }
79
+ }
80
+ }
81
+
82
+ // Built-in host component handling
83
+ switch (node.type) {
84
+ case 'Text':
85
+ return renderText(node, index);
86
+ case 'Image':
87
+ return renderImage(node, index);
88
+ }
89
+ if (HOST_LIST_TYPES.has(node.type) || node.type === 'ScrollView') {
90
+ return renderScrollableView(node, index);
91
+ }
92
+ if (HOST_CONTAINER_TYPES.has(node.type)) {
93
+ return renderView(node, index);
94
+ }
95
+
96
+ // Opaque component: the parser can't see inside it (a user-defined
97
+ // function/class component). Render it hidden and measure its real size,
98
+ // then overlay a size-matched shimmer.
99
+ return renderOpaque(node, index);
100
+ };
101
+
102
+ /**
103
+ * Render an opaque (non-host) component via runtime measurement.
104
+ */
105
+ const renderOpaque = (node, index) => {
106
+ if (__DEV__ && !warnedOpaqueTypes.has(node.type)) {
107
+ warnedOpaqueTypes.add(node.type);
108
+ console.warn(`[Skelo] "${node.type}" is a custom component, so Skelo can't inspect ` + `its internal View/Text/Image structure. It will be measured and ` + `shown as a single size-matched skeleton block.\n` + `For a structured skeleton, either compose "${node.type}" from host ` + `elements directly inside <Skeleton>, register a plugin via ` + `Skelo.register(${node.type}, ...), or provide a manual skeleton.`);
109
+ }
110
+
111
+ // If we still have the original element, measure it. Otherwise fall back
112
+ // to a container/box render.
113
+ if (node.element) {
114
+ return /*#__PURE__*/React.createElement(MeasuredBlock, {
115
+ key: index,
116
+ config: config
117
+ }, node.element);
118
+ }
119
+ return renderView(node, index);
120
+ };
121
+
122
+ /**
123
+ * Render View component
124
+ */
125
+ const renderView = (node, index) => {
126
+ const {
127
+ width,
128
+ height
129
+ } = node.style;
130
+ const hasChildren = node.children && node.children.length > 0;
131
+
132
+ // If View has explicit dimensions, render as box
133
+ if (width && height) {
134
+ return /*#__PURE__*/React.createElement(SkeletonBox, {
135
+ key: index,
136
+ width: width,
137
+ height: height,
138
+ borderRadius: node.style.borderRadius ?? config.borderRadius,
139
+ animation: config.animation,
140
+ baseColor: config.baseColor,
141
+ highlightColor: config.highlightColor,
142
+ duration: config.duration,
143
+ style: node.style
144
+ });
145
+ }
146
+
147
+ // If View has children, render container with children
148
+ if (hasChildren) {
149
+ return /*#__PURE__*/React.createElement(View, {
150
+ key: index,
151
+ style: node.style
152
+ }, node.children.map((child, i) => renderNode(child, i)));
153
+ }
154
+
155
+ // Empty View with no dimensions - render as small box
156
+ return /*#__PURE__*/React.createElement(SkeletonBox, {
157
+ key: index,
158
+ width: width ?? 100,
159
+ height: height ?? 20,
160
+ borderRadius: node.style.borderRadius ?? config.borderRadius,
161
+ animation: config.animation,
162
+ baseColor: config.baseColor,
163
+ highlightColor: config.highlightColor,
164
+ duration: config.duration,
165
+ style: node.style
166
+ });
167
+ };
168
+
169
+ /**
170
+ * Render Text component
171
+ */
172
+ const renderText = (node, index) => {
173
+ const fontSize = node.style.fontSize ?? 14;
174
+ const lineHeight = node.style.lineHeight ?? fontSize * 1.4;
175
+
176
+ // Estimate number of lines from text content
177
+ const textContent = node.props.children;
178
+ const estimatedLines = estimateTextLines(textContent);
179
+ return /*#__PURE__*/React.createElement(SkeletonText, {
180
+ key: index,
181
+ lines: estimatedLines,
182
+ fontSize: fontSize,
183
+ lineHeight: lineHeight,
184
+ width: node.style.width ?? '100%',
185
+ animation: config.animation,
186
+ baseColor: config.baseColor,
187
+ highlightColor: config.highlightColor,
188
+ duration: config.duration,
189
+ style: node.style
190
+ });
191
+ };
192
+
193
+ /**
194
+ * Render Image component
195
+ */
196
+ const renderImage = (node, index) => {
197
+ const width = node.style.width ?? 100;
198
+ const height = node.style.height ?? 100;
199
+ const borderRadius = node.style.borderRadius ?? 0;
200
+
201
+ // Check if it's a circular image (avatar)
202
+ const isCircle = typeof width === 'number' && typeof height === 'number' && width === height && borderRadius === width / 2;
203
+ if (isCircle) {
204
+ return /*#__PURE__*/React.createElement(SkeletonCircle, {
205
+ key: index,
206
+ size: width,
207
+ animation: config.animation,
208
+ baseColor: config.baseColor,
209
+ highlightColor: config.highlightColor,
210
+ duration: config.duration,
211
+ style: node.style
212
+ });
213
+ }
214
+ return /*#__PURE__*/React.createElement(SkeletonImage, {
215
+ key: index,
216
+ width: width,
217
+ height: height,
218
+ borderRadius: borderRadius,
219
+ animation: config.animation,
220
+ baseColor: config.baseColor,
221
+ highlightColor: config.highlightColor,
222
+ duration: config.duration,
223
+ style: node.style
224
+ });
225
+ };
226
+
227
+ /**
228
+ * Render scrollable views
229
+ */
230
+ const renderScrollableView = (node, index) => {
231
+ // For scrollable views, render their children
232
+ return /*#__PURE__*/React.createElement(View, {
233
+ key: index,
234
+ style: node.style
235
+ }, node.children.map((child, i) => renderNode(child, i)));
236
+ };
237
+
238
+ /**
239
+ * Estimate number of lines from text content
240
+ */
241
+ const estimateTextLines = children => {
242
+ if (!children) return 1;
243
+ if (typeof children === 'string' || typeof children === 'number') {
244
+ const text = String(children);
245
+ const avgCharsPerLine = 40;
246
+ const estimatedLines = Math.ceil(text.length / avgCharsPerLine);
247
+ return Math.max(1, Math.min(estimatedLines, 5)); // Cap at 5 lines
248
+ }
249
+ if (Array.isArray(children)) {
250
+ // Multiple text nodes - count as separate lines
251
+ return Math.min(children.length, 5);
252
+ }
253
+ return 1;
254
+ };
255
+
256
+ // Render the skeleton tree
257
+ return /*#__PURE__*/React.createElement(View, {
258
+ accessible: accessible,
259
+ accessibilityLabel: accessibilityLabel,
260
+ accessibilityRole: "progressbar"
261
+ }, tree.map((node, index) => renderNode(node, index)));
262
+ }
263
+ SkeletonRenderer.displayName = 'SkeletonRenderer';
264
+ //# sourceMappingURL=SkeletonRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","registry","SkeletonBox","SkeletonText","SkeletonImage","SkeletonCircle","MeasuredBlock","resolveStyle","extractDimensions","randomWidth","HOST_CONTAINER_TYPES","Set","HOST_LIST_TYPES","warnedOpaqueTypes","SkeletonRenderer","tree","config","accessible","accessibilityLabel","debug","renderNode","node","index","__DEV__","console","log","type","createElement","Fragment","key","props","children","plugin","getPluginByName","strategy","theme","parseChildren","parsed","map","child","i","primitives","Box","Text","Image","Circle","utils","error","name","renderText","renderImage","has","renderScrollableView","renderView","renderOpaque","add","warn","element","width","height","style","hasChildren","length","borderRadius","animation","baseColor","highlightColor","duration","fontSize","lineHeight","textContent","estimatedLines","estimateTextLines","lines","isCircle","size","text","String","avgCharsPerLine","Math","ceil","max","min","Array","isArray","accessibilityRole","displayName"],"sourceRoot":"../../../src","sources":["components/SkeletonRenderer.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,WAAW,EAAEC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,cAAc;AACvF,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,YAAY,EAAEC,iBAAiB,QAAQ,qBAAqB;AACrE,SAASC,WAAW,QAAQ,yBAAyB;;AAErD;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CACnC,MAAM,EACN,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,EACX,UAAU,CACX,CAAC;AACF,MAAMC,eAAe,GAAG,IAAID,GAAG,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;;AAE/E;AACA,MAAME,iBAAiB,GAAG,IAAIF,GAAG,CAAS,CAAC;AA6B3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAAC;EAC/BC,IAAI;EACJC,MAAM;EACNC,UAAU;EACVC,kBAAkB;EAClBC;AACqB,CAAC,EAAE;EACxB;AACF;AAC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AR,gBAAgB,CAACwE,WAAW,GAAG,kBAAkB","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { AnimationWrapper } from '../../animations';
4
+ /**
5
+ * Basic box skeleton primitive
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <SkeletonBox width={100} height={50} borderRadius={8} />
10
+ * ```
11
+ */
12
+ export function SkeletonBox({
13
+ width,
14
+ height,
15
+ borderRadius = 4,
16
+ style,
17
+ children,
18
+ animation = 'shimmer',
19
+ baseColor,
20
+ highlightColor,
21
+ duration
22
+ }) {
23
+ return /*#__PURE__*/React.createElement(AnimationWrapper, {
24
+ animation: animation,
25
+ width: width,
26
+ height: height,
27
+ borderRadius: borderRadius,
28
+ baseColor: baseColor,
29
+ highlightColor: highlightColor,
30
+ duration: duration,
31
+ style: [styles.box, style]
32
+ }, children);
33
+ }
34
+ const styles = StyleSheet.create({
35
+ box: {
36
+ overflow: 'hidden'
37
+ }
38
+ });
39
+ SkeletonBox.displayName = 'Skeleton.Box';
40
+ //# sourceMappingURL=SkeletonBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","AnimationWrapper","SkeletonBox","width","height","borderRadius","style","children","animation","baseColor","highlightColor","duration","createElement","styles","box","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonBox.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AAEzC,SAASC,gBAAgB,QAAQ,kBAAkB;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,MAAM;EACNC,YAAY,GAAG,CAAC;EAChBC,KAAK;EACLC,QAAQ;EACRC,SAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,cAAc;EACdC;AAMF,CAAC,EAAE;EACD,oBACEZ,KAAA,CAAAa,aAAA,CAACX,gBAAgB;IACfO,SAAS,EAAEA,SAAU;IACrBL,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfC,YAAY,EAAEA,YAAa;IAC3BI,SAAS,EAAEA,SAAU;IACrBC,cAAc,EAAEA,cAAe;IAC/BC,QAAQ,EAAEA,QAAS;IACnBL,KAAK,EAAE,CAACO,MAAM,CAACC,GAAG,EAAER,KAAK;EAAE,GAE1BC,QACe,CAAC;AAEvB;AAEA,MAAMM,MAAM,GAAGb,UAAU,CAACe,MAAM,CAAC;EAC/BD,GAAG,EAAE;IACHE,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFd,WAAW,CAACe,WAAW,GAAG,cAAc","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { AnimationWrapper } from '../../animations';
4
+ /**
5
+ * Circle skeleton primitive (useful for avatars)
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <SkeletonCircle size={40} />
10
+ * ```
11
+ */
12
+ export function SkeletonCircle({
13
+ size = 40,
14
+ style,
15
+ animation = 'shimmer',
16
+ baseColor,
17
+ highlightColor,
18
+ duration
19
+ }) {
20
+ return /*#__PURE__*/React.createElement(AnimationWrapper, {
21
+ animation: animation,
22
+ width: size,
23
+ height: size,
24
+ borderRadius: size / 2,
25
+ baseColor: baseColor,
26
+ highlightColor: highlightColor,
27
+ duration: duration,
28
+ style: [styles.circle, style]
29
+ });
30
+ }
31
+ const styles = StyleSheet.create({
32
+ circle: {
33
+ overflow: 'hidden'
34
+ }
35
+ });
36
+ SkeletonCircle.displayName = 'Skeleton.Circle';
37
+ //# sourceMappingURL=SkeletonCircle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","AnimationWrapper","SkeletonCircle","size","style","animation","baseColor","highlightColor","duration","createElement","width","height","borderRadius","styles","circle","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonCircle.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AAEzC,SAASC,gBAAgB,QAAQ,kBAAkB;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAC7BC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,SAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,cAAc;EACdC;AAMF,CAAC,EAAE;EACD,oBACET,KAAA,CAAAU,aAAA,CAACR,gBAAgB;IACfI,SAAS,EAAEA,SAAU;IACrBK,KAAK,EAAEP,IAAK;IACZQ,MAAM,EAAER,IAAK;IACbS,YAAY,EAAET,IAAI,GAAG,CAAE;IACvBG,SAAS,EAAEA,SAAU;IACrBC,cAAc,EAAEA,cAAe;IAC/BC,QAAQ,EAAEA,QAAS;IACnBJ,KAAK,EAAE,CAACS,MAAM,CAACC,MAAM,EAAEV,KAAK;EAAE,CAC/B,CAAC;AAEN;AAEA,MAAMS,MAAM,GAAGb,UAAU,CAACe,MAAM,CAAC;EAC/BD,MAAM,EAAE;IACNE,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFd,cAAc,CAACe,WAAW,GAAG,iBAAiB","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { AnimationWrapper } from '../../animations';
4
+ /**
5
+ * Image skeleton primitive
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <SkeletonImage width={80} height={80} borderRadius={40} />
10
+ * ```
11
+ */
12
+ export function SkeletonImage({
13
+ width = 100,
14
+ height = 100,
15
+ borderRadius = 0,
16
+ style,
17
+ animation = 'shimmer',
18
+ baseColor,
19
+ highlightColor,
20
+ duration
21
+ }) {
22
+ return /*#__PURE__*/React.createElement(AnimationWrapper, {
23
+ animation: animation,
24
+ width: width,
25
+ height: height,
26
+ borderRadius: borderRadius,
27
+ baseColor: baseColor,
28
+ highlightColor: highlightColor,
29
+ duration: duration,
30
+ style: [styles.image, style]
31
+ });
32
+ }
33
+ const styles = StyleSheet.create({
34
+ image: {
35
+ overflow: 'hidden'
36
+ }
37
+ });
38
+ SkeletonImage.displayName = 'Skeleton.Image';
39
+ //# sourceMappingURL=SkeletonImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","AnimationWrapper","SkeletonImage","width","height","borderRadius","style","animation","baseColor","highlightColor","duration","createElement","styles","image","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonImage.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AAEzC,SAASC,gBAAgB,QAAQ,kBAAkB;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,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,oBACEX,KAAA,CAAAY,aAAA,CAACV,gBAAgB;IACfM,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,CAACM,MAAM,CAACC,KAAK,EAAEP,KAAK;EAAE,CAC9B,CAAC;AAEN;AAEA,MAAMM,MAAM,GAAGZ,UAAU,CAACc,MAAM,CAAC;EAC/BD,KAAK,EAAE;IACLE,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFb,aAAa,CAACc,WAAW,GAAG,gBAAgB","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { AnimationWrapper } from '../../animations';
4
+ /**
5
+ * Text skeleton primitive with multiple lines
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <SkeletonText lines={3} fontSize={16} lastLineWidth="70%" />
10
+ * ```
11
+ */
12
+ export function SkeletonText({
13
+ lines = 1,
14
+ fontSize = 14,
15
+ lineHeight,
16
+ width = '100%',
17
+ lastLineWidth = '60%',
18
+ style,
19
+ animation = 'shimmer',
20
+ baseColor,
21
+ highlightColor,
22
+ duration
23
+ }) {
24
+ const calculatedLineHeight = lineHeight || fontSize * 1.4;
25
+ return /*#__PURE__*/React.createElement(View, {
26
+ style: style
27
+ }, Array.from({
28
+ length: lines
29
+ }).map((_, index) => {
30
+ const isLastLine = index === lines - 1;
31
+ const lineWidth = isLastLine && lines > 1 ? lastLineWidth : width;
32
+ return /*#__PURE__*/React.createElement(AnimationWrapper, {
33
+ key: index,
34
+ animation: animation,
35
+ width: lineWidth,
36
+ height: fontSize,
37
+ borderRadius: 4,
38
+ baseColor: baseColor,
39
+ highlightColor: highlightColor,
40
+ duration: duration,
41
+ style: [styles.line, {
42
+ marginBottom: index < lines - 1 ? calculatedLineHeight - fontSize : 0
43
+ }]
44
+ });
45
+ }));
46
+ }
47
+ const styles = StyleSheet.create({
48
+ line: {
49
+ overflow: 'hidden'
50
+ }
51
+ });
52
+ SkeletonText.displayName = 'Skeleton.Text';
53
+ //# sourceMappingURL=SkeletonText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","StyleSheet","AnimationWrapper","SkeletonText","lines","fontSize","lineHeight","width","lastLineWidth","style","animation","baseColor","highlightColor","duration","calculatedLineHeight","createElement","Array","from","length","map","_","index","isLastLine","lineWidth","key","height","borderRadius","styles","line","marginBottom","create","overflow","displayName"],"sourceRoot":"../../../../src","sources":["components/primitives/SkeletonText.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAE/C,SAASC,gBAAg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AAE;EACZ;AACF,CAAC,CAAC;AAEF5B,YAAY,CAAC6B,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export { SkeletonBox } from './SkeletonBox';
2
+ export { SkeletonText } from './SkeletonText';
3
+ export { SkeletonImage } from './SkeletonImage';
4
+ export { SkeletonCircle } from './SkeletonCircle';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SkeletonBox","SkeletonText","SkeletonImage","SkeletonCircle"],"sourceRoot":"../../../../src","sources":["components/primitives/index.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,kBAAkB","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { Skeleton } from './Skeleton';
3
+ /**
4
+ * Higher-order component that adds a loading skeleton to any component.
5
+ *
6
+ * The returned component accepts a `loading` prop (plus the wrapped
7
+ * component's own props). While `loading` is true it renders a skeleton
8
+ * derived from `options.styles`; otherwise it renders the real component.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const Home = withSkeleton(HomeScreen, { styles });
13
+ *
14
+ * <Home loading={isLoading} user={user} />
15
+ * ```
16
+ */
17
+ export function withSkeleton(Component, options = {}) {
18
+ const WithSkeleton = props => {
19
+ const {
20
+ loading,
21
+ ...componentProps
22
+ } = props;
23
+ return /*#__PURE__*/React.createElement(Skeleton, {
24
+ loading: loading,
25
+ styles: options.styles,
26
+ excludeStyles: options.excludeStyles,
27
+ animation: options.animation,
28
+ duration: options.duration,
29
+ baseColor: options.baseColor,
30
+ highlightColor: options.highlightColor,
31
+ borderRadius: options.borderRadius
32
+ }, /*#__PURE__*/React.createElement(Component, componentProps));
33
+ };
34
+ const name = Component.displayName || Component.name || 'Component';
35
+ WithSkeleton.displayName = `withSkeleton(${name})`;
36
+ return WithSkeleton;
37
+ }
38
+ //# sourceMappingURL=withSkeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Skeleton","withSkeleton","Component","options","WithSkeleton","props","loading","componentProps","createElement","styles","excludeStyles","animation","duration","baseColor","highlightColor","borderRadius","name","displayName"],"sourceRoot":"../../../src","sources":["components/withSkeleton.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,QAAQ,QAAQ,YAAY;AAgBrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,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,oBACEN,KAAA,CAAAS,aAAA,CAACR,QAAQ;MACPM,OAAO,EAAEA,OAAQ;MACjBG,MAAM,EAAEN,OAAO,CAACM,MAAO;MACvBC,aAAa,EAAEP,OAAO,CAACO,aAAc;MACrCC,SAAS,EAAER,OAAO,CAACQ,SAAU;MAC7BC,QAAQ,EAAET,OAAO,CAACS,QAAS;MAC3BC,SAAS,EAAEV,OAAO,CAACU,SAAU;MAC7BC,cAAc,EAAEX,OAAO,CAACW,cAAe;MACvCC,YAAY,EAAEZ,OAAO,CAACY;IAAa,gBAEnChB,KAAA,CAAAS,aAAA,CAACN,SAAS,EAAMK,cAAkC,CAC1C,CAAC;EAEf,CAAC;EAED,MAAMS,IAAI,GAAGd,SAAS,CAACe,WAAW,IAAIf,SAAS,CAACc,IAAI,IAAI,WAAW;EACnEZ,YAAY,CAACa,WAAW,GAAG,gBAAgBD,IAAI,GAAG;EAElD,OAAOZ,YAAY;AACrB","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Default skeleton configuration
3
+ */
4
+ export const DEFAULT_CONFIG = {
5
+ animation: 'shimmer',
6
+ duration: 1200,
7
+ baseColor: '#E1E9EE',
8
+ highlightColor: '#F0F4F8',
9
+ borderRadius: 4,
10
+ debug: false
11
+ };
12
+
13
+ /**
14
+ * Dark mode colors
15
+ */
16
+ export const DARK_MODE_COLORS = {
17
+ baseColor: '#2A3F4F',
18
+ highlightColor: '#3A5364'
19
+ };
20
+
21
+ /**
22
+ * Default dimensions for components without explicit sizing
23
+ */
24
+ export const DEFAULT_DIMENSIONS = {
25
+ image: {
26
+ width: 100,
27
+ height: 100
28
+ },
29
+ text: {
30
+ fontSize: 14,
31
+ lineHeight: 20
32
+ },
33
+ box: {
34
+ height: 50
35
+ }
36
+ };
37
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_CONFIG","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;AACA,OAAO,MAAMA,cAAwC,GAAG;EACtDC,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;AACA,OAAO,MAAMC,gBAAgB,GAAG;EAC9BJ,SAAS,EAAE,SAAS;EACpBC,cAAc,EAAE;AAClB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMI,kBAAkB,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,11 @@
1
+ // Deep expansion is opt-in so the core bundle never depends on react-reconciler.
2
+ // `react-native-skelo/deep` registers the expander; Skeleton reads it here.
3
+
4
+ let expander = null;
5
+ export function setDeepExpander(fn) {
6
+ expander = fn;
7
+ }
8
+ export function getDeepExpander() {
9
+ return expander;
10
+ }
11
+ //# 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;AAExC,OAAO,SAASC,eAAeA,CAACC,EAAgB,EAAQ;EACtDF,QAAQ,GAAGE,EAAE;AACf;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAwB;EACrD,OAAOH,QAAQ;AACjB","ignoreList":[]}