@promakeai/inspector 1.0.0 → 1.0.3
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/README.md +111 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/__tests__/App.test.d.ts.map +1 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/ControlBox/ContentArea.d.ts.map +1 -0
- package/dist/components/ControlBox/PromptInput.d.ts.map +1 -0
- package/dist/components/ControlBox/index.d.ts.map +1 -0
- package/dist/components/ImageEditor/UploadBox.d.ts.map +1 -0
- package/dist/components/ImageEditor/index.d.ts.map +1 -0
- package/dist/components/Overlay.d.ts.map +1 -0
- package/dist/components/StyleEditor/BorderSection.d.ts.map +1 -0
- package/dist/components/StyleEditor/ColorPicker.d.ts.map +1 -0
- package/dist/components/StyleEditor/DisplaySection.d.ts.map +1 -0
- package/dist/components/StyleEditor/ImageSection.d.ts.map +1 -0
- package/dist/components/StyleEditor/LayoutSection.d.ts.map +1 -0
- package/dist/components/StyleEditor/NumberInput.d.ts.map +1 -0
- package/dist/components/StyleEditor/SliderInput.d.ts.map +1 -0
- package/dist/components/StyleEditor/SpacingSection.d.ts.map +1 -0
- package/dist/components/StyleEditor/TextSection.d.ts.map +1 -0
- package/dist/components/StyleEditor/index.d.ts.map +1 -0
- package/dist/components/TextEditor/index.d.ts.map +1 -0
- package/dist/components/ui/CustomCollapsible.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/color-picker.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/core/highlighter.d.ts.map +1 -0
- package/dist/hooks/useMessageBridge.d.ts.map +1 -0
- package/dist/hooks/useStylePreview.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/store/useInspectorStore.d.ts.map +1 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/elementNames.d.ts.map +1 -0
- package/dist/utils/elementUtils.d.ts.map +1 -0
- package/dist/utils/errorTracker.d.ts.map +1 -0
- package/dist/utils/inputStyles.d.ts.map +1 -0
- package/dist/utils/styleUtils.d.ts.map +1 -0
- package/dist/utils/tailwindMapper.d.ts.map +1 -0
- package/dist/utils/urlTracker.d.ts.map +1 -0
- package/package.json +15 -10
- package/dist/packages/inspector/src/App.d.ts.map +0 -1
- package/dist/packages/inspector/src/__tests__/App.test.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/Badge.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ControlBox/ContentArea.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ControlBox/PromptInput.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ControlBox/index.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ImageEditor/UploadBox.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ImageEditor/index.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/Overlay.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/BorderSection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/ColorPicker.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/DisplaySection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/ImageSection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/LayoutSection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/NumberInput.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/SliderInput.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/SpacingSection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/TextSection.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/StyleEditor/index.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/TextEditor/index.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/CustomCollapsible.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/button.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/color-picker.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/input.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/popover.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/select.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/slider.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/textarea.d.ts.map +0 -1
- package/dist/packages/inspector/src/components/ui/tooltip.d.ts.map +0 -1
- package/dist/packages/inspector/src/core/highlighter.d.ts.map +0 -1
- package/dist/packages/inspector/src/hooks/useMessageBridge.d.ts.map +0 -1
- package/dist/packages/inspector/src/hooks/useStylePreview.d.ts.map +0 -1
- package/dist/packages/inspector/src/index.d.ts.map +0 -1
- package/dist/packages/inspector/src/lib/utils.d.ts.map +0 -1
- package/dist/packages/inspector/src/plugin.d.ts.map +0 -1
- package/dist/packages/inspector/src/store/useInspectorStore.d.ts.map +0 -1
- package/dist/packages/inspector/src/styles.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/colorUtils.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/elementNames.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/elementUtils.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/errorTracker.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/inputStyles.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/styleUtils.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/tailwindMapper.d.ts.map +0 -1
- package/dist/packages/inspector/src/utils/urlTracker.d.ts.map +0 -1
- package/dist/packages/inspector/tsconfig.tsbuildinfo +0 -1
- package/src/App.tsx +0 -912
- package/src/__tests__/App.test.tsx +0 -373
- package/src/assets/fonts/Satoshi-Variable.woff +0 -0
- package/src/assets/fonts/Satoshi-Variable.woff2 +0 -0
- package/src/components/Badge.tsx +0 -118
- package/src/components/ControlBox/ContentArea.tsx +0 -13
- package/src/components/ControlBox/PromptInput.module.css +0 -66
- package/src/components/ControlBox/PromptInput.tsx +0 -104
- package/src/components/ControlBox/index.module.css +0 -81
- package/src/components/ControlBox/index.tsx +0 -409
- package/src/components/ImageEditor/UploadBox.module.css +0 -69
- package/src/components/ImageEditor/UploadBox.tsx +0 -113
- package/src/components/ImageEditor/index.module.css +0 -11
- package/src/components/ImageEditor/index.tsx +0 -84
- package/src/components/Overlay.tsx +0 -157
- package/src/components/StyleEditor/BorderSection.tsx +0 -147
- package/src/components/StyleEditor/ColorPicker.tsx +0 -182
- package/src/components/StyleEditor/DisplaySection.tsx +0 -349
- package/src/components/StyleEditor/ImageSection.tsx +0 -105
- package/src/components/StyleEditor/LayoutSection.tsx +0 -63
- package/src/components/StyleEditor/NumberInput.tsx +0 -138
- package/src/components/StyleEditor/SliderInput.tsx +0 -121
- package/src/components/StyleEditor/SpacingSection.tsx +0 -365
- package/src/components/StyleEditor/TextSection.tsx +0 -381
- package/src/components/StyleEditor/index.module.css +0 -133
- package/src/components/StyleEditor/index.tsx +0 -612
- package/src/components/StyleEditor/shared.module.css +0 -193
- package/src/components/TextEditor/index.module.css +0 -31
- package/src/components/TextEditor/index.tsx +0 -166
- package/src/components/ui/CustomCollapsible.tsx +0 -159
- package/src/components/ui/button.module.css +0 -141
- package/src/components/ui/button.tsx +0 -73
- package/src/components/ui/color-picker.module.css +0 -112
- package/src/components/ui/color-picker.tsx +0 -146
- package/src/components/ui/input.module.css +0 -49
- package/src/components/ui/input.tsx +0 -34
- package/src/components/ui/popover.module.css +0 -42
- package/src/components/ui/popover.tsx +0 -59
- package/src/components/ui/select.module.css +0 -160
- package/src/components/ui/select.tsx +0 -216
- package/src/components/ui/slider.module.css +0 -75
- package/src/components/ui/slider.tsx +0 -60
- package/src/components/ui/textarea.module.css +0 -30
- package/src/components/ui/textarea.tsx +0 -23
- package/src/components/ui/tooltip.module.css +0 -11
- package/src/components/ui/tooltip.tsx +0 -37
- package/src/core/highlighter.ts +0 -197
- package/src/hooks/useMessageBridge.ts +0 -49
- package/src/hooks/useStylePreview.ts +0 -332
- package/src/index.ts +0 -20
- package/src/lib/utils.ts +0 -5
- package/src/plugin.ts +0 -11
- package/src/store/useInspectorStore.ts +0 -235
- package/src/styles/fonts.css +0 -15
- package/src/styles/global.css +0 -138
- package/src/styles/variables.css +0 -151
- package/src/styles.ts +0 -5
- package/src/utils/colorUtils.ts +0 -133
- package/src/utils/elementNames.ts +0 -103
- package/src/utils/elementUtils.ts +0 -90
- package/src/utils/errorTracker.ts +0 -186
- package/src/utils/inputStyles.ts +0 -30
- package/src/utils/styleUtils.ts +0 -226
- package/src/utils/tailwindMapper.ts +0 -554
- package/src/utils/urlTracker.ts +0 -75
- package/src/vite-env.d.ts +0 -7
- /package/dist/{packages/inspector/src/App.d.ts → App.d.ts} +0 -0
- /package/dist/{packages/inspector/src/__tests__ → __tests__}/App.test.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/Badge.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ControlBox/ContentArea.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ControlBox/PromptInput.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ControlBox/index.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ImageEditor/UploadBox.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ImageEditor/index.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/Overlay.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/BorderSection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/ColorPicker.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/DisplaySection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/ImageSection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/LayoutSection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/NumberInput.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/SliderInput.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/SpacingSection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/TextSection.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/StyleEditor/index.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/TextEditor/index.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/CustomCollapsible.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/button.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/color-picker.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/input.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/popover.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/select.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/slider.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/textarea.d.ts +0 -0
- /package/dist/{packages/inspector/src/components → components}/ui/tooltip.d.ts +0 -0
- /package/dist/{packages/inspector/src/core → core}/highlighter.d.ts +0 -0
- /package/dist/{packages/inspector/src/hooks → hooks}/useMessageBridge.d.ts +0 -0
- /package/dist/{packages/inspector/src/hooks → hooks}/useStylePreview.d.ts +0 -0
- /package/dist/{packages/inspector/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{packages/inspector/src/lib → lib}/utils.d.ts +0 -0
- /package/dist/{packages/inspector/src/plugin.d.ts → plugin.d.ts} +0 -0
- /package/dist/{packages/inspector/src/store → store}/useInspectorStore.d.ts +0 -0
- /package/dist/{packages/inspector/src/styles.d.ts → styles.d.ts} +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/colorUtils.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/elementNames.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/elementUtils.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/errorTracker.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/inputStyles.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/styleUtils.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/tailwindMapper.d.ts +0 -0
- /package/dist/{packages/inspector/src/utils → utils}/urlTracker.d.ts +0 -0
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DisplaySection - Display mode and Opacity
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { StyleChanges } from "@promakeai/inspector-types";
|
|
6
|
-
import { NumberInput } from "./NumberInput";
|
|
7
|
-
import {
|
|
8
|
-
Select,
|
|
9
|
-
SelectContent,
|
|
10
|
-
SelectItem,
|
|
11
|
-
SelectTrigger,
|
|
12
|
-
SelectValue,
|
|
13
|
-
} from "../ui/select";
|
|
14
|
-
import { RotateCcw } from "lucide-react";
|
|
15
|
-
import { useInspectorStore } from "../../store/useInspectorStore";
|
|
16
|
-
import styles from "./shared.module.css";
|
|
17
|
-
|
|
18
|
-
interface DisplaySectionProps {
|
|
19
|
-
styles: StyleChanges;
|
|
20
|
-
onChange: (property: keyof StyleChanges, value: string) => void;
|
|
21
|
-
originalStyles: StyleChanges;
|
|
22
|
-
onResetProperty: (property: keyof StyleChanges) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function DisplaySection({
|
|
26
|
-
styles: styleValues,
|
|
27
|
-
onChange,
|
|
28
|
-
originalStyles,
|
|
29
|
-
onResetProperty,
|
|
30
|
-
}: DisplaySectionProps) {
|
|
31
|
-
const { labels, theme } = useInspectorStore();
|
|
32
|
-
|
|
33
|
-
const DISPLAY_MODES = [
|
|
34
|
-
{ label: labels.displayBlock || "Block", value: "block" },
|
|
35
|
-
{ label: labels.displayInline || "Inline", value: "inline" },
|
|
36
|
-
{ label: labels.displayInlineBlock || "Inline Block", value: "inline-block" },
|
|
37
|
-
{ label: labels.displayFlex || "Flex", value: "flex" },
|
|
38
|
-
{ label: labels.displayGrid || "Grid", value: "grid" },
|
|
39
|
-
{ label: labels.displayNone || "None", value: "none" },
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const JUSTIFY_CONTENT_OPTIONS = [
|
|
43
|
-
{ label: labels.justifyContentFlexStart || "Flex Start", value: "flex-start" },
|
|
44
|
-
{ label: labels.justifyContentCenter || "Center", value: "center" },
|
|
45
|
-
{ label: labels.justifyContentFlexEnd || "Flex End", value: "flex-end" },
|
|
46
|
-
{ label: labels.justifyContentSpaceBetween || "Space Between", value: "space-between" },
|
|
47
|
-
{ label: labels.justifyContentSpaceAround || "Space Around", value: "space-around" },
|
|
48
|
-
{ label: labels.justifyContentSpaceEvenly || "Space Evenly", value: "space-evenly" },
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const ALIGN_ITEMS_OPTIONS = [
|
|
52
|
-
{ label: labels.alignItemsFlexStart || "Flex Start", value: "flex-start" },
|
|
53
|
-
{ label: labels.alignItemsCenter || "Center", value: "center" },
|
|
54
|
-
{ label: labels.alignItemsFlexEnd || "Flex End", value: "flex-end" },
|
|
55
|
-
{ label: labels.alignItemsStretch || "Stretch", value: "stretch" },
|
|
56
|
-
{ label: labels.alignItemsBaseline || "Baseline", value: "baseline" },
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
const FLEX_DIRECTION_OPTIONS = [
|
|
60
|
-
{ label: labels.flexDirectionRow || "Row", value: "row" },
|
|
61
|
-
{ label: labels.flexDirectionRowReverse || "Row Reverse", value: "row-reverse" },
|
|
62
|
-
{ label: labels.flexDirectionColumn || "Column", value: "column" },
|
|
63
|
-
{ label: labels.flexDirectionColumnReverse || "Column Reverse", value: "column-reverse" },
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className={styles.section}>
|
|
68
|
-
{/* Display Mode and Opacity - Side by side */}
|
|
69
|
-
<div className={styles.grid2}>
|
|
70
|
-
{/* Display Mode */}
|
|
71
|
-
<div>
|
|
72
|
-
<div className={styles.labelContainer}>
|
|
73
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
74
|
-
{labels.displayLabel || "Display"}
|
|
75
|
-
</label>
|
|
76
|
-
{styleValues.display !== originalStyles.display && (
|
|
77
|
-
<button
|
|
78
|
-
type="button"
|
|
79
|
-
onClick={() => onResetProperty("display")}
|
|
80
|
-
className={styles.resetIcon}
|
|
81
|
-
style={{ color: theme.secondaryTextColor }}
|
|
82
|
-
title="Reset to original"
|
|
83
|
-
>
|
|
84
|
-
<RotateCcw size={12} />
|
|
85
|
-
</button>
|
|
86
|
-
)}
|
|
87
|
-
</div>
|
|
88
|
-
<div
|
|
89
|
-
className={styles.inputContainer}
|
|
90
|
-
style={{
|
|
91
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
92
|
-
borderColor: theme.inputBorderColor,
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
<Select
|
|
96
|
-
value={styleValues.display || "block"}
|
|
97
|
-
onValueChange={(value) => onChange("display", value)}
|
|
98
|
-
>
|
|
99
|
-
<SelectTrigger
|
|
100
|
-
className={styles.input}
|
|
101
|
-
style={{
|
|
102
|
-
backgroundColor: "transparent",
|
|
103
|
-
color: theme.inputTextColor,
|
|
104
|
-
}}
|
|
105
|
-
size="sm"
|
|
106
|
-
>
|
|
107
|
-
<SelectValue />
|
|
108
|
-
</SelectTrigger>
|
|
109
|
-
<SelectContent
|
|
110
|
-
style={{
|
|
111
|
-
backgroundColor: theme.backgroundColor,
|
|
112
|
-
borderColor: theme.borderColor,
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
{DISPLAY_MODES.map((mode) => (
|
|
116
|
-
<SelectItem
|
|
117
|
-
key={mode.value}
|
|
118
|
-
value={mode.value}
|
|
119
|
-
style={{
|
|
120
|
-
color: theme.textColor,
|
|
121
|
-
}}
|
|
122
|
-
>
|
|
123
|
-
{mode.label}
|
|
124
|
-
</SelectItem>
|
|
125
|
-
))}
|
|
126
|
-
</SelectContent>
|
|
127
|
-
</Select>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
{/* Opacity */}
|
|
132
|
-
<NumberInput
|
|
133
|
-
label={labels.opacityLabel || "Opacity"}
|
|
134
|
-
value={styleValues.opacity}
|
|
135
|
-
onChange={(value) => onChange("opacity", value)}
|
|
136
|
-
min={0}
|
|
137
|
-
max={1}
|
|
138
|
-
step={0.1}
|
|
139
|
-
unit=""
|
|
140
|
-
originalValue={originalStyles.opacity}
|
|
141
|
-
onReset={() => onResetProperty("opacity")}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
{/* Flex and Flex Direction - Side by side */}
|
|
146
|
-
<div className={styles.grid2}>
|
|
147
|
-
{/* Flex */}
|
|
148
|
-
<NumberInput
|
|
149
|
-
label={labels.flexLabel || "Flex"}
|
|
150
|
-
value={styleValues.flex}
|
|
151
|
-
onChange={(value) => onChange("flex", value)}
|
|
152
|
-
min={0}
|
|
153
|
-
max={100}
|
|
154
|
-
step={1}
|
|
155
|
-
unit=""
|
|
156
|
-
originalValue={originalStyles.flex}
|
|
157
|
-
onReset={() => onResetProperty("flex")}
|
|
158
|
-
/>
|
|
159
|
-
|
|
160
|
-
{/* Flex Direction */}
|
|
161
|
-
<div>
|
|
162
|
-
<div className={styles.labelContainer}>
|
|
163
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
164
|
-
{labels.flexDirectionLabel || "Flex Direction"}
|
|
165
|
-
</label>
|
|
166
|
-
{styleValues.flexDirection !== originalStyles.flexDirection && (
|
|
167
|
-
<button
|
|
168
|
-
type="button"
|
|
169
|
-
onClick={() => onResetProperty("flexDirection")}
|
|
170
|
-
className={styles.resetIcon}
|
|
171
|
-
style={{ color: theme.secondaryTextColor }}
|
|
172
|
-
title="Reset to original"
|
|
173
|
-
>
|
|
174
|
-
<RotateCcw size={12} />
|
|
175
|
-
</button>
|
|
176
|
-
)}
|
|
177
|
-
</div>
|
|
178
|
-
<div
|
|
179
|
-
className={styles.inputContainer}
|
|
180
|
-
style={{
|
|
181
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
182
|
-
borderColor: theme.inputBorderColor,
|
|
183
|
-
}}
|
|
184
|
-
>
|
|
185
|
-
<Select
|
|
186
|
-
value={styleValues.flexDirection || "row"}
|
|
187
|
-
onValueChange={(value) => onChange("flexDirection", value)}
|
|
188
|
-
>
|
|
189
|
-
<SelectTrigger
|
|
190
|
-
className={styles.input}
|
|
191
|
-
style={{
|
|
192
|
-
backgroundColor: "transparent",
|
|
193
|
-
color: theme.inputTextColor,
|
|
194
|
-
}}
|
|
195
|
-
size="sm"
|
|
196
|
-
>
|
|
197
|
-
<SelectValue />
|
|
198
|
-
</SelectTrigger>
|
|
199
|
-
<SelectContent
|
|
200
|
-
style={{
|
|
201
|
-
backgroundColor: theme.backgroundColor,
|
|
202
|
-
borderColor: theme.borderColor,
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
{FLEX_DIRECTION_OPTIONS.map((option) => (
|
|
206
|
-
<SelectItem
|
|
207
|
-
key={option.value}
|
|
208
|
-
value={option.value}
|
|
209
|
-
style={{
|
|
210
|
-
color: theme.textColor,
|
|
211
|
-
}}
|
|
212
|
-
>
|
|
213
|
-
{option.label}
|
|
214
|
-
</SelectItem>
|
|
215
|
-
))}
|
|
216
|
-
</SelectContent>
|
|
217
|
-
</Select>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
{/* Justify Content and Align Items - Side by side */}
|
|
223
|
-
<div className={styles.grid2}>
|
|
224
|
-
{/* Justify Content */}
|
|
225
|
-
<div>
|
|
226
|
-
<div className={styles.labelContainer}>
|
|
227
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
228
|
-
{labels.justifyContentLabel || "Justify Content"}
|
|
229
|
-
</label>
|
|
230
|
-
{styleValues.justifyContent !== originalStyles.justifyContent && (
|
|
231
|
-
<button
|
|
232
|
-
type="button"
|
|
233
|
-
onClick={() => onResetProperty("justifyContent")}
|
|
234
|
-
className={styles.resetIcon}
|
|
235
|
-
style={{ color: theme.secondaryTextColor }}
|
|
236
|
-
title="Reset to original"
|
|
237
|
-
>
|
|
238
|
-
<RotateCcw size={12} />
|
|
239
|
-
</button>
|
|
240
|
-
)}
|
|
241
|
-
</div>
|
|
242
|
-
<div
|
|
243
|
-
className={styles.inputContainer}
|
|
244
|
-
style={{
|
|
245
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
246
|
-
borderColor: theme.inputBorderColor,
|
|
247
|
-
}}
|
|
248
|
-
>
|
|
249
|
-
<Select
|
|
250
|
-
value={styleValues.justifyContent || "flex-start"}
|
|
251
|
-
onValueChange={(value) => onChange("justifyContent", value)}
|
|
252
|
-
>
|
|
253
|
-
<SelectTrigger
|
|
254
|
-
className={styles.input}
|
|
255
|
-
style={{
|
|
256
|
-
backgroundColor: "transparent",
|
|
257
|
-
color: theme.inputTextColor,
|
|
258
|
-
}}
|
|
259
|
-
size="sm"
|
|
260
|
-
>
|
|
261
|
-
<SelectValue />
|
|
262
|
-
</SelectTrigger>
|
|
263
|
-
<SelectContent
|
|
264
|
-
style={{
|
|
265
|
-
backgroundColor: theme.backgroundColor,
|
|
266
|
-
borderColor: theme.borderColor,
|
|
267
|
-
}}
|
|
268
|
-
>
|
|
269
|
-
{JUSTIFY_CONTENT_OPTIONS.map((option) => (
|
|
270
|
-
<SelectItem
|
|
271
|
-
key={option.value}
|
|
272
|
-
value={option.value}
|
|
273
|
-
style={{
|
|
274
|
-
color: theme.textColor,
|
|
275
|
-
}}
|
|
276
|
-
>
|
|
277
|
-
{option.label}
|
|
278
|
-
</SelectItem>
|
|
279
|
-
))}
|
|
280
|
-
</SelectContent>
|
|
281
|
-
</Select>
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
{/* Align Items */}
|
|
286
|
-
<div>
|
|
287
|
-
<div className={styles.labelContainer}>
|
|
288
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
289
|
-
{labels.alignItemsLabel || "Align Items"}
|
|
290
|
-
</label>
|
|
291
|
-
{styleValues.alignItems !== originalStyles.alignItems && (
|
|
292
|
-
<button
|
|
293
|
-
type="button"
|
|
294
|
-
onClick={() => onResetProperty("alignItems")}
|
|
295
|
-
className={styles.resetIcon}
|
|
296
|
-
style={{ color: theme.secondaryTextColor }}
|
|
297
|
-
title="Reset to original"
|
|
298
|
-
>
|
|
299
|
-
<RotateCcw size={12} />
|
|
300
|
-
</button>
|
|
301
|
-
)}
|
|
302
|
-
</div>
|
|
303
|
-
<div
|
|
304
|
-
className={styles.inputContainer}
|
|
305
|
-
style={{
|
|
306
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
307
|
-
borderColor: theme.inputBorderColor,
|
|
308
|
-
}}
|
|
309
|
-
>
|
|
310
|
-
<Select
|
|
311
|
-
value={styleValues.alignItems || "stretch"}
|
|
312
|
-
onValueChange={(value) => onChange("alignItems", value)}
|
|
313
|
-
>
|
|
314
|
-
<SelectTrigger
|
|
315
|
-
className={styles.input}
|
|
316
|
-
style={{
|
|
317
|
-
backgroundColor: "transparent",
|
|
318
|
-
color: theme.inputTextColor,
|
|
319
|
-
}}
|
|
320
|
-
size="sm"
|
|
321
|
-
>
|
|
322
|
-
<SelectValue />
|
|
323
|
-
</SelectTrigger>
|
|
324
|
-
<SelectContent
|
|
325
|
-
style={{
|
|
326
|
-
backgroundColor: theme.backgroundColor,
|
|
327
|
-
borderColor: theme.borderColor,
|
|
328
|
-
}}
|
|
329
|
-
>
|
|
330
|
-
{ALIGN_ITEMS_OPTIONS.map((option) => (
|
|
331
|
-
<SelectItem
|
|
332
|
-
key={option.value}
|
|
333
|
-
value={option.value}
|
|
334
|
-
style={{
|
|
335
|
-
color: theme.textColor,
|
|
336
|
-
}}
|
|
337
|
-
>
|
|
338
|
-
{option.label}
|
|
339
|
-
</SelectItem>
|
|
340
|
-
))}
|
|
341
|
-
</SelectContent>
|
|
342
|
-
</Select>
|
|
343
|
-
</div>
|
|
344
|
-
</div>
|
|
345
|
-
</div>
|
|
346
|
-
</div>
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ImageSection - Object Fit for image elements
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { StyleChanges } from "@promakeai/inspector-types";
|
|
6
|
-
import {
|
|
7
|
-
Select,
|
|
8
|
-
SelectContent,
|
|
9
|
-
SelectItem,
|
|
10
|
-
SelectTrigger,
|
|
11
|
-
SelectValue,
|
|
12
|
-
} from "../ui/select";
|
|
13
|
-
import { RotateCcw } from "lucide-react";
|
|
14
|
-
import { useInspectorStore } from "../../store/useInspectorStore";
|
|
15
|
-
import styles from "./shared.module.css";
|
|
16
|
-
|
|
17
|
-
interface ImageSectionProps {
|
|
18
|
-
styles: StyleChanges;
|
|
19
|
-
onChange: (property: keyof StyleChanges, value: string) => void;
|
|
20
|
-
originalStyles: StyleChanges;
|
|
21
|
-
onResetProperty: (property: keyof StyleChanges) => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function ImageSection({
|
|
25
|
-
styles: styleValues,
|
|
26
|
-
onChange,
|
|
27
|
-
originalStyles,
|
|
28
|
-
onResetProperty,
|
|
29
|
-
}: ImageSectionProps) {
|
|
30
|
-
const { labels, theme } = useInspectorStore();
|
|
31
|
-
|
|
32
|
-
const OBJECT_FIT_OPTIONS = [
|
|
33
|
-
{ label: labels.objectFitFill || "Fill", value: "fill" },
|
|
34
|
-
{ label: labels.objectFitContain || "Contain", value: "contain" },
|
|
35
|
-
{ label: labels.objectFitCover || "Cover", value: "cover" },
|
|
36
|
-
{ label: labels.objectFitNone || "None", value: "none" },
|
|
37
|
-
{ label: labels.objectFitScaleDown || "Scale Down", value: "scale-down" },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className={styles.section}>
|
|
42
|
-
{/* Object Fit */}
|
|
43
|
-
<div>
|
|
44
|
-
<div className={styles.labelContainer}>
|
|
45
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
46
|
-
{labels.objectFitLabel || "Object Fit"}
|
|
47
|
-
</label>
|
|
48
|
-
{styleValues.objectFit !== originalStyles.objectFit && (
|
|
49
|
-
<button
|
|
50
|
-
type="button"
|
|
51
|
-
onClick={() => onResetProperty("objectFit")}
|
|
52
|
-
className={styles.resetIcon}
|
|
53
|
-
style={{ color: theme.secondaryTextColor }}
|
|
54
|
-
title="Reset to original"
|
|
55
|
-
>
|
|
56
|
-
<RotateCcw size={12} />
|
|
57
|
-
</button>
|
|
58
|
-
)}
|
|
59
|
-
</div>
|
|
60
|
-
<div
|
|
61
|
-
className={styles.inputContainer}
|
|
62
|
-
style={{
|
|
63
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
64
|
-
borderColor: theme.inputBorderColor,
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
<Select
|
|
68
|
-
value={styleValues.objectFit || "fill"}
|
|
69
|
-
onValueChange={(value) => onChange("objectFit", value)}
|
|
70
|
-
>
|
|
71
|
-
<SelectTrigger
|
|
72
|
-
className={styles.input}
|
|
73
|
-
style={{
|
|
74
|
-
backgroundColor: "transparent",
|
|
75
|
-
color: theme.inputTextColor,
|
|
76
|
-
}}
|
|
77
|
-
size="sm"
|
|
78
|
-
>
|
|
79
|
-
<SelectValue />
|
|
80
|
-
</SelectTrigger>
|
|
81
|
-
<SelectContent
|
|
82
|
-
style={{
|
|
83
|
-
backgroundColor: theme.backgroundColor,
|
|
84
|
-
borderColor: theme.borderColor,
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
{OBJECT_FIT_OPTIONS.map((option) => (
|
|
88
|
-
<SelectItem
|
|
89
|
-
key={option.value}
|
|
90
|
-
value={option.value}
|
|
91
|
-
style={{
|
|
92
|
-
color: theme.textColor,
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{option.label}
|
|
96
|
-
</SelectItem>
|
|
97
|
-
))}
|
|
98
|
-
</SelectContent>
|
|
99
|
-
</Select>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LayoutSection - Background Color, Height, Width
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { StyleChanges } from "@promakeai/inspector-types";
|
|
6
|
-
import { ColorPicker } from "./ColorPicker";
|
|
7
|
-
import { NumberInput } from "./NumberInput";
|
|
8
|
-
import { useInspectorStore } from "../../store/useInspectorStore";
|
|
9
|
-
import styles from "./shared.module.css";
|
|
10
|
-
|
|
11
|
-
interface LayoutSectionProps {
|
|
12
|
-
styles: StyleChanges;
|
|
13
|
-
onChange: (property: keyof StyleChanges, value: string) => void;
|
|
14
|
-
originalStyles: StyleChanges;
|
|
15
|
-
onResetProperty: (property: keyof StyleChanges) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function LayoutSection({
|
|
19
|
-
styles: styleValues,
|
|
20
|
-
onChange,
|
|
21
|
-
originalStyles,
|
|
22
|
-
onResetProperty
|
|
23
|
-
}: LayoutSectionProps) {
|
|
24
|
-
const { labels } = useInspectorStore();
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className={styles.section}>
|
|
28
|
-
<ColorPicker
|
|
29
|
-
label={labels.backgroundColorLabel || "Background Color"}
|
|
30
|
-
value={styleValues.backgroundColor || "#ffffff"}
|
|
31
|
-
onChange={(value) => onChange("backgroundColor", value)}
|
|
32
|
-
originalValue={originalStyles.backgroundColor}
|
|
33
|
-
onReset={() => onResetProperty("backgroundColor")}
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
<div className={styles.grid2}>
|
|
37
|
-
<NumberInput
|
|
38
|
-
label={labels.heightLabel || "Height"}
|
|
39
|
-
value={styleValues.height}
|
|
40
|
-
onChange={(value) => onChange("height", value)}
|
|
41
|
-
min={0}
|
|
42
|
-
max={2000}
|
|
43
|
-
step={1}
|
|
44
|
-
unit="px"
|
|
45
|
-
originalValue={originalStyles.height}
|
|
46
|
-
onReset={() => onResetProperty("height")}
|
|
47
|
-
/>
|
|
48
|
-
|
|
49
|
-
<NumberInput
|
|
50
|
-
label={labels.widthLabel || "Width"}
|
|
51
|
-
value={styleValues.width}
|
|
52
|
-
onChange={(value) => onChange("width", value)}
|
|
53
|
-
min={0}
|
|
54
|
-
max={2000}
|
|
55
|
-
step={1}
|
|
56
|
-
unit="px"
|
|
57
|
-
originalValue={originalStyles.width}
|
|
58
|
-
onReset={() => onResetProperty("width")}
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NumberInput - Input with drag-to-adjust handle (Figma-style)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { useState, useRef, useEffect } from "react";
|
|
6
|
-
import { Input } from "../ui/input";
|
|
7
|
-
import { GripVertical, RotateCcw } from "lucide-react";
|
|
8
|
-
import { useInspectorStore } from "../../store/useInspectorStore";
|
|
9
|
-
import styles from "./shared.module.css";
|
|
10
|
-
|
|
11
|
-
interface NumberInputProps {
|
|
12
|
-
label: string;
|
|
13
|
-
value: string | undefined;
|
|
14
|
-
onChange: (value: string) => void;
|
|
15
|
-
min?: number;
|
|
16
|
-
max?: number;
|
|
17
|
-
step?: number;
|
|
18
|
-
unit?: string;
|
|
19
|
-
originalValue?: string;
|
|
20
|
-
onReset?: () => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function NumberInput({
|
|
24
|
-
label,
|
|
25
|
-
value,
|
|
26
|
-
onChange,
|
|
27
|
-
min = 0,
|
|
28
|
-
max = 1000,
|
|
29
|
-
step = 1,
|
|
30
|
-
unit = "px",
|
|
31
|
-
originalValue,
|
|
32
|
-
onReset,
|
|
33
|
-
}: NumberInputProps) {
|
|
34
|
-
const { labels, theme } = useInspectorStore();
|
|
35
|
-
const hasChanged = originalValue !== undefined && value !== originalValue;
|
|
36
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
37
|
-
const dragStartX = useRef(0);
|
|
38
|
-
const dragStartValue = useRef(0);
|
|
39
|
-
const dragHandleRef = useRef<HTMLDivElement>(null);
|
|
40
|
-
|
|
41
|
-
const parseValue = (val: string | undefined): number => {
|
|
42
|
-
if (!val) return 0;
|
|
43
|
-
const parsed = parseFloat(val.replace(/[^\d.-]/g, ""));
|
|
44
|
-
return isNaN(parsed) ? 0 : parsed;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const currentValue = parseValue(value);
|
|
48
|
-
|
|
49
|
-
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
50
|
-
onChange(e.target.value);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (!isDragging) return;
|
|
55
|
-
|
|
56
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
57
|
-
const deltaX = e.clientX - dragStartX.current;
|
|
58
|
-
const deltaValue = Math.round(deltaX / 2) * step; // 2px movement = 1 step
|
|
59
|
-
let newValue = dragStartValue.current + deltaValue;
|
|
60
|
-
|
|
61
|
-
// Clamp value
|
|
62
|
-
newValue = Math.max(min, Math.min(max, newValue));
|
|
63
|
-
|
|
64
|
-
onChange(`${newValue}${unit}`);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const handleMouseUp = () => {
|
|
68
|
-
setIsDragging(false);
|
|
69
|
-
document.body.style.cursor = "";
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
73
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
74
|
-
|
|
75
|
-
return () => {
|
|
76
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
77
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
78
|
-
};
|
|
79
|
-
}, [isDragging, step, min, max, unit, onChange]);
|
|
80
|
-
|
|
81
|
-
const handleDragStart = (e: React.MouseEvent) => {
|
|
82
|
-
e.preventDefault();
|
|
83
|
-
setIsDragging(true);
|
|
84
|
-
dragStartX.current = e.clientX;
|
|
85
|
-
dragStartValue.current = currentValue;
|
|
86
|
-
document.body.style.cursor = "ew-resize";
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={styles.inputField}>
|
|
91
|
-
<div className={styles.labelContainer}>
|
|
92
|
-
<label className={styles.label} style={{ color: theme.textColor }}>
|
|
93
|
-
{label}
|
|
94
|
-
</label>
|
|
95
|
-
{hasChanged && onReset && (
|
|
96
|
-
<button
|
|
97
|
-
type="button"
|
|
98
|
-
onClick={onReset}
|
|
99
|
-
className={styles.resetIcon}
|
|
100
|
-
style={{ color: theme.secondaryTextColor }}
|
|
101
|
-
title="Reset to original"
|
|
102
|
-
>
|
|
103
|
-
<RotateCcw size={12} />
|
|
104
|
-
</button>
|
|
105
|
-
)}
|
|
106
|
-
</div>
|
|
107
|
-
<div
|
|
108
|
-
className={styles.inputContainer}
|
|
109
|
-
style={{
|
|
110
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
111
|
-
borderColor: theme.inputBorderColor,
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<Input
|
|
115
|
-
type="text"
|
|
116
|
-
value={value || ""}
|
|
117
|
-
onChange={handleInputChange}
|
|
118
|
-
className={styles.input}
|
|
119
|
-
style={{
|
|
120
|
-
backgroundColor: "transparent",
|
|
121
|
-
color: theme.inputTextColor,
|
|
122
|
-
}}
|
|
123
|
-
/>
|
|
124
|
-
<div
|
|
125
|
-
ref={dragHandleRef}
|
|
126
|
-
onMouseDown={handleDragStart}
|
|
127
|
-
className={styles.dragHandle}
|
|
128
|
-
style={{
|
|
129
|
-
color: theme.secondaryTextColor || theme.textColor,
|
|
130
|
-
opacity: isDragging ? 1 : 0.6,
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<GripVertical className={styles.dragHandleIcon} />
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
);
|
|
138
|
-
}
|