@srivarsank/glide 1.0.47
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/LICENSE +201 -0
- package/README.md +284 -0
- package/dist/babel-plugin.d.ts +11 -0
- package/dist/babel-plugin.js +39 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +225253 -0
- package/dist/index.d.ts +257 -0
- package/dist/index.js +227186 -0
- package/dist/vite-plugin.d.ts +15 -0
- package/dist/vite-plugin.js +5976 -0
- package/package.json +90 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface ComponentTreeNode {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
children: ComponentTreeNode[];
|
|
9
|
+
}
|
|
10
|
+
export type FrameworkId = "react" | "vue" | "svelte" | "astro" | "html" | "unknown";
|
|
11
|
+
export type MetaFrameworkId = "next" | "nuxt" | "astro" | "none";
|
|
12
|
+
export interface ProjectMeta {
|
|
13
|
+
framework: FrameworkId;
|
|
14
|
+
metaFramework: MetaFrameworkId;
|
|
15
|
+
srcDir: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FileDiff {
|
|
18
|
+
file: string;
|
|
19
|
+
before: string;
|
|
20
|
+
after: string;
|
|
21
|
+
}
|
|
22
|
+
export interface HistoryEntry {
|
|
23
|
+
id: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
description: string;
|
|
26
|
+
diffs: FileDiff[];
|
|
27
|
+
/** If set, consecutive pushes with same squashKey within squashWindowMs are merged. */
|
|
28
|
+
squashKey?: string;
|
|
29
|
+
squashWindowMs?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function detectProjectMeta(projectRoot: string): ProjectMeta;
|
|
32
|
+
export declare function generateVSCodeConfig(projectRoot: string): void;
|
|
33
|
+
export declare function buildComponentTree(code: string, filepath?: string): ComponentTreeNode[];
|
|
34
|
+
export declare function getNestingPath(tree: ComponentTreeNode[], selectedId: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* @srivarsank/core — Centralized Glide configuration.
|
|
37
|
+
* Single source of truth for every value that used to be hardcoded.
|
|
38
|
+
*/
|
|
39
|
+
export interface GlideEditorTheme {
|
|
40
|
+
accentColor: string;
|
|
41
|
+
bgCanvas: string;
|
|
42
|
+
bgPanel: string;
|
|
43
|
+
borderColor: string;
|
|
44
|
+
fontFamily: string;
|
|
45
|
+
}
|
|
46
|
+
export interface GlideViewport {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
}
|
|
50
|
+
export interface GlideConfig {
|
|
51
|
+
port: number;
|
|
52
|
+
targetPort: number;
|
|
53
|
+
historyLimit: number;
|
|
54
|
+
selfWriteDebounceMs: number;
|
|
55
|
+
snapThresholdPx: number;
|
|
56
|
+
maxGapDetection: number;
|
|
57
|
+
maxDistanceIndicator: number;
|
|
58
|
+
sourceAttribute: string;
|
|
59
|
+
hoverAttribute: string;
|
|
60
|
+
selectedAttribute: string;
|
|
61
|
+
editorTheme: GlideEditorTheme;
|
|
62
|
+
defaultViewport: GlideViewport;
|
|
63
|
+
sidebarWidth: number;
|
|
64
|
+
}
|
|
65
|
+
export declare function computeNodeHash(sourceCodeSlice: string): string;
|
|
66
|
+
export declare function updateClassString(existingClasses: string, property: string, value: any, breakpoint?: string): string;
|
|
67
|
+
export declare function updateClassName(sourceCode: string, line: number, column: number, property: string, value: any, breakpoint?: string, expectedHash?: string): string;
|
|
68
|
+
export declare function updateJSXText(sourceCode: string, line: number, column: number, newText: string, expectedHash?: string): string;
|
|
69
|
+
export declare function updateJSXStyleProp(sourceCode: string, line: number, column: number, styles: Record<string, string>, expectedHash?: string): string;
|
|
70
|
+
export declare function reorderJSXElement(code: string, targetId: string, parentId: string, siblingId: string | null, position: "before" | "after"): string;
|
|
71
|
+
export declare function insertJSXElement(code: string, parentId: string, elementType: "rectangle" | "ellipse" | "frame" | "text"): string;
|
|
72
|
+
export declare function groupJSXElements(code: string, selectedIds: string[]): string;
|
|
73
|
+
export declare function ungroupJSXElement(code: string, groupId: string): string;
|
|
74
|
+
export declare function arrangeJSXElement(code: string, targetId: string, action: "front" | "back" | "forward" | "backward"): string;
|
|
75
|
+
export declare function updateCSSModuleRule(cssCode: string, className: string, properties: Record<string, string | null>): string;
|
|
76
|
+
export interface BoxModelProperties {
|
|
77
|
+
padding: {
|
|
78
|
+
top: string | null;
|
|
79
|
+
right: string | null;
|
|
80
|
+
bottom: string | null;
|
|
81
|
+
left: string | null;
|
|
82
|
+
};
|
|
83
|
+
margin: {
|
|
84
|
+
top: string | null;
|
|
85
|
+
right: string | null;
|
|
86
|
+
bottom: string | null;
|
|
87
|
+
left: string | null;
|
|
88
|
+
};
|
|
89
|
+
width: string | null;
|
|
90
|
+
height: string | null;
|
|
91
|
+
position: string | null;
|
|
92
|
+
offsets: {
|
|
93
|
+
top: string | null;
|
|
94
|
+
right: string | null;
|
|
95
|
+
bottom: string | null;
|
|
96
|
+
left: string | null;
|
|
97
|
+
};
|
|
98
|
+
rotation: string | null;
|
|
99
|
+
flexDirection: string | null;
|
|
100
|
+
justifyContent: string | null;
|
|
101
|
+
alignItems: string | null;
|
|
102
|
+
gap: string | null;
|
|
103
|
+
fontFamily: string | null;
|
|
104
|
+
fontWeight: string | null;
|
|
105
|
+
fontSize: string | null;
|
|
106
|
+
textColor: string | null;
|
|
107
|
+
}
|
|
108
|
+
export declare function parseTailwindClasses(classStr: string): BoxModelProperties;
|
|
109
|
+
export declare function updateTailwindClasses(classStr: string, updates: Partial<BoxModelProperties>): string;
|
|
110
|
+
export declare function updateVueSFCClass(sfcCode: string, targetId: string, updatedClasses: string): string;
|
|
111
|
+
export declare function updateVueSFCStyle(sfcCode: string, targetId: string, styles: Record<string, string>): string;
|
|
112
|
+
export declare function updateVueSFCText(sfcCode: string, targetId: string, newText: string): string;
|
|
113
|
+
export declare function updateSvelteClass(svelteCode: string, targetId: string, updatedClasses: string): string;
|
|
114
|
+
export declare function updateSvelteStyle(svelteCode: string, targetId: string, styles: Record<string, string>): string;
|
|
115
|
+
export declare function updateSvelteText(svelteCode: string, targetId: string, newText: string): string;
|
|
116
|
+
export declare function updateAstroClass(astroCode: string, targetId: string, updatedClasses: string): string;
|
|
117
|
+
export declare function updateAstroStyle(astroCode: string, targetId: string, styles: Record<string, string>): string;
|
|
118
|
+
export declare function updateAstroText(astroCode: string, targetId: string, newText: string): string;
|
|
119
|
+
/**
|
|
120
|
+
* Parses HTML and updates a class attribute on a target element matching data-gl-source targetId.
|
|
121
|
+
*/
|
|
122
|
+
export declare function updateHTMLClass(htmlCode: string, targetId: string, updatedClasses: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* Parses HTML and updates inline style attribute on a target element matching data-gl-source targetId.
|
|
125
|
+
*/
|
|
126
|
+
export declare function updateHTMLStyle(htmlCode: string, targetId: string, styles: Record<string, string>): string;
|
|
127
|
+
/**
|
|
128
|
+
* Parses HTML and updates the inner text of a target element matching data-gl-source targetId.
|
|
129
|
+
*/
|
|
130
|
+
export declare function updateHTMLText(htmlCode: string, targetId: string, newText: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* Converts a raw HTML snippet into React elements using html-react-parser.
|
|
133
|
+
*/
|
|
134
|
+
export declare function parseHTMLToReact(htmlSnippet: string): any;
|
|
135
|
+
/**
|
|
136
|
+
* Parses an HTML/Vue/Svelte template and returns the class attribute of the element matching the data-gl-source.
|
|
137
|
+
*/
|
|
138
|
+
export declare function getElementClass(template: string, targetId: string): string;
|
|
139
|
+
export interface EditChange {
|
|
140
|
+
type: "style" | "class" | "text" | "multi-class" | "position" | "group" | "ungroup";
|
|
141
|
+
property?: string;
|
|
142
|
+
value?: any;
|
|
143
|
+
sources?: string[];
|
|
144
|
+
source?: string;
|
|
145
|
+
}
|
|
146
|
+
export type EditCallback = (file: string, line: number, column: number, change: EditChange, hash?: string) => void | Promise<void>;
|
|
147
|
+
export declare class GlideServer {
|
|
148
|
+
private wss;
|
|
149
|
+
private server;
|
|
150
|
+
private port;
|
|
151
|
+
private targetPort;
|
|
152
|
+
private config;
|
|
153
|
+
private editCallbacks;
|
|
154
|
+
private fileGenerations;
|
|
155
|
+
private watcher;
|
|
156
|
+
private lastSelfWrites;
|
|
157
|
+
recordSelfWrite(filePath: string): void;
|
|
158
|
+
constructor(port?: number, targetPort?: number, config?: GlideConfig);
|
|
159
|
+
start(): Promise<void>;
|
|
160
|
+
stop(): Promise<void>;
|
|
161
|
+
private closeHttpServer;
|
|
162
|
+
onEdit(callback: EditCallback): void;
|
|
163
|
+
}
|
|
164
|
+
export declare function saveUploadedAsset(projectRoot: string, sourcePath: string, fileName: string): string;
|
|
165
|
+
export declare class HistoryStore {
|
|
166
|
+
private maxHistory;
|
|
167
|
+
private stack;
|
|
168
|
+
private currentIndex;
|
|
169
|
+
setLimit(limit: number): void;
|
|
170
|
+
push(entry: Omit<HistoryEntry, "id" | "timestamp">): void;
|
|
171
|
+
undo(): FileDiff[] | null;
|
|
172
|
+
redo(): FileDiff[] | null;
|
|
173
|
+
jumpTo(targetIndex: number): {
|
|
174
|
+
file: string;
|
|
175
|
+
content: string;
|
|
176
|
+
}[];
|
|
177
|
+
getState(): {
|
|
178
|
+
stack: HistoryEntry[];
|
|
179
|
+
currentIndex: number;
|
|
180
|
+
};
|
|
181
|
+
clear(): void;
|
|
182
|
+
}
|
|
183
|
+
export declare function getEditorHTML(config?: GlideConfig): string;
|
|
184
|
+
export declare class GlideBridge {
|
|
185
|
+
private targetWindow;
|
|
186
|
+
private activeHoverElement;
|
|
187
|
+
private selectedElement;
|
|
188
|
+
private styleSheet;
|
|
189
|
+
private sourceAttribute;
|
|
190
|
+
private hoverAttribute;
|
|
191
|
+
private selectedAttribute;
|
|
192
|
+
constructor(targetWindow?: Window, options?: {
|
|
193
|
+
sourceAttribute?: string;
|
|
194
|
+
hoverAttribute?: string;
|
|
195
|
+
selectedAttribute?: string;
|
|
196
|
+
});
|
|
197
|
+
init(): void;
|
|
198
|
+
dispose(): void;
|
|
199
|
+
private handleScrollOrResize;
|
|
200
|
+
private injectStyles;
|
|
201
|
+
private clearHover;
|
|
202
|
+
private clearSelection;
|
|
203
|
+
private handleMessage;
|
|
204
|
+
private handleMouseMove;
|
|
205
|
+
private handleClick;
|
|
206
|
+
private sendTelemetry;
|
|
207
|
+
}
|
|
208
|
+
export interface ElementRect {
|
|
209
|
+
left: number;
|
|
210
|
+
top: number;
|
|
211
|
+
width: number;
|
|
212
|
+
height: number;
|
|
213
|
+
}
|
|
214
|
+
export type ResizeCallback = (source: string, rect: ElementRect, delta: {
|
|
215
|
+
width: number;
|
|
216
|
+
height: number;
|
|
217
|
+
left: number;
|
|
218
|
+
top: number;
|
|
219
|
+
}) => void;
|
|
220
|
+
export declare class GlideOverlay {
|
|
221
|
+
private targetWindow;
|
|
222
|
+
private container;
|
|
223
|
+
private svg;
|
|
224
|
+
private selectionRect;
|
|
225
|
+
private activeSource;
|
|
226
|
+
private resizeCallback;
|
|
227
|
+
private dragHandle;
|
|
228
|
+
private startPointerX;
|
|
229
|
+
private startPointerY;
|
|
230
|
+
private startRect;
|
|
231
|
+
constructor(targetWindow?: Window, container?: HTMLElement);
|
|
232
|
+
init(): void;
|
|
233
|
+
dispose(): void;
|
|
234
|
+
onResize(callback: ResizeCallback): void;
|
|
235
|
+
private handleMessage;
|
|
236
|
+
private renderOverlay;
|
|
237
|
+
private removeOverlay;
|
|
238
|
+
private getCursorForHandle;
|
|
239
|
+
private handlePointerMove;
|
|
240
|
+
private handlePointerUp;
|
|
241
|
+
}
|
|
242
|
+
/** @deprecated Use resolvePixelGridSnap for pixel-perfect snapping. */
|
|
243
|
+
export declare function snapToGrid(x: number, y: number, gridSize?: number): {
|
|
244
|
+
x: number;
|
|
245
|
+
y: number;
|
|
246
|
+
};
|
|
247
|
+
export interface MeasureResult {
|
|
248
|
+
width: number;
|
|
249
|
+
lineCount: number;
|
|
250
|
+
lines: string[];
|
|
251
|
+
}
|
|
252
|
+
export declare function measureTextLayout(text: string, font: string, maxWidth: number): MeasureResult;
|
|
253
|
+
export declare function resolveActiveBreakpoint(width: number): string | null;
|
|
254
|
+
export declare function glideSourceStamping(): Plugin;
|
|
255
|
+
export declare const VERSION = "0.1.0";
|
|
256
|
+
|
|
257
|
+
export {};
|