@rozenite/vite-plugin 1.8.1 → 1.9.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/dist/bundle-dts.d.ts +1 -0
- package/dist/bundle-dts.d.ts.map +1 -1
- package/dist/client-plugin.d.ts.map +1 -1
- package/dist/dev-host/App.d.ts +3 -0
- package/dist/dev-host/App.d.ts.map +1 -0
- package/dist/dev-host/components/DispatchForm.d.ts +13 -0
- package/dist/dev-host/components/DispatchForm.d.ts.map +1 -0
- package/dist/dev-host/components/MessageDetailsPane.d.ts +18 -0
- package/dist/dev-host/components/MessageDetailsPane.d.ts.map +1 -0
- package/dist/dev-host/components/MessageLogPane.d.ts +10 -0
- package/dist/dev-host/components/MessageLogPane.d.ts.map +1 -0
- package/dist/dev-host/components/MessagePayloadDetail.d.ts +6 -0
- package/dist/dev-host/components/MessagePayloadDetail.d.ts.map +1 -0
- package/dist/dev-host/components/PanelTabs.d.ts +9 -0
- package/dist/dev-host/components/PanelTabs.d.ts.map +1 -0
- package/dist/dev-host/components/ResizeHandle.d.ts +12 -0
- package/dist/dev-host/components/ResizeHandle.d.ts.map +1 -0
- package/dist/dev-host/components/icons.d.ts +3 -0
- package/dist/dev-host/components/icons.d.ts.map +1 -0
- package/dist/dev-host/components/ui/ScrollArea.d.ts +6 -0
- package/dist/dev-host/components/ui/ScrollArea.d.ts.map +1 -0
- package/dist/dev-host/components/ui/Tabs.d.ts +5 -0
- package/dist/dev-host/components/ui/Tabs.d.ts.map +1 -0
- package/dist/dev-host/constants.d.ts +28 -0
- package/dist/dev-host/constants.d.ts.map +1 -0
- package/dist/dev-host/index.d.ts +1 -0
- package/dist/dev-host/index.d.ts.map +1 -0
- package/dist/dev-host/types.d.ts +29 -0
- package/dist/dev-host/types.d.ts.map +1 -0
- package/dist/dev-host/utils.d.ts +13 -0
- package/dist/dev-host/utils.d.ts.map +1 -0
- package/dist/index.cjs +101 -12
- package/dist/index.js +101 -12
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/src/dev-host/App.tsx +403 -0
- package/src/dev-host/components/DispatchForm.tsx +87 -0
- package/src/dev-host/components/MessageDetailsPane.tsx +108 -0
- package/src/dev-host/components/MessageLogPane.tsx +84 -0
- package/src/dev-host/components/MessagePayloadDetail.tsx +32 -0
- package/src/dev-host/components/PanelTabs.tsx +22 -0
- package/src/dev-host/components/ResizeHandle.tsx +33 -0
- package/src/dev-host/components/icons.tsx +27 -0
- package/src/dev-host/components/ui/ScrollArea.tsx +46 -0
- package/src/dev-host/components/ui/Tabs.tsx +33 -0
- package/src/dev-host/constants.ts +29 -0
- package/src/dev-host/dev-host.html +11 -0
- package/src/dev-host/index.tsx +19 -0
- package/src/dev-host/styles.css +631 -0
- package/src/dev-host/types.ts +33 -0
- package/src/dev-host/utils.ts +96 -0
- package/templates/panel.ejs +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSONTree } from 'react-json-tree';
|
|
2
|
+
import { jsonTreeTheme } from '../constants.js';
|
|
3
|
+
import { isJsonTreeData } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
type MessagePayloadDetailProps = {
|
|
6
|
+
payload: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const MessagePayloadDetail = ({ payload }: MessagePayloadDetailProps) => {
|
|
10
|
+
if (typeof payload === 'string') {
|
|
11
|
+
return <pre className="rz-detail-pre rz-detail-mono">{payload}</pre>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (typeof payload === 'number' || typeof payload === 'boolean' || payload == null) {
|
|
15
|
+
return <pre className="rz-detail-pre rz-detail-mono">{String(payload)}</pre>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (isJsonTreeData(payload)) {
|
|
19
|
+
return (
|
|
20
|
+
<div className="rz-detail-json-tree">
|
|
21
|
+
<JSONTree
|
|
22
|
+
data={payload}
|
|
23
|
+
theme={jsonTreeTheme}
|
|
24
|
+
invertTheme={false}
|
|
25
|
+
shouldExpandNodeInitially={(keyPath) => keyPath.length <= 2}
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return <pre className="rz-detail-pre rz-detail-mono">{String(payload)}</pre>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DevHostPanelEntry } from '../types.js';
|
|
2
|
+
import { Tabs, TabsList, TabsTrigger } from './ui/Tabs.js';
|
|
3
|
+
|
|
4
|
+
type PanelTabsProps = {
|
|
5
|
+
panels: DevHostPanelEntry[];
|
|
6
|
+
activeSource: string;
|
|
7
|
+
onValueChange: (value: string) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const PanelTabs = ({ panels, activeSource, onValueChange }: PanelTabsProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<Tabs className="rz-tabs-root" value={activeSource} onValueChange={onValueChange}>
|
|
13
|
+
<TabsList aria-label="Plugin panels">
|
|
14
|
+
{panels.map((panel) => (
|
|
15
|
+
<TabsTrigger key={panel.source} value={panel.source}>
|
|
16
|
+
{panel.label}
|
|
17
|
+
</TabsTrigger>
|
|
18
|
+
))}
|
|
19
|
+
</TabsList>
|
|
20
|
+
</Tabs>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
type ResizeHandleProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
isDragging: boolean;
|
|
7
|
+
isHidden?: boolean;
|
|
8
|
+
orientation: 'horizontal' | 'vertical';
|
|
9
|
+
label: string;
|
|
10
|
+
onPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ResizeHandle = ({
|
|
14
|
+
className,
|
|
15
|
+
isDragging,
|
|
16
|
+
isHidden = false,
|
|
17
|
+
orientation,
|
|
18
|
+
label,
|
|
19
|
+
onPointerDown,
|
|
20
|
+
}: ResizeHandleProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={cn(className)}
|
|
24
|
+
data-dragging={isDragging}
|
|
25
|
+
data-hidden={isHidden}
|
|
26
|
+
aria-hidden={isHidden}
|
|
27
|
+
onPointerDown={onPointerDown}
|
|
28
|
+
role="separator"
|
|
29
|
+
aria-orientation={orientation}
|
|
30
|
+
aria-label={label}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const ClearIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
|
|
4
|
+
<path
|
|
5
|
+
d="M2.5 3.5H11.5M5.5 1.75H8.5M4 3.5V10.5C4 10.9641 4.18437 11.4092 4.51256 11.7374C4.84075 12.0656 5.28587 12.25 5.75 12.25H8.25C8.71413 12.25 9.15925 12.0656 9.48744 11.7374C9.81563 11.4092 10 10.9641 10 10.5V3.5M5.75 5.5V9.625M8.25 5.5V9.625"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
strokeWidth="1.25"
|
|
8
|
+
strokeLinecap="round"
|
|
9
|
+
strokeLinejoin="round"
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const SendIcon = () => {
|
|
16
|
+
return (
|
|
17
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
|
|
18
|
+
<path
|
|
19
|
+
d="M12.25 1.75L6.75 7.25M12.25 1.75L8.75 12.25L6.75 7.25M12.25 1.75L1.75 5.25L6.75 7.25"
|
|
20
|
+
stroke="currentColor"
|
|
21
|
+
strokeWidth="1.25"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
type ComponentPropsWithoutRef,
|
|
4
|
+
type ElementRef,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
8
|
+
import { cn } from '../../utils.js';
|
|
9
|
+
|
|
10
|
+
type ScrollAreaProps = ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const ScrollBar = forwardRef<
|
|
15
|
+
ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
16
|
+
ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
17
|
+
>(({ className, ...props }, ref) => {
|
|
18
|
+
return (
|
|
19
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn('rz-scrollbar', className)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="rz-scrollbar-thumb" />
|
|
25
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
30
|
+
|
|
31
|
+
export const ScrollArea = forwardRef<
|
|
32
|
+
ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
33
|
+
ScrollAreaProps
|
|
34
|
+
>(({ className, children, ...props }, ref) => {
|
|
35
|
+
return (
|
|
36
|
+
<ScrollAreaPrimitive.Root ref={ref} className={cn('rz-scroll-area', className)} {...props}>
|
|
37
|
+
<ScrollAreaPrimitive.Viewport className="rz-scroll-viewport">
|
|
38
|
+
{children}
|
|
39
|
+
</ScrollAreaPrimitive.Viewport>
|
|
40
|
+
<ScrollBar orientation="vertical" />
|
|
41
|
+
<ScrollAreaPrimitive.Corner />
|
|
42
|
+
</ScrollAreaPrimitive.Root>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
type ComponentPropsWithoutRef,
|
|
4
|
+
type ElementRef,
|
|
5
|
+
} from 'react';
|
|
6
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
7
|
+
import { cn } from '../../utils.js';
|
|
8
|
+
|
|
9
|
+
export const Tabs = TabsPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
export const TabsList = forwardRef<
|
|
12
|
+
ElementRef<typeof TabsPrimitive.List>,
|
|
13
|
+
ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
14
|
+
>(({ className, ...props }, ref) => {
|
|
15
|
+
return <TabsPrimitive.List ref={ref} className={cn('rz-tabs-list', className)} {...props} />;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
19
|
+
|
|
20
|
+
export const TabsTrigger = forwardRef<
|
|
21
|
+
ElementRef<typeof TabsPrimitive.Trigger>,
|
|
22
|
+
ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
23
|
+
>(({ className, ...props }, ref) => {
|
|
24
|
+
return (
|
|
25
|
+
<TabsPrimitive.Trigger
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn('rz-tabs-trigger', className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const DEV_HOST_STATE_ELEMENT_ID = '__rozenite-dev-host__';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_DEVTOOLS_HEIGHT = 288;
|
|
4
|
+
export const MIN_DEVTOOLS_HEIGHT = 180;
|
|
5
|
+
export const MIN_IFRAME_HEIGHT = 220;
|
|
6
|
+
export const DETAILS_PANEL_WIDTH = 360;
|
|
7
|
+
export const MIN_DETAILS_WIDTH = 280;
|
|
8
|
+
export const DEFAULT_COMMAND_WIDTH = 320;
|
|
9
|
+
export const MIN_COMMAND_WIDTH = 260;
|
|
10
|
+
export const SPLITTER_SIZE = 6;
|
|
11
|
+
|
|
12
|
+
export const jsonTreeTheme = {
|
|
13
|
+
base00: 'transparent',
|
|
14
|
+
base01: '#374151',
|
|
15
|
+
base02: '#4b5563',
|
|
16
|
+
base03: '#6b7280',
|
|
17
|
+
base04: '#9ca3af',
|
|
18
|
+
base05: '#d1d5db',
|
|
19
|
+
base06: '#e5e7eb',
|
|
20
|
+
base07: '#f9fafb',
|
|
21
|
+
base08: '#ef4444',
|
|
22
|
+
base09: '#f59e0b',
|
|
23
|
+
base0A: '#10b981',
|
|
24
|
+
base0B: '#3b82f6',
|
|
25
|
+
base0C: '#06b6d4',
|
|
26
|
+
base0D: '#8b5cf6',
|
|
27
|
+
base0E: '#ec4899',
|
|
28
|
+
base0F: '#f97316',
|
|
29
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { App } from './App.js';
|
|
4
|
+
import './styles.css';
|
|
5
|
+
import { readDevHostState } from './utils.js';
|
|
6
|
+
|
|
7
|
+
const rootElement = document.getElementById('root');
|
|
8
|
+
|
|
9
|
+
if (!rootElement) {
|
|
10
|
+
throw new Error('Rozenite dev host failed to initialize.');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const state = readDevHostState();
|
|
14
|
+
|
|
15
|
+
createRoot(rootElement).render(
|
|
16
|
+
<StrictMode>
|
|
17
|
+
<App {...state} />
|
|
18
|
+
</StrictMode>,
|
|
19
|
+
);
|