@punica/form 1.1.8 → 1.1.10
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/controller/index.js +15 -1
- package/dist/utils/devtools.js +20 -4
- package/package.json +2 -2
package/dist/controller/index.js
CHANGED
|
@@ -37,12 +37,21 @@ class FormController extends common_1.BaseListener {
|
|
|
37
37
|
* @param data Data associated with the event
|
|
38
38
|
*/
|
|
39
39
|
this.fireEvent = (eventType, data) => {
|
|
40
|
+
var _a, _b;
|
|
40
41
|
this.trigger(eventType, data);
|
|
41
42
|
const devTools = (0, __1.getDevToolsBridge)();
|
|
42
|
-
|
|
43
|
+
const isEnabled = devTools.isEnabled();
|
|
44
|
+
if (typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'development') {
|
|
45
|
+
console.log('🔥 FormController.fireEvent:', eventType, {
|
|
46
|
+
devToolsEnabled: isEnabled,
|
|
47
|
+
hasData: !!data
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (isEnabled) {
|
|
43
51
|
switch (eventType) {
|
|
44
52
|
case 'UPDATE_FORM':
|
|
45
53
|
devTools.sendUpdate(__classPrivateFieldGet(this, _FormController_form, "f"));
|
|
54
|
+
// Also send entity update
|
|
46
55
|
this.sendEntityToDevTools();
|
|
47
56
|
break;
|
|
48
57
|
case 'RESET':
|
|
@@ -56,6 +65,11 @@ class FormController extends common_1.BaseListener {
|
|
|
56
65
|
break;
|
|
57
66
|
}
|
|
58
67
|
}
|
|
68
|
+
else {
|
|
69
|
+
if (typeof process !== 'undefined' && ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'development') {
|
|
70
|
+
console.warn('⚠️ FormController: DevTools bridge is disabled. Event not sent:', eventType);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
59
73
|
};
|
|
60
74
|
/**
|
|
61
75
|
* Send entity data to DevTools
|
package/dist/utils/devtools.js
CHANGED
|
@@ -49,8 +49,12 @@ class DevToolsBridge {
|
|
|
49
49
|
* Send message to DevTools extension
|
|
50
50
|
*/
|
|
51
51
|
sendMessage(type, data, formItemKey) {
|
|
52
|
-
var _a;
|
|
52
|
+
var _a, _b, _c;
|
|
53
53
|
if (!this.isEnabled()) {
|
|
54
|
+
if (typeof process !== 'undefined' &&
|
|
55
|
+
((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'development') {
|
|
56
|
+
console.warn('⚠️ Punica Form DevTools: Bridge is DISABLED. Event not sent:', type);
|
|
57
|
+
}
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
56
60
|
try {
|
|
@@ -60,12 +64,24 @@ class DevToolsBridge {
|
|
|
60
64
|
...(formItemKey && { formItemKey })
|
|
61
65
|
};
|
|
62
66
|
window.postMessage(message, '*');
|
|
67
|
+
// Log in development for debugging
|
|
68
|
+
if (typeof process !== 'undefined' &&
|
|
69
|
+
((_b = process.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'development') {
|
|
70
|
+
console.log('📤 Punica Form DevTools: Sending event', type, {
|
|
71
|
+
hasData: !!data,
|
|
72
|
+
hasFormItemKey: !!formItemKey,
|
|
73
|
+
dataType: typeof data,
|
|
74
|
+
dataKeys: data && typeof data === 'object'
|
|
75
|
+
? Object.keys(data).slice(0, 5)
|
|
76
|
+
: null
|
|
77
|
+
});
|
|
78
|
+
}
|
|
63
79
|
}
|
|
64
80
|
catch (error) {
|
|
65
81
|
// Silently fail in production
|
|
66
82
|
if (typeof process !== 'undefined' &&
|
|
67
|
-
((
|
|
68
|
-
console.warn('Punica Form DevTools: Failed to send message', error);
|
|
83
|
+
((_c = process.env) === null || _c === void 0 ? void 0 : _c.NODE_ENV) === 'development') {
|
|
84
|
+
console.warn('❌ Punica Form DevTools: Failed to send message', error);
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
87
|
}
|
|
@@ -85,7 +101,7 @@ class DevToolsBridge {
|
|
|
85
101
|
* Send form update event
|
|
86
102
|
*/
|
|
87
103
|
sendUpdate(form) {
|
|
88
|
-
this.sendMessage('
|
|
104
|
+
this.sendMessage('UPDATE_FORM', form);
|
|
89
105
|
}
|
|
90
106
|
/**
|
|
91
107
|
* Send form reset event
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punica/form",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "Form",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Uryan Sezgin TEKE",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"@punica/common": "^1.0.1",
|
|
37
37
|
"@punica/util": "^1.0.2"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "110f0d8548d6db85b9cb35d60a6709f18b644e0c"
|
|
40
40
|
}
|