-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update building of examples and docs site
- add hover indication of floating layers in ContextPanel
- Loading branch information
Showing
37 changed files
with
1,126 additions
and
1,391 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
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,47 @@ | ||
import { | ||
Inspector, | ||
gotoServerEditor, | ||
type InspectParams, | ||
} from 'react-dev-inspector' | ||
import { | ||
isDev, | ||
projectRepo, | ||
} from '@utils' | ||
|
||
|
||
/** | ||
* only for online showcase in docs site | ||
*/ | ||
export const OnlineInspector = ({ active, setActive }: { | ||
active?: boolean; | ||
setActive?: (active: boolean) => void; | ||
}) => { | ||
return ( | ||
<Inspector | ||
disable={false} | ||
active={active} | ||
onActiveChange={setActive} | ||
onInspectElement={handleInspectOnline} | ||
/> | ||
) | ||
} | ||
|
||
const handleInspectOnline = (inspect: InspectParams) => { | ||
if (!inspect.codeInfo) { | ||
return | ||
} | ||
|
||
if (isDev) { | ||
return gotoServerEditor(inspect.codeInfo) | ||
} | ||
|
||
const { relativePath, absolutePath, lineNumber } = inspect.codeInfo | ||
if (relativePath) { | ||
const onlineFilePath = `docs/${relativePath}` | ||
window.open(`${projectRepo}/blob/dev/${onlineFilePath}#L${lineNumber}`) | ||
} | ||
else if (absolutePath) { | ||
const onlineFilePath = absolutePath.replace(/^.*?\/docs\//, 'docs/') | ||
window.open(`${projectRepo}/blob/dev/${onlineFilePath}#L${lineNumber}`) | ||
} | ||
} |
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,7 +1,2 @@ | ||
// only use for IDE code highlight | ||
export const css = (temp: TemplateStringsArray, ...values: any[]): string => ( | ||
temp | ||
.flatMap((element, index) => [element, values[index]]) | ||
.filter(Boolean) | ||
.join('') | ||
) | ||
export const css = String.raw |
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,25 +1,5 @@ | ||
import { | ||
gotoServerEditor, | ||
type InspectParams, | ||
} from 'react-dev-inspector' | ||
|
||
|
||
export * from './css' | ||
|
||
export const isDev = process.env.NODE_ENV === 'development' | ||
|
||
export const projectRepo = 'https://github.com/zthxxx/react-dev-inspector' | ||
|
||
export const handleInspectOnline = (inspect: Required<InspectParams>) => { | ||
if (isDev) return gotoServerEditor(inspect.codeInfo) | ||
|
||
const { relativePath, absolutePath, lineNumber } = inspect.codeInfo | ||
if (relativePath) { | ||
const onlineFilePath = `docs/${relativePath}` | ||
window.open(`${projectRepo}/blob/dev/${onlineFilePath}#L${lineNumber}`) | ||
} | ||
else if (absolutePath) { | ||
const onlineFilePath = absolutePath.replace(/^.*?\/docs\//, 'docs/') | ||
window.open(`${projectRepo}/blob/dev/${onlineFilePath}#L${lineNumber}`) | ||
} | ||
} |
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
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
Oops, something went wrong.