Skip to content

Commit 4fb71a7

Browse files
committed
[devtools] apply react-draggable
1 parent 99f8275 commit 4fb71a7

File tree

8 files changed

+132
-14
lines changed

8 files changed

+132
-14
lines changed

packages/next/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@
304304
"punycode": "2.1.1",
305305
"querystring-es3": "0.2.1",
306306
"raw-body": "2.4.1",
307+
"react-draggable": "4.4.6",
307308
"react-refresh": "0.12.0",
308309
"recast": "0.23.11",
309310
"regenerator-runtime": "0.13.4",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(MIT License)
2+
3+
Copyright (c) 2014-2016 Matt Zabriskie. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a
6+
copy of this software and associated documentation files (the "Software"),
7+
to deal in the Software without restriction, including without limitation
8+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
and/or sell copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
DEALINGS IN THE SOFTWARE.

packages/next/src/compiled/react-draggable/cjs.js

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"react-draggable","main":"cjs.js","author":"Matt Zabriskie","license":"MIT"}

packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { OverlayDispatch, OverlayState } from '../../shared'
22

33
import { Suspense, useRef } from 'react'
4+
import Draggable from 'next/dist/compiled/react-draggable'
5+
46
import { Dialog, DialogContent, DialogHeader, DialogBody } from '../dialog'
57
import { Overlay } from '../overlay/overlay'
68
import { useFocusTrap } from '../errors/dev-tools-indicator/utils'
@@ -15,7 +17,7 @@ export function DevToolsPanel({
1517
state: OverlayState
1618
dispatch: OverlayDispatch
1719
}) {
18-
const dialogRef = useRef<HTMLDivElement>(null)
20+
const dialogRef = useRef<HTMLDivElement>(null as unknown as HTMLDivElement)
1921

2022
// This hook lets us do an exit animation before unmounting the component
2123
const { mounted, rendered } = useDelayedRender(state.isDevToolsPanelOpen)
@@ -34,19 +36,21 @@ export function DevToolsPanel({
3436

3537
return (
3638
<Overlay data-nextjs-devtools-panel-overlay>
37-
<div data-nextjs-devtools-panel-container ref={dialogRef}>
38-
<Dialog
39-
data-nextjs-devtools-panel-dialog
40-
aria-labelledby="nextjs__container_dev_tools_panel_label"
41-
aria-describedby="nextjs__container_dev_tools_panel_desc"
42-
onClose={onClose}
43-
>
44-
<DialogContent>
45-
<DialogHeader></DialogHeader>
46-
<DialogBody></DialogBody>
47-
</DialogContent>
48-
</Dialog>
49-
</div>
39+
<Draggable nodeRef={dialogRef}>
40+
<div data-nextjs-devtools-panel-container ref={dialogRef}>
41+
<Dialog
42+
data-nextjs-devtools-panel-dialog
43+
aria-labelledby="nextjs__container_dev_tools_panel_label"
44+
aria-describedby="nextjs__container_dev_tools_panel_desc"
45+
onClose={onClose}
46+
>
47+
<DialogContent>
48+
<DialogHeader></DialogHeader>
49+
<DialogBody></DialogBody>
50+
</DialogContent>
51+
</Dialog>
52+
</div>
53+
</Draggable>
5054
</Overlay>
5155
)
5256
}

packages/next/taskfile.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,6 +2390,14 @@ export async function ncc_https_proxy_agent(task, opts) {
23902390
.target('src/compiled/https-proxy-agent')
23912391
}
23922392

2393+
externals['react-draggable'] = 'next/dist/compiled/react-draggable'
2394+
export async function ncc_react_draggable(task, opts) {
2395+
await task
2396+
.source(relative(__dirname, require.resolve('react-draggable')))
2397+
.ncc({ packageName: 'react-draggable', externals })
2398+
.target('src/compiled/react-draggable')
2399+
}
2400+
23932401
export async function precompile(task, opts) {
23942402
await task.parallel(
23952403
['browser_polyfills', 'copy_ncced', 'copy_styled_jsx_assets'],
@@ -2537,6 +2545,7 @@ export async function ncc(task, opts) {
25372545
'ncc_opentelemetry_api',
25382546
'ncc_http_proxy_agent',
25392547
'ncc_https_proxy_agent',
2548+
'ncc_react_draggable',
25402549
'ncc_mini_css_extract_plugin',
25412550
],
25422551
opts

packages/next/types/$$compiled.internal.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,11 @@ declare module 'next/dist/compiled/shell-quote' {
709709
export = m
710710
}
711711

712+
declare module 'next/dist/compiled/react-draggable' {
713+
import * as m from 'react-draggable'
714+
export = m
715+
}
716+
712717
declare module 'next/dist/compiled/@vercel/og/satori-types' {
713718
export * from 'satori'
714719
}

pnpm-lock.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)