@punica/form 1.1.11 → 1.1.12
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 +0 -14
- package/dist/utils/devtools.d.ts +0 -1
- package/dist/utils/devtools.js +11 -33
- package/package.json +2 -2
package/dist/controller/index.js
CHANGED
|
@@ -37,17 +37,9 @@ 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;
|
|
41
40
|
this.trigger(eventType, data);
|
|
42
41
|
const devTools = (0, __1.getDevToolsBridge)();
|
|
43
42
|
const isEnabled = devTools.isEnabled();
|
|
44
|
-
if (typeof process !== 'undefined' &&
|
|
45
|
-
((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'development') {
|
|
46
|
-
console.log('🔥 FormController.fireEvent:', eventType, {
|
|
47
|
-
devToolsEnabled: isEnabled,
|
|
48
|
-
hasData: !!data
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
43
|
if (isEnabled) {
|
|
52
44
|
switch (eventType) {
|
|
53
45
|
case 'UPDATE_FORM':
|
|
@@ -66,12 +58,6 @@ class FormController extends common_1.BaseListener {
|
|
|
66
58
|
break;
|
|
67
59
|
}
|
|
68
60
|
}
|
|
69
|
-
else {
|
|
70
|
-
if (typeof process !== 'undefined' &&
|
|
71
|
-
((_b = process.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'development') {
|
|
72
|
-
console.warn('⚠️ FormController: DevTools bridge is disabled. Event not sent:', eventType);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
61
|
};
|
|
76
62
|
/**
|
|
77
63
|
* Send entity data to DevTools
|
package/dist/utils/devtools.d.ts
CHANGED
package/dist/utils/devtools.js
CHANGED
|
@@ -6,17 +6,7 @@ exports.isDevToolsEnabled = exports.disableDevTools = exports.enableDevTools = e
|
|
|
6
6
|
*/
|
|
7
7
|
class DevToolsBridge {
|
|
8
8
|
constructor() {
|
|
9
|
-
var _a;
|
|
10
9
|
this.enabled = false;
|
|
11
|
-
// Check if we're in a browser environment
|
|
12
|
-
if (typeof window !== 'undefined') {
|
|
13
|
-
// Enable by default in development
|
|
14
|
-
// Check for NODE_ENV or global flag
|
|
15
|
-
const isDevelopment = (typeof process !== 'undefined' &&
|
|
16
|
-
((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'development') ||
|
|
17
|
-
window.__PUNICA_FORM_DEVTOOLS__ === true;
|
|
18
|
-
this.enabled = isDevelopment;
|
|
19
|
-
}
|
|
20
10
|
}
|
|
21
11
|
/**
|
|
22
12
|
* Get singleton instance
|
|
@@ -49,40 +39,28 @@ class DevToolsBridge {
|
|
|
49
39
|
* Send message to DevTools extension
|
|
50
40
|
*/
|
|
51
41
|
sendMessage(type, data, formItemKey) {
|
|
52
|
-
var _a, _b, _c;
|
|
53
42
|
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
|
-
}
|
|
58
43
|
return;
|
|
59
44
|
}
|
|
45
|
+
console.log('🔥 DevToolsBridge.sendMessage:', type, data, formItemKey);
|
|
60
46
|
try {
|
|
61
47
|
const message = {
|
|
62
48
|
type,
|
|
63
|
-
data
|
|
64
|
-
...(formItemKey && { formItemKey })
|
|
49
|
+
data: JSON.stringify(data)
|
|
65
50
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
? Object.keys(data).slice(0, 5)
|
|
76
|
-
: null
|
|
77
|
-
});
|
|
51
|
+
// Try multiple ways to send message to ensure it reaches content script
|
|
52
|
+
try {
|
|
53
|
+
window.postMessage(message, '*');
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
// Fallback: try with current window
|
|
57
|
+
if (typeof window !== 'undefined') {
|
|
58
|
+
window.postMessage(message, '*');
|
|
59
|
+
}
|
|
78
60
|
}
|
|
79
61
|
}
|
|
80
62
|
catch (error) {
|
|
81
63
|
// Silently fail in production
|
|
82
|
-
if (typeof process !== 'undefined' &&
|
|
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);
|
|
85
|
-
}
|
|
86
64
|
}
|
|
87
65
|
}
|
|
88
66
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punica/form",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
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": "b5c408308c84a7f81cbdd77bfaebc8fc6e7d243a"
|
|
40
40
|
}
|