react-native-smart-skeleton 0.0.1
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.
- package/README.md +255 -0
- package/lib/commonjs/animations/breathing.js +53 -0
- package/lib/commonjs/animations/breathing.js.map +1 -0
- package/lib/commonjs/animations/pulse.js +50 -0
- package/lib/commonjs/animations/pulse.js.map +1 -0
- package/lib/commonjs/animations/shimmer.js +68 -0
- package/lib/commonjs/animations/shimmer.js.map +1 -0
- package/lib/commonjs/animations/wave.js +54 -0
- package/lib/commonjs/animations/wave.js.map +1 -0
- package/lib/commonjs/clone/SkeletonClone.js +91 -0
- package/lib/commonjs/clone/SkeletonClone.js.map +1 -0
- package/lib/commonjs/components/Circle.js +27 -0
- package/lib/commonjs/components/Circle.js.map +1 -0
- package/lib/commonjs/components/Group.js +57 -0
- package/lib/commonjs/components/Group.js.map +1 -0
- package/lib/commonjs/components/Pill.js +32 -0
- package/lib/commonjs/components/Pill.js.map +1 -0
- package/lib/commonjs/components/Rect.js +21 -0
- package/lib/commonjs/components/Rect.js.map +1 -0
- package/lib/commonjs/components/Skeleton.js +196 -0
- package/lib/commonjs/components/Skeleton.js.map +1 -0
- package/lib/commonjs/components/Square.js +28 -0
- package/lib/commonjs/components/Square.js.map +1 -0
- package/lib/commonjs/demo/demo.gif +0 -0
- package/lib/commonjs/hooks/useReducedMotion.js +42 -0
- package/lib/commonjs/hooks/useReducedMotion.js.map +1 -0
- package/lib/commonjs/hooks/useSkeletonTheme.js +46 -0
- package/lib/commonjs/hooks/useSkeletonTheme.js.map +1 -0
- package/lib/commonjs/index.js +149 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/presets/Card.js +83 -0
- package/lib/commonjs/presets/Card.js.map +1 -0
- package/lib/commonjs/presets/Chat.js +54 -0
- package/lib/commonjs/presets/Chat.js.map +1 -0
- package/lib/commonjs/presets/Product.js +70 -0
- package/lib/commonjs/presets/Product.js.map +1 -0
- package/lib/commonjs/presets/Profile.js +67 -0
- package/lib/commonjs/presets/Profile.js.map +1 -0
- package/lib/commonjs/presets/Video.js +76 -0
- package/lib/commonjs/presets/Video.js.map +1 -0
- package/lib/commonjs/providers/SkeletonProvider.js +70 -0
- package/lib/commonjs/providers/SkeletonProvider.js.map +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/colors.js +144 -0
- package/lib/commonjs/utils/colors.js.map +1 -0
- package/lib/commonjs/utils/responsive.js +84 -0
- package/lib/commonjs/utils/responsive.js.map +1 -0
- package/lib/commonjs/utils/theme.js +39 -0
- package/lib/commonjs/utils/theme.js.map +1 -0
- package/lib/module/animations/breathing.js +47 -0
- package/lib/module/animations/breathing.js.map +1 -0
- package/lib/module/animations/pulse.js +44 -0
- package/lib/module/animations/pulse.js.map +1 -0
- package/lib/module/animations/shimmer.js +61 -0
- package/lib/module/animations/shimmer.js.map +1 -0
- package/lib/module/animations/wave.js +48 -0
- package/lib/module/animations/wave.js.map +1 -0
- package/lib/module/clone/SkeletonClone.js +84 -0
- package/lib/module/clone/SkeletonClone.js.map +1 -0
- package/lib/module/components/Circle.js +20 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Group.js +50 -0
- package/lib/module/components/Group.js.map +1 -0
- package/lib/module/components/Pill.js +25 -0
- package/lib/module/components/Pill.js.map +1 -0
- package/lib/module/components/Rect.js +14 -0
- package/lib/module/components/Rect.js.map +1 -0
- package/lib/module/components/Skeleton.js +188 -0
- package/lib/module/components/Skeleton.js.map +1 -0
- package/lib/module/components/Square.js +21 -0
- package/lib/module/components/Square.js.map +1 -0
- package/lib/module/demo/demo.gif +0 -0
- package/lib/module/hooks/useReducedMotion.js +37 -0
- package/lib/module/hooks/useReducedMotion.js.map +1 -0
- package/lib/module/hooks/useSkeletonTheme.js +40 -0
- package/lib/module/hooks/useSkeletonTheme.js.map +1 -0
- package/lib/module/index.js +50 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/presets/Card.js +76 -0
- package/lib/module/presets/Card.js.map +1 -0
- package/lib/module/presets/Chat.js +47 -0
- package/lib/module/presets/Chat.js.map +1 -0
- package/lib/module/presets/Product.js +63 -0
- package/lib/module/presets/Product.js.map +1 -0
- package/lib/module/presets/Profile.js +60 -0
- package/lib/module/presets/Profile.js.map +1 -0
- package/lib/module/presets/Video.js +69 -0
- package/lib/module/presets/Video.js.map +1 -0
- package/lib/module/providers/SkeletonProvider.js +61 -0
- package/lib/module/providers/SkeletonProvider.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/colors.js +132 -0
- package/lib/module/utils/colors.js.map +1 -0
- package/lib/module/utils/responsive.js +74 -0
- package/lib/module/utils/responsive.js.map +1 -0
- package/lib/module/utils/theme.js +32 -0
- package/lib/module/utils/theme.js.map +1 -0
- package/lib/typescript/animations/breathing.d.ts +26 -0
- package/lib/typescript/animations/breathing.d.ts.map +1 -0
- package/lib/typescript/animations/pulse.d.ts +22 -0
- package/lib/typescript/animations/pulse.d.ts.map +1 -0
- package/lib/typescript/animations/shimmer.d.ts +34 -0
- package/lib/typescript/animations/shimmer.d.ts.map +1 -0
- package/lib/typescript/animations/wave.d.ts +23 -0
- package/lib/typescript/animations/wave.d.ts.map +1 -0
- package/lib/typescript/clone/SkeletonClone.d.ts +30 -0
- package/lib/typescript/clone/SkeletonClone.d.ts.map +1 -0
- package/lib/typescript/components/Circle.d.ts +10 -0
- package/lib/typescript/components/Circle.d.ts.map +1 -0
- package/lib/typescript/components/Group.d.ts +21 -0
- package/lib/typescript/components/Group.d.ts.map +1 -0
- package/lib/typescript/components/Pill.d.ts +12 -0
- package/lib/typescript/components/Pill.d.ts.map +1 -0
- package/lib/typescript/components/Rect.d.ts +12 -0
- package/lib/typescript/components/Rect.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton.d.ts +16 -0
- package/lib/typescript/components/Skeleton.d.ts.map +1 -0
- package/lib/typescript/components/Square.d.ts +10 -0
- package/lib/typescript/components/Square.d.ts.map +1 -0
- package/lib/typescript/hooks/useReducedMotion.d.ts +11 -0
- package/lib/typescript/hooks/useReducedMotion.d.ts.map +1 -0
- package/lib/typescript/hooks/useSkeletonTheme.d.ts +12 -0
- package/lib/typescript/hooks/useSkeletonTheme.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +51 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/presets/Card.d.ts +11 -0
- package/lib/typescript/presets/Card.d.ts.map +1 -0
- package/lib/typescript/presets/Chat.d.ts +12 -0
- package/lib/typescript/presets/Chat.d.ts.map +1 -0
- package/lib/typescript/presets/Product.d.ts +12 -0
- package/lib/typescript/presets/Product.d.ts.map +1 -0
- package/lib/typescript/presets/Profile.d.ts +11 -0
- package/lib/typescript/presets/Profile.d.ts.map +1 -0
- package/lib/typescript/presets/Video.d.ts +12 -0
- package/lib/typescript/presets/Video.d.ts.map +1 -0
- package/lib/typescript/providers/SkeletonProvider.d.ts +18 -0
- package/lib/typescript/providers/SkeletonProvider.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +149 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/utils/colors.d.ts +51 -0
- package/lib/typescript/utils/colors.d.ts.map +1 -0
- package/lib/typescript/utils/responsive.d.ts +27 -0
- package/lib/typescript/utils/responsive.d.ts.map +1 -0
- package/lib/typescript/utils/theme.d.ts +16 -0
- package/lib/typescript/utils/theme.d.ts.map +1 -0
- package/package.json +74 -0
- package/src/animations/breathing.tsx +81 -0
- package/src/animations/pulse.tsx +75 -0
- package/src/animations/shimmer.tsx +88 -0
- package/src/animations/wave.tsx +74 -0
- package/src/clone/SkeletonClone.tsx +82 -0
- package/src/components/Circle.tsx +13 -0
- package/src/components/Group.tsx +55 -0
- package/src/components/Pill.tsx +23 -0
- package/src/components/Rect.tsx +15 -0
- package/src/components/Skeleton.tsx +218 -0
- package/src/components/Square.tsx +13 -0
- package/src/demo/demo.gif +0 -0
- package/src/hooks/useReducedMotion.ts +46 -0
- package/src/hooks/useSkeletonTheme.ts +45 -0
- package/src/index.ts +94 -0
- package/src/presets/Card.tsx +56 -0
- package/src/presets/Chat.tsx +52 -0
- package/src/presets/Product.tsx +45 -0
- package/src/presets/Profile.tsx +54 -0
- package/src/presets/Video.tsx +53 -0
- package/src/providers/SkeletonProvider.tsx +67 -0
- package/src/types/index.ts +246 -0
- package/src/utils/colors.ts +132 -0
- package/src/utils/responsive.ts +73 -0
- package/src/utils/theme.ts +35 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* The base building block of react-native-smart-skeleton. Renders a single
|
|
5
|
+
* rectangular (optionally rounded) placeholder shape with the requested
|
|
6
|
+
* animation, fully theme-aware and accessible.
|
|
7
|
+
*
|
|
8
|
+
* Most consumers will reach for `Skeleton.Rect`, `Skeleton.Circle`,
|
|
9
|
+
* `Skeleton.Square`, or `Skeleton.Pill` instead of this directly, but those
|
|
10
|
+
* are all thin wrappers around this component.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <Skeleton width={200} height={20} animation="shimmer" />
|
|
14
|
+
*/
|
|
15
|
+
export default function Skeleton({ width, height, borderRadius, backgroundColor, highlightColor, gradientColors, animation, duration, delay, rtl, colorVariant, style, accessibilityLabel, accessible, testID, }: SkeletonProps): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAkBjE,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,UAAU,CAAC;AAgBjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC7B,KAAc,EACd,MAAW,EACX,YAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,SAAS,EACT,QAAQ,EACR,KAAS,EACT,GAAG,EACH,YAAY,EACZ,KAAK,EACL,kBAAsC,EACtC,UAAiB,EACjB,MAAM,GACT,EAAE,aAAa,qBA2Jf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonSquareProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A square skeleton placeholder with equal width and height.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Skeleton.Square size={64} borderRadius={8} />
|
|
8
|
+
*/
|
|
9
|
+
export default function Square({ size, borderRadius, ...props }: SkeletonSquareProps): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Square.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Square.d.ts","sourceRoot":"","sources":["../../../src/components/Square.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,IAAS,EAAE,YAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,qBAE5F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks the OS-level "reduce motion" accessibility setting
|
|
3
|
+
* (Reduce Motion on iOS, Remove Animations on Android) and keeps it
|
|
4
|
+
* up to date if the user changes the setting while the app is running.
|
|
5
|
+
*
|
|
6
|
+
* Skeleton animations should fall back to a static or near-static
|
|
7
|
+
* appearance (or the "breathing" animation at a slow, low-amplitude
|
|
8
|
+
* rate) when this returns true.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useReducedMotion(): boolean;
|
|
11
|
+
//# sourceMappingURL=useReducedMotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReducedMotion.d.ts","sourceRoot":"","sources":["../../../src/hooks/useReducedMotion.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAiC1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedSkeletonTheme } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the active light/dark colors for a skeleton.
|
|
4
|
+
*
|
|
5
|
+
* If used inside a <SkeletonProvider>, honors its `theme` prop ("light" | "dark" | "system")
|
|
6
|
+
* and any registered brand `colors`. If used standalone (no provider), falls back to the
|
|
7
|
+
* device's OS color scheme and the library's default palette.
|
|
8
|
+
*
|
|
9
|
+
* @param colorVariant optional brand color variant name registered on the provider
|
|
10
|
+
*/
|
|
11
|
+
export declare function useSkeletonTheme(colorVariant?: string): ResolvedSkeletonTheme;
|
|
12
|
+
//# sourceMappingURL=useSkeletonTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSkeletonTheme.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSkeletonTheme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,qBAAqB,CA4B7E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import SkeletonBase from "./components/Skeleton";
|
|
2
|
+
import Rect from "./components/Rect";
|
|
3
|
+
import Circle from "./components/Circle";
|
|
4
|
+
import Square from "./components/Square";
|
|
5
|
+
import Pill from "./components/Pill";
|
|
6
|
+
import Group from "./components/Group";
|
|
7
|
+
import Profile from "./presets/Profile";
|
|
8
|
+
import Card from "./presets/Card";
|
|
9
|
+
import Chat from "./presets/Chat";
|
|
10
|
+
import Product from "./presets/Product";
|
|
11
|
+
import Video from "./presets/Video";
|
|
12
|
+
import SkeletonClone from "./clone/SkeletonClone";
|
|
13
|
+
export { SkeletonProvider, SkeletonContext } from "./providers/SkeletonProvider";
|
|
14
|
+
export { useSkeletonTheme } from "./hooks/useSkeletonTheme";
|
|
15
|
+
export { useReducedMotion } from "./hooks/useReducedMotion";
|
|
16
|
+
export type { SkeletonAnimation, SkeletonPerformanceMode, SkeletonThemeMode, SkeletonThemeColors, SkeletonBrandColors, ResolvedSkeletonTheme, SkeletonProps, SkeletonCircleProps, SkeletonSquareProps, SkeletonPillProps, SkeletonGroupProps, SkeletonContextValue, SkeletonProviderProps, SkeletonCloneShape, SkeletonCloneNode, SkeletonCloneProps, SkeletonPresetProps, SkeletonProfilePresetProps, SkeletonCardPresetProps, SkeletonChatPresetProps, SkeletonProductPresetProps, SkeletonVideoPresetProps, ScreenSizeClass, } from "./types";
|
|
17
|
+
/**
|
|
18
|
+
* `Skeleton` is the library's primary export: a callable base component
|
|
19
|
+
* (`<Skeleton />`) that also carries every shape, the layout-grouping
|
|
20
|
+
* helper, and every smart preset as static properties — so you only ever
|
|
21
|
+
* need a single import.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { Skeleton, SkeletonProvider } from "react-native-smart-skeleton";
|
|
25
|
+
*
|
|
26
|
+
* <SkeletonProvider>
|
|
27
|
+
* <Skeleton.Rect width={200} height={20} />
|
|
28
|
+
* <Skeleton.Circle size={48} />
|
|
29
|
+
* <Skeleton.Profile lines={2} />
|
|
30
|
+
* </SkeletonProvider>
|
|
31
|
+
*/
|
|
32
|
+
type SkeletonComponent = typeof SkeletonBase & {
|
|
33
|
+
Rect: typeof Rect;
|
|
34
|
+
Circle: typeof Circle;
|
|
35
|
+
Square: typeof Square;
|
|
36
|
+
Pill: typeof Pill;
|
|
37
|
+
Group: typeof Group;
|
|
38
|
+
Clone: typeof SkeletonClone;
|
|
39
|
+
Profile: typeof Profile;
|
|
40
|
+
Card: typeof Card;
|
|
41
|
+
Chat: typeof Chat;
|
|
42
|
+
Product: typeof Product;
|
|
43
|
+
Video: typeof Video;
|
|
44
|
+
};
|
|
45
|
+
declare const Skeleton: SkeletonComponent;
|
|
46
|
+
export { Skeleton };
|
|
47
|
+
export { SkeletonBase };
|
|
48
|
+
export { Rect, Circle, Square, Pill, Group, SkeletonClone };
|
|
49
|
+
export { Profile, Card, Chat, Product, Video };
|
|
50
|
+
export default Skeleton;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,IAAI,MAAM,mBAAmB,CAAC;AACrC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,IAAI,MAAM,mBAAmB,CAAC;AACrC,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAEpC,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,YAAY,EACR,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,GAClB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,KAAK,iBAAiB,GAAG,OAAO,YAAY,GAAG;IAC3C,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,OAAO,aAAa,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,KAAK,EAAE,OAAO,KAAK,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAmB,iBAAiB,CAAC;AAcnD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAE/C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonCardPresetProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A ready-made skeleton block mimicking a typical content card: an image
|
|
5
|
+
* area on top, optionally a small avatar + name row, then body text lines.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Skeleton.Card imageHeight={160} lines={3} />
|
|
9
|
+
*/
|
|
10
|
+
export default function Card({ imageHeight, lines, showAvatar, count, gap, animation, style, testID, }: SkeletonCardPresetProps): React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/presets/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,uBAAuB,EAAiB,MAAM,UAAU,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EACzB,WAAiB,EACjB,KAAS,EACT,UAAkB,EAClB,KAAS,EACT,GAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,uBAAuB,qBAgCzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonChatPresetProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A ready-made skeleton block mimicking a chat conversation: a series of
|
|
5
|
+
* message bubbles, alternating left/right alignment by default to read as
|
|
6
|
+
* a two-party conversation while loading.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Skeleton.Chat messages={5} />
|
|
10
|
+
*/
|
|
11
|
+
export default function Chat({ messages, alternate, gap, animation, style, testID, }: SkeletonChatPresetProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/presets/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAIxD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EACzB,QAAY,EACZ,SAAgB,EAChB,GAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,uBAAuB,qBA6BzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonProductPresetProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A ready-made skeleton grid mimicking a product listing (e.g. e-commerce
|
|
5
|
+
* catalog or search results): square-ish image, title line, and price line,
|
|
6
|
+
* tiled into a responsive grid.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Skeleton.Product count={6} columns={2} />
|
|
10
|
+
*/
|
|
11
|
+
export default function Product({ imageHeight, columns, count, gap, animation, style, testID, }: SkeletonProductPresetProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Product.d.ts","sourceRoot":"","sources":["../../../src/presets/Product.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC5B,WAAiB,EACjB,OAAO,EACP,KAAS,EACT,GAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,0BAA0B,qBAsB5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonProfilePresetProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A ready-made skeleton block mimicking a profile header: a circular avatar
|
|
5
|
+
* beside a name line and one or more secondary text lines (e.g. handle/bio).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Skeleton.Profile avatarSize={56} lines={2} />
|
|
9
|
+
*/
|
|
10
|
+
export default function Profile({ avatarSize, lines, count, gap, animation, style, testID, }: SkeletonProfilePresetProps): React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../src/presets/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,0BAA0B,EAAiB,MAAM,UAAU,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC5B,UAAe,EACf,KAAS,EACT,KAAS,EACT,GAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,0BAA0B,qBA+B5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonVideoPresetProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A ready-made skeleton block mimicking a video list item: a video
|
|
5
|
+
* thumbnail at a given aspect ratio, optionally followed by a channel
|
|
6
|
+
* avatar + title row and a meta line (views / date).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Skeleton.Video aspectRatio={16 / 9} showTitle showMeta />
|
|
10
|
+
*/
|
|
11
|
+
export default function Video({ aspectRatio, showTitle, showMeta, count, gap, animation, style, testID, }: SkeletonVideoPresetProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../src/presets/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,WAAoB,EACpB,SAAgB,EAChB,QAAe,EACf,KAAS,EACT,GAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,wBAAwB,qBA6B1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonContextValue, SkeletonProviderProps } from "../types";
|
|
3
|
+
export declare const SkeletonContext: React.Context<SkeletonContextValue | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Global configuration provider for react-native-smart-skeleton.
|
|
6
|
+
*
|
|
7
|
+
* Wrap your app (or a subtree) once to set defaults for theme, animation,
|
|
8
|
+
* duration, performance mode, RTL, reduced-motion override, and brand colors.
|
|
9
|
+
* Any individual Skeleton component can still override these via its own props.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <SkeletonProvider theme="system" animation="shimmer" duration={1200}>
|
|
13
|
+
* <App />
|
|
14
|
+
* </SkeletonProvider>
|
|
15
|
+
*/
|
|
16
|
+
export declare function SkeletonProvider({ children, theme, animation, duration, performanceMode, rtl, reducedMotion: reducedMotionOverride, colors, }: SkeletonProviderProps): React.JSX.Element;
|
|
17
|
+
export default SkeletonProvider;
|
|
18
|
+
//# sourceMappingURL=SkeletonProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkeletonProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/SkeletonProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAKtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAuB,MAAM,UAAU,CAAC;AAEjG,eAAO,MAAM,eAAe,4CAAmD,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,QAAQ,EACR,KAAgB,EAChB,SAAqB,EACrB,QAAe,EACf,eAA4B,EAC5B,GAAG,EACH,aAAa,EAAE,qBAAqB,EACpC,MAAM,GACT,EAAE,qBAAqB,qBAkCvB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ViewStyle, StyleProp } from "react-native";
|
|
3
|
+
export type SkeletonDimensionValue = number | string | "auto" | undefined;
|
|
4
|
+
export type SkeletonAnimation = "shimmer" | "pulse" | "wave" | "breathing" | "none";
|
|
5
|
+
/**
|
|
6
|
+
* Controls how much work the animation driver does.
|
|
7
|
+
* - "high": full fidelity (gradients, smooth easing)
|
|
8
|
+
* - "balanced": default, good fidelity with cheaper easing curves
|
|
9
|
+
* - "battery-saver": reduces frame work, simpler interpolations, longer durations
|
|
10
|
+
*/
|
|
11
|
+
export type SkeletonPerformanceMode = "high" | "balanced" | "battery-saver";
|
|
12
|
+
export type SkeletonThemeMode = "light" | "dark" | "system";
|
|
13
|
+
export interface SkeletonThemeColors {
|
|
14
|
+
background: string;
|
|
15
|
+
highlight: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SkeletonBrandColors {
|
|
18
|
+
light: SkeletonThemeColors;
|
|
19
|
+
dark: SkeletonThemeColors;
|
|
20
|
+
}
|
|
21
|
+
export interface ResolvedSkeletonTheme extends SkeletonThemeColors {
|
|
22
|
+
isDark: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface SkeletonProps {
|
|
25
|
+
/** Width of the skeleton. */
|
|
26
|
+
width?: SkeletonDimensionValue;
|
|
27
|
+
/** Height of the skeleton. */
|
|
28
|
+
height?: SkeletonDimensionValue;
|
|
29
|
+
borderRadius?: number;
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
highlightColor?: string;
|
|
32
|
+
gradientColors?: string[];
|
|
33
|
+
animation?: SkeletonAnimation;
|
|
34
|
+
duration?: number;
|
|
35
|
+
delay?: number;
|
|
36
|
+
rtl?: boolean;
|
|
37
|
+
colorVariant?: string;
|
|
38
|
+
/** Style overrides */
|
|
39
|
+
style?: StyleProp<ViewStyle>;
|
|
40
|
+
accessibilityLabel?: string;
|
|
41
|
+
accessible?: boolean;
|
|
42
|
+
testID?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SkeletonCircleProps extends Omit<SkeletonProps, "width" | "height" | "borderRadius"> {
|
|
45
|
+
/** Diameter of the circle. Defaults to 50. */
|
|
46
|
+
size?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface SkeletonSquareProps extends Omit<SkeletonProps, "width" | "height"> {
|
|
49
|
+
/** Side length of the square. Defaults to 50. */
|
|
50
|
+
size?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface SkeletonPillProps extends SkeletonProps {
|
|
53
|
+
/** Width of the pill. Defaults to 80. */
|
|
54
|
+
width?: SkeletonDimensionValue;
|
|
55
|
+
/** Height of the pill. Defaults to 24. */
|
|
56
|
+
height?: SkeletonDimensionValue;
|
|
57
|
+
}
|
|
58
|
+
export interface SkeletonGroupProps {
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
/** Delay added between each direct child's animation start, in ms. Defaults to 80. */
|
|
61
|
+
staggerDelay?: number;
|
|
62
|
+
/** Animation applied to all children unless a child overrides it. */
|
|
63
|
+
animation?: SkeletonAnimation;
|
|
64
|
+
/** Layout direction for stagger ordering. Defaults to "column". */
|
|
65
|
+
direction?: "row" | "column";
|
|
66
|
+
style?: ViewStyle;
|
|
67
|
+
testID?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface SkeletonContextValue {
|
|
70
|
+
theme: SkeletonThemeMode;
|
|
71
|
+
isDark: boolean;
|
|
72
|
+
animation: SkeletonAnimation;
|
|
73
|
+
duration: number;
|
|
74
|
+
performanceMode: SkeletonPerformanceMode;
|
|
75
|
+
reducedMotion: boolean;
|
|
76
|
+
rtl: boolean;
|
|
77
|
+
colors?: Record<string, SkeletonBrandColors>;
|
|
78
|
+
resolvedColors: SkeletonThemeColors;
|
|
79
|
+
getVariantColors: (variant?: string) => SkeletonThemeColors;
|
|
80
|
+
}
|
|
81
|
+
export interface SkeletonProviderProps {
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
/** "light" | "dark" | "system" (default). */
|
|
84
|
+
theme?: SkeletonThemeMode;
|
|
85
|
+
/** Default animation for all descendant skeletons. Defaults to "shimmer". */
|
|
86
|
+
animation?: SkeletonAnimation;
|
|
87
|
+
/** Default animation loop duration in ms. Defaults to 1200. */
|
|
88
|
+
duration?: number;
|
|
89
|
+
/** Default performance mode. Defaults to "balanced". */
|
|
90
|
+
performanceMode?: SkeletonPerformanceMode;
|
|
91
|
+
/** Force-enable/disable RTL mirroring. Defaults to following I18nManager. */
|
|
92
|
+
rtl?: boolean;
|
|
93
|
+
/** Force reduced-motion behavior regardless of OS setting. */
|
|
94
|
+
reducedMotion?: boolean;
|
|
95
|
+
/** Named brand color palettes, keyed by variant name, each with light/dark colors. */
|
|
96
|
+
colors?: Record<string, SkeletonBrandColors>;
|
|
97
|
+
}
|
|
98
|
+
export type SkeletonCloneShape = "rect" | "circle" | "pill";
|
|
99
|
+
export interface SkeletonCloneNode {
|
|
100
|
+
shape?: "rect" | "circle" | "pill";
|
|
101
|
+
width?: SkeletonDimensionValue;
|
|
102
|
+
height?: SkeletonDimensionValue;
|
|
103
|
+
borderRadius?: number;
|
|
104
|
+
style?: StyleProp<ViewStyle>;
|
|
105
|
+
children?: SkeletonCloneNode[];
|
|
106
|
+
direction?: "row" | "column";
|
|
107
|
+
gap?: number;
|
|
108
|
+
}
|
|
109
|
+
export interface SkeletonCloneProps {
|
|
110
|
+
/** Declarative layout tree describing the real content's shape. */
|
|
111
|
+
layout: SkeletonCloneNode;
|
|
112
|
+
animation?: SkeletonAnimation;
|
|
113
|
+
style?: ViewStyle;
|
|
114
|
+
testID?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface SkeletonPresetProps {
|
|
117
|
+
/** Number of times to repeat this preset block. Defaults to 1. */
|
|
118
|
+
count?: number;
|
|
119
|
+
/** Gap between repeated blocks, in dp. Defaults to 16. */
|
|
120
|
+
gap?: number;
|
|
121
|
+
animation?: SkeletonAnimation;
|
|
122
|
+
style?: ViewStyle;
|
|
123
|
+
testID?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface SkeletonProfilePresetProps extends SkeletonPresetProps {
|
|
126
|
+
avatarSize?: number;
|
|
127
|
+
lines?: number;
|
|
128
|
+
}
|
|
129
|
+
export interface SkeletonCardPresetProps extends SkeletonPresetProps {
|
|
130
|
+
imageHeight?: number;
|
|
131
|
+
lines?: number;
|
|
132
|
+
showAvatar?: boolean;
|
|
133
|
+
}
|
|
134
|
+
export interface SkeletonChatPresetProps extends SkeletonPresetProps {
|
|
135
|
+
messages?: number;
|
|
136
|
+
/** Alternate bubble alignment left/right to mimic a real conversation. Defaults to true. */
|
|
137
|
+
alternate?: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface SkeletonProductPresetProps extends SkeletonPresetProps {
|
|
140
|
+
imageHeight?: number;
|
|
141
|
+
columns?: number;
|
|
142
|
+
}
|
|
143
|
+
export interface SkeletonVideoPresetProps extends SkeletonPresetProps {
|
|
144
|
+
aspectRatio?: number;
|
|
145
|
+
showTitle?: boolean;
|
|
146
|
+
showMeta?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export type ScreenSizeClass = "compact" | "regular" | "wide";
|
|
149
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACR,SAAS,EACT,SAAS,EAEZ,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAM1E,MAAM,MAAM,iBAAiB,GACvB,SAAS,GACT,OAAO,GACP,MAAM,GACN,WAAW,GACX,MAAM,CAAC;AAMb;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC;AAM5E,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,mBAAmB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EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SkeletonBrandColors, SkeletonThemeColors } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Default light/dark palettes used when no brand colors or explicit
|
|
4
|
+
* backgroundColor/highlightColor are supplied.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_LIGHT_COLORS: SkeletonThemeColors;
|
|
7
|
+
export declare const DEFAULT_DARK_COLORS: SkeletonThemeColors;
|
|
8
|
+
/**
|
|
9
|
+
* Parse a hex color (#RGB, #RRGGBB, #RRGGBBAA) into r/g/b/a channels.
|
|
10
|
+
* Returns null if the string isn't a parseable hex color.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseHexColor(hex: string): {
|
|
13
|
+
r: number;
|
|
14
|
+
g: number;
|
|
15
|
+
b: number;
|
|
16
|
+
a: number;
|
|
17
|
+
} | null;
|
|
18
|
+
/**
|
|
19
|
+
* Convert an rgb/rgba channel set back into a CSS rgba() string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toRgbaString(r: number, g: number, b: number, a: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Lighten or darken a hex color by a percentage (-1 to 1).
|
|
24
|
+
* Positive amount lightens, negative darkens. Non-hex input is returned unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function shadeColor(hex: string, amount: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Given a hex/rgba color, return a translucent rgba() version at the given opacity.
|
|
29
|
+
* Falls back to the original string if it isn't parseable (e.g. already rgba(), or a named color).
|
|
30
|
+
*/
|
|
31
|
+
export declare function withOpacity(color: string, opacity: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the {background, highlight} pair to use for a skeleton, given (in priority order):
|
|
34
|
+
* 1. explicit backgroundColor/highlightColor props
|
|
35
|
+
* 2. a brand color variant (colorVariant + colors map from the provider)
|
|
36
|
+
* 3. the ambient theme colors resolved from useSkeletonTheme
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveThemeColors(params: {
|
|
39
|
+
backgroundColor?: string;
|
|
40
|
+
highlightColor?: string;
|
|
41
|
+
colorVariant?: string;
|
|
42
|
+
isDark: boolean;
|
|
43
|
+
brandColors?: Record<string, SkeletonBrandColors>;
|
|
44
|
+
ambient: SkeletonThemeColors;
|
|
45
|
+
}): SkeletonThemeColors;
|
|
46
|
+
/**
|
|
47
|
+
* Build a 3-stop gradient color array from a background/highlight pair,
|
|
48
|
+
* matching the classic skeleton "sweep" look: base -> highlight -> base.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildSweepGradient(background: string, highlight: string): string[];
|
|
51
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../src/utils/colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,mBAGlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,mBAGjC,CAAC;AASF;;;GAGG;AACH,wBAAgB,aAAa,CACzB,GAAG,EAAE,MAAM,GACZ;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA0BvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAa9D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIlE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAClD,OAAO,EAAE,mBAAmB,CAAC;CAChC,GAAG,mBAAmB,CActB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAElF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ScreenSizeClass } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current window width, with a safe fallback for environments
|
|
4
|
+
* where Dimensions may not be ready (e.g. very early app boot, tests).
|
|
5
|
+
*/
|
|
6
|
+
export declare function getScreenWidth(): number;
|
|
7
|
+
/**
|
|
8
|
+
* Classify the current screen width into a coarse size bucket, useful for
|
|
9
|
+
* preset components that want to adapt column counts or avatar sizes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getScreenSizeClass(width?: number): ScreenSizeClass;
|
|
12
|
+
/**
|
|
13
|
+
* Scale a base dp value by the size class, useful for nudging preset
|
|
14
|
+
* dimensions (avatar size, line height) up slightly on larger screens.
|
|
15
|
+
*/
|
|
16
|
+
export declare function scaleBySize(base: number, sizeClass: ScreenSizeClass): number;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a recommended column count for grid-style presets (e.g. Product),
|
|
19
|
+
* based on the current screen size class.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRecommendedColumns(sizeClass?: ScreenSizeClass): number;
|
|
22
|
+
/**
|
|
23
|
+
* Snap a dp value to the nearest physical pixel, reducing anti-aliased/blurry
|
|
24
|
+
* edges on skeleton borders, similar to React Native's own hairline handling.
|
|
25
|
+
*/
|
|
26
|
+
export declare function pixelSnap(value: number): number;
|
|
27
|
+
//# sourceMappingURL=responsive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../src/utils/responsive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAYhD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,GAAE,MAAyB,GAAG,eAAe,CAIpF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,MAAM,CAS5E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,GAAE,eAAsC,GAAG,MAAM,CAS/F;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SkeletonThemeMode } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a SkeletonThemeMode ("light" | "dark" | "system") plus the current
|
|
4
|
+
* OS color scheme into a concrete isDark boolean.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveIsDark(mode: SkeletonThemeMode, systemScheme: "light" | "dark" | null | undefined): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Synchronous read of the current system color scheme, for use outside
|
|
9
|
+
* of component render (e.g. computing an initial value).
|
|
10
|
+
*/
|
|
11
|
+
export declare function getSystemColorScheme(): "light" | "dark" | null;
|
|
12
|
+
/**
|
|
13
|
+
* Default theme colors for a resolved dark/light state.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDefaultThemeColors(isDark: boolean): import("..").SkeletonThemeColors;
|
|
16
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIjH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAC9B,OAAO,GACP,MAAM,GACN,IAAI,CAMT;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,oCAEpD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-smart-skeleton",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A fully customizable, theme-aware, animated skeleton loader for React Native.",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"source": "src/index.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"lib",
|
|
12
|
+
"android",
|
|
13
|
+
"ios",
|
|
14
|
+
"react-native-smart-skeleton.podspec",
|
|
15
|
+
"!**/__tests__",
|
|
16
|
+
"!**/__fixtures__",
|
|
17
|
+
"!**/__mocks__"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "bob build",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
23
|
+
"prepare": "bob build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"react-native",
|
|
27
|
+
"skeleton",
|
|
28
|
+
"loading",
|
|
29
|
+
"placeholder",
|
|
30
|
+
"shimmer",
|
|
31
|
+
"reanimated",
|
|
32
|
+
"ios",
|
|
33
|
+
"android"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "*",
|
|
38
|
+
"react-native": "*",
|
|
39
|
+
"react-native-linear-gradient": "*",
|
|
40
|
+
"react-native-reanimated": ">=2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"react-native-linear-gradient": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/react": "^18.2.0",
|
|
49
|
+
"react": "18.2.0",
|
|
50
|
+
"react-native": "0.73.0",
|
|
51
|
+
"react-native-builder-bob": "^0.23.0",
|
|
52
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
53
|
+
"react-native-reanimated": "^3.6.0",
|
|
54
|
+
"typescript": "^5.3.0"
|
|
55
|
+
},
|
|
56
|
+
"react-native-builder-bob": {
|
|
57
|
+
"source": "src",
|
|
58
|
+
"output": "lib",
|
|
59
|
+
"targets": [
|
|
60
|
+
"commonjs",
|
|
61
|
+
"module",
|
|
62
|
+
"typescript"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"author": "Neeraj Singh",
|
|
66
|
+
"homepage": "https://github.com/your-username/react-native-smart-skeleton",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "git+https://github.com/your-username/react-native-smart-skeleton.git"
|
|
70
|
+
},
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/your-username/react-native-smart-skeleton/issues"
|
|
73
|
+
}
|
|
74
|
+
}
|