number-flow-react-native 0.1.0
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/LICENSE +21 -0
- package/README.md +44 -0
- package/lib/module/core/constants.js +21 -0
- package/lib/module/core/constants.js.map +1 -0
- package/lib/module/core/intlHelpers.js +310 -0
- package/lib/module/core/intlHelpers.js.map +1 -0
- package/lib/module/core/layout.js +71 -0
- package/lib/module/core/layout.js.map +1 -0
- package/lib/module/core/mask.js +50 -0
- package/lib/module/core/mask.js.map +1 -0
- package/lib/module/core/numerals/detection.js +105 -0
- package/lib/module/core/numerals/detection.js.map +1 -0
- package/lib/module/core/numerals/digits.js +128 -0
- package/lib/module/core/numerals/digits.js.map +1 -0
- package/lib/module/core/numerals/index.js +5 -0
- package/lib/module/core/numerals/index.js.map +1 -0
- package/lib/module/core/numerals/tables.js +114 -0
- package/lib/module/core/numerals/tables.js.map +1 -0
- package/lib/module/core/superscript.js +31 -0
- package/lib/module/core/superscript.js.map +1 -0
- package/lib/module/core/timeLayout.js +98 -0
- package/lib/module/core/timeLayout.js.map +1 -0
- package/lib/module/core/timeTypes.js +4 -0
- package/lib/module/core/timeTypes.js.map +1 -0
- package/lib/module/core/timing.js +45 -0
- package/lib/module/core/timing.js.map +1 -0
- package/lib/module/core/types.js +58 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/useAccessibilityAnnouncement.js +27 -0
- package/lib/module/core/useAccessibilityAnnouncement.js.map +1 -0
- package/lib/module/core/useAnimatedX.js +25 -0
- package/lib/module/core/useAnimatedX.js.map +1 -0
- package/lib/module/core/useAnimationLifecycle.js +37 -0
- package/lib/module/core/useAnimationLifecycle.js.map +1 -0
- package/lib/module/core/useCanAnimate.js +22 -0
- package/lib/module/core/useCanAnimate.js.map +1 -0
- package/lib/module/core/useContinuousSpin.js +89 -0
- package/lib/module/core/useContinuousSpin.js.map +1 -0
- package/lib/module/core/useDebouncedWidths.js +74 -0
- package/lib/module/core/useDebouncedWidths.js.map +1 -0
- package/lib/module/core/useDigitAnimation.js +138 -0
- package/lib/module/core/useDigitAnimation.js.map +1 -0
- package/lib/module/core/useFlowPipeline.js +85 -0
- package/lib/module/core/useFlowPipeline.js.map +1 -0
- package/lib/module/core/useFormattedValue.js +28 -0
- package/lib/module/core/useFormattedValue.js.map +1 -0
- package/lib/module/core/useLayoutDiff.js +59 -0
- package/lib/module/core/useLayoutDiff.js.map +1 -0
- package/lib/module/core/useNumberFormatting.js +158 -0
- package/lib/module/core/useNumberFormatting.js.map +1 -0
- package/lib/module/core/useSlotOpacity.js +53 -0
- package/lib/module/core/useSlotOpacity.js.map +1 -0
- package/lib/module/core/useTimeFormatting.js +74 -0
- package/lib/module/core/useTimeFormatting.js.map +1 -0
- package/lib/module/core/useTimingResolution.js +21 -0
- package/lib/module/core/useTimingResolution.js.map +1 -0
- package/lib/module/core/useWorkletFormatting.js +49 -0
- package/lib/module/core/useWorkletFormatting.js.map +1 -0
- package/lib/module/core/utils.js +132 -0
- package/lib/module/core/utils.js.map +1 -0
- package/lib/module/core/warnings.js +10 -0
- package/lib/module/core/warnings.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native/DigitSlot.js +163 -0
- package/lib/module/native/DigitSlot.js.map +1 -0
- package/lib/module/native/NumberFlow.js +244 -0
- package/lib/module/native/NumberFlow.js.map +1 -0
- package/lib/module/native/SymbolSlot.js +52 -0
- package/lib/module/native/SymbolSlot.js.map +1 -0
- package/lib/module/native/TimeFlow.js +270 -0
- package/lib/module/native/TimeFlow.js.map +1 -0
- package/lib/module/native/index.js +5 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/native/renderSlots.js +108 -0
- package/lib/module/native/renderSlots.js.map +1 -0
- package/lib/module/native/types.js +4 -0
- package/lib/module/native/types.js.map +1 -0
- package/lib/module/native/useMeasuredGlyphMetrics.js +156 -0
- package/lib/module/native/useMeasuredGlyphMetrics.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/skia/DigitSlot.js +171 -0
- package/lib/module/skia/DigitSlot.js.map +1 -0
- package/lib/module/skia/SkiaNumberFlow.js +430 -0
- package/lib/module/skia/SkiaNumberFlow.js.map +1 -0
- package/lib/module/skia/SkiaTimeFlow.js +226 -0
- package/lib/module/skia/SkiaTimeFlow.js.map +1 -0
- package/lib/module/skia/SymbolSlot.js +92 -0
- package/lib/module/skia/SymbolSlot.js.map +1 -0
- package/lib/module/skia/index.js +6 -0
- package/lib/module/skia/index.js.map +1 -0
- package/lib/module/skia/renderSlots.js +131 -0
- package/lib/module/skia/renderSlots.js.map +1 -0
- package/lib/module/skia/useGlyphMetrics.js +72 -0
- package/lib/module/skia/useGlyphMetrics.js.map +1 -0
- package/lib/module/skia/useScrubbing.js +165 -0
- package/lib/module/skia/useScrubbing.js.map +1 -0
- package/lib/module/skia/useSkiaFont.js +23 -0
- package/lib/module/skia/useSkiaFont.js.map +1 -0
- package/lib/typescript/core/constants.d.ts +15 -0
- package/lib/typescript/core/constants.d.ts.map +1 -0
- package/lib/typescript/core/intlHelpers.d.ts +10 -0
- package/lib/typescript/core/intlHelpers.d.ts.map +1 -0
- package/lib/typescript/core/layout.d.ts +22 -0
- package/lib/typescript/core/layout.d.ts.map +1 -0
- package/lib/typescript/core/mask.d.ts +18 -0
- package/lib/typescript/core/mask.d.ts.map +1 -0
- package/lib/typescript/core/numerals/detection.d.ts +17 -0
- package/lib/typescript/core/numerals/detection.d.ts.map +1 -0
- package/lib/typescript/core/numerals/digits.d.ts +43 -0
- package/lib/typescript/core/numerals/digits.d.ts.map +1 -0
- package/lib/typescript/core/numerals/index.d.ts +3 -0
- package/lib/typescript/core/numerals/index.d.ts.map +1 -0
- package/lib/typescript/core/numerals/tables.d.ts +32 -0
- package/lib/typescript/core/numerals/tables.d.ts.map +1 -0
- package/lib/typescript/core/superscript.d.ts +16 -0
- package/lib/typescript/core/superscript.d.ts.map +1 -0
- package/lib/typescript/core/timeLayout.d.ts +19 -0
- package/lib/typescript/core/timeLayout.d.ts.map +1 -0
- package/lib/typescript/core/timeTypes.d.ts +80 -0
- package/lib/typescript/core/timeTypes.d.ts.map +1 -0
- package/lib/typescript/core/timing.d.ts +6 -0
- package/lib/typescript/core/timing.d.ts.map +1 -0
- package/lib/typescript/core/types.d.ts +165 -0
- package/lib/typescript/core/types.d.ts.map +1 -0
- package/lib/typescript/core/useAccessibilityAnnouncement.d.ts +10 -0
- package/lib/typescript/core/useAccessibilityAnnouncement.d.ts.map +1 -0
- package/lib/typescript/core/useAnimatedX.d.ts +9 -0
- package/lib/typescript/core/useAnimatedX.d.ts.map +1 -0
- package/lib/typescript/core/useAnimationLifecycle.d.ts +14 -0
- package/lib/typescript/core/useAnimationLifecycle.d.ts.map +1 -0
- package/lib/typescript/core/useCanAnimate.d.ts +14 -0
- package/lib/typescript/core/useCanAnimate.d.ts.map +1 -0
- package/lib/typescript/core/useContinuousSpin.d.ts +23 -0
- package/lib/typescript/core/useContinuousSpin.d.ts.map +1 -0
- package/lib/typescript/core/useDebouncedWidths.d.ts +17 -0
- package/lib/typescript/core/useDebouncedWidths.d.ts.map +1 -0
- package/lib/typescript/core/useDigitAnimation.d.ts +38 -0
- package/lib/typescript/core/useDigitAnimation.d.ts.map +1 -0
- package/lib/typescript/core/useFlowPipeline.d.ts +46 -0
- package/lib/typescript/core/useFlowPipeline.d.ts.map +1 -0
- package/lib/typescript/core/useFormattedValue.d.ts +14 -0
- package/lib/typescript/core/useFormattedValue.d.ts.map +1 -0
- package/lib/typescript/core/useLayoutDiff.d.ts +18 -0
- package/lib/typescript/core/useLayoutDiff.d.ts.map +1 -0
- package/lib/typescript/core/useNumberFormatting.d.ts +18 -0
- package/lib/typescript/core/useNumberFormatting.d.ts.map +1 -0
- package/lib/typescript/core/useSlotOpacity.d.ts +18 -0
- package/lib/typescript/core/useSlotOpacity.d.ts.map +1 -0
- package/lib/typescript/core/useTimeFormatting.d.ts +22 -0
- package/lib/typescript/core/useTimeFormatting.d.ts.map +1 -0
- package/lib/typescript/core/useTimingResolution.d.ts +13 -0
- package/lib/typescript/core/useTimingResolution.d.ts.map +1 -0
- package/lib/typescript/core/useWorkletFormatting.d.ts +14 -0
- package/lib/typescript/core/useWorkletFormatting.d.ts.map +1 -0
- package/lib/typescript/core/utils.d.ts +44 -0
- package/lib/typescript/core/utils.d.ts.map +1 -0
- package/lib/typescript/core/warnings.d.ts +2 -0
- package/lib/typescript/core/warnings.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/native/DigitSlot.d.ts +27 -0
- package/lib/typescript/native/DigitSlot.d.ts.map +1 -0
- package/lib/typescript/native/NumberFlow.d.ts +3 -0
- package/lib/typescript/native/NumberFlow.d.ts.map +1 -0
- package/lib/typescript/native/SymbolSlot.d.ts +19 -0
- package/lib/typescript/native/SymbolSlot.d.ts.map +1 -0
- package/lib/typescript/native/TimeFlow.d.ts +3 -0
- package/lib/typescript/native/TimeFlow.d.ts.map +1 -0
- package/lib/typescript/native/index.d.ts +3 -0
- package/lib/typescript/native/index.d.ts.map +1 -0
- package/lib/typescript/native/renderSlots.d.ts +31 -0
- package/lib/typescript/native/renderSlots.d.ts.map +1 -0
- package/lib/typescript/native/types.d.ts +36 -0
- package/lib/typescript/native/types.d.ts.map +1 -0
- package/lib/typescript/native/useMeasuredGlyphMetrics.d.ts +8 -0
- package/lib/typescript/native/useMeasuredGlyphMetrics.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/skia/DigitSlot.d.ts +35 -0
- package/lib/typescript/skia/DigitSlot.d.ts.map +1 -0
- package/lib/typescript/skia/SkiaNumberFlow.d.ts +3 -0
- package/lib/typescript/skia/SkiaNumberFlow.d.ts.map +1 -0
- package/lib/typescript/skia/SkiaTimeFlow.d.ts +3 -0
- package/lib/typescript/skia/SkiaTimeFlow.d.ts.map +1 -0
- package/lib/typescript/skia/SymbolSlot.d.ts +26 -0
- package/lib/typescript/skia/SymbolSlot.d.ts.map +1 -0
- package/lib/typescript/skia/index.d.ts +6 -0
- package/lib/typescript/skia/index.d.ts.map +1 -0
- package/lib/typescript/skia/renderSlots.d.ts +40 -0
- package/lib/typescript/skia/renderSlots.d.ts.map +1 -0
- package/lib/typescript/skia/useGlyphMetrics.d.ts +16 -0
- package/lib/typescript/skia/useGlyphMetrics.d.ts.map +1 -0
- package/lib/typescript/skia/useScrubbing.d.ts +59 -0
- package/lib/typescript/skia/useScrubbing.d.ts.map +1 -0
- package/lib/typescript/skia/useSkiaFont.d.ts +13 -0
- package/lib/typescript/skia/useSkiaFont.d.ts.map +1 -0
- package/package.json +104 -0
- package/src/core/constants.ts +20 -0
- package/src/core/intlHelpers.ts +351 -0
- package/src/core/layout.ts +108 -0
- package/src/core/mask.ts +72 -0
- package/src/core/numerals/detection.ts +112 -0
- package/src/core/numerals/digits.ts +102 -0
- package/src/core/numerals/index.ts +9 -0
- package/src/core/numerals/tables.ts +112 -0
- package/src/core/superscript.ts +27 -0
- package/src/core/timeLayout.ts +119 -0
- package/src/core/timeTypes.ts +88 -0
- package/src/core/timing.ts +60 -0
- package/src/core/types.ts +189 -0
- package/src/core/useAccessibilityAnnouncement.ts +27 -0
- package/src/core/useAnimatedX.ts +30 -0
- package/src/core/useAnimationLifecycle.ts +54 -0
- package/src/core/useCanAnimate.ts +21 -0
- package/src/core/useContinuousSpin.ts +112 -0
- package/src/core/useDebouncedWidths.ts +93 -0
- package/src/core/useDigitAnimation.ts +192 -0
- package/src/core/useFlowPipeline.ts +126 -0
- package/src/core/useFormattedValue.ts +32 -0
- package/src/core/useLayoutDiff.ts +71 -0
- package/src/core/useNumberFormatting.ts +164 -0
- package/src/core/useSlotOpacity.ts +66 -0
- package/src/core/useTimeFormatting.ts +95 -0
- package/src/core/useTimingResolution.ts +47 -0
- package/src/core/useWorkletFormatting.ts +59 -0
- package/src/core/utils.ts +149 -0
- package/src/core/warnings.ts +8 -0
- package/src/index.ts +15 -0
- package/src/native/DigitSlot.tsx +203 -0
- package/src/native/NumberFlow.tsx +287 -0
- package/src/native/SymbolSlot.tsx +68 -0
- package/src/native/TimeFlow.tsx +287 -0
- package/src/native/index.ts +2 -0
- package/src/native/renderSlots.tsx +150 -0
- package/src/native/types.ts +40 -0
- package/src/native/useMeasuredGlyphMetrics.tsx +205 -0
- package/src/skia/DigitSlot.tsx +221 -0
- package/src/skia/SkiaNumberFlow.tsx +506 -0
- package/src/skia/SkiaTimeFlow.tsx +257 -0
- package/src/skia/SymbolSlot.tsx +120 -0
- package/src/skia/index.ts +5 -0
- package/src/skia/renderSlots.tsx +180 -0
- package/src/skia/useGlyphMetrics.ts +79 -0
- package/src/skia/useScrubbing.ts +223 -0
- package/src/skia/useSkiaFont.ts +25 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import MaskedView from "@rednegniw/masked-view";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { Text, View } from "react-native";
|
|
6
|
+
import { computeKeyedLayout } from "../core/layout.js";
|
|
7
|
+
import { useFlowPipeline } from "../core/useFlowPipeline.js";
|
|
8
|
+
import { useTimeFormatting } from "../core/useTimeFormatting.js";
|
|
9
|
+
import { TIME_DIGIT_COUNTS } from "../core/utils.js";
|
|
10
|
+
import { warnOnce } from "../core/warnings.js";
|
|
11
|
+
import { renderSlots } from "./renderSlots.js";
|
|
12
|
+
import { useMeasuredGlyphMetrics } from "./useMeasuredGlyphMetrics.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export const TimeFlow = ({
|
|
15
|
+
hours,
|
|
16
|
+
minutes,
|
|
17
|
+
seconds,
|
|
18
|
+
timestamp,
|
|
19
|
+
timezoneOffset,
|
|
20
|
+
is24Hour = true,
|
|
21
|
+
padHours = true,
|
|
22
|
+
style: nfStyle,
|
|
23
|
+
textAlign = "left",
|
|
24
|
+
spinTiming,
|
|
25
|
+
opacityTiming,
|
|
26
|
+
transformTiming,
|
|
27
|
+
trend,
|
|
28
|
+
animated,
|
|
29
|
+
respectMotionPreference,
|
|
30
|
+
continuous,
|
|
31
|
+
onAnimationsStart,
|
|
32
|
+
onAnimationsFinish,
|
|
33
|
+
containerStyle,
|
|
34
|
+
mask
|
|
35
|
+
}) => {
|
|
36
|
+
const {
|
|
37
|
+
metrics,
|
|
38
|
+
MeasureElement
|
|
39
|
+
} = useMeasuredGlyphMetrics(nfStyle);
|
|
40
|
+
if (__DEV__) {
|
|
41
|
+
if (!nfStyle.fontSize) {
|
|
42
|
+
warnOnce("tf-fontSize", "style.fontSize is required for TimeFlow to measure glyphs.");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const resolved = useMemo(() => {
|
|
46
|
+
if (timestamp !== undefined) {
|
|
47
|
+
const d = new Date(timestamp + (timezoneOffset ?? 0));
|
|
48
|
+
return {
|
|
49
|
+
hours: d.getUTCHours(),
|
|
50
|
+
minutes: d.getUTCMinutes(),
|
|
51
|
+
seconds: d.getUTCSeconds()
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
hours,
|
|
56
|
+
minutes,
|
|
57
|
+
seconds
|
|
58
|
+
};
|
|
59
|
+
}, [timestamp, timezoneOffset, hours, minutes, seconds]);
|
|
60
|
+
const resolvedHours = resolved.hours;
|
|
61
|
+
const resolvedMinutes = resolved.minutes;
|
|
62
|
+
const resolvedSeconds = resolved.seconds;
|
|
63
|
+
if (__DEV__) {
|
|
64
|
+
if (resolvedHours !== undefined && (resolvedHours < 0 || resolvedHours > 23)) {
|
|
65
|
+
warnOnce("tf-hours", "hours must be 0-23.");
|
|
66
|
+
}
|
|
67
|
+
if (resolvedMinutes !== undefined && (resolvedMinutes < 0 || resolvedMinutes > 59)) {
|
|
68
|
+
warnOnce("tf-minutes", "minutes must be 0-59.");
|
|
69
|
+
}
|
|
70
|
+
if (resolvedSeconds !== undefined && (resolvedSeconds < 0 || resolvedSeconds > 59)) {
|
|
71
|
+
warnOnce("tf-seconds", "seconds must be 0-59.");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const totalSeconds = (resolvedHours ?? 0) * 3600 + (resolvedMinutes ?? 0) * 60 + (resolvedSeconds ?? 0);
|
|
75
|
+
const keyedParts = useTimeFormatting(resolvedHours, resolvedMinutes, resolvedSeconds, is24Hour, padHours);
|
|
76
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
77
|
+
const handleContainerLayout = useCallback(e => {
|
|
78
|
+
setContainerWidth(e.nativeEvent.layout.width);
|
|
79
|
+
}, []);
|
|
80
|
+
const layout = useMemo(() => {
|
|
81
|
+
if (!metrics) return [];
|
|
82
|
+
|
|
83
|
+
// Skip layout when container hasn't measured yet and alignment needs width.
|
|
84
|
+
// Without this guard, center/right alignment computes with width=0,
|
|
85
|
+
// then re-computes after onLayout — causing a visible slide-in animation.
|
|
86
|
+
if (containerWidth === 0 && textAlign !== "left") return [];
|
|
87
|
+
if (keyedParts.length === 0) return [];
|
|
88
|
+
return computeKeyedLayout(keyedParts, metrics, containerWidth, textAlign);
|
|
89
|
+
}, [metrics, keyedParts, containerWidth, textAlign]);
|
|
90
|
+
const pipeline = useFlowPipeline({
|
|
91
|
+
keyedParts,
|
|
92
|
+
trendValue: totalSeconds,
|
|
93
|
+
layout,
|
|
94
|
+
metrics,
|
|
95
|
+
animated,
|
|
96
|
+
respectMotionPreference,
|
|
97
|
+
spinTiming,
|
|
98
|
+
opacityTiming,
|
|
99
|
+
transformTiming,
|
|
100
|
+
trend,
|
|
101
|
+
continuous,
|
|
102
|
+
mask,
|
|
103
|
+
onAnimationsStart,
|
|
104
|
+
onAnimationsFinish
|
|
105
|
+
});
|
|
106
|
+
const {
|
|
107
|
+
resolvedSpinTiming,
|
|
108
|
+
resolvedOpacityTiming,
|
|
109
|
+
resolvedTransformTiming,
|
|
110
|
+
resolvedTrend,
|
|
111
|
+
spinGenerations,
|
|
112
|
+
prevMap,
|
|
113
|
+
isInitialRender,
|
|
114
|
+
exitingEntries,
|
|
115
|
+
onExitComplete,
|
|
116
|
+
accessibilityLabel,
|
|
117
|
+
adaptiveMask
|
|
118
|
+
} = pipeline;
|
|
119
|
+
const textStyle = useMemo(() => ({
|
|
120
|
+
...nfStyle,
|
|
121
|
+
color: nfStyle.color ?? "#000000"
|
|
122
|
+
}), [nfStyle]);
|
|
123
|
+
const resolvedMask = mask ?? true;
|
|
124
|
+
const maskTop = adaptiveMask.top;
|
|
125
|
+
const maskBottom = adaptiveMask.bottom;
|
|
126
|
+
const {
|
|
127
|
+
expansionTop,
|
|
128
|
+
expansionBottom
|
|
129
|
+
} = adaptiveMask;
|
|
130
|
+
|
|
131
|
+
// Step count scales with mask height — each step must be >=1px (sub-pixel Views collapse to 0).
|
|
132
|
+
const topSteps = Math.max(2, Math.round(maskTop));
|
|
133
|
+
const bottomSteps = Math.max(2, Math.round(maskBottom));
|
|
134
|
+
const gradientMaskElement = useMemo(() => {
|
|
135
|
+
if (!resolvedMask || !metrics) return null;
|
|
136
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
137
|
+
style: {
|
|
138
|
+
flex: 1,
|
|
139
|
+
flexDirection: "column"
|
|
140
|
+
},
|
|
141
|
+
children: [Array.from({
|
|
142
|
+
length: topSteps
|
|
143
|
+
}, (_, i) => /*#__PURE__*/_jsx(View, {
|
|
144
|
+
style: {
|
|
145
|
+
height: maskTop / topSteps,
|
|
146
|
+
backgroundColor: `rgba(0,0,0,${i / (topSteps - 1)})`
|
|
147
|
+
}
|
|
148
|
+
}, `t${i}`)), /*#__PURE__*/_jsx(View, {
|
|
149
|
+
style: {
|
|
150
|
+
flex: 1,
|
|
151
|
+
backgroundColor: "black"
|
|
152
|
+
}
|
|
153
|
+
}), Array.from({
|
|
154
|
+
length: bottomSteps
|
|
155
|
+
}, (_, i) => /*#__PURE__*/_jsx(View, {
|
|
156
|
+
style: {
|
|
157
|
+
height: maskBottom / bottomSteps,
|
|
158
|
+
backgroundColor: `rgba(0,0,0,${1 - i / (bottomSteps - 1)})`
|
|
159
|
+
}
|
|
160
|
+
}, `b${i}`))]
|
|
161
|
+
});
|
|
162
|
+
}, [resolvedMask, metrics, maskTop, maskBottom, topSteps, bottomSteps]);
|
|
163
|
+
|
|
164
|
+
// Progressive mount: render a plain <Text> on the first frame, then swap to
|
|
165
|
+
// the full animated slot tree on the next frame. At mount time there is never
|
|
166
|
+
// a value change to animate, so the placeholder is visually identical while
|
|
167
|
+
// avoiding the ~80ms cost of instantiating dozens of useAnimatedStyle hooks.
|
|
168
|
+
const [slotsReady, setSlotsReady] = useState(false);
|
|
169
|
+
const metricsReady = !!metrics;
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (!metricsReady) return;
|
|
172
|
+
const id = requestAnimationFrame(() => setSlotsReady(true));
|
|
173
|
+
return () => cancelAnimationFrame(id);
|
|
174
|
+
}, [metricsReady]);
|
|
175
|
+
if (!metrics || layout.length === 0 && exitingEntries.size === 0) {
|
|
176
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
177
|
+
accessible: true,
|
|
178
|
+
accessibilityRole: "text",
|
|
179
|
+
accessibilityLabel: accessibilityLabel,
|
|
180
|
+
onLayout: handleContainerLayout,
|
|
181
|
+
style: containerStyle,
|
|
182
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
183
|
+
style: [textStyle, {
|
|
184
|
+
textAlign
|
|
185
|
+
}],
|
|
186
|
+
children: accessibilityLabel
|
|
187
|
+
}), MeasureElement]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
{/* Placeholder branch: show plain Text while slot tree loads */}
|
|
191
|
+
if (!slotsReady) {
|
|
192
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
193
|
+
accessible: true,
|
|
194
|
+
accessibilityRole: "text",
|
|
195
|
+
accessibilityLabel: accessibilityLabel,
|
|
196
|
+
onLayout: handleContainerLayout,
|
|
197
|
+
style: [containerStyle, {
|
|
198
|
+
height: metrics.lineHeight + expansionTop + expansionBottom,
|
|
199
|
+
marginTop: -expansionTop,
|
|
200
|
+
marginBottom: -expansionBottom,
|
|
201
|
+
position: "relative",
|
|
202
|
+
overflow: "hidden"
|
|
203
|
+
}],
|
|
204
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
205
|
+
style: [textStyle, {
|
|
206
|
+
textAlign
|
|
207
|
+
}],
|
|
208
|
+
children: accessibilityLabel
|
|
209
|
+
}), MeasureElement]
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const slots = renderSlots({
|
|
213
|
+
layout,
|
|
214
|
+
exitingEntries,
|
|
215
|
+
prevMap,
|
|
216
|
+
isInitialRender,
|
|
217
|
+
onExitComplete,
|
|
218
|
+
metrics,
|
|
219
|
+
textStyle,
|
|
220
|
+
resolvedTrend,
|
|
221
|
+
spinTiming: resolvedSpinTiming,
|
|
222
|
+
opacityTiming: resolvedOpacityTiming,
|
|
223
|
+
transformTiming: resolvedTransformTiming,
|
|
224
|
+
spinGenerations,
|
|
225
|
+
digitCountResolver: key => TIME_DIGIT_COUNTS[key],
|
|
226
|
+
maskTop,
|
|
227
|
+
maskBottom
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Optionally wrap in MaskedView for gradient edge fade.
|
|
231
|
+
// Content must be inside a single wrapper View so MaskedView's native
|
|
232
|
+
// didUpdateReactSubviews always sees one stable child — avoids Fabric
|
|
233
|
+
// "Attempt to recycle a mounted view" crash from dynamic slot churn.
|
|
234
|
+
const maskedContent = resolvedMask && gradientMaskElement ? /*#__PURE__*/_jsx(MaskedView, {
|
|
235
|
+
maskElement: gradientMaskElement,
|
|
236
|
+
style: {
|
|
237
|
+
flex: 1
|
|
238
|
+
},
|
|
239
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
240
|
+
style: {
|
|
241
|
+
flex: 1,
|
|
242
|
+
position: "relative",
|
|
243
|
+
top: expansionTop
|
|
244
|
+
},
|
|
245
|
+
children: [MeasureElement, slots]
|
|
246
|
+
})
|
|
247
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
248
|
+
style: {
|
|
249
|
+
flex: 1,
|
|
250
|
+
position: "relative",
|
|
251
|
+
top: expansionTop
|
|
252
|
+
},
|
|
253
|
+
children: [MeasureElement, slots]
|
|
254
|
+
});
|
|
255
|
+
return /*#__PURE__*/_jsx(View, {
|
|
256
|
+
accessible: true,
|
|
257
|
+
accessibilityRole: "text",
|
|
258
|
+
accessibilityLabel: accessibilityLabel,
|
|
259
|
+
onLayout: handleContainerLayout,
|
|
260
|
+
style: [containerStyle, {
|
|
261
|
+
height: metrics.lineHeight + expansionTop + expansionBottom,
|
|
262
|
+
marginTop: -expansionTop,
|
|
263
|
+
marginBottom: -expansionBottom,
|
|
264
|
+
position: "relative",
|
|
265
|
+
overflow: "hidden"
|
|
266
|
+
}],
|
|
267
|
+
children: maskedContent
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
//# sourceMappingURL=TimeFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MaskedView","useCallback","useEffect","useMemo","useState","Text","View","computeKeyedLayout","useFlowPipeline","useTimeFormatting","TIME_DIGIT_COUNTS","warnOnce","renderSlots","useMeasuredGlyphMetrics","jsx","_jsx","jsxs","_jsxs","TimeFlow","hours","minutes","seconds","timestamp","timezoneOffset","is24Hour","padHours","style","nfStyle","textAlign","spinTiming","opacityTiming","transformTiming","trend","animated","respectMotionPreference","continuous","onAnimationsStart","onAnimationsFinish","containerStyle","mask","metrics","MeasureElement","__DEV__","fontSize","resolved","undefined","d","Date","getUTCHours","getUTCMinutes","getUTCSeconds","resolvedHours","resolvedMinutes","resolvedSeconds","totalSeconds","keyedParts","containerWidth","setContainerWidth","handleContainerLayout","e","nativeEvent","layout","width","length","pipeline","trendValue","resolvedSpinTiming","resolvedOpacityTiming","resolvedTransformTiming","resolvedTrend","spinGenerations","prevMap","isInitialRender","exitingEntries","onExitComplete","accessibilityLabel","adaptiveMask","textStyle","color","resolvedMask","maskTop","top","maskBottom","bottom","expansionTop","expansionBottom","topSteps","Math","max","round","bottomSteps","gradientMaskElement","flex","flexDirection","children","Array","from","_","i","height","backgroundColor","slotsReady","setSlotsReady","metricsReady","id","requestAnimationFrame","cancelAnimationFrame","size","accessible","accessibilityRole","onLayout","lineHeight","marginTop","marginBottom","position","overflow","slots","digitCountResolver","key","maskedContent","maskElement"],"sourceRoot":"../../../src","sources":["native/TimeFlow.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,wBAAwB;AAC/C,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAAiCC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACjE,SAASC,kBAAkB,QAAQ,mBAAgB;AAEnD,SAASC,eAAe,QAAQ,4BAAyB;AACzD,SAASC,iBAAiB,QAAQ,8BAA2B;AAC7D,SAASC,iBAAiB,QAAQ,kBAAe;AACjD,SAASC,QAAQ,QAAQ,qBAAkB;AAC3C,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,uBAAuB,QAAQ,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpE,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EACvBC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,cAAc;EACdC,QAAQ,GAAG,IAAI;EACfC,QAAQ,GAAG,IAAI;EACfC,KAAK,EAAEC,OAAO;EACdC,SAAS,GAAG,MAAM;EAClBC,UAAU;EACVC,aAAa;EACbC,eAAe;EACfC,KAAK;EACLC,QAAQ;EACRC,uBAAuB;EACvBC,UAAU;EACVC,iBAAiB;EACjBC,kBAAkB;EAClBC,cAAc;EACdC;AACa,CAAC,KAAK;EACnB,MAAM;IAAEC,OAAO;IAAEC;EAAe,CAAC,GAAG5B,uBAAuB,CAACc,OAAO,CAAC;EAEpE,IAAIe,OAAO,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W,EAAE7B,mBAAoB;IAACjE,KAAK,EAAE;MAAEkE,IAAI,EAAE;IAAE,CAAE;IAAAE,QAAA,eAC/D7E,KAAA,CAACX,IAAI;MAACoB,KAAK,EAAE;QAAEkE,IAAI,EAAE,CAAC;QAAEsB,QAAQ,EAAE,UAAU;QAAEjC,GAAG,EAAEG;MAAa,CAAE;MAAAU,QAAA,GAC/DrD,cAAc,EACd2E,KAAK;IAAA,CACF;EAAC,CACG,CAAC,gBAEbnG,KAAA,CAACX,IAAI;IAACoB,KAAK,EAAE;MAAEkE,IAAI,EAAE,CAAC;MAAEsB,QAAQ,EAAE,UAAU;MAAEjC,GAAG,EAAEG;IAAa,CAAE;IAAAU,QAAA,GAC/DrD,cAAc,EACd2E,KAAK;EAAA,CACF,CACP;EAEH,oBACErG,IAAA,CAACT,IAAI;IACHsG,UAAU;IACVC,iBAAiB,EAAC,MAAM;IACxBlC,kBAAkB,EAAEA,kBAAmB;IACvCmC,QAAQ,EAAEpD,qBAAsB;IAChChC,KAAK,EAAE,CACLY,cAAc,EACd;MACE6D,MAAM,EAAE3D,OAAO,CAACuE,UAAU,GAAG3B,YAAY,GAAGC,eAAe;MAC3D2B,SAAS,EAAE,CAAC5B,YAAY;MACxB6B,YAAY,EAAE,CAAC5B,eAAe;MAC9B6B,QAAQ,EAAE,UAAU;MACpBC,QAAQ,EAAE;IACZ,CAAC,CACD;IAAArB,QAAA,EAEDyB;EAAa,CACV,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NumberFlow","TimeFlow"],"sourceRoot":"../../../src","sources":["native/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,iBAAc;AACzC,SAASC,QAAQ,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DigitSlot } from "./DigitSlot.js";
|
|
4
|
+
import { SymbolSlot } from "./SymbolSlot.js";
|
|
5
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* Renders the active and exiting digit/symbol slot tree.
|
|
8
|
+
*
|
|
9
|
+
* Shared between NumberFlow and TimeFlow — the only behavioral differences
|
|
10
|
+
* are abstracted via `digitCountResolver` (which digit-count lookup to use)
|
|
11
|
+
* and the optional `digitStrings` (locale-specific digit characters).
|
|
12
|
+
*/
|
|
13
|
+
export function renderSlots({
|
|
14
|
+
layout,
|
|
15
|
+
exitingEntries,
|
|
16
|
+
prevMap,
|
|
17
|
+
isInitialRender,
|
|
18
|
+
onExitComplete,
|
|
19
|
+
metrics,
|
|
20
|
+
textStyle,
|
|
21
|
+
resolvedTrend,
|
|
22
|
+
spinTiming,
|
|
23
|
+
opacityTiming,
|
|
24
|
+
transformTiming,
|
|
25
|
+
spinGenerations,
|
|
26
|
+
digitCountResolver,
|
|
27
|
+
maskTop,
|
|
28
|
+
maskBottom,
|
|
29
|
+
digitStrings
|
|
30
|
+
}) {
|
|
31
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
|
+
children: [layout.map(entry => {
|
|
33
|
+
const isEntering = !isInitialRender && !prevMap.has(entry.key);
|
|
34
|
+
if (entry.isDigit) {
|
|
35
|
+
const digitCount = digitCountResolver(entry.key);
|
|
36
|
+
const spinGeneration = spinGenerations?.get(entry.key);
|
|
37
|
+
return /*#__PURE__*/_jsx(DigitSlot, {
|
|
38
|
+
charWidth: entry.width,
|
|
39
|
+
continuousSpinGeneration: spinGeneration,
|
|
40
|
+
digitCount: digitCount,
|
|
41
|
+
digitStrings: digitStrings,
|
|
42
|
+
digitValue: entry.digitValue,
|
|
43
|
+
entering: isEntering,
|
|
44
|
+
exiting: false,
|
|
45
|
+
maskTop: maskTop,
|
|
46
|
+
maskBottom: maskBottom,
|
|
47
|
+
metrics: metrics,
|
|
48
|
+
opacityTiming: opacityTiming,
|
|
49
|
+
spinTiming: spinTiming,
|
|
50
|
+
superscript: entry.superscript,
|
|
51
|
+
targetX: entry.x,
|
|
52
|
+
textStyle: textStyle,
|
|
53
|
+
transformTiming: transformTiming,
|
|
54
|
+
trend: resolvedTrend
|
|
55
|
+
}, entry.key);
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/_jsx(SymbolSlot, {
|
|
58
|
+
char: entry.char,
|
|
59
|
+
entering: isEntering,
|
|
60
|
+
exiting: false,
|
|
61
|
+
lineHeight: metrics.lineHeight,
|
|
62
|
+
opacityTiming: opacityTiming,
|
|
63
|
+
superscript: entry.superscript,
|
|
64
|
+
targetX: entry.x,
|
|
65
|
+
textStyle: textStyle,
|
|
66
|
+
transformTiming: transformTiming
|
|
67
|
+
}, entry.key);
|
|
68
|
+
}), Array.from(exitingEntries.entries()).map(([key, entry]) => {
|
|
69
|
+
if (entry.isDigit) {
|
|
70
|
+
const digitCount = digitCountResolver(key);
|
|
71
|
+
return /*#__PURE__*/_jsx(DigitSlot, {
|
|
72
|
+
charWidth: entry.width,
|
|
73
|
+
digitCount: digitCount,
|
|
74
|
+
digitStrings: digitStrings,
|
|
75
|
+
digitValue: entry.digitValue,
|
|
76
|
+
entering: false,
|
|
77
|
+
exitKey: key,
|
|
78
|
+
exiting: true,
|
|
79
|
+
maskTop: maskTop,
|
|
80
|
+
maskBottom: maskBottom,
|
|
81
|
+
metrics: metrics,
|
|
82
|
+
onExitComplete: onExitComplete,
|
|
83
|
+
opacityTiming: opacityTiming,
|
|
84
|
+
spinTiming: spinTiming,
|
|
85
|
+
superscript: entry.superscript,
|
|
86
|
+
targetX: entry.x,
|
|
87
|
+
textStyle: textStyle,
|
|
88
|
+
transformTiming: transformTiming,
|
|
89
|
+
trend: resolvedTrend
|
|
90
|
+
}, key);
|
|
91
|
+
}
|
|
92
|
+
return /*#__PURE__*/_jsx(SymbolSlot, {
|
|
93
|
+
char: entry.char,
|
|
94
|
+
entering: false,
|
|
95
|
+
exitKey: key,
|
|
96
|
+
exiting: true,
|
|
97
|
+
lineHeight: metrics.lineHeight,
|
|
98
|
+
onExitComplete: onExitComplete,
|
|
99
|
+
opacityTiming: opacityTiming,
|
|
100
|
+
superscript: entry.superscript,
|
|
101
|
+
targetX: entry.x,
|
|
102
|
+
textStyle: textStyle,
|
|
103
|
+
transformTiming: transformTiming
|
|
104
|
+
}, key);
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=renderSlots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DigitSlot","SymbolSlot","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","renderSlots","layout","exitingEntries","prevMap","isInitialRender","onExitComplete","metrics","textStyle","resolvedTrend","spinTiming","opacityTiming","transformTiming","spinGenerations","digitCountResolver","maskTop","maskBottom","digitStrings","children","map","entry","isEntering","has","key","isDigit","digitCount","spinGeneration","get","charWidth","width","continuousSpinGeneration","digitValue","entering","exiting","superscript","targetX","x","trend","char","lineHeight","Array","from","entries","exitKey"],"sourceRoot":"../../../src","sources":["native/renderSlots.tsx"],"mappings":";;AAGA,SAASA,SAAS,QAAQ,gBAAa;AACvC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAqB1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAC1BC,MAAM;EACNC,cAAc;EACdC,OAAO;EACPC,eAAe;EACfC,cAAc;EACdC,OAAO;EACPC,SAAS;EACTC,aAAa;EACbC,UAAU;EACVC,aAAa;EACbC,eAAe;EACfC,eAAe;EACfC,kBAAkB;EAClBC,OAAO;EACPC,UAAU;EACVC;AACiB,CAAC,EAAE;EACpB,oBACEjB,KAAA,CAAAF,SAAA;IAAAoB,QAAA,GAEGhB,MAAM,CAACiB,GAAG,CAAEC,KAAK,IAAK;MACrB,MAAMC,U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;EAAA,CACF,CAAC;AAEP","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["native/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useMemo, useReducer, useRef } from "react";
|
|
4
|
+
import { Text } from "react-native";
|
|
5
|
+
import { MEASURABLE_CHARS } from "../core/constants.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
// Combines MEASURABLE_CHARS with additional chars, deduplicating
|
|
8
|
+
function buildCharSet(additionalChars) {
|
|
9
|
+
if (!additionalChars) return MEASURABLE_CHARS;
|
|
10
|
+
const unique = Array.from(additionalChars).filter(c => !MEASURABLE_CHARS.includes(c));
|
|
11
|
+
return unique.length > 0 ? MEASURABLE_CHARS + unique.join("") : MEASURABLE_CHARS;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Key: "fontFamily:fontSize", Value: measured GlyphMetrics.
|
|
15
|
+
* Once measured for a given font config, subsequent mounts return instantly.
|
|
16
|
+
*/
|
|
17
|
+
const metricsCache = new Map();
|
|
18
|
+
function cacheKey(style, additionalChars) {
|
|
19
|
+
const base = `${style.fontFamily}:${style.fontSize}`;
|
|
20
|
+
return additionalChars ? `${base}:${additionalChars}` : base;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Renders a single off-screen <Text> with all measurable characters separated
|
|
25
|
+
* by newlines. onTextLayout fires once with lines[] — one entry per line, each
|
|
26
|
+
* containing the advance width of that single character.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
// ASCII characters known to have no descender (bottom = 0)
|
|
30
|
+
const NO_DESCENDER = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.:%+-~°!^*×/$€£¥₩ \u00A0");
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Estimates per-character vertical bounds using font-level metrics.
|
|
34
|
+
* Top: -capHeight for all chars (precise for digits, safe overestimate for smaller glyphs).
|
|
35
|
+
* Bottom: 0 for known no-descender chars (+ locale digits), full descent otherwise.
|
|
36
|
+
*/
|
|
37
|
+
function estimateCharBounds(charSet, descent, capHeight, localeDigitStrings) {
|
|
38
|
+
const noDescender = new Set(NO_DESCENDER);
|
|
39
|
+
if (localeDigitStrings) {
|
|
40
|
+
for (const d of localeDigitStrings) noDescender.add(d);
|
|
41
|
+
}
|
|
42
|
+
const bounds = {};
|
|
43
|
+
const top = -capHeight;
|
|
44
|
+
for (let i = 0; i < charSet.length; i++) {
|
|
45
|
+
const bottom = noDescender.has(charSet[i]) ? 0 : descent;
|
|
46
|
+
bounds[charSet[i]] = {
|
|
47
|
+
top,
|
|
48
|
+
bottom
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return bounds;
|
|
52
|
+
}
|
|
53
|
+
const MeasureComponent = /*#__PURE__*/React.memo(({
|
|
54
|
+
nfStyle,
|
|
55
|
+
charSet,
|
|
56
|
+
localeDigitStrings,
|
|
57
|
+
onComplete
|
|
58
|
+
}) => {
|
|
59
|
+
const completedRef = useRef(false);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Replace regular space with NBSP for measurement safety — some Android
|
|
63
|
+
* text layout engines collapse trailing whitespace on a line.
|
|
64
|
+
*/
|
|
65
|
+
const measureString = useMemo(() => Array.from(charSet).map(c => c === " " ? "\u00A0" : c).join("\n"), [charSet]);
|
|
66
|
+
const handleTextLayout = useCallback(e => {
|
|
67
|
+
if (completedRef.current) return;
|
|
68
|
+
const lines = e.nativeEvent.lines;
|
|
69
|
+
if (lines.length < charSet.length) return;
|
|
70
|
+
completedRef.current = true;
|
|
71
|
+
const charWidths = {};
|
|
72
|
+
for (let i = 0; i < charSet.length; i++) {
|
|
73
|
+
charWidths[charSet[i]] = lines[i].width;
|
|
74
|
+
}
|
|
75
|
+
let maxDigitWidth = 0;
|
|
76
|
+
const digitChars = localeDigitStrings ?? Array.from({
|
|
77
|
+
length: 10
|
|
78
|
+
}, (_, d) => String(d));
|
|
79
|
+
for (const dc of digitChars) {
|
|
80
|
+
const w = charWidths[dc] ?? 0;
|
|
81
|
+
if (w > maxDigitWidth) maxDigitWidth = w;
|
|
82
|
+
}
|
|
83
|
+
let tallestLine = lines[0];
|
|
84
|
+
for (let i = 1; i < charSet.length; i++) {
|
|
85
|
+
if (lines[i].height > tallestLine.height) tallestLine = lines[i];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Negate ascender to match Skia convention (negative = above baseline).
|
|
89
|
+
const ascent = -tallestLine.ascender;
|
|
90
|
+
const descent = tallestLine.descender;
|
|
91
|
+
// Fallback 0.72 × |ascent| matches typical system font cap-height ratio.
|
|
92
|
+
const capHeight = tallestLine.capHeight || -ascent * 0.72;
|
|
93
|
+
const charBounds = estimateCharBounds(charSet, descent, capHeight, localeDigitStrings);
|
|
94
|
+
onComplete({
|
|
95
|
+
charWidths,
|
|
96
|
+
maxDigitWidth,
|
|
97
|
+
lineHeight: Math.ceil(tallestLine.height),
|
|
98
|
+
ascent,
|
|
99
|
+
descent,
|
|
100
|
+
charBounds
|
|
101
|
+
});
|
|
102
|
+
}, [onComplete, charSet, localeDigitStrings]);
|
|
103
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
104
|
+
onTextLayout: handleTextLayout,
|
|
105
|
+
pointerEvents: "none",
|
|
106
|
+
style: {
|
|
107
|
+
fontFamily: nfStyle.fontFamily,
|
|
108
|
+
fontSize: nfStyle.fontSize,
|
|
109
|
+
position: "absolute",
|
|
110
|
+
opacity: 0
|
|
111
|
+
},
|
|
112
|
+
children: measureString
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
MeasureComponent.displayName = "NumberFlowMeasure";
|
|
116
|
+
export function useMeasuredGlyphMetrics(style, additionalChars, localeDigitStrings) {
|
|
117
|
+
const charSet = useMemo(() => buildCharSet(additionalChars), [additionalChars]);
|
|
118
|
+
const key = cacheKey(style, additionalChars);
|
|
119
|
+
const cached = metricsCache.get(key);
|
|
120
|
+
const [, forceUpdate] = useReducer(n => n + 1, 0);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Track the best available metrics for this font config — prevents
|
|
124
|
+
* returning null (and unmounting all slots) when additionalChars
|
|
125
|
+
* changes and triggers an async re-measurement.
|
|
126
|
+
*/
|
|
127
|
+
const baseKey = cacheKey(style);
|
|
128
|
+
const prevMetricsRef = useRef(null);
|
|
129
|
+
if (cached) prevMetricsRef.current = cached;
|
|
130
|
+
const handleComplete = useCallback(metrics => {
|
|
131
|
+
metricsCache.set(key, metrics);
|
|
132
|
+
forceUpdate();
|
|
133
|
+
}, [key]);
|
|
134
|
+
if (cached) {
|
|
135
|
+
return {
|
|
136
|
+
metrics: cached,
|
|
137
|
+
MeasureElement: null
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* If we have stale metrics from a previous measurement of this font,
|
|
143
|
+
* return them while re-measuring — avoids unmounting the slot tree.
|
|
144
|
+
*/
|
|
145
|
+
const staleMetrics = prevMetricsRef.current ?? metricsCache.get(baseKey) ?? null;
|
|
146
|
+
return {
|
|
147
|
+
metrics: staleMetrics,
|
|
148
|
+
MeasureElement: /*#__PURE__*/React.createElement(MeasureComponent, {
|
|
149
|
+
nfStyle: style,
|
|
150
|
+
charSet,
|
|
151
|
+
localeDigitStrings,
|
|
152
|
+
onComplete: handleComplete
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=useMeasuredGlyphMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useReducer","useRef","Text","MEASURABLE_CHARS","jsx","_jsx","buildCharSet","additionalChars","unique","Array","from","filter","c","includes","length","join","metricsCache","Map","cacheKey","style","base","fontFamily","fontSize","NO_DESCENDER","Set","estimateCharBounds","charSet","descent","capHeight","localeDigitStrings","noDescender","d","add","bounds","top","i","bottom","has","MeasureComponent","memo","nfStyle","onComplete","completedRef","measureString","map","handleTextLayout","e","current","lines","nativeEvent","charWidths","width","maxDigitWidth","digitChars","_","String","dc","w","tallestLine","height","ascent","ascender","descender","charBounds","lineHeight","Math","ceil","onTextLayout","pointerEvents","position","opacity","children","displayName","useMeasuredGlyphMetrics","key","cached","get","forceUpdate","n","baseKey","prevMetricsRef","handleComplete","metrics","set","MeasureElement","staleMetrics","createElement"],"sourceRoot":"../../../src","sources":["native/useMeasuredGlyphMetrics.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AACvE,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,gBAAgB,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIrD;AACA,SAASC,YAAYA,CAACC,eAAwB,EAAU;EACtD,IAAI,CAACA,eAAe,EAAE,OAAOJ,gBAAgB;EAC7C,MAAMK,MAAM,GAAGC,KAAK,CAACC,IAAI,CAACH,eAAe,CAAC,CAACI,MAAM,CAAEC,CAAC,IAAK,CAACT,gBAAgB,CAACU,QAAQ,CAACD,CAAC,CAAC,CAAC;EACvF,OAAOJ,MAAM,CAACM,MAAM,GAAG,CAAC,GAAGX,gBAAgB,GAAGK,MAAM,CAACO,IAAI,CAAC,EAAE,CAAC,GAAGZ,gBAAgB;AAClF;AAMA;AACA;AACA;AACA;AACA,MAAMa,YAAY,GAAG,IAAIC,GAAG,CAAuB,CAAC;AAEpD,SAASC,QAAQA,CACfC,KAAgD,EAChDZ,eAAwB,EAChB;EACR,MAAMa,IAAI,GAAG,GAAGD,KAAK,CAACE,UAAU,IAAIF,KAAK,CAACG,QAAQ,EAAE;EACpD,OAAOf,eAAe,GAAG,GAAGa,IAAI,IAAIb,eAAe,EAAE,GAAGa,IAAI;AAC9D;;AAEA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