@promakeai/inspector 1.1.8 → 1.2.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/App.d.ts.map +1 -1
- package/dist/components/ActionsEditor/index.d.ts +16 -0
- package/dist/components/ActionsEditor/index.d.ts.map +1 -0
- package/dist/components/ControlBox/index.d.ts +4 -4
- package/dist/components/ControlBox/index.d.ts.map +1 -1
- package/dist/components/ImageEditor/index.d.ts +1 -0
- package/dist/components/ImageEditor/index.d.ts.map +1 -1
- package/dist/components/Overlay.d.ts.map +1 -1
- package/dist/components/StyleEditor/ColorPicker.d.ts.map +1 -1
- package/dist/components/StyleEditor/NumberInput.d.ts.map +1 -1
- package/dist/components/StyleEditor/SliderInput.d.ts.map +1 -1
- package/dist/components/StyleEditor/index.d.ts +3 -1
- package/dist/components/StyleEditor/index.d.ts.map +1 -1
- package/dist/components/TextEditor/index.d.ts +3 -1
- package/dist/components/TextEditor/index.d.ts.map +1 -1
- package/dist/components/ui/InstanceWarning.d.ts +11 -0
- package/dist/components/ui/InstanceWarning.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +6 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/core/highlighter.d.ts.map +1 -1
- package/dist/hooks/useStylePreview.d.ts +1 -1
- package/dist/hooks/useStylePreview.d.ts.map +1 -1
- package/dist/inspector.css +1 -1
- package/dist/inspector.js +3225 -2716
- package/dist/store/useInspectorStore.d.ts +12 -1
- package/dist/store/useInspectorStore.d.ts.map +1 -1
- package/dist/utils/changeManager.d.ts +56 -0
- package/dist/utils/changeManager.d.ts.map +1 -0
- package/dist/utils/instanceDetection.d.ts +37 -0
- package/dist/utils/instanceDetection.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zustand store for Inspector global state
|
|
3
3
|
*/
|
|
4
|
-
import type { InspectorTheme, InspectorLabels } from "@promakeai/inspector-types";
|
|
4
|
+
import type { InspectorTheme, InspectorLabels, InspectorChange } from "@promakeai/inspector-types";
|
|
5
5
|
interface InspectorStore {
|
|
6
6
|
theme: Required<InspectorTheme>;
|
|
7
7
|
labels: Required<InspectorLabels>;
|
|
8
8
|
setTheme: (theme: Partial<InspectorTheme>) => void;
|
|
9
9
|
setLabels: (labels: Partial<InspectorLabels>) => void;
|
|
10
|
+
changes: InspectorChange[];
|
|
11
|
+
addChange: (change: InspectorChange) => void;
|
|
12
|
+
updateChange: (changeId: string, updates: Partial<InspectorChange>) => void;
|
|
13
|
+
undoLastChange: () => InspectorChange | null;
|
|
14
|
+
discardAllChanges: () => void;
|
|
15
|
+
getChanges: () => InspectorChange[];
|
|
16
|
+
getMergedChanges: () => InspectorChange[];
|
|
17
|
+
clearChanges: () => void;
|
|
18
|
+
hasChanges: () => boolean;
|
|
19
|
+
changeHistory: InspectorChange[];
|
|
20
|
+
clearHistory: () => void;
|
|
10
21
|
}
|
|
11
22
|
export declare const useInspectorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<InspectorStore>>;
|
|
12
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInspectorStore.d.ts","sourceRoot":"","sources":["../../src/store/useInspectorStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAChB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"useInspectorStore.d.ts","sourceRoot":"","sources":["../../src/store/useInspectorStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAOpC,UAAU,cAAc;IACtB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAChC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACnD,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAEtD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAC5E,cAAc,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC7C,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,eAAe,EAAE,CAAC;IACpC,gBAAgB,EAAE,MAAM,eAAe,EAAE,CAAC;IAC1C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,OAAO,CAAC;IAE1B,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AA+OD,eAAO,MAAM,iBAAiB,6EAsI3B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change Manager - Utility functions for managing inspector changes
|
|
3
|
+
* Handles applying and unapplying changes to the DOM
|
|
4
|
+
*/
|
|
5
|
+
import type { InspectorChange, InspectorChangeType, SelectedElementData, StyleChanges } from "@promakeai/inspector-types";
|
|
6
|
+
/**
|
|
7
|
+
* Generate a unique ID for a change
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateChangeId(type: InspectorChangeType): string;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new text change
|
|
12
|
+
*/
|
|
13
|
+
export declare function createTextChange(element: SelectedElementData, previous: string, current: string): InspectorChange;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new style change (legacy - all styles at once)
|
|
16
|
+
*/
|
|
17
|
+
export declare function createStyleChange(element: SelectedElementData, previous: StyleChanges, current: StyleChanges, inlineStyles?: Record<string, string>, tailwindClasses?: string[]): InspectorChange;
|
|
18
|
+
/**
|
|
19
|
+
* Create a single style property change (for granular undo)
|
|
20
|
+
* @param previousValue - null means the property didn't exist before (will use removeProperty on undo)
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSingleStyleChange(element: SelectedElementData, property: keyof StyleChanges, previousValue: string | null, currentValue: string): InspectorChange;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new image change
|
|
25
|
+
*/
|
|
26
|
+
export declare function createImageChange(element: SelectedElementData, previous: string, current: string, imageFile?: {
|
|
27
|
+
name: string;
|
|
28
|
+
size: number;
|
|
29
|
+
type: string;
|
|
30
|
+
}): InspectorChange;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new delete change
|
|
33
|
+
*/
|
|
34
|
+
export declare function createDeleteChange(element: SelectedElementData, domSnapshot: string, parentSelector?: string, nextSiblingSelector?: string): InspectorChange;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new duplicate change
|
|
37
|
+
*/
|
|
38
|
+
export declare function createDuplicateChange(element: SelectedElementData, newElementSnapshot: string, duplicatedElement?: HTMLElement): InspectorChange;
|
|
39
|
+
/**
|
|
40
|
+
* Apply a change to the DOM (preview)
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyChange(domElement: HTMLElement | null, change: InspectorChange): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Unapply a change from the DOM (undo)
|
|
45
|
+
*/
|
|
46
|
+
export declare function unapplyChange(domElement: HTMLElement | null, change: InspectorChange): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Merge changes for submit - combines multiple changes to same property into single change
|
|
49
|
+
* Returns merged changes: original (first change's prev) → final (last change's current)
|
|
50
|
+
*/
|
|
51
|
+
export declare function mergeChangesForSubmit(changes: InspectorChange[]): InspectorChange[];
|
|
52
|
+
/**
|
|
53
|
+
* Find DOM element by SelectedElementData
|
|
54
|
+
*/
|
|
55
|
+
export declare function findElementByData(elementData: SelectedElementData): HTMLElement | null;
|
|
56
|
+
//# sourceMappingURL=changeManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeManager.d.ts","sourceRoot":"","sources":["../../src/utils/changeManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAElE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,eAAe,CAQjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,YAAY,EACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,eAAe,CAQjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,MAAM,YAAY,EAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,YAAY,EAAE,MAAM,GACnB,eAAe,CAQjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACvD,eAAe,CAQjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,EACvB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,eAAe,CAQjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,mBAAmB,EAC5B,kBAAkB,EAAE,MAAM,EAC1B,iBAAiB,CAAC,EAAE,WAAW,GAC9B,eAAe,CAQjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,MAAM,EAAE,eAAe,GACtB,OAAO,CAuDT;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,MAAM,EAAE,eAAe,GACtB,OAAO,CAoET;AAiND;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CA6CnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,mBAAmB,GAC/B,WAAW,GAAG,IAAI,CAwBpB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instance Detection Utilities
|
|
3
|
+
* Detects if an element is part of a loop (.map()) or has multiple instances
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Count how many elements share the same data-dev-id
|
|
7
|
+
* Elements in .map() loops will have the same id since they're defined on the same line
|
|
8
|
+
*/
|
|
9
|
+
export declare function countInstancesWithSameId(element: HTMLElement): number;
|
|
10
|
+
/**
|
|
11
|
+
* Get all elements that share the same data-dev-id
|
|
12
|
+
*/
|
|
13
|
+
export declare function getInstancesWithSameId(element: HTMLElement): HTMLElement[];
|
|
14
|
+
export interface SafeEditResult {
|
|
15
|
+
safe: boolean;
|
|
16
|
+
instanceCount: number;
|
|
17
|
+
reason?: string;
|
|
18
|
+
instances?: HTMLElement[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if it's safe to edit this element (single instance)
|
|
22
|
+
* Returns warning info if multiple instances exist
|
|
23
|
+
*/
|
|
24
|
+
export declare function isSafeToEdit(element: HTMLElement): SafeEditResult;
|
|
25
|
+
/**
|
|
26
|
+
* Check if element is likely from a loop/map based on siblings with same id
|
|
27
|
+
*/
|
|
28
|
+
export declare function isLikelyFromLoop(element: HTMLElement): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get a descriptive message based on instance count
|
|
31
|
+
*/
|
|
32
|
+
export declare function getInstanceWarningMessage(count: number, labels?: {
|
|
33
|
+
singleInstance?: string;
|
|
34
|
+
multipleInstances?: string;
|
|
35
|
+
loopWarning?: string;
|
|
36
|
+
}): string;
|
|
37
|
+
//# sourceMappingURL=instanceDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceDetection.d.ts","sourceRoot":"","sources":["../../src/utils/instanceDetection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAYrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAY1E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAkBjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAc9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE;IACP,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,MAAM,CASR"}
|