@promakeai/inspector-hook 1.5.1 → 1.7.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/index.d.ts.map +1 -1
- package/dist/index.js +56 -0
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,sBAAsB,EAEtB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,sBAAsB,EAEtB,kBAAkB,EAkBnB,MAAM,4BAA4B,CAAC;AA+KpC,wBAAgB,YAAY,CAC1B,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,EACvC,SAAS,CAAC,EAAE,kBAAkB,EAC9B,MAAM,CAAC,EAAE,eAAe,EACxB,KAAK,CAAC,EAAE,cAAc,EACtB,aAAa,CAAC,EAAE,sBAAsB,GACrC,kBAAkB,CAwpBpB;AAGD,YAAY,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -119,6 +119,27 @@ export function useInspector(iframeRef, callbacks, labels, theme, initialConfig)
|
|
|
119
119
|
show: show,
|
|
120
120
|
});
|
|
121
121
|
}, [sendMessage]);
|
|
122
|
+
/**
|
|
123
|
+
* Show or hide custom tab
|
|
124
|
+
*/
|
|
125
|
+
const showCustomTab = useCallback((show) => {
|
|
126
|
+
sendMessage({
|
|
127
|
+
type: "SHOW_CUSTOM_TAB",
|
|
128
|
+
show: show,
|
|
129
|
+
});
|
|
130
|
+
}, [sendMessage]);
|
|
131
|
+
/**
|
|
132
|
+
* Set custom fields for an element
|
|
133
|
+
*/
|
|
134
|
+
const setCustomFields = useCallback((elementId, fields) => {
|
|
135
|
+
sendMessage({
|
|
136
|
+
type: "SET_CUSTOM_FIELDS",
|
|
137
|
+
data: {
|
|
138
|
+
elementId,
|
|
139
|
+
fields,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}, [sendMessage]);
|
|
122
143
|
/**
|
|
123
144
|
* Show or hide "Built with Promake" badge
|
|
124
145
|
*/
|
|
@@ -311,6 +332,33 @@ export function useInspector(iframeRef, callbacks, labels, theme, initialConfig)
|
|
|
311
332
|
});
|
|
312
333
|
}
|
|
313
334
|
}
|
|
335
|
+
// Also trigger onCustomUpdated if there are custom changes
|
|
336
|
+
if (callbacks?.onCustomUpdated) {
|
|
337
|
+
const customChanges = messageData.data.changes.filter((c) => c.type === "custom");
|
|
338
|
+
if (customChanges.length > 0) {
|
|
339
|
+
customChanges.forEach((change) => {
|
|
340
|
+
if (change.custom) {
|
|
341
|
+
// Extract only changed values
|
|
342
|
+
const changedValues = {};
|
|
343
|
+
Object.keys(change.custom.current).forEach((key) => {
|
|
344
|
+
const currentVal = change.custom.current[key];
|
|
345
|
+
const previousVal = change.custom.previous[key];
|
|
346
|
+
if (currentVal !== previousVal) {
|
|
347
|
+
changedValues[key] = currentVal;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
callbacks.onCustomUpdated({
|
|
351
|
+
element: change.element,
|
|
352
|
+
changes: changedValues,
|
|
353
|
+
groupId: change.custom.groupId,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
case "INSPECTOR_CUSTOM_UPDATED":
|
|
361
|
+
callbacks?.onCustomUpdated?.(messageData.data);
|
|
314
362
|
break;
|
|
315
363
|
case "INSPECTOR_GO_TO_CODE":
|
|
316
364
|
callbacks?.onGoToCode?.(messageData.data);
|
|
@@ -414,6 +462,12 @@ export function useInspector(iframeRef, callbacks, labels, theme, initialConfig)
|
|
|
414
462
|
show: initialConfig.showDatabaseTab,
|
|
415
463
|
});
|
|
416
464
|
}
|
|
465
|
+
if (initialConfig.showCustomTab !== undefined) {
|
|
466
|
+
sendMessage({
|
|
467
|
+
type: "SHOW_CUSTOM_TAB",
|
|
468
|
+
show: initialConfig.showCustomTab,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
417
471
|
if (initialConfig.showChildBorders !== undefined) {
|
|
418
472
|
sendMessage({
|
|
419
473
|
type: "SET_SHOW_CHILD_BORDERS",
|
|
@@ -477,6 +531,8 @@ export function useInspector(iframeRef, callbacks, labels, theme, initialConfig)
|
|
|
477
531
|
setIsResizable,
|
|
478
532
|
showImagesTab,
|
|
479
533
|
showDatabaseTab,
|
|
534
|
+
showCustomTab,
|
|
535
|
+
setCustomFields,
|
|
480
536
|
};
|
|
481
537
|
}
|
|
482
538
|
// Export utility functions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promakeai/inspector-hook",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "React hook for controlling inspector in parent applications",
|
|
5
5
|
"author": "Promake",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@promakeai/inspector-types": "1.
|
|
48
|
+
"@promakeai/inspector-types": "1.7.0",
|
|
49
49
|
"vitest": "^1.0.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|