@promakeai/inspector 0.2.1 → 1.0.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.
Files changed (170) hide show
  1. package/dist/inspector.css +1 -0
  2. package/dist/inspector.js +8740 -0
  3. package/dist/packages/inspector/src/App.d.ts +5 -0
  4. package/dist/packages/inspector/src/App.d.ts.map +1 -0
  5. package/dist/packages/inspector/src/__tests__/App.test.d.ts +5 -0
  6. package/dist/packages/inspector/src/__tests__/App.test.d.ts.map +1 -0
  7. package/dist/packages/inspector/src/components/Badge.d.ts +9 -0
  8. package/dist/packages/inspector/src/components/Badge.d.ts.map +1 -0
  9. package/dist/packages/inspector/src/components/ControlBox/ContentArea.d.ts +10 -0
  10. package/dist/packages/inspector/src/components/ControlBox/ContentArea.d.ts.map +1 -0
  11. package/dist/packages/inspector/src/components/ControlBox/PromptInput.d.ts +12 -0
  12. package/dist/packages/inspector/src/components/ControlBox/PromptInput.d.ts.map +1 -0
  13. package/dist/packages/inspector/src/components/ControlBox/index.d.ts +21 -0
  14. package/dist/packages/inspector/src/components/ControlBox/index.d.ts.map +1 -0
  15. package/dist/packages/inspector/src/components/ImageEditor/UploadBox.d.ts +10 -0
  16. package/dist/packages/inspector/src/components/ImageEditor/UploadBox.d.ts.map +1 -0
  17. package/dist/packages/inspector/src/components/ImageEditor/index.d.ts +11 -0
  18. package/dist/packages/inspector/src/components/ImageEditor/index.d.ts.map +1 -0
  19. package/dist/packages/inspector/src/components/Overlay.d.ts +11 -0
  20. package/dist/packages/inspector/src/components/Overlay.d.ts.map +1 -0
  21. package/dist/packages/inspector/src/components/StyleEditor/BorderSection.d.ts +13 -0
  22. package/dist/packages/inspector/src/components/StyleEditor/BorderSection.d.ts.map +1 -0
  23. package/dist/packages/inspector/src/components/StyleEditor/ColorPicker.d.ts +13 -0
  24. package/dist/packages/inspector/src/components/StyleEditor/ColorPicker.d.ts.map +1 -0
  25. package/dist/packages/inspector/src/components/StyleEditor/DisplaySection.d.ts +13 -0
  26. package/dist/packages/inspector/src/components/StyleEditor/DisplaySection.d.ts.map +1 -0
  27. package/dist/packages/inspector/src/components/StyleEditor/ImageSection.d.ts +13 -0
  28. package/dist/packages/inspector/src/components/StyleEditor/ImageSection.d.ts.map +1 -0
  29. package/dist/packages/inspector/src/components/StyleEditor/LayoutSection.d.ts +13 -0
  30. package/dist/packages/inspector/src/components/StyleEditor/LayoutSection.d.ts.map +1 -0
  31. package/dist/packages/inspector/src/components/StyleEditor/NumberInput.d.ts +17 -0
  32. package/dist/packages/inspector/src/components/StyleEditor/NumberInput.d.ts.map +1 -0
  33. package/dist/packages/inspector/src/components/StyleEditor/SliderInput.d.ts +16 -0
  34. package/dist/packages/inspector/src/components/StyleEditor/SliderInput.d.ts.map +1 -0
  35. package/dist/packages/inspector/src/components/StyleEditor/SpacingSection.d.ts +13 -0
  36. package/dist/packages/inspector/src/components/StyleEditor/SpacingSection.d.ts.map +1 -0
  37. package/dist/packages/inspector/src/components/StyleEditor/TextSection.d.ts +13 -0
  38. package/dist/packages/inspector/src/components/StyleEditor/TextSection.d.ts.map +1 -0
  39. package/dist/packages/inspector/src/components/StyleEditor/index.d.ts +12 -0
  40. package/dist/packages/inspector/src/components/StyleEditor/index.d.ts.map +1 -0
  41. package/dist/packages/inspector/src/components/TextEditor/index.d.ts +11 -0
  42. package/dist/packages/inspector/src/components/TextEditor/index.d.ts.map +1 -0
  43. package/dist/packages/inspector/src/components/ui/CustomCollapsible.d.ts +26 -0
  44. package/dist/packages/inspector/src/components/ui/CustomCollapsible.d.ts.map +1 -0
  45. package/dist/packages/inspector/src/components/ui/button.d.ts +9 -0
  46. package/dist/packages/inspector/src/components/ui/button.d.ts.map +1 -0
  47. package/dist/packages/inspector/src/components/ui/color-picker.d.ts +10 -0
  48. package/dist/packages/inspector/src/components/ui/color-picker.d.ts.map +1 -0
  49. package/dist/packages/inspector/src/components/ui/input.d.ts +6 -0
  50. package/dist/packages/inspector/src/components/ui/input.d.ts.map +1 -0
  51. package/dist/packages/inspector/src/components/ui/popover.d.ts +8 -0
  52. package/dist/packages/inspector/src/components/ui/popover.d.ts.map +1 -0
  53. package/dist/packages/inspector/src/components/ui/select.d.ts +16 -0
  54. package/dist/packages/inspector/src/components/ui/select.d.ts.map +1 -0
  55. package/dist/packages/inspector/src/components/ui/slider.d.ts +5 -0
  56. package/dist/packages/inspector/src/components/ui/slider.d.ts.map +1 -0
  57. package/dist/packages/inspector/src/components/ui/textarea.d.ts +4 -0
  58. package/dist/packages/inspector/src/components/ui/textarea.d.ts.map +1 -0
  59. package/dist/packages/inspector/src/components/ui/tooltip.d.ts +8 -0
  60. package/dist/packages/inspector/src/components/ui/tooltip.d.ts.map +1 -0
  61. package/dist/packages/inspector/src/core/highlighter.d.ts +40 -0
  62. package/dist/packages/inspector/src/core/highlighter.d.ts.map +1 -0
  63. package/dist/packages/inspector/src/hooks/useMessageBridge.d.ts +9 -0
  64. package/dist/packages/inspector/src/hooks/useMessageBridge.d.ts.map +1 -0
  65. package/dist/packages/inspector/src/hooks/useStylePreview.d.ts +11 -0
  66. package/dist/packages/inspector/src/hooks/useStylePreview.d.ts.map +1 -0
  67. package/dist/packages/inspector/src/index.d.ts +16 -0
  68. package/dist/packages/inspector/src/index.d.ts.map +1 -0
  69. package/dist/packages/inspector/src/lib/utils.d.ts +3 -0
  70. package/dist/packages/inspector/src/lib/utils.d.ts.map +1 -0
  71. package/dist/packages/inspector/src/plugin.d.ts +4 -0
  72. package/dist/packages/inspector/src/plugin.d.ts.map +1 -0
  73. package/dist/packages/inspector/src/store/useInspectorStore.d.ts +13 -0
  74. package/dist/packages/inspector/src/store/useInspectorStore.d.ts.map +1 -0
  75. package/dist/packages/inspector/src/styles.d.ts +5 -0
  76. package/dist/packages/inspector/src/styles.d.ts.map +1 -0
  77. package/dist/packages/inspector/src/utils/colorUtils.d.ts +49 -0
  78. package/dist/packages/inspector/src/utils/colorUtils.d.ts.map +1 -0
  79. package/dist/packages/inspector/src/utils/elementNames.d.ts +7 -0
  80. package/dist/packages/inspector/src/utils/elementNames.d.ts.map +1 -0
  81. package/dist/packages/inspector/src/utils/elementUtils.d.ts +28 -0
  82. package/dist/packages/inspector/src/utils/elementUtils.d.ts.map +1 -0
  83. package/dist/packages/inspector/src/utils/errorTracker.d.ts +48 -0
  84. package/dist/packages/inspector/src/utils/errorTracker.d.ts.map +1 -0
  85. package/dist/packages/inspector/src/utils/inputStyles.d.ts +23 -0
  86. package/dist/packages/inspector/src/utils/inputStyles.d.ts.map +1 -0
  87. package/dist/packages/inspector/src/utils/styleUtils.d.ts +27 -0
  88. package/dist/packages/inspector/src/utils/styleUtils.d.ts.map +1 -0
  89. package/dist/packages/inspector/src/utils/tailwindMapper.d.ts +9 -0
  90. package/dist/packages/inspector/src/utils/tailwindMapper.d.ts.map +1 -0
  91. package/dist/packages/inspector/src/utils/urlTracker.d.ts +27 -0
  92. package/dist/packages/inspector/src/utils/urlTracker.d.ts.map +1 -0
  93. package/dist/packages/inspector/tsconfig.tsbuildinfo +1 -0
  94. package/dist/plugin.js +10 -1813
  95. package/package.json +86 -76
  96. package/src/App.tsx +912 -0
  97. package/src/__tests__/App.test.tsx +373 -0
  98. package/src/assets/fonts/Satoshi-Variable.woff +0 -0
  99. package/src/assets/fonts/Satoshi-Variable.woff2 +0 -0
  100. package/src/components/Badge.tsx +118 -0
  101. package/src/components/ControlBox/ContentArea.tsx +13 -0
  102. package/src/components/ControlBox/PromptInput.module.css +66 -0
  103. package/src/components/ControlBox/PromptInput.tsx +104 -0
  104. package/src/components/ControlBox/index.module.css +81 -0
  105. package/src/components/ControlBox/index.tsx +409 -0
  106. package/src/components/ImageEditor/UploadBox.module.css +69 -0
  107. package/src/components/ImageEditor/UploadBox.tsx +113 -0
  108. package/src/components/ImageEditor/index.module.css +11 -0
  109. package/src/components/ImageEditor/index.tsx +84 -0
  110. package/src/components/Overlay.tsx +157 -0
  111. package/src/components/StyleEditor/BorderSection.tsx +147 -0
  112. package/src/components/StyleEditor/ColorPicker.tsx +182 -0
  113. package/src/components/StyleEditor/DisplaySection.tsx +349 -0
  114. package/src/components/StyleEditor/ImageSection.tsx +105 -0
  115. package/src/components/StyleEditor/LayoutSection.tsx +63 -0
  116. package/src/components/StyleEditor/NumberInput.tsx +138 -0
  117. package/src/components/StyleEditor/SliderInput.tsx +121 -0
  118. package/src/components/StyleEditor/SpacingSection.tsx +365 -0
  119. package/src/components/StyleEditor/TextSection.tsx +381 -0
  120. package/src/components/StyleEditor/index.module.css +133 -0
  121. package/src/components/StyleEditor/index.tsx +612 -0
  122. package/src/components/StyleEditor/shared.module.css +193 -0
  123. package/src/components/TextEditor/index.module.css +31 -0
  124. package/src/components/TextEditor/index.tsx +166 -0
  125. package/src/components/ui/CustomCollapsible.tsx +159 -0
  126. package/src/components/ui/button.module.css +141 -0
  127. package/src/components/ui/button.tsx +73 -0
  128. package/src/components/ui/color-picker.module.css +112 -0
  129. package/src/components/ui/color-picker.tsx +146 -0
  130. package/src/components/ui/input.module.css +49 -0
  131. package/src/components/ui/input.tsx +34 -0
  132. package/src/components/ui/popover.module.css +42 -0
  133. package/src/components/ui/popover.tsx +59 -0
  134. package/src/components/ui/select.module.css +160 -0
  135. package/src/components/ui/select.tsx +216 -0
  136. package/src/components/ui/slider.module.css +75 -0
  137. package/src/components/ui/slider.tsx +60 -0
  138. package/src/components/ui/textarea.module.css +30 -0
  139. package/src/components/ui/textarea.tsx +23 -0
  140. package/src/components/ui/tooltip.module.css +11 -0
  141. package/src/components/ui/tooltip.tsx +37 -0
  142. package/src/core/highlighter.ts +197 -0
  143. package/src/hooks/useMessageBridge.ts +49 -0
  144. package/src/hooks/useStylePreview.ts +332 -0
  145. package/src/index.ts +20 -0
  146. package/src/lib/utils.ts +5 -0
  147. package/src/plugin.ts +11 -0
  148. package/src/store/useInspectorStore.ts +235 -0
  149. package/src/styles/fonts.css +15 -0
  150. package/src/styles/global.css +138 -0
  151. package/src/styles/variables.css +151 -0
  152. package/src/styles.ts +5 -0
  153. package/src/utils/colorUtils.ts +133 -0
  154. package/src/utils/elementNames.ts +103 -0
  155. package/src/utils/elementUtils.ts +90 -0
  156. package/src/utils/errorTracker.ts +186 -0
  157. package/src/utils/inputStyles.ts +30 -0
  158. package/src/utils/styleUtils.ts +226 -0
  159. package/src/utils/tailwindMapper.ts +554 -0
  160. package/src/utils/urlTracker.ts +75 -0
  161. package/src/vite-env.d.ts +7 -0
  162. package/README.md +0 -866
  163. package/dist/hook.d.ts +0 -115
  164. package/dist/hook.d.ts.map +0 -1
  165. package/dist/hook.js +0 -288
  166. package/dist/plugin.d.ts +0 -44
  167. package/dist/plugin.d.ts.map +0 -1
  168. package/dist/types.d.ts +0 -139
  169. package/dist/types.d.ts.map +0 -1
  170. package/dist/types.js +0 -7
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Error Tracker - Captures and reports all types of errors
3
+ */
4
+
5
+ export interface ErrorData {
6
+ type: "javascript" | "promise" | "console" | "vite";
7
+ message: string;
8
+ stack?: string;
9
+ fileName?: string;
10
+ lineNumber?: number;
11
+ columnNumber?: number;
12
+ frame?: string;
13
+ plugin?: string;
14
+ }
15
+
16
+ export type ErrorCallback = (error: ErrorData) => void;
17
+
18
+ export class ErrorTracker {
19
+ private callback: ErrorCallback;
20
+ private viteObserver: MutationObserver | null = null;
21
+
22
+ constructor(callback: ErrorCallback) {
23
+ this.callback = callback;
24
+ }
25
+
26
+ /**
27
+ * Start tracking all error types
28
+ */
29
+ start() {
30
+ this.trackJavaScriptErrors();
31
+ this.trackPromiseRejections();
32
+ this.trackConsoleErrors();
33
+ this.trackViteErrors();
34
+ }
35
+
36
+ /**
37
+ * Stop tracking all errors
38
+ */
39
+ stop() {
40
+ // Note: Can't remove window.onerror/onunhandledrejection once set
41
+ // But can stop Vite observer
42
+ if (this.viteObserver) {
43
+ this.viteObserver.disconnect();
44
+ this.viteObserver = null;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Track JavaScript runtime errors
50
+ */
51
+ private trackJavaScriptErrors() {
52
+ window.addEventListener("error", (event) => {
53
+ // Ignore errors from inspector itself
54
+ if (
55
+ event.filename?.includes("inspector") ||
56
+ event.error?.stack?.includes("inspector")
57
+ ) {
58
+ return;
59
+ }
60
+
61
+ this.callback({
62
+ type: "javascript",
63
+ message: event.message,
64
+ stack: event.error?.stack,
65
+ fileName: event.filename,
66
+ lineNumber: event.lineno,
67
+ columnNumber: event.colno,
68
+ });
69
+ });
70
+ }
71
+
72
+ /**
73
+ * Track unhandled promise rejections
74
+ */
75
+ private trackPromiseRejections() {
76
+ window.addEventListener("unhandledrejection", (event) => {
77
+ const error = event.reason;
78
+
79
+ this.callback({
80
+ type: "promise",
81
+ message: error?.message || String(event.reason),
82
+ stack: error?.stack,
83
+ fileName: error?.fileName,
84
+ lineNumber: error?.lineNumber,
85
+ columnNumber: error?.columnNumber,
86
+ });
87
+ });
88
+ }
89
+
90
+ /**
91
+ * Track console.error calls
92
+ */
93
+ private trackConsoleErrors() {
94
+ const originalError = console.error;
95
+
96
+ console.error = (...args: any[]) => {
97
+ // Call original console.error
98
+ originalError.apply(console, args);
99
+
100
+ // Extract error info
101
+ const message = args
102
+ .map((arg) =>
103
+ typeof arg === "object" ? JSON.stringify(arg) : String(arg)
104
+ )
105
+ .join(" ");
106
+
107
+ // Check if first arg is an Error object
108
+ const errorObj = args.find((arg) => arg instanceof Error);
109
+
110
+ this.callback({
111
+ type: "console",
112
+ message,
113
+ stack: errorObj?.stack,
114
+ fileName: (errorObj as any)?.fileName,
115
+ lineNumber: (errorObj as any)?.lineNumber,
116
+ columnNumber: (errorObj as any)?.columnNumber,
117
+ });
118
+ };
119
+ }
120
+
121
+ /**
122
+ * Track Vite dev server errors
123
+ */
124
+ private trackViteErrors() {
125
+ // Watch for Vite error overlay
126
+ this.viteObserver = new MutationObserver((mutations) => {
127
+ mutations.forEach((mutation) => {
128
+ mutation.addedNodes.forEach((node) => {
129
+ if (node.nodeType === 1) {
130
+ const element = node as Element;
131
+
132
+ // Check if it's Vite error overlay
133
+ if (element.tagName === "VITE-ERROR-OVERLAY") {
134
+ this.parseViteError(element);
135
+ }
136
+ }
137
+ });
138
+ });
139
+ });
140
+
141
+ this.viteObserver.observe(document.body, {
142
+ childList: true,
143
+ subtree: true,
144
+ });
145
+ }
146
+
147
+ /**
148
+ * Parse Vite error overlay content
149
+ */
150
+ private parseViteError(overlay: Element) {
151
+ try {
152
+ // Access shadow DOM
153
+ const shadowRoot = overlay.shadowRoot;
154
+ if (!shadowRoot) return;
155
+
156
+ // Extract error message
157
+ const messageEl = shadowRoot.querySelector(".message-body");
158
+ const message = messageEl?.textContent?.trim() || "Vite error";
159
+
160
+ // Extract file info
161
+ const fileEl = shadowRoot.querySelector(".file");
162
+ const fileText = fileEl?.textContent?.trim() || "";
163
+ const fileMatch = fileText.match(/(.+):(\d+):(\d+)/);
164
+
165
+ // Extract code frame
166
+ const frameEl = shadowRoot.querySelector(".frame");
167
+ const frame = frameEl?.textContent?.trim();
168
+
169
+ // Extract plugin name if available
170
+ const pluginEl = shadowRoot.querySelector(".plugin");
171
+ const plugin = pluginEl?.textContent?.trim();
172
+
173
+ this.callback({
174
+ type: "vite",
175
+ message,
176
+ fileName: fileMatch?.[1],
177
+ lineNumber: fileMatch?.[2] ? parseInt(fileMatch[2]) : undefined,
178
+ columnNumber: fileMatch?.[3] ? parseInt(fileMatch[3]) : undefined,
179
+ frame,
180
+ plugin,
181
+ });
182
+ } catch (error) {
183
+ console.error("Failed to parse Vite error:", error);
184
+ }
185
+ }
186
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Central input styling utilities
3
+ */
4
+
5
+ import type { InspectorTheme } from "@promakeai/inspector-types";
6
+
7
+ export const getInputContainerStyles = (theme: InspectorTheme) => ({
8
+ backgroundColor: theme.inputBackgroundColor,
9
+ borderColor: theme.inputBorderColor,
10
+ });
11
+
12
+ export const getInputStyles = (theme: InspectorTheme) => ({
13
+ backgroundColor: "transparent",
14
+ color: theme.inputTextColor,
15
+ });
16
+
17
+ export const getLabelStyles = (theme: InspectorTheme) => ({
18
+ color: theme.secondaryTextColor,
19
+ });
20
+
21
+ export const getSectionTitleStyles = (theme: InspectorTheme) => ({
22
+ color: theme.textColor,
23
+ });
24
+
25
+ // Common class names for consistent sizing
26
+ export const INPUT_CONTAINER_CLASSES = "rounded-lg px-2 py-1 shadow-sm border";
27
+ export const INPUT_CLASSES = "text-xs border-none shadow-none focus-visible:ring-0 focus-visible:outline-none h-7 px-1.5";
28
+ export const LABEL_CLASSES = "block text-xs mb-1";
29
+ export const SECTION_TITLE_CLASSES = "text-sm font-semibold mb-2";
30
+
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Style utility functions for parsing and converting styles
3
+ */
4
+
5
+ import type { StyleChanges } from "@promakeai/inspector-types";
6
+
7
+ /**
8
+ * Normalize font family to one of our supported values
9
+ */
10
+ function normalizeFontFamily(fontFamily: string): string {
11
+ const lower = fontFamily.toLowerCase();
12
+ if (
13
+ lower.includes("monospace") ||
14
+ lower.includes("courier") ||
15
+ lower.includes("consolas")
16
+ ) {
17
+ return "monospace";
18
+ }
19
+ if (lower.includes("serif") || lower.includes("times")) {
20
+ return "serif";
21
+ }
22
+ return "sans-serif"; // default
23
+ }
24
+
25
+ /**
26
+ * Get element's own styles (inline + className styles) for input prefill
27
+ * Returns only explicitly defined styles, not inherited/computed defaults
28
+ */
29
+ export function getElementOwnStyles(element: HTMLElement): StyleChanges {
30
+ const computed = window.getComputedStyle(element);
31
+
32
+ // Get inline styles if present, otherwise use computed from classNames
33
+ return {
34
+ // Layout
35
+ backgroundColor: element.style.backgroundColor || computed.backgroundColor,
36
+ height:
37
+ element.style.height ||
38
+ (computed.height !== "auto" ? computed.height : ""),
39
+ width:
40
+ element.style.width || (computed.width !== "auto" ? computed.width : ""),
41
+ display: element.style.display || computed.display,
42
+ opacity: element.style.opacity || computed.opacity,
43
+ flex: element.style.flex || computed.flex,
44
+ flexDirection: element.style.flexDirection || computed.flexDirection,
45
+ justifyContent: element.style.justifyContent || computed.justifyContent,
46
+ alignItems: element.style.alignItems || computed.alignItems,
47
+
48
+ // Image
49
+ objectFit: element.style.objectFit || computed.objectFit,
50
+
51
+ // Text
52
+ color: element.style.color || computed.color,
53
+ fontSize: element.style.fontSize || computed.fontSize,
54
+ fontWeight: element.style.fontWeight || computed.fontWeight,
55
+ fontFamily:
56
+ element.style.fontFamily || normalizeFontFamily(computed.fontFamily),
57
+ textAlign: element.style.textAlign || computed.textAlign,
58
+ textDecoration: element.style.textDecoration || computed.textDecoration,
59
+
60
+ // Border
61
+ borderRadius: element.style.borderRadius || computed.borderRadius,
62
+ borderWidth: element.style.borderWidth || computed.borderWidth,
63
+ borderColor: element.style.borderColor || computed.borderColor,
64
+ borderStyle: element.style.borderStyle || computed.borderStyle,
65
+
66
+ // Spacing - Vertical/Horizontal (combined)
67
+ paddingVertical: element.style.paddingTop || computed.paddingTop,
68
+ paddingHorizontal: element.style.paddingLeft || computed.paddingLeft,
69
+ marginVertical: element.style.marginTop || computed.marginTop,
70
+ marginHorizontal: element.style.marginLeft || computed.marginLeft,
71
+
72
+ // Spacing - Individual sides
73
+ paddingTop: element.style.paddingTop || computed.paddingTop,
74
+ paddingRight: element.style.paddingRight || computed.paddingRight,
75
+ paddingBottom: element.style.paddingBottom || computed.paddingBottom,
76
+ paddingLeft: element.style.paddingLeft || computed.paddingLeft,
77
+ marginTop: element.style.marginTop || computed.marginTop,
78
+ marginRight: element.style.marginRight || computed.marginRight,
79
+ marginBottom: element.style.marginBottom || computed.marginBottom,
80
+ marginLeft: element.style.marginLeft || computed.marginLeft,
81
+ };
82
+ }
83
+
84
+ /**
85
+ * Convert StyleChanges to inline style object for React
86
+ * All values include !important flag for maximum specificity
87
+ */
88
+ export function convertToInlineStyle(
89
+ styles: StyleChanges
90
+ ): Record<string, string> {
91
+ const inlineStyle: Record<string, string> = {};
92
+
93
+ // Helper to add !important to value
94
+ const withImportant = (value: string) => `${value} !important`;
95
+
96
+ // Layout
97
+ if (styles.backgroundColor)
98
+ inlineStyle.backgroundColor = withImportant(styles.backgroundColor);
99
+ if (styles.height && parseFloat(styles.height) > 0)
100
+ inlineStyle.height = withImportant(styles.height);
101
+ if (styles.width && parseFloat(styles.width) > 0)
102
+ inlineStyle.width = withImportant(styles.width);
103
+ if (styles.display) inlineStyle.display = withImportant(styles.display);
104
+ if (styles.opacity) inlineStyle.opacity = withImportant(styles.opacity);
105
+ if (styles.flex) inlineStyle.flex = withImportant(styles.flex);
106
+ if (styles.flexDirection)
107
+ inlineStyle.flexDirection = withImportant(styles.flexDirection);
108
+ if (styles.justifyContent)
109
+ inlineStyle.justifyContent = withImportant(styles.justifyContent);
110
+ if (styles.alignItems)
111
+ inlineStyle.alignItems = withImportant(styles.alignItems);
112
+
113
+ // Image
114
+ if (styles.objectFit) inlineStyle.objectFit = withImportant(styles.objectFit);
115
+
116
+ // Text
117
+ if (styles.color) inlineStyle.color = withImportant(styles.color);
118
+ if (styles.fontSize) inlineStyle.fontSize = withImportant(styles.fontSize);
119
+ if (styles.fontWeight)
120
+ inlineStyle.fontWeight = withImportant(styles.fontWeight);
121
+ if (styles.fontFamily)
122
+ inlineStyle.fontFamily = withImportant(styles.fontFamily);
123
+ if (styles.textAlign) inlineStyle.textAlign = withImportant(styles.textAlign);
124
+ if (styles.textDecoration)
125
+ inlineStyle.textDecoration = withImportant(styles.textDecoration);
126
+
127
+ // Border
128
+ if (styles.borderRadius)
129
+ inlineStyle.borderRadius = withImportant(styles.borderRadius);
130
+ if (styles.borderWidth && styles.borderColor) {
131
+ inlineStyle.border = withImportant(
132
+ `${styles.borderWidth} ${styles.borderStyle || "solid"} ${
133
+ styles.borderColor
134
+ }`
135
+ );
136
+ }
137
+
138
+ // Spacing - handle both combined and individual properties
139
+ // Check if individual sides are set
140
+ if (
141
+ styles.paddingTop ||
142
+ styles.paddingRight ||
143
+ styles.paddingBottom ||
144
+ styles.paddingLeft
145
+ ) {
146
+ inlineStyle.paddingTop = withImportant(styles.paddingTop || "0");
147
+ inlineStyle.paddingRight = withImportant(styles.paddingRight || "0");
148
+ inlineStyle.paddingBottom = withImportant(styles.paddingBottom || "0");
149
+ inlineStyle.paddingLeft = withImportant(styles.paddingLeft || "0");
150
+ } else if (styles.paddingVertical || styles.paddingHorizontal) {
151
+ const v = styles.paddingVertical || "0";
152
+ const h = styles.paddingHorizontal || "0";
153
+ inlineStyle.padding = withImportant(`${v} ${h}`);
154
+ }
155
+
156
+ if (
157
+ styles.marginTop ||
158
+ styles.marginRight ||
159
+ styles.marginBottom ||
160
+ styles.marginLeft
161
+ ) {
162
+ inlineStyle.marginTop = withImportant(styles.marginTop || "0");
163
+ inlineStyle.marginRight = withImportant(styles.marginRight || "0");
164
+ inlineStyle.marginBottom = withImportant(styles.marginBottom || "0");
165
+ inlineStyle.marginLeft = withImportant(styles.marginLeft || "0");
166
+ } else if (styles.marginVertical || styles.marginHorizontal) {
167
+ const v = styles.marginVertical || "0";
168
+ const h = styles.marginHorizontal || "0";
169
+ inlineStyle.margin = withImportant(`${v} ${h}`);
170
+ }
171
+
172
+ return inlineStyle;
173
+ }
174
+
175
+ /**
176
+ * Parse pixel value from string
177
+ */
178
+ export function parsePixelValue(value: string): number {
179
+ const match = value.match(/^(\d+(?:\.\d+)?)px$/);
180
+ return match ? parseFloat(match[1]) : 0;
181
+ }
182
+
183
+ /**
184
+ * Format number to pixel string
185
+ */
186
+ export function toPixelString(value: number): string {
187
+ return `${value}px`;
188
+ }
189
+
190
+ /**
191
+ * Map StyleChanges property names to CSS property names for removeProperty()
192
+ */
193
+ export const stylePropToCSSProp: Record<keyof StyleChanges, string> = {
194
+ backgroundColor: "background-color",
195
+ height: "height",
196
+ width: "width",
197
+ display: "display",
198
+ opacity: "opacity",
199
+ flex: "flex",
200
+ flexDirection: "flex-direction",
201
+ justifyContent: "justify-content",
202
+ alignItems: "align-items",
203
+ objectFit: "object-fit",
204
+ color: "color",
205
+ fontSize: "font-size",
206
+ fontWeight: "font-weight",
207
+ fontFamily: "font-family",
208
+ textAlign: "text-align",
209
+ textDecoration: "text-decoration",
210
+ borderRadius: "border-radius",
211
+ borderWidth: "border-width",
212
+ borderColor: "border-color",
213
+ borderStyle: "border-style",
214
+ paddingVertical: "padding-top",
215
+ paddingHorizontal: "padding-left",
216
+ marginVertical: "margin-top",
217
+ marginHorizontal: "margin-left",
218
+ paddingTop: "padding-top",
219
+ paddingRight: "padding-right",
220
+ paddingBottom: "padding-bottom",
221
+ paddingLeft: "padding-left",
222
+ marginTop: "margin-top",
223
+ marginRight: "margin-right",
224
+ marginBottom: "margin-bottom",
225
+ marginLeft: "margin-left",
226
+ };