fixdog 0.0.1
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/README.md +478 -0
- package/USAGE.md +77 -0
- package/dist/client/index.d.mts +110 -0
- package/dist/client/index.d.ts +110 -0
- package/dist/client/index.js +1601 -0
- package/dist/client/index.mjs +1582 -0
- package/dist/client/init.d.mts +67 -0
- package/dist/client/init.d.ts +67 -0
- package/dist/client/init.js +1609 -0
- package/dist/client/init.mjs +1593 -0
- package/dist/index.d.mts +158 -0
- package/dist/index.d.ts +158 -0
- package/dist/index.js +1635 -0
- package/dist/index.mjs +1606 -0
- package/package.json +57 -0
- package/src/api/client.ts +141 -0
- package/src/client/index.ts +75 -0
- package/src/client/init.tsx +78 -0
- package/src/components/ConversationalInputReact.tsx +406 -0
- package/src/components/ElementInfoDisplayReact.tsx +84 -0
- package/src/components/UiDogSidebarReact.tsx +49 -0
- package/src/element-detector.ts +186 -0
- package/src/index.ts +228 -0
- package/src/instrument.ts +171 -0
- package/src/sidebar-initializer.ts +171 -0
- package/src/source-resolver.ts +121 -0
- package/src/styles/sidebarStyles.ts +597 -0
- package/src/types/css.d.ts +9 -0
- package/src/types/sidebar.ts +56 -0
- package/src/types.ts +119 -0
- package/tsconfig.json +23 -0
- package/tsup.config.ts +40 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
type ElementInfoKind = "source" | "dom";
|
|
2
|
+
interface DomSnapshot {
|
|
3
|
+
outerHTML: string;
|
|
4
|
+
text: string;
|
|
5
|
+
attributes: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
interface ElementInfo {
|
|
8
|
+
kind: ElementInfoKind;
|
|
9
|
+
componentName?: string;
|
|
10
|
+
filePath?: string;
|
|
11
|
+
line?: number;
|
|
12
|
+
column?: number;
|
|
13
|
+
domSnapshot?: DomSnapshot;
|
|
14
|
+
box?: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
type EditorType = "vscode" | "vscode-insiders" | "cursor" | "webstorm" | "atom" | "sublime";
|
|
22
|
+
interface UiDogNextOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Editor to open when clicking elements
|
|
25
|
+
* @default 'cursor'
|
|
26
|
+
*/
|
|
27
|
+
editor?: EditorType;
|
|
28
|
+
/**
|
|
29
|
+
* Project root path for resolving file paths
|
|
30
|
+
*/
|
|
31
|
+
projectPath?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Modifier key for element selection
|
|
34
|
+
* @default 'alt'
|
|
35
|
+
*/
|
|
36
|
+
modifier?: "alt" | "ctrl" | "meta" | "shift";
|
|
37
|
+
/**
|
|
38
|
+
* Enable sidebar mode
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
enableSidebar?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* API endpoint for edit requests
|
|
44
|
+
* @default 'https://api.ui.dog'
|
|
45
|
+
*/
|
|
46
|
+
apiEndpoint?: string;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface Window {
|
|
50
|
+
__UIDOG_NEXT_INITIALIZED__?: boolean;
|
|
51
|
+
__UIDOG_SIDEBAR__?: {
|
|
52
|
+
isOpen: boolean;
|
|
53
|
+
elementInfo: ElementInfo | null;
|
|
54
|
+
editorUrl: string | null;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* UiDog SDK for Next.js - Main entry point
|
|
61
|
+
*
|
|
62
|
+
* Uses Bippy to hook into React's internals for element source detection,
|
|
63
|
+
* providing a seamless developer experience for inspecting component locations.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Initialize UiDog for Next.js
|
|
68
|
+
*
|
|
69
|
+
* This function sets up Bippy instrumentation, element detection, and the sidebar UI.
|
|
70
|
+
* It should be called early in your application's lifecycle, ideally via
|
|
71
|
+
* instrumentation-client.ts (Next.js 15.3+) or at the top of _app.tsx.
|
|
72
|
+
*/
|
|
73
|
+
declare function initializeUiDogNext(options?: UiDogNextOptions): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Client entry point for UiDog Next.js integration
|
|
77
|
+
*
|
|
78
|
+
* This file is designed to be imported in:
|
|
79
|
+
* - Next.js 15.3+: instrumentation-client.ts at project root
|
|
80
|
+
* - Next.js 14.x / Pages Router: top of _app.tsx (must be first import)
|
|
81
|
+
*
|
|
82
|
+
* IMPORTANT: This file MUST be imported BEFORE React loads to properly
|
|
83
|
+
* install Bippy's React DevTools hook.
|
|
84
|
+
*
|
|
85
|
+
* Usage:
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // instrumentation-client.ts (Next.js 15.3+)
|
|
88
|
+
* import 'uidog-sdk-next/client';
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // pages/_app.tsx (Next.js 14.x / Pages Router)
|
|
93
|
+
* import 'uidog-sdk-next/client'; // MUST be first import
|
|
94
|
+
* import type { AppProps } from 'next/app';
|
|
95
|
+
* // ... rest of your imports
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Configure UiDog options before initialization
|
|
101
|
+
* Call this before auto-initialization happens (at DOMContentLoaded)
|
|
102
|
+
*/
|
|
103
|
+
declare function configureUiDogNext(options: UiDogNextOptions): void;
|
|
104
|
+
/**
|
|
105
|
+
* Disable auto-initialization
|
|
106
|
+
* Use this if you want to manually initialize UiDog later
|
|
107
|
+
*/
|
|
108
|
+
declare function disableAutoInit(): void;
|
|
109
|
+
|
|
110
|
+
export { UiDogNextOptions, configureUiDogNext, disableAutoInit, initializeUiDogNext };
|