@punica/form 1.1.10 → 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.
@@ -37,16 +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' && ((_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
43
  if (isEnabled) {
51
44
  switch (eventType) {
52
45
  case 'UPDATE_FORM':
@@ -65,11 +58,6 @@ class FormController extends common_1.BaseListener {
65
58
  break;
66
59
  }
67
60
  }
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
- }
73
61
  };
74
62
  /**
75
63
  * Send entity data to DevTools
@@ -5,7 +5,6 @@ import { Form, FormItem } from '../model';
5
5
  declare class DevToolsBridge {
6
6
  private static instance;
7
7
  private enabled;
8
- private constructor();
9
8
  /**
10
9
  * Get singleton instance
11
10
  */
@@ -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
- 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
- });
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.10",
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": "110f0d8548d6db85b9cb35d60a6709f18b644e0c"
39
+ "gitHead": "b5c408308c84a7f81cbdd77bfaebc8fc6e7d243a"
40
40
  }