Skip to content

Commit 6f05140

Browse files
committed
feat: compatibility with 0.5.8 number-flow.
1 parent 5258ac8 commit 6f05140

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
22
dist
33
gitignore
4+
_context
45

56
# tsup
67
tsup.config.bundled_*.{m,c,}s

bun.lockb

-46.8 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@
109109
"types": "./dist/index.d.ts",
110110
"typesVersions": {},
111111
"dependencies": {
112-
"number-flow": "0.5.3"
112+
"number-flow": "0.5.8"
113113
}
114114
}

src/index.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import {
1+
import NumberFlowLite, {
22
type Data,
33
define,
44
type Format,
55
formatToData,
6-
NumberFlowLite,
76
type Props,
87
renderInnerHTML,
98
type Value,
10-
} from "number-flow"
9+
} from "number-flow/lite"
1110
import {
1211
type Accessor,
1312
createContext,
@@ -24,7 +23,8 @@ import {
2423
import type { JSX } from "solid-js/jsx-runtime"
2524
import { Dynamic } from "solid-js/web"
2625

27-
export type { Format, Trend, Value } from "number-flow"
26+
export type { Format, NumberPartType, Trend, Value } from "number-flow/lite"
27+
export * from "number-flow/plugins"
2828

2929
// Can't wait to not have to do this in React 19:
3030
const OBSERVED_ATTRIBUTES = ["data", "digits"] as const
@@ -72,7 +72,7 @@ function NumberFlowImpl(props: VoidProps<NumberFlowImplProps>) {
7272
const updateProperties = (prevProps?: NumberFlowImplProps_NoSignals) => {
7373
if (!el) return
7474

75-
// // el.manual = !props.isolate; (Not sure why but this breaks the animations, so isolate might not work right now. I personally think it has a very niche usecase though).
75+
// el.batched = !props.isolate (Not sure why but this breaks the animations, so isolate might not work right now. I personally think it has a very niche usecase though).
7676
if (props.transformTiming)
7777
el.transformTiming ?? NumberFlowElement.defaultProps["transformTiming"]
7878
if (props.spinTiming) el.spinTiming ?? NumberFlowElement.defaultProps["spinTiming"]
@@ -268,14 +268,10 @@ export function NumberFlowGroup(props: FlowProps) {
268268
)
269269
}
270270

271-
// ===========================================================================
272-
// src/index.tsx
273-
// ===========================================================================
274-
275271
import {
276272
canAnimate as _canAnimate,
277273
prefersReducedMotion as _prefersReducedMotion,
278-
} from "number-flow"
274+
} from "number-flow/lite"
279275

280276
function usePrefersReducedMotion() {
281277
const [prefersReducedMotion, set] = createSignal(false)

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"target": "ESNext",
55
"module": "ESNext",
66
"lib": ["DOM", "DOM.Iterable", "ESNext"],
7-
"moduleResolution": "node",
7+
"moduleResolution": "bundler",
88
"resolveJsonModule": true,
99
"esModuleInterop": true,
1010
"noEmit": true,
@@ -18,5 +18,5 @@
1818
"types": [],
1919
"baseUrl": "."
2020
},
21-
"exclude": ["node_modules", "dist", "./dev"]
21+
"exclude": ["node_modules", "dist", "./dev", "_context"]
2222
}

0 commit comments

Comments
 (0)