-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
567 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@number-flow/react': patch | ||
'@number-flow/vue': patch | ||
'@number-flow/svelte': patch | ||
--- | ||
|
||
Fix useCanAnimate hydration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/react/test/apps/react-18/app/can-animate/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use client' | ||
|
||
import * as React from 'react' | ||
import { useCanAnimate } from '@number-flow/react' | ||
|
||
export default function Page() { | ||
const canAnimate = useCanAnimate() | ||
const disrespectMotionPreference = useCanAnimate({ respectMotionPreference: false }) | ||
return ( | ||
<div> | ||
<p data-testid="default">{String(canAnimate)}</p> | ||
<p data-testid="disrespect-motion-preference">{String(disrespectMotionPreference)}</p> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
import webpack from 'webpack' | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
const nextConfig = { | ||
webpack(config, context) { | ||
config.plugins.push( | ||
new webpack.DefinePlugin({ | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__: '({ isDisabled: true })' | ||
}) | ||
) | ||
return config | ||
} | ||
} | ||
|
||
export default nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "next build", | ||
"start": "next start --port 3039", | ||
"dev": "next dev --port 3039", | ||
"lint": "next lint", | ||
"test": "playwright test", | ||
|
@@ -23,7 +25,8 @@ | |
"postcss": "^8", | ||
"tailwindcss": "^3.4.1", | ||
"tw-reset": "^0.0.5", | ||
"typescript": "^5" | ||
"typescript": "^5", | ||
"webpack": "^5.96.1" | ||
}, | ||
"packageManager": "[email protected]+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228" | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/react/test/apps/react-19/app/can-animate/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use client' | ||
|
||
import * as React from 'react' | ||
import { useCanAnimate } from '@number-flow/react' | ||
|
||
export default function Page() { | ||
const canAnimate = useCanAnimate() | ||
const disrespectMotionPreference = useCanAnimate({ respectMotionPreference: false }) | ||
return ( | ||
<div> | ||
<p data-testid="default">{String(canAnimate)}</p> | ||
<p data-testid="disrespect-motion-preference">{String(disrespectMotionPreference)}</p> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
export { config as default } from '../../lib/playwright' | ||
import { defineConfig } from '@playwright/test' | ||
import { config } from '../../lib/playwright' | ||
|
||
// Use prod build cause it includes hydration errors but excludes random Vite stuff: | ||
export default defineConfig({ | ||
...config, | ||
webServer: { | ||
...config.webServer, | ||
command: 'pnpm build:site && pnpm preview' | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script lang="ts"> | ||
import { getCanAnimate } from '$lib/index.js' | ||
const canAnimate = getCanAnimate() | ||
const disrespectMotionPreference = getCanAnimate({ respectMotionPreference: false }) | ||
</script> | ||
|
||
<div> | ||
<p data-testid="default">{String($canAnimate)}</p> | ||
<p data-testid="disrespect-motion-preference">{String($disrespectMotionPreference)}</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
export { config as default } from '../../../../../lib/playwright' | ||
import { defineConfig } from '@playwright/test' | ||
import { config } from '../../../../../lib/playwright' | ||
|
||
// Use prod build cause it includes hydration errors but excludes random Vite stuff: | ||
export default defineConfig({ | ||
...config, | ||
webServer: { | ||
...config.webServer, | ||
command: 'pnpm build && pnpm start' | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script lang="ts" setup> | ||
import { useCanAnimate } from '@number-flow/vue' | ||
const canAnimate = useCanAnimate() | ||
const disrespectMotionPreference = useCanAnimate({ respectMotionPreference: false }) | ||
</script> | ||
<template> | ||
<div> | ||
<p data-testid="default">{{ String(canAnimate) }}</p> | ||
<p data-testid="disrespect-motion-preference">{{ String(disrespectMotionPreference) }}</p> | ||
</div> | ||
</template> |
File renamed without changes.
Oops, something went wrong.