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 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","ImagePlugin","exports","name","component","Image","version","strategy","props","context","primitives","config","style","flatStyle","Array","isArray","Object","assign","width","height","borderRadius","isCircle","createElement","Circle","size","animation","baseColor","highlightColor","duration","metadata","description","author"],"sourceRoot":"../../../src","sources":["plugins/ImagePlugin.tsx"],"mappings":";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AAEhB,MAAM,CAACgB,cAAe;QACtCC,QAAQ,EAAEjB,MAAM,CAACiB,QAAS;QAC1BhB,KAAK,EAAEC;MAAU,CAClB,CAAC;IAEN;IAEA,oBACEnB,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAACZ,UAAU,CAACL,KAAK;MACfa,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA,MAAO;MACfC,YAAY,EAAEA,YAAuB;MACrCK,SAAS,EAAEd,MAAM,CAACc,SAAU;MAC5BC,SAAS,EAAEf,MAAM,CAACe,SAAU;MAC5BC,cAAc,EAAEhB,MAAM,CAACgB,cAAe;MACtCC,QAAQ,EAAEjB,MAAM,CAACiB,QAAS;MAC1BhB,KAAK,EAAEC;IAAU,CAClB,CAAC;EAEN,CAAC;EAEDgB,QAAQ,EAAE;IACRC,WAAW,EAAE,oDAAoD;IACjEC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TextPlugin = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Built-in plugin for React Native Text component
12
+ *
13
+ * Renders Text as SkeletonText with:
14
+ * - Estimated line count from text content
15
+ * - Font size from style
16
+ * - Line height from style
17
+ */
18
+ const TextPlugin = exports.TextPlugin = {
19
+ name: 'Text',
20
+ component: _reactNative.Text,
21
+ version: '1.0.0',
22
+ strategy: (props, context) => {
23
+ const {
24
+ primitives,
25
+ config
26
+ } = context;
27
+ const style = props.style || {};
28
+ const flatStyle = Array.isArray(style) ? Object.assign({}, ...style) : style;
29
+ const fontSize = flatStyle.fontSize ?? 14;
30
+ const lineHeight = flatStyle.lineHeight ?? fontSize * 1.4;
31
+
32
+ // Estimate number of lines from text content
33
+ const textContent = props.children;
34
+ const estimatedLines = estimateTextLines(textContent);
35
+ return /*#__PURE__*/_react.default.createElement(primitives.Text, {
36
+ lines: estimatedLines,
37
+ fontSize: fontSize,
38
+ lineHeight: lineHeight,
39
+ width: flatStyle.width ?? '100%',
40
+ animation: config.animation,
41
+ baseColor: config.baseColor,
42
+ highlightColor: config.highlightColor,
43
+ duration: config.duration,
44
+ style: flatStyle
45
+ });
46
+ },
47
+ metadata: {
48
+ description: 'Automatic skeleton generation for Text components',
49
+ author: 'Skelo'
50
+ }
51
+ };
52
+
53
+ /**
54
+ * Estimate number of lines from text content
55
+ */
56
+ function estimateTextLines(children) {
57
+ if (!children) return 1;
58
+ if (typeof children === 'string' || typeof children === 'number') {
59
+ const text = String(children);
60
+ const avgCharsPerLine = 40;
61
+ const estimatedLines = Math.ceil(text.length / avgCharsPerLine);
62
+ return Math.max(1, Math.min(estimatedLines, 5)); // Cap at 5 lines
63
+ }
64
+ if (Array.isArray(children)) {
65
+ // Multiple text nodes - count as separate lines
66
+ return Math.min(children.length, 5);
67
+ }
68
+ return 1;
69
+ }
70
+ //# sourceMappingURL=TextPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","TextPlugin","exports","name","component","Text","version","strategy","props","context","primitives","config","style","flatStyle","Array","isArray","Object","assign","fontSize","lineHeight","textContent","children","estimatedLines","estimateTextLines","createElement","lines","width","animation","baseColor","highlightColor","duration","metadata","description","author","text","String","avgCharsPerLine","Math","ceil","length","max","min"],"sourceRoot":"../../../src","sources":["plugins/TextPlugin.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAoC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,UAAqC,GAAAC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,CAACA,QAAQ,EAAE,OAAO,CAAC;EAEvB,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;IAChE,MAAMa,IAAI,GAAGC,MAAM,CAACd,QAAQ,CAAC;IAC7B,MAAMe,eAAe,GAAG,EAAE;IAC1B,MAAMd,cAAc,GAAGe,IAAI,CAACC,IAAI,CAACJ,IAAI,CAACK,MAAM,GAAGH,eAAe,CAAC;IAC/D,OAAOC,IAAI,CAACG,GAAG,CAAC,CAAC,EAAEH,IAAI,CAACI,GAAG,CAACnB,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;EACnD;EAEA,IAAIR,KAAK,CAACC,OAAO,CAACM,QAAQ,CAAC,EAAE;IAC3B;IACA,OAAOgB,IAAI,CAACI,GAAG,CAACpB,QAAQ,CAACkB,MAAM,EAAE,CAAC,CAAC;EACrC;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ViewPlugin = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Built-in plugin for React Native View component
12
+ *
13
+ * Renders View as:
14
+ * - SkeletonBox if has explicit width/height
15
+ * - Container with parsed children otherwise
16
+ */
17
+ const ViewPlugin = exports.ViewPlugin = {
18
+ name: 'View',
19
+ component: _reactNative.View,
20
+ version: '1.0.0',
21
+ strategy: (props, context) => {
22
+ const {
23
+ primitives,
24
+ parseChildren,
25
+ config
26
+ } = context;
27
+ const style = props.style || {};
28
+ const flatStyle = Array.isArray(style) ? Object.assign({}, ...style) : style;
29
+ const width = flatStyle.width;
30
+ const height = flatStyle.height;
31
+ const borderRadius = flatStyle.borderRadius ?? config.borderRadius;
32
+
33
+ // If View has explicit dimensions, render as box
34
+ if (width && height) {
35
+ return /*#__PURE__*/_react.default.createElement(primitives.Box, {
36
+ width: width,
37
+ height: height,
38
+ borderRadius: borderRadius,
39
+ animation: config.animation,
40
+ baseColor: config.baseColor,
41
+ highlightColor: config.highlightColor,
42
+ duration: config.duration,
43
+ style: flatStyle
44
+ });
45
+ }
46
+
47
+ // If View has children, render as container
48
+ if (props.children) {
49
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
50
+ style: flatStyle
51
+ }, parseChildren(props.children));
52
+ }
53
+
54
+ // Empty View - render as small placeholder
55
+ return /*#__PURE__*/_react.default.createElement(primitives.Box, {
56
+ width: width ?? 100,
57
+ height: height ?? 20,
58
+ borderRadius: borderRadius,
59
+ animation: config.animation,
60
+ baseColor: config.baseColor,
61
+ highlightColor: config.highlightColor,
62
+ duration: config.duration,
63
+ style: flatStyle
64
+ });
65
+ },
66
+ metadata: {
67
+ description: 'Automatic skeleton generation for View components',
68
+ author: 'Skelo'
69
+ }
70
+ };
71
+ //# sourceMappingURL=ViewPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","ViewPlugin","exports","name","component","View","version","strategy","props","context","primitives","parseChildren","config","style","flatStyle","Array","isArray","Object","assign","width","height","borderRadius","createElement","Box","animation","baseColor","highlightColor","duration","children","metadata","description","author"],"sourceRoot":"../../../src","sources":["plugins/ViewPlugin.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAoC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIpC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,UAAqC,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACnDE,IAAI,EAAE,MAAM;EACZC,SAAS,EAAEC,iBAAI;EACfC,OAAO,EA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;MACpBC,MAAM,EAAEA,MAAM,IAAI,EAAG;MACrBC,YAAY,EAAEA,YAAa;MAC3BG,SAAS,EAAEZ,MAAM,CAACY,SAAU;MAC5BC,SAAS,EAAEb,MAAM,CAACa,SAAU;MAC5BC,cAAc,EAAEd,MAAM,CAACc,cAAe;MACtCC,QAAQ,EAAEf,MAAM,CAACe,QAAS;MAC1Bd,KAAK,EAAEC;IAAU,CAClB,CAAC;EAEN,CAAC;EAEDe,QAAQ,EAAE;IACRC,WAAW,EAAE,mDAAmD;IAChEC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ImagePlugin", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ImagePlugin.ImagePlugin;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TextPlugin", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _TextPlugin.TextPlugin;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ViewPlugin", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _ViewPlugin.ViewPlugin;
22
+ }
23
+ });
24
+ var _ViewPlugin = require("./ViewPlugin");
25
+ var _TextPlugin = require("./TextPlugin");
26
+ var _ImagePlugin = require("./ImagePlugin");
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ViewPlugin","require","_TextPlugin","_ImagePlugin"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/plugin.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/skeleton.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.flattenChildren = flattenChildren;
7
+ exports.getComponentName = getComponentName;
8
+ exports.isFragment = isFragment;
9
+ exports.isTouchableComponent = isTouchableComponent;
10
+ Object.defineProperty(exports, "isValidElement", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _react.isValidElement;
14
+ }
15
+ });
16
+ exports.randomWidth = randomWidth;
17
+ var _react = _interopRequireWildcard(require("react"));
18
+ var _reactNative = require("react-native");
19
+ 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); }
20
+ // Re-exported so consumers can access it from the skelo utils surface
21
+
22
+ /**
23
+ * Reference map of React Native host components to their canonical names.
24
+ *
25
+ * Modern RN components (View/Text/Image/...) are `forwardRef`/`memo` objects,
26
+ * not plain functions or strings, so name/displayName sniffing is unreliable.
27
+ * Identifying them by reference is exact. This works across the library/app
28
+ * module boundary because Metro resolves a single `react-native` instance.
29
+ */
30
+ const RN_COMPONENT_NAMES = new Map([[_reactNative.View, 'View'], [_reactNative.Text, 'Text'], [_reactNative.Image, 'Image'], [_reactNative.ImageBackground, 'ImageBackground'], [_reactNative.ScrollView, 'ScrollView'], [_reactNative.SafeAreaView, 'SafeAreaView'], [_reactNative.FlatList, 'FlatList'], [_reactNative.SectionList, 'SectionList'], [_reactNative.VirtualizedList, 'VirtualizedList'], [_reactNative.TouchableOpacity, 'TouchableOpacity'], [_reactNative.TouchableHighlight, 'TouchableHighlight'], [_reactNative.TouchableWithoutFeedback, 'TouchableWithoutFeedback'], [_reactNative.Pressable, 'Pressable'], [_reactNative.KeyboardAvoidingView, 'KeyboardAvoidingView']]);
31
+
32
+ /**
33
+ * Get component display name or type name
34
+ *
35
+ * @param element - React element
36
+ * @returns Component name as string
37
+ */
38
+ function getComponentName(element) {
39
+ const type = element.type;
40
+ if (type === _react.default.Fragment) {
41
+ return 'Fragment';
42
+ }
43
+
44
+ // Exact identification of RN host components (forwardRef/memo objects).
45
+ const mapped = RN_COMPONENT_NAMES.get(type);
46
+ if (mapped) {
47
+ return mapped;
48
+ }
49
+
50
+ // Intrinsic host string (e.g. web/DOM or raw native tags).
51
+ if (typeof type === 'string') {
52
+ return type;
53
+ }
54
+
55
+ // Plain function/class components.
56
+ if (typeof type === 'function') {
57
+ const fn = type;
58
+ return fn.displayName || fn.name || 'Anonymous';
59
+ }
60
+
61
+ // forwardRef / memo wrappers: unwrap to find a usable name.
62
+ if (typeof type === 'object' && type !== null) {
63
+ const obj = type;
64
+ if (obj.displayName) {
65
+ return obj.displayName;
66
+ }
67
+ if (obj.render) {
68
+ return obj.render.displayName || obj.render.name || 'Anonymous';
69
+ }
70
+ // memo(Component) nests the real component under `.type`.
71
+ if (obj.type) {
72
+ return getComponentName({
73
+ type: obj.type
74
+ });
75
+ }
76
+ return 'Anonymous';
77
+ }
78
+ return 'Unknown';
79
+ }
80
+
81
+ /**
82
+ * Check if element is a React Fragment
83
+ *
84
+ * @param element - React element
85
+ * @returns True if element is a Fragment
86
+ */
87
+ function isFragment(element) {
88
+ return element.type === _react.default.Fragment;
89
+ }
90
+
91
+ /**
92
+ * Flatten children, handling Fragments recursively
93
+ *
94
+ * @param children - React children
95
+ * @returns Flattened array of children
96
+ */
97
+ function flattenChildren(children) {
98
+ const result = [];
99
+ _react.default.Children.forEach(children, child => {
100
+ if (! /*#__PURE__*/(0, _react.isValidElement)(child)) {
101
+ result.push(child);
102
+ return;
103
+ }
104
+ if (isFragment(child)) {
105
+ // Recursively flatten fragment children
106
+ const fragmentChildren = flattenChildren(child.props.children);
107
+ result.push(...fragmentChildren);
108
+ } else {
109
+ result.push(child);
110
+ }
111
+ });
112
+ return result;
113
+ }
114
+
115
+ /**
116
+ * Check if component is a touchable component
117
+ *
118
+ * @param element - React element
119
+ * @returns True if component is touchable
120
+ */
121
+ function isTouchableComponent(element) {
122
+ const name = getComponentName(element);
123
+ const touchableTypes = ['TouchableOpacity', 'TouchableHighlight', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'Pressable'];
124
+ return touchableTypes.includes(name);
125
+ }
126
+
127
+ /**
128
+ * Generate random width percentage for natural skeleton look
129
+ *
130
+ * @param min - Minimum percentage (0-100)
131
+ * @param max - Maximum percentage (0-100)
132
+ * @returns Random percentage as string (e.g., "75%")
133
+ */
134
+ function randomWidth(min = 60, max = 90) {
135
+ const random = Math.floor(Math.random() * (max - min + 1)) + min;
136
+ return `${random}%`;
137
+ }
138
+ //# sourceMappingURL=componentUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RN_COMPONENT_NAMES","Map","View","Text","Image","ImageBackground","ScrollView","SafeAreaView","FlatList","SectionList","VirtualizedList","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","Pressable","KeyboardAvoidingView","getComponentName","element","type","React","Fragment","mapped","fn","displayName","name","obj","render","isFragment","flattenChildren","children","result","Children","forEach","child","isValidElement","push","fragmentChildren","props","isTouchableComponent","touchableTypes","includes","randomWidth","min","max","random","Math","floor"],"sourceRoot":"../../../src","sources":["utils/componentUtils.ts"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAesB,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,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,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP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AAC;IACpB;EACF,CAAC,CAAC;EAEF,OAAOH,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,oBAAoBA,CAACrB,OAAqB,EAAW;EACnE,MAAMO,IAAI,GAAGR,gBAAgB,CAACC,OAAO,CAAC;EACtC,MAAMsB,cAAc,GAAG,CACrB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,CACZ;EACD,OAAOA,cAAc,CAACC,QAAQ,CAAChB,IAAI,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiB,WAAWA,CAACC,GAAW,GAAG,EAAE,EAAEC,GAAW,GAAG,EAAE,EAAU;EACtE,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACD,MAAM,CAAC,CAAC,IAAID,GAAG,GAAGD,GAAG,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG;EAChE,OAAO,GAAGE,MAAM,GAAG;AACrB","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "extractDimensions", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _styleUtils.extractDimensions;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "flattenChildren", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _componentUtils.flattenChildren;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "getComponentName", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _componentUtils.getComponentName;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "isFragment", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _componentUtils.isFragment;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "isPercentage", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _styleUtils.isPercentage;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "isTouchableComponent", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _componentUtils.isTouchableComponent;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "percentageToNumber", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _styleUtils.percentageToNumber;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "randomWidth", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _componentUtils.randomWidth;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "resolveStyle", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _styleUtils.resolveStyle;
58
+ }
59
+ });
60
+ var _styleUtils = require("./styleUtils");
61
+ var _componentUtils = require("./componentUtils");
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_styleUtils","require","_componentUtils"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.extractDimensions = extractDimensions;
7
+ exports.hasExplicitSize = hasExplicitSize;
8
+ exports.isPercentage = isPercentage;
9
+ exports.percentageToNumber = percentageToNumber;
10
+ exports.resolveStyle = resolveStyle;
11
+ var _reactNative = require("react-native");
12
+ /**
13
+ * Flatten and resolve styles from React Native style prop
14
+ *
15
+ * @param style - Style prop (can be object, array, or StyleSheet reference)
16
+ * @returns Flattened style object
17
+ */
18
+ function resolveStyle(style) {
19
+ if (!style) {
20
+ return {};
21
+ }
22
+ try {
23
+ const flattened = _reactNative.StyleSheet.flatten(style);
24
+ return flattened;
25
+ } catch (error) {
26
+ // Handle invalid styles gracefully
27
+ if (__DEV__) {
28
+ console.warn('[Skelo] Failed to resolve style:', error);
29
+ }
30
+ return {};
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Extract dimensions from resolved style
36
+ *
37
+ * @param style - Resolved style object
38
+ * @returns Object with width and height (if present)
39
+ */
40
+ function extractDimensions(style) {
41
+ return {
42
+ width: style.width,
43
+ height: style.height
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Check if a resolved style declares both an explicit width and height
49
+ *
50
+ * @param style - Resolved style object
51
+ * @returns True if both width and height are defined
52
+ */
53
+ function hasExplicitSize(style) {
54
+ return style.width !== undefined && style.height !== undefined;
55
+ }
56
+
57
+ /**
58
+ * Check if a value is a percentage string
59
+ *
60
+ * @param value - Value to check
61
+ * @returns True if value is a percentage string
62
+ */
63
+ function isPercentage(value) {
64
+ return typeof value === 'string' && value.includes('%');
65
+ }
66
+
67
+ /**
68
+ * Convert percentage to number (strips %)
69
+ *
70
+ * @param value - Percentage string (e.g., "50%")
71
+ * @returns Number without % sign
72
+ */
73
+ function percentageToNumber(value) {
74
+ return parseFloat(value.replace('%', ''));
75
+ }
76
+ //# sourceMappingURL=styleUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","resolveStyle","style","flattened","StyleSheet","flatten","error","__DEV__","console","warn","extractDimensions","width","height","hasExplicitSize","undefined","isPercentage","value","includes","percentageToNumber","parseFloat","replace"],"sourceRoot":"../../../src","sources":["utils/styleUtils.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,KAAU,EAAiB;EACtD,IAAI,CAACA,KAAK,EAAE;IACV,OAAO,CAAC,CAAC;EACX;EAEA,IAAI;IACF,MAAMC,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACH,KAAK,CAAC;IAC3C,OAAOC,SAAS;EAClB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd;IACA,IAAIC,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CAAC,kCAAkC,EAAEH,KAAK,CAAC;IACzD;IACA,OAAO,CAAC,CAAC;EACX;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAACR,KAAoB,EAGpD;EACA,OAAO;IACLS,KAAK,EAAET,KAAK,CAACS,KAAK;IAClBC,MAAM,EAAEV,KAAK,CAACU;EAChB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACX,KAAoB,EAAW;EAC7D,OAAOA,KAAK,CAACS,KAAK,KAAKG,SAAS,IAAIZ,KAAK,CAACU,MAAM,KAAKE,SAAS;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,KAAU,EAAW;EAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,QAAQ,CAAC,GAAG,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACF,KAAa,EAAU;EACxD,OAAOG,UAAU,CAACH,KAAK,CAACI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3C","ignoreList":[]}
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import { registry } from './core/registry';
3
+ import { StyleSkeleton } from './core/generator/StyleSkeleton';
4
+ import { DEFAULT_CONFIG } from './constants/defaults';
5
+
6
+ /**
7
+ * Global Skelo API for plugin management
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import { Skelo } from 'react-native-skelo';
12
+ * import { Avatar } from 'my-ui-library';
13
+ *
14
+ * Skelo.register({
15
+ * name: 'Avatar',
16
+ * component: Avatar,
17
+ * strategy: (props, { primitives }) => {
18
+ * return <primitives.Circle size={props.size || 40} />;
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ export const Skelo = {
24
+ /**
25
+ * Register a plugin
26
+ *
27
+ * @param plugin - Plugin configuration
28
+ */
29
+ register(plugin) {
30
+ registry.register(plugin);
31
+ },
32
+ /**
33
+ * Unregister a plugin
34
+ *
35
+ * @param component - Component type to unregister
36
+ */
37
+ unregister(component) {
38
+ registry.unregister(component);
39
+ },
40
+ /**
41
+ * Get plugin for component
42
+ *
43
+ * @param component - Component type
44
+ * @returns Plugin or undefined
45
+ */
46
+ getPlugin(component) {
47
+ return registry.getPlugin(component);
48
+ },
49
+ /**
50
+ * Check if plugin exists
51
+ *
52
+ * @param component - Component type
53
+ * @returns True if plugin is registered
54
+ */
55
+ hasPlugin(component) {
56
+ return registry.hasPlugin(component);
57
+ },
58
+ /**
59
+ * Get all plugins
60
+ *
61
+ * @returns Array of all registered plugins
62
+ */
63
+ getAllPlugins() {
64
+ return registry.getAllPlugins();
65
+ },
66
+ /**
67
+ * Clear all plugins (useful for testing)
68
+ */
69
+ clearPlugins() {
70
+ registry.clear();
71
+ },
72
+ /**
73
+ * Generate a skeleton element directly from a set of styles.
74
+ *
75
+ * @param styles - A `StyleSheet.create` object or an array of styles
76
+ * @param config - Optional animation/color overrides
77
+ * @returns A skeleton React element
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * {loading ? Skelo.fromStyles(styles) : <Screen />}
82
+ * ```
83
+ */
84
+ fromStyles(styles, config = {}) {
85
+ return /*#__PURE__*/React.createElement(StyleSkeleton, {
86
+ styles,
87
+ config: {
88
+ ...DEFAULT_CONFIG,
89
+ ...config
90
+ }
91
+ });
92
+ },
93
+ /**
94
+ * Library version
95
+ */
96
+ version: '0.1.0'
97
+ };
98
+ //# sourceMappingURL=Skelo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","registry","StyleSkeleton","DEFAULT_CONFIG","Skelo","register","plugin","unregister","component","getPlugin","hasPlugin","getAllPlugins","clearPlugins","clear","fromStyles","styles","config","createElement","version"],"sourceRoot":"../../src","sources":["Skelo.ts"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,aAAa,QAAyB,gCAAgC;AAC/E,SAASC,cAAc,QAAQ,sBAAsB;;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