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
package/src/types.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Element information from source detection
|
|
2
|
+
export type ElementInfoKind = "source" | "dom";
|
|
3
|
+
|
|
4
|
+
export interface DomSnapshot {
|
|
5
|
+
outerHTML: string;
|
|
6
|
+
text: string;
|
|
7
|
+
attributes: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ElementInfo {
|
|
11
|
+
kind: ElementInfoKind;
|
|
12
|
+
|
|
13
|
+
// Source-mapped fields (present for kind === "source")
|
|
14
|
+
componentName?: string;
|
|
15
|
+
filePath?: string;
|
|
16
|
+
line?: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
|
|
19
|
+
// DOM snapshot fields (present for kind === "dom")
|
|
20
|
+
domSnapshot?: DomSnapshot;
|
|
21
|
+
|
|
22
|
+
// Bounding box is useful for both modes
|
|
23
|
+
box?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Source location from Bippy fiber inspection
|
|
32
|
+
export interface SourceLocation {
|
|
33
|
+
fileName: string;
|
|
34
|
+
lineNumber: number;
|
|
35
|
+
columnNumber: number;
|
|
36
|
+
functionName?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Supported editor types
|
|
40
|
+
export type EditorType =
|
|
41
|
+
| "vscode"
|
|
42
|
+
| "vscode-insiders"
|
|
43
|
+
| "cursor"
|
|
44
|
+
| "webstorm"
|
|
45
|
+
| "atom"
|
|
46
|
+
| "sublime";
|
|
47
|
+
|
|
48
|
+
// Configuration options for UiDog Next
|
|
49
|
+
export interface UiDogNextOptions {
|
|
50
|
+
/**
|
|
51
|
+
* Editor to open when clicking elements
|
|
52
|
+
* @default 'cursor'
|
|
53
|
+
*/
|
|
54
|
+
editor?: EditorType;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Project root path for resolving file paths
|
|
58
|
+
*/
|
|
59
|
+
projectPath?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Modifier key for element selection
|
|
63
|
+
* @default 'alt'
|
|
64
|
+
*/
|
|
65
|
+
modifier?: "alt" | "ctrl" | "meta" | "shift";
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Enable sidebar mode
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
enableSidebar?: boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* API endpoint for edit requests
|
|
75
|
+
* @default 'https://api.ui.dog'
|
|
76
|
+
*/
|
|
77
|
+
apiEndpoint?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Element detector options
|
|
81
|
+
export interface ElementDetectorOptions {
|
|
82
|
+
onElementSelected: (source: SourceLocation | null, element: Element) => void;
|
|
83
|
+
modifier?: "alt" | "ctrl" | "meta" | "shift";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Sidebar configuration
|
|
87
|
+
export interface SidebarConfig {
|
|
88
|
+
apiEndpoint: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// API types
|
|
92
|
+
export interface EditRequest {
|
|
93
|
+
editorUrl: string;
|
|
94
|
+
userInput: string;
|
|
95
|
+
/**
|
|
96
|
+
* Optional metadata to help when source is unavailable (e.g., server components)
|
|
97
|
+
*/
|
|
98
|
+
elementKind?: ElementInfoKind;
|
|
99
|
+
domSnapshot?: DomSnapshot;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface EditResponse {
|
|
103
|
+
sessionId: string;
|
|
104
|
+
message: string;
|
|
105
|
+
status: "success" | "error";
|
|
106
|
+
error?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Global window extensions
|
|
110
|
+
declare global {
|
|
111
|
+
interface Window {
|
|
112
|
+
__UIDOG_NEXT_INITIALIZED__?: boolean;
|
|
113
|
+
__UIDOG_SIDEBAR__?: {
|
|
114
|
+
isOpen: boolean;
|
|
115
|
+
elementInfo: ElementInfo | null;
|
|
116
|
+
editorUrl: string | null;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"rootDir": "./src",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"noEmit": false
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist"]
|
|
23
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig([
|
|
4
|
+
// Main entry
|
|
5
|
+
{
|
|
6
|
+
entry: {
|
|
7
|
+
index: "src/index.ts",
|
|
8
|
+
},
|
|
9
|
+
format: ["cjs", "esm"],
|
|
10
|
+
dts: true,
|
|
11
|
+
clean: true,
|
|
12
|
+
external: ["react", "react-dom", "next"],
|
|
13
|
+
splitting: false,
|
|
14
|
+
shims: true,
|
|
15
|
+
},
|
|
16
|
+
// Client entry (for instrumentation-client.ts)
|
|
17
|
+
{
|
|
18
|
+
entry: {
|
|
19
|
+
"client/index": "src/client/index.ts",
|
|
20
|
+
},
|
|
21
|
+
format: ["cjs", "esm"],
|
|
22
|
+
dts: true,
|
|
23
|
+
clean: false,
|
|
24
|
+
external: ["react", "react-dom", "next"],
|
|
25
|
+
splitting: false,
|
|
26
|
+
shims: true,
|
|
27
|
+
},
|
|
28
|
+
// React component entry (UiDogProvider)
|
|
29
|
+
{
|
|
30
|
+
entry: {
|
|
31
|
+
"client/init": "src/client/init.tsx",
|
|
32
|
+
},
|
|
33
|
+
format: ["cjs", "esm"],
|
|
34
|
+
dts: true,
|
|
35
|
+
clean: false,
|
|
36
|
+
external: ["react", "react-dom", "next"],
|
|
37
|
+
splitting: false,
|
|
38
|
+
shims: true,
|
|
39
|
+
},
|
|
40
|
+
]);
|