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,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import Skeleton from "../components/Skeleton";
|
|
4
|
+
import Circle from "../components/Circle";
|
|
5
|
+
/**
|
|
6
|
+
* A ready-made skeleton block mimicking a video list item: a video
|
|
7
|
+
* thumbnail at a given aspect ratio, optionally followed by a channel
|
|
8
|
+
* avatar + title row and a meta line (views / date).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Skeleton.Video aspectRatio={16 / 9} showTitle showMeta />
|
|
12
|
+
*/
|
|
13
|
+
export default function Video({
|
|
14
|
+
aspectRatio = 16 / 9,
|
|
15
|
+
showTitle = true,
|
|
16
|
+
showMeta = true,
|
|
17
|
+
count = 1,
|
|
18
|
+
gap = 20,
|
|
19
|
+
animation,
|
|
20
|
+
style,
|
|
21
|
+
testID
|
|
22
|
+
}) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
24
|
+
style: style,
|
|
25
|
+
testID: testID
|
|
26
|
+
}, Array.from({
|
|
27
|
+
length: count
|
|
28
|
+
}).map((_, index) => /*#__PURE__*/React.createElement(View, {
|
|
29
|
+
key: index,
|
|
30
|
+
style: {
|
|
31
|
+
marginTop: index === 0 ? 0 : gap
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
34
|
+
style: {
|
|
35
|
+
width: "100%",
|
|
36
|
+
aspectRatio
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
39
|
+
width: "100%",
|
|
40
|
+
height: "100%",
|
|
41
|
+
borderRadius: 10,
|
|
42
|
+
animation: animation
|
|
43
|
+
})), (showTitle || showMeta) && /*#__PURE__*/React.createElement(View, {
|
|
44
|
+
style: {
|
|
45
|
+
flexDirection: "row",
|
|
46
|
+
marginTop: 10
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Circle, {
|
|
49
|
+
size: 36,
|
|
50
|
+
animation: animation
|
|
51
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
52
|
+
style: {
|
|
53
|
+
marginLeft: 10,
|
|
54
|
+
flex: 1
|
|
55
|
+
}
|
|
56
|
+
}, showTitle && /*#__PURE__*/React.createElement(Skeleton, {
|
|
57
|
+
width: "90%",
|
|
58
|
+
height: 14,
|
|
59
|
+
animation: animation
|
|
60
|
+
}), showMeta && /*#__PURE__*/React.createElement(Skeleton, {
|
|
61
|
+
width: "50%",
|
|
62
|
+
height: 11,
|
|
63
|
+
style: {
|
|
64
|
+
marginTop: 6
|
|
65
|
+
},
|
|
66
|
+
animation: animation
|
|
67
|
+
}))))));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=Video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Skeleton","Circle","Video","aspectRatio","showTitle","showMeta","count","gap","animation","style","testID","createElement","Array","from","length","map","_","index","key","marginTop","width","height","borderRadius","flexDirection","size","marginLeft","flex"],"sourceRoot":"../../../src","sources":["presets/Video.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,MAAM,MAAM,sBAAsB;AAGzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,KAAKA,CAAC;EA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X,QAAQ;IAACoB,KAAK,EAAC,KAAK;IAACC,MAAM,EAAE,EAAG;IAACb,SAAS,EAAEA;EAAU,CAAE,CAAC,EACvEH,QAAQ,iBACLP,KAAA,CAAAa,aAAA,CAACX,QAAQ;IACLoB,KAAK,EAAC,KAAK;IACXC,MAAM,EAAE,EAAG;IACXZ,KAAK,EAAE;MAAEU,SAAS,EAAE;IAAE,CAAE;IACxBX,SAAS,EAAEA;EAAU,CACxB,CAEH,CACJ,CAER,CACT,CACC,CAAC;AAEf","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { createContext, useMemo } from "react";
|
|
2
|
+
import { I18nManager, useColorScheme } from "react-native";
|
|
3
|
+
import { useReducedMotion } from "../hooks/useReducedMotion";
|
|
4
|
+
import { resolveIsDark, getDefaultThemeColors } from "../utils/theme";
|
|
5
|
+
import { resolveThemeColors } from "../utils/colors";
|
|
6
|
+
export const SkeletonContext = /*#__PURE__*/createContext(null);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Global configuration provider for react-native-smart-skeleton.
|
|
10
|
+
*
|
|
11
|
+
* Wrap your app (or a subtree) once to set defaults for theme, animation,
|
|
12
|
+
* duration, performance mode, RTL, reduced-motion override, and brand colors.
|
|
13
|
+
* Any individual Skeleton component can still override these via its own props.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <SkeletonProvider theme="system" animation="shimmer" duration={1200}>
|
|
17
|
+
* <App />
|
|
18
|
+
* </SkeletonProvider>
|
|
19
|
+
*/
|
|
20
|
+
export function SkeletonProvider({
|
|
21
|
+
children,
|
|
22
|
+
theme = "system",
|
|
23
|
+
animation = "shimmer",
|
|
24
|
+
duration = 1200,
|
|
25
|
+
performanceMode = "balanced",
|
|
26
|
+
rtl,
|
|
27
|
+
reducedMotion: reducedMotionOverride,
|
|
28
|
+
colors
|
|
29
|
+
}) {
|
|
30
|
+
const systemScheme = useColorScheme();
|
|
31
|
+
const osReducedMotion = useReducedMotion();
|
|
32
|
+
const isDark = resolveIsDark(theme, systemScheme);
|
|
33
|
+
const reducedMotion = reducedMotionOverride ?? osReducedMotion;
|
|
34
|
+
const resolvedRtl = rtl ?? I18nManager.isRTL;
|
|
35
|
+
const value = useMemo(() => {
|
|
36
|
+
const ambient = getDefaultThemeColors(isDark);
|
|
37
|
+
const getVariantColors = variant => resolveThemeColors({
|
|
38
|
+
colorVariant: variant,
|
|
39
|
+
isDark,
|
|
40
|
+
brandColors: colors,
|
|
41
|
+
ambient
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
theme,
|
|
45
|
+
isDark,
|
|
46
|
+
animation,
|
|
47
|
+
duration,
|
|
48
|
+
performanceMode,
|
|
49
|
+
reducedMotion,
|
|
50
|
+
rtl: resolvedRtl,
|
|
51
|
+
colors,
|
|
52
|
+
resolvedColors: ambient,
|
|
53
|
+
getVariantColors
|
|
54
|
+
};
|
|
55
|
+
}, [theme, isDark, animation, duration, performanceMode, reducedMotion, resolvedRtl, colors]);
|
|
56
|
+
return /*#__PURE__*/React.createElement(SkeletonContext.Provider, {
|
|
57
|
+
value: value
|
|
58
|
+
}, children);
|
|
59
|
+
}
|
|
60
|
+
export default SkeletonProvider;
|
|
61
|
+
//# sourceMappingURL=SkeletonProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createContext","useMemo","I18nManager","useColorScheme","useReducedMotion","resolveIsDark","getDefaultThemeColors","resolveThemeColors","SkeletonContext","SkeletonProvider","children","theme","animation","duration","performanceMode","rtl","reducedMotion","reducedMotionOverride","colors","systemScheme","osReducedMotion","isDark","resolvedRtl","isRTL","value","ambient","getVariantColors","variant","colorVariant","brandColors","resolvedColors","createElement","Provider"],"sourceRoot":"../../../src","sources":["providers/SkeletonProvider.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,OAAO,QAAQ,OAAO;AACrD,SAASC,WAAW,EAAEC,cAAc,QAAQ,cAAc;AAC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Ae,EAAEE,aAAa,EAAEM,WAAW,EAAEJ,MAAM,CAAC,CAAC;EAE7F,oBAAOnB,KAAA,CAAAgC,aAAA,CAACvB,eAAe,CAACwB,QAAQ;IAACR,KAAK,EAAEA;EAAM,GAAEd,QAAmC,CAAC;AACxF;AAEA,eAAeD,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default light/dark palettes used when no brand colors or explicit
|
|
3
|
+
* backgroundColor/highlightColor are supplied.
|
|
4
|
+
*/
|
|
5
|
+
export const DEFAULT_LIGHT_COLORS = {
|
|
6
|
+
background: "#E5E7EB",
|
|
7
|
+
highlight: "#F3F4F6"
|
|
8
|
+
};
|
|
9
|
+
export const DEFAULT_DARK_COLORS = {
|
|
10
|
+
background: "#2D3748",
|
|
11
|
+
highlight: "#4A5568"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Clamp a number between 0 and 255.
|
|
16
|
+
*/
|
|
17
|
+
function clampChannel(value) {
|
|
18
|
+
return Math.max(0, Math.min(255, Math.round(value)));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Parse a hex color (#RGB, #RRGGBB, #RRGGBBAA) into r/g/b/a channels.
|
|
23
|
+
* Returns null if the string isn't a parseable hex color.
|
|
24
|
+
*/
|
|
25
|
+
export function parseHexColor(hex) {
|
|
26
|
+
const normalized = hex.trim().replace("#", "");
|
|
27
|
+
if (normalized.length === 3) {
|
|
28
|
+
const r = parseInt(normalized[0] + normalized[0], 16);
|
|
29
|
+
const g = parseInt(normalized[1] + normalized[1], 16);
|
|
30
|
+
const b = parseInt(normalized[2] + normalized[2], 16);
|
|
31
|
+
return {
|
|
32
|
+
r,
|
|
33
|
+
g,
|
|
34
|
+
b,
|
|
35
|
+
a: 1
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (normalized.length === 6) {
|
|
39
|
+
const r = parseInt(normalized.slice(0, 2), 16);
|
|
40
|
+
const g = parseInt(normalized.slice(2, 4), 16);
|
|
41
|
+
const b = parseInt(normalized.slice(4, 6), 16);
|
|
42
|
+
return {
|
|
43
|
+
r,
|
|
44
|
+
g,
|
|
45
|
+
b,
|
|
46
|
+
a: 1
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (normalized.length === 8) {
|
|
50
|
+
const r = parseInt(normalized.slice(0, 2), 16);
|
|
51
|
+
const g = parseInt(normalized.slice(2, 4), 16);
|
|
52
|
+
const b = parseInt(normalized.slice(4, 6), 16);
|
|
53
|
+
const a = parseInt(normalized.slice(6, 8), 16) / 255;
|
|
54
|
+
return {
|
|
55
|
+
r,
|
|
56
|
+
g,
|
|
57
|
+
b,
|
|
58
|
+
a
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Convert an rgb/rgba channel set back into a CSS rgba() string.
|
|
66
|
+
*/
|
|
67
|
+
export function toRgbaString(r, g, b, a) {
|
|
68
|
+
return `rgba(${clampChannel(r)}, ${clampChannel(g)}, ${clampChannel(b)}, ${Math.max(0, Math.min(1, a))})`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Lighten or darken a hex color by a percentage (-1 to 1).
|
|
73
|
+
* Positive amount lightens, negative darkens. Non-hex input is returned unchanged.
|
|
74
|
+
*/
|
|
75
|
+
export function shadeColor(hex, amount) {
|
|
76
|
+
const parsed = parseHexColor(hex);
|
|
77
|
+
if (!parsed) return hex;
|
|
78
|
+
const {
|
|
79
|
+
r,
|
|
80
|
+
g,
|
|
81
|
+
b,
|
|
82
|
+
a
|
|
83
|
+
} = parsed;
|
|
84
|
+
const factor = amount;
|
|
85
|
+
const adjust = channel => factor >= 0 ? channel + (255 - channel) * factor : channel + channel * factor;
|
|
86
|
+
return toRgbaString(adjust(r), adjust(g), adjust(b), a);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Given a hex/rgba color, return a translucent rgba() version at the given opacity.
|
|
91
|
+
* Falls back to the original string if it isn't parseable (e.g. already rgba(), or a named color).
|
|
92
|
+
*/
|
|
93
|
+
export function withOpacity(color, opacity) {
|
|
94
|
+
const parsed = parseHexColor(color);
|
|
95
|
+
if (!parsed) return color;
|
|
96
|
+
return toRgbaString(parsed.r, parsed.g, parsed.b, opacity);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Resolve the {background, highlight} pair to use for a skeleton, given (in priority order):
|
|
101
|
+
* 1. explicit backgroundColor/highlightColor props
|
|
102
|
+
* 2. a brand color variant (colorVariant + colors map from the provider)
|
|
103
|
+
* 3. the ambient theme colors resolved from useSkeletonTheme
|
|
104
|
+
*/
|
|
105
|
+
export function resolveThemeColors(params) {
|
|
106
|
+
const {
|
|
107
|
+
backgroundColor,
|
|
108
|
+
highlightColor,
|
|
109
|
+
colorVariant,
|
|
110
|
+
isDark,
|
|
111
|
+
brandColors,
|
|
112
|
+
ambient
|
|
113
|
+
} = params;
|
|
114
|
+
let base = ambient;
|
|
115
|
+
if (colorVariant && brandColors && brandColors[colorVariant]) {
|
|
116
|
+
const variant = brandColors[colorVariant];
|
|
117
|
+
base = isDark ? variant.dark : variant.light;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
background: backgroundColor ?? base.background,
|
|
121
|
+
highlight: highlightColor ?? base.highlight
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Build a 3-stop gradient color array from a background/highlight pair,
|
|
127
|
+
* matching the classic skeleton "sweep" look: base -> highlight -> base.
|
|
128
|
+
*/
|
|
129
|
+
export function buildSweepGradient(background, highlight) {
|
|
130
|
+
return [background, highlight, background];
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_LIGHT_COLORS","background","highlight","DEFAULT_DARK_COLORS","clampChannel","value","Math","max","min","round","parseHexColor","hex","normalized","trim","replace","length","r","parseInt","g","b","a","slice","toRgbaString","shadeColor","amount","parsed","factor","adjust","channel","withOpacity","color","opacity","resolveThemeColors","params","backgroundColor","highlightColor","colorVariant","isDark","brandColors","ambient","base","variant","dark","light","buildSweepGradient"],"sourceRoot":"../../../src","sources":["utils/colors.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAyC,GAAG;EACrDC,UAAU,EAAE,SAAS;EACrBC,SAAS,EAAE;AACf,CAAC;AAED,OAAO,MAAMC,mBAAwC,GAAG;EACpDF,UAAU,EAAE,SAAS;EACrBC,SAAS,EAAE;AACf,CAAC;;AAED;AACA;AACA;AACA,SAASE,YAAYA,CAACC,KAAa,EAAU;EACzC,OAAOC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,GAAG,CAAC,GAAG,EAAEF,IAAI,CAACG,KAAK,CAACJ,KAAK,CAAC,CAAC,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,aAAaA,CACzBC,GAAW,EAC0C;EACrD,MAAMC,UAAU,GAAGD,GAAG,CAACE,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EAE9C,IAAIF,UAAU,CAACG,MAAM,KAAK,CAAC,EAAE;IACzB,MAAMC,CAAC,GAAGC,QAAQ,CAACL,UAAU,CAAC,CAAC,CAAC,GAAGA,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACrD,MAAMM,CAAC,GAAGD,QAAQ,CAACL,UAAU,CAAC,CAAC,CAAC,GAAGA,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACrD,MAAMO,CAA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AACA,OAAO,SAASC,kBAAkBA,CAACC,MAOlC,EAAuB;EACpB,MAAM;IAAEC,eAAe;IAAEC,cAAc;IAAEC,YAAY;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAGN,MAAM;EAE9F,IAAIO,IAAyB,GAAGD,OAAO;EAEvC,IAAIH,YAAY,IAAIE,WAAW,IAAIA,WAAW,CAACF,YAAY,CAAC,EAAE;IAC1D,MAAMK,OAAO,GAAGH,WAAW,CAACF,YAAY,CAAC;IACzCI,IAAI,GAAGH,MAAM,GAAGI,OAAO,CAACC,IAAI,GAAGD,OAAO,CAACE,KAAK;EAChD;EAEA,OAAO;IACH1C,UAAU,EAAEiC,eAAe,IAAIM,IAAI,CAACvC,UAAU;IAC9CC,SAAS,EAAEiC,cAAc,IAAIK,IAAI,CAACtC;EACtC,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAS0C,kBAAkBA,CAAC3C,UAAkB,EAAEC,SAAiB,EAAY;EAChF,OAAO,CAACD,UAAU,EAAEC,SAAS,EAAED,UAAU,CAAC;AAC9C","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Dimensions, PixelRatio } from "react-native";
|
|
2
|
+
/**
|
|
3
|
+
* Breakpoints (in dp) used to classify the current screen width.
|
|
4
|
+
* Roughly: phones -> "compact", small tablets / large phones landscape -> "regular",
|
|
5
|
+
* tablets / desktop-like windows -> "wide".
|
|
6
|
+
*/
|
|
7
|
+
const BREAKPOINTS = {
|
|
8
|
+
regular: 480,
|
|
9
|
+
wide: 768
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current window width, with a safe fallback for environments
|
|
14
|
+
* where Dimensions may not be ready (e.g. very early app boot, tests).
|
|
15
|
+
*/
|
|
16
|
+
export function getScreenWidth() {
|
|
17
|
+
try {
|
|
18
|
+
const {
|
|
19
|
+
width
|
|
20
|
+
} = Dimensions.get("window");
|
|
21
|
+
return width || 0;
|
|
22
|
+
} catch {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Classify the current screen width into a coarse size bucket, useful for
|
|
29
|
+
* preset components that want to adapt column counts or avatar sizes.
|
|
30
|
+
*/
|
|
31
|
+
export function getScreenSizeClass(width = getScreenWidth()) {
|
|
32
|
+
if (width >= BREAKPOINTS.wide) return "wide";
|
|
33
|
+
if (width >= BREAKPOINTS.regular) return "regular";
|
|
34
|
+
return "compact";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Scale a base dp value by the size class, useful for nudging preset
|
|
39
|
+
* dimensions (avatar size, line height) up slightly on larger screens.
|
|
40
|
+
*/
|
|
41
|
+
export function scaleBySize(base, sizeClass) {
|
|
42
|
+
switch (sizeClass) {
|
|
43
|
+
case "wide":
|
|
44
|
+
return Math.round(base * 1.25);
|
|
45
|
+
case "regular":
|
|
46
|
+
return Math.round(base * 1.1);
|
|
47
|
+
default:
|
|
48
|
+
return base;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a recommended column count for grid-style presets (e.g. Product),
|
|
54
|
+
* based on the current screen size class.
|
|
55
|
+
*/
|
|
56
|
+
export function getRecommendedColumns(sizeClass = getScreenSizeClass()) {
|
|
57
|
+
switch (sizeClass) {
|
|
58
|
+
case "wide":
|
|
59
|
+
return 4;
|
|
60
|
+
case "regular":
|
|
61
|
+
return 3;
|
|
62
|
+
default:
|
|
63
|
+
return 2;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Snap a dp value to the nearest physical pixel, reducing anti-aliased/blurry
|
|
69
|
+
* edges on skeleton borders, similar to React Native's own hairline handling.
|
|
70
|
+
*/
|
|
71
|
+
export function pixelSnap(value) {
|
|
72
|
+
return PixelRatio.roundToNearestPixel(value);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Dimensions","PixelRatio","BREAKPOINTS","regular","wide","getScreenWidth","width","get","getScreenSizeClass","scaleBySize","base","sizeClass","Math","round","getRecommendedColumns","pixelSnap","value","roundToNearestPixel"],"sourceRoot":"../../../src","sources":["utils/responsive.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAGrD;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EAChBC,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAW;EACrC,IAAI;IACA,MAAM;MAAEC;IAAM,CAAC,GAAGN,UAAU,CAACO,GAAG,CAAC,QAAQ,CAAC;IAC1C,OAAOD,KAAK,IAAI,CAAC;EACrB,CAAC,CAAC,MAAM;IACJ,OAAO,CAAC;EACZ;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,kBAAkBA,CAACF,KAAa,GAAGD,cAAc,CAAC,CAAC,EAAmB;EAClF,IAAIC,KAAK,IAAIJ,WAAW,CAACE,IAAI,EAAE,OAAO,MAAM;EAC5C,IAAIE,KAAK,IAAIJ,WAAW,CAACC,OAAO,EAAE,OAAO,SAAS;EAClD,OAAO,SAAS;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASM,WAAWA,CAACC,IAAY,EAAEC,SAA0B,EAAU;EAC1E,QAAQA,SAAS;IACb,KAAK,MAAM;MACP,OAAOC,IAAI,CAACC,KAAK,CAACH,IAAI,GAAG,IAAI,CAAC;IAClC,KAAK,SAAS;MACV,OAAOE,IAAI,CAACC,KAAK,CAACH,IAAI,GAAG,GAAG,CAAC;IACjC;MACI,OAAOA,IAAI;EACnB;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,qBAAqBA,CAACH,SAA0B,GAAGH,kBAAkB,CAAC,CAAC,EAAU;EAC7F,QAAQG,SAAS;IACb,KAAK,MAAM;MACP,OAAO,CAAC;IACZ,KAAK,SAAS;MACV,OAAO,CAAC;IACZ;MACI,OAAO,CAAC;EAChB;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,SAASA,CAACC,KAAa,EAAU;EAC7C,OAAOf,UAAU,CAACgB,mBAAmB,CAACD,KAAK,CAAC;AAChD","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Appearance } from "react-native";
|
|
2
|
+
import { DEFAULT_DARK_COLORS, DEFAULT_LIGHT_COLORS } from "./colors";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a SkeletonThemeMode ("light" | "dark" | "system") plus the current
|
|
6
|
+
* OS color scheme into a concrete isDark boolean.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveIsDark(mode, systemScheme) {
|
|
9
|
+
if (mode === "light") return false;
|
|
10
|
+
if (mode === "dark") return true;
|
|
11
|
+
return systemScheme === "dark";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Synchronous read of the current system color scheme, for use outside
|
|
16
|
+
* of component render (e.g. computing an initial value).
|
|
17
|
+
*/
|
|
18
|
+
export function getSystemColorScheme() {
|
|
19
|
+
try {
|
|
20
|
+
return Appearance.getColorScheme() ?? null;
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Default theme colors for a resolved dark/light state.
|
|
28
|
+
*/
|
|
29
|
+
export function getDefaultThemeColors(isDark) {
|
|
30
|
+
return isDark ? DEFAULT_DARK_COLORS : DEFAULT_LIGHT_COLORS;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Appearance","DEFAULT_DARK_COLORS","DEFAULT_LIGHT_COLORS","resolveIsDark","mode","systemScheme","getSystemColorScheme","getColorScheme","getDefaultThemeColors","isDark"],"sourceRoot":"../../../src","sources":["utils/theme.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,UAAU;;AAEpE;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,IAAuB,EAAEC,YAAiD,EAAW;EAC/G,IAAID,IAAI,KAAK,OAAO,EAAE,OAAO,KAAK;EAClC,IAAIA,IAAI,KAAK,MAAM,EAAE,OAAO,IAAI;EAChC,OAAOC,YAAY,KAAK,MAAM;AAClC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAA,EAGzB;EACP,IAAI;IACA,OAAON,UAAU,CAACO,cAAc,CAAC,CAAC,IAAI,IAAI;EAC9C,CAAC,CAAC,MAAM;IACJ,OAAO,IAAI;EACf;AACJ;;AAEA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,MAAe,EAAE;EACnD,OAAOA,MAAM,GAAGR,mBAAmB,GAAGC,oBAAoB;AAC9D","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SkeletonPerformanceMode } from "../types";
|
|
2
|
+
export interface BreathingOptions {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
performanceMode?: SkeletonPerformanceMode;
|
|
7
|
+
/** Smallest scale factor during the "exhale" phase. Defaults to 0.97. */
|
|
8
|
+
minScale?: number;
|
|
9
|
+
/** Largest scale factor during the "inhale" phase. Defaults to 1. */
|
|
10
|
+
maxScale?: number;
|
|
11
|
+
/** Paired opacity dip alongside the scale-down. Defaults to 0.85. */
|
|
12
|
+
minOpacity?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A slow, very gentle scale + opacity oscillation — softer and slower than
|
|
16
|
+
* "pulse" — intended as the most reduced-motion-friendly animation. This is
|
|
17
|
+
* the animation `Skeleton` falls back to (at a slowed rate) when the OS
|
|
18
|
+
* reduce-motion setting is on and the consumer hasn't explicitly chosen "none".
|
|
19
|
+
*/
|
|
20
|
+
export declare function useBreathingStyle({ duration, delay, disabled, performanceMode, minScale, maxScale, minOpacity, }: BreathingOptions): {
|
|
21
|
+
opacity: number;
|
|
22
|
+
transform: {
|
|
23
|
+
scale: number;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=breathing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breathing.d.ts","sourceRoot":"","sources":["../../../src/animations/breathing.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,QAAe,EACf,KAAS,EACT,QAAgB,EAChB,eAA4B,EAC5B,QAAe,EACf,QAAY,EACZ,UAAiB,GACpB,EAAE,gBAAgB;;;;;EAyClB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SkeletonPerformanceMode } from "../types";
|
|
2
|
+
export interface PulseOptions {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
performanceMode?: SkeletonPerformanceMode;
|
|
7
|
+
/** Minimum opacity of the "dim" phase. Defaults to 0.4. */
|
|
8
|
+
minOpacity?: number;
|
|
9
|
+
/** Maximum opacity of the "bright" phase. Defaults to 1. */
|
|
10
|
+
maxOpacity?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Classic fade in/out pulse: opacity oscillates between minOpacity and
|
|
14
|
+
* maxOpacity using an ease-in-out curve, looping indefinitely.
|
|
15
|
+
*
|
|
16
|
+
* Returns an animated style with just `opacity`, ready to spread onto the
|
|
17
|
+
* skeleton's base View.
|
|
18
|
+
*/
|
|
19
|
+
export declare function usePulseStyle({ duration, delay, disabled, performanceMode, minOpacity, maxOpacity, }: PulseOptions): {
|
|
20
|
+
opacity: number;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=pulse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulse.d.ts","sourceRoot":"","sources":["../../../src/animations/pulse.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC1B,QAAe,EACf,KAAS,EACT,QAAgB,EAChB,eAA4B,EAC5B,UAAgB,EAChB,UAAc,GACjB,EAAE,YAAY;;EAqCd"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SkeletonPerformanceMode } from "../types";
|
|
2
|
+
export interface ShimmerOptions {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
/** When true, freezes the animation at progress 0 (used for reduced motion / "none"). */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
performanceMode?: SkeletonPerformanceMode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Drives a 0 -> 1 -> 0 progress value looping indefinitely, intended to be
|
|
11
|
+
* mapped (by the consuming component) onto a translateX of a gradient
|
|
12
|
+
* overlay to create the classic "shimmer sweep" effect.
|
|
13
|
+
*
|
|
14
|
+
* Returns both the raw shared value-derived animated style (opacity passthrough,
|
|
15
|
+
* so it can be spread directly) and the progress itself isn't exposed —
|
|
16
|
+
* components should use `useShimmerTransform` below to get a transform style
|
|
17
|
+
* sized to their own width.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useShimmerProgress({ duration, delay, disabled, performanceMode, }: ShimmerOptions): import("react-native-reanimated").SharedValue<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Convenience hook: given a measured width, returns an animated style that
|
|
22
|
+
* translates a highlight overlay (assumed ~60% of `width` wide) from off-screen
|
|
23
|
+
* left to off-screen right, looping. Use on an absolutely-positioned overlay
|
|
24
|
+
* View/LinearGradient layered on top of the base skeleton rect.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useShimmerTransform(width: number, options: ShimmerOptions): {
|
|
27
|
+
style: {
|
|
28
|
+
transform: {
|
|
29
|
+
translateX: number;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
sweepWidth: number;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=shimmer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shimmer.d.ts","sourceRoot":"","sources":["../../../src/animations/shimmer.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAC/B,QAAe,EACf,KAAS,EACT,QAAgB,EAChB,eAA4B,GAC/B,EAAE,cAAc,yDAgChB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;;;;;;;EAYzE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SkeletonPerformanceMode } from "../types";
|
|
2
|
+
export interface WaveOptions {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
performanceMode?: SkeletonPerformanceMode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Similar to shimmer, but drives a smoother sine-like sweep (ease-in-out
|
|
10
|
+
* instead of linear) intended for a softer "ripple" look, typically paired
|
|
11
|
+
* with a wider, lower-contrast gradient than shimmer uses.
|
|
12
|
+
*
|
|
13
|
+
* Returns a translateX-based animated style for a given measured width.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useWaveTransform(width: number, options: WaveOptions): {
|
|
16
|
+
style: {
|
|
17
|
+
transform: {
|
|
18
|
+
translateX: number;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
sweepWidth: number;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=wave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wave.d.ts","sourceRoot":"","sources":["../../../src/animations/wave.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;;;;;;;EA8CnE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonCloneProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Clones an arbitrary layout tree as skeleton placeholders. Useful when you
|
|
5
|
+
* have a complex, bespoke screen layout and don't want to hand-place a
|
|
6
|
+
* Skeleton for every element — instead describe the rough shape once as a
|
|
7
|
+
* `SkeletonCloneNode` tree (mirroring your real layout's structure) and let
|
|
8
|
+
* SkeletonClone render matching placeholders.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <SkeletonClone
|
|
12
|
+
* layout={{
|
|
13
|
+
* direction: "row",
|
|
14
|
+
* gap: 12,
|
|
15
|
+
* children: [
|
|
16
|
+
* { shape: "circle", width: 48, height: 48 },
|
|
17
|
+
* {
|
|
18
|
+
* direction: "column",
|
|
19
|
+
* gap: 6,
|
|
20
|
+
* children: [
|
|
21
|
+
* { width: 120, height: 14 },
|
|
22
|
+
* { width: 80, height: 12 },
|
|
23
|
+
* ],
|
|
24
|
+
* },
|
|
25
|
+
* ],
|
|
26
|
+
* }}
|
|
27
|
+
* />
|
|
28
|
+
*/
|
|
29
|
+
export default function SkeletonClone({ layout, animation, style, testID }: SkeletonCloneProps): React.JSX.Element;
|
|
30
|
+
//# sourceMappingURL=SkeletonClone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkeletonClone.d.ts","sourceRoot":"","sources":["../../../src/clone/SkeletonClone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAkDtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,kBAAkB,qBAE7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonCircleProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A circular skeleton placeholder, commonly used for avatars.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Skeleton.Circle size={48} />
|
|
8
|
+
*/
|
|
9
|
+
export default function Circle({ size, ...props }: SkeletonCircleProps): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../src/components/Circle.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,GAAG,KAAK,EAAE,EAAE,mBAAmB,qBAE1E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonGroupProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Groups multiple skeleton children together and automatically staggers
|
|
5
|
+
* their animation start so they don't all pulse/shimmer perfectly in sync —
|
|
6
|
+
* a subtle touch that reads as more natural for lists of skeleton rows.
|
|
7
|
+
*
|
|
8
|
+
* Any direct child that accepts a `delay` prop (i.e. any Skeleton.* shape,
|
|
9
|
+
* or a custom component that forwards `delay` to one) will have an
|
|
10
|
+
* incremental delay injected automatically. Children that already specify
|
|
11
|
+
* their own `delay` are left untouched.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Skeleton.Group staggerDelay={80}>
|
|
15
|
+
* <Skeleton.Rect width="100%" height={16} />
|
|
16
|
+
* <Skeleton.Rect width="80%" height={16} />
|
|
17
|
+
* <Skeleton.Rect width="60%" height={16} />
|
|
18
|
+
* </Skeleton.Group>
|
|
19
|
+
*/
|
|
20
|
+
export default function Group({ children, staggerDelay, animation, direction, style, testID, }: SkeletonGroupProps): React.JSX.Element;
|
|
21
|
+
//# sourceMappingURL=Group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../src/components/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,QAAQ,EACR,YAAiB,EACjB,SAAS,EACT,SAAoB,EACpB,KAAK,EACL,MAAM,GACT,EAAE,kBAAkB,qBA0BpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonPillProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A fully-rounded "pill" skeleton placeholder, commonly used for buttons,
|
|
5
|
+
* tags/chips, or badges. Border radius is automatically derived from height
|
|
6
|
+
* unless overridden.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Skeleton.Pill width={80} height={28} />
|
|
10
|
+
*/
|
|
11
|
+
export default function Pill({ width, height, borderRadius, ...props }: SkeletonPillProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Pill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../src/components/Pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,KAAU,EAAE,MAAW,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,qBAUlG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SkeletonProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* A rectangular skeleton placeholder. Equivalent to `<Skeleton />` directly,
|
|
5
|
+
* provided for a consistent, explicit naming convention alongside
|
|
6
|
+
* `Skeleton.Circle`, `Skeleton.Square`, and `Skeleton.Pill`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Skeleton.Rect width={200} height={20} />
|
|
10
|
+
*/
|
|
11
|
+
export default function Rect(props: SkeletonProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Rect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rect.d.ts","sourceRoot":"","sources":["../../../src/components/Rect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,aAAa,qBAEhD"}
|