@jhits/plugin-images 0.0.5 → 0.0.7
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/api/fallback/route.d.ts +7 -0
- package/dist/api/fallback/route.d.ts.map +1 -0
- package/dist/api/fallback/route.js +65 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/list/index.d.ts +21 -0
- package/dist/api/list/index.d.ts.map +1 -0
- package/dist/api/list/index.js +80 -0
- package/dist/api/resolve/route.d.ts +39 -0
- package/dist/api/resolve/route.d.ts.map +1 -0
- package/dist/api/resolve/route.js +213 -0
- package/dist/api/router.d.ts +14 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +67 -0
- package/dist/api/upload/index.d.ts +20 -0
- package/dist/api/upload/index.d.ts.map +1 -0
- package/dist/api/upload/index.js +65 -0
- package/dist/api/uploads/[filename]/route.d.ts +21 -0
- package/dist/api/uploads/[filename]/route.d.ts.map +1 -0
- package/dist/api/uploads/[filename]/route.js +80 -0
- package/dist/api-server.d.ts +9 -0
- package/dist/api-server.d.ts.map +1 -0
- package/dist/api-server.js +9 -0
- package/dist/components/BackgroundImage.d.ts +11 -0
- package/dist/components/BackgroundImage.d.ts.map +1 -0
- package/dist/components/BackgroundImage.js +33 -0
- package/dist/components/GlobalImageEditor/config.d.ts +9 -0
- package/dist/components/GlobalImageEditor/config.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/config.js +17 -0
- package/dist/components/GlobalImageEditor/eventHandlers.d.ts +20 -0
- package/dist/components/GlobalImageEditor/eventHandlers.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/eventHandlers.js +210 -0
- package/dist/components/GlobalImageEditor/imageDetection.d.ts +16 -0
- package/dist/components/GlobalImageEditor/imageDetection.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/imageDetection.js +135 -0
- package/dist/components/GlobalImageEditor/imageSetup.d.ts +9 -0
- package/dist/components/GlobalImageEditor/imageSetup.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/imageSetup.js +260 -0
- package/dist/components/GlobalImageEditor/saveLogic.d.ts +26 -0
- package/dist/components/GlobalImageEditor/saveLogic.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/saveLogic.js +98 -0
- package/dist/components/GlobalImageEditor/stylingDetection.d.ts +9 -0
- package/dist/components/GlobalImageEditor/stylingDetection.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/stylingDetection.js +110 -0
- package/dist/components/GlobalImageEditor/transformParsing.d.ts +16 -0
- package/dist/components/GlobalImageEditor/transformParsing.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/transformParsing.js +68 -0
- package/dist/components/GlobalImageEditor/types.d.ts +36 -0
- package/dist/components/GlobalImageEditor/types.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor/types.js +4 -0
- package/dist/components/GlobalImageEditor.d.ts +8 -0
- package/dist/components/GlobalImageEditor.d.ts.map +1 -0
- package/dist/components/GlobalImageEditor.js +232 -0
- package/dist/components/Image.d.ts +22 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +227 -0
- package/dist/components/ImageBrowserModal.d.ts +13 -0
- package/dist/components/ImageBrowserModal.d.ts.map +1 -0
- package/dist/components/ImageBrowserModal.js +507 -0
- package/dist/components/ImageEditor.d.ts +27 -0
- package/dist/components/ImageEditor.d.ts.map +1 -0
- package/dist/components/ImageEditor.js +172 -0
- package/dist/components/ImageEffectsPanel.d.ts +10 -0
- package/dist/components/ImageEffectsPanel.d.ts.map +1 -0
- package/dist/components/ImageEffectsPanel.js +11 -0
- package/dist/components/ImagePicker.d.ts +3 -0
- package/dist/components/ImagePicker.d.ts.map +1 -0
- package/dist/components/ImagePicker.js +142 -0
- package/dist/components/ImagesPluginInit.d.ts +24 -0
- package/dist/components/ImagesPluginInit.d.ts.map +1 -0
- package/dist/components/ImagesPluginInit.js +28 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +7 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +172 -0
- package/dist/hooks/useImagePicker.d.ts +20 -0
- package/dist/hooks/useImagePicker.d.ts.map +1 -0
- package/dist/hooks/useImagePicker.js +320 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.server.d.ts +11 -0
- package/dist/index.server.d.ts.map +1 -0
- package/dist/index.server.js +10 -0
- package/dist/init.d.ts +33 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +43 -0
- package/dist/types/index.d.ts +80 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/utils/fallback.d.ts +27 -0
- package/dist/utils/fallback.d.ts.map +1 -0
- package/dist/utils/fallback.js +63 -0
- package/dist/utils/transforms.d.ts +26 -0
- package/dist/utils/transforms.d.ts.map +1 -0
- package/dist/utils/transforms.js +38 -0
- package/dist/views/ImageManager.d.ts +10 -0
- package/dist/views/ImageManager.d.ts.map +1 -0
- package/dist/views/ImageManager.js +9 -0
- package/package.json +26 -22
- package/src/assets/noimagefound.jpg +0 -0
- package/src/components/BackgroundImage.d.ts +11 -0
- package/src/components/BackgroundImage.d.ts.map +1 -0
- package/src/components/BackgroundImage.js +35 -0
- package/src/components/GlobalImageEditor/config.d.ts +9 -0
- package/src/components/GlobalImageEditor/config.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/config.js +18 -0
- package/src/components/GlobalImageEditor/eventHandlers.d.ts +20 -0
- package/src/components/GlobalImageEditor/eventHandlers.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/eventHandlers.js +206 -0
- package/src/components/GlobalImageEditor/imageDetection.d.ts +16 -0
- package/src/components/GlobalImageEditor/imageDetection.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/imageDetection.js +130 -0
- package/src/components/GlobalImageEditor/imageSetup.d.ts +9 -0
- package/src/components/GlobalImageEditor/imageSetup.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/imageSetup.js +261 -0
- package/src/components/GlobalImageEditor/saveLogic.d.ts +26 -0
- package/src/components/GlobalImageEditor/saveLogic.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/saveLogic.js +99 -0
- package/src/components/GlobalImageEditor/stylingDetection.d.ts +9 -0
- package/src/components/GlobalImageEditor/stylingDetection.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/stylingDetection.js +110 -0
- package/src/components/GlobalImageEditor/transformParsing.d.ts +16 -0
- package/src/components/GlobalImageEditor/transformParsing.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/transformParsing.js +68 -0
- package/src/components/GlobalImageEditor/types.d.ts +36 -0
- package/src/components/GlobalImageEditor/types.d.ts.map +1 -0
- package/src/components/GlobalImageEditor/types.js +4 -0
- package/src/components/GlobalImageEditor.d.ts +8 -0
- package/src/components/GlobalImageEditor.d.ts.map +1 -0
- package/src/components/GlobalImageEditor.js +227 -0
- package/src/components/GlobalImageEditor.tsx +2 -2
- package/src/components/Image.d.ts +22 -0
- package/src/components/Image.d.ts.map +1 -0
- package/src/components/Image.js +229 -0
- package/src/components/ImageBrowserModal.d.ts +13 -0
- package/src/components/ImageBrowserModal.d.ts.map +1 -0
- package/src/components/ImageBrowserModal.js +504 -0
- package/src/components/ImageBrowserModal.tsx +18 -5
- package/src/components/ImageEditor.d.ts +27 -0
- package/src/components/ImageEditor.d.ts.map +1 -0
- package/src/components/ImageEditor.js +173 -0
- package/src/components/ImagePicker.d.ts +3 -0
- package/src/components/ImagePicker.d.ts.map +1 -0
- package/src/components/ImagePicker.js +143 -0
- package/src/components/ImagePicker.tsx +53 -15
- package/src/components/ImagesPluginInit.d.ts +24 -0
- package/src/components/ImagesPluginInit.d.ts.map +1 -0
- package/src/components/ImagesPluginInit.js +28 -0
- package/src/hooks/useImagePicker.d.ts +20 -0
- package/src/hooks/useImagePicker.d.ts.map +1 -0
- package/src/hooks/useImagePicker.js +322 -0
- package/src/hooks/useImagePicker.ts +28 -6
- package/src/index.d.ts +23 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +28 -0
- package/src/init.d.ts +33 -0
- package/src/init.d.ts.map +1 -0
- package/src/init.js +43 -0
- package/src/types/index.d.ts +80 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +4 -0
- package/src/utils/fallback.d.ts +27 -0
- package/src/utils/fallback.d.ts.map +1 -0
- package/src/utils/fallback.js +63 -0
- package/src/utils/transforms.d.ts +26 -0
- package/src/utils/transforms.d.ts.map +1 -0
- package/src/utils/transforms.js +38 -0
- package/src/views/ImageManager.d.ts +10 -0
- package/src/views/ImageManager.d.ts.map +1 -0
- package/src/views/ImageManager.js +9 -0
- package/src/components/GlobalImageEditor/GlobalImageEditor.tsx +0 -374
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image setup and click handlers
|
|
3
|
+
*/
|
|
4
|
+
import { parseImageData } from './imageDetection';
|
|
5
|
+
/**
|
|
6
|
+
* Setup click handlers and hover effects for all images
|
|
7
|
+
*/
|
|
8
|
+
export function setupImageHandlers(onImageClick) {
|
|
9
|
+
const cleanupFunctions = [];
|
|
10
|
+
const handleImageClick = (e) => {
|
|
11
|
+
const target = e.target;
|
|
12
|
+
// Only handle clicks on images that use the plugin components
|
|
13
|
+
let img = target.closest('img[data-image-id]');
|
|
14
|
+
let isBackground = false;
|
|
15
|
+
let element = null;
|
|
16
|
+
let currentSrc = '';
|
|
17
|
+
if (img) {
|
|
18
|
+
// This is a plugin Image component
|
|
19
|
+
element = img;
|
|
20
|
+
currentSrc = img.src;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Check if it's an element with background-image
|
|
24
|
+
let bgElement = target.closest('[data-background-image-component]');
|
|
25
|
+
if (bgElement) {
|
|
26
|
+
element = bgElement;
|
|
27
|
+
isBackground = true;
|
|
28
|
+
// Try to get image source from nested Image component first
|
|
29
|
+
const imgInside = bgElement.querySelector('img[data-image-id]');
|
|
30
|
+
if (imgInside) {
|
|
31
|
+
currentSrc = imgInside.src;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Fallback to background-image CSS
|
|
35
|
+
const bgImage = window.getComputedStyle(bgElement).backgroundImage;
|
|
36
|
+
const urlMatch = bgImage.match(/url\(['"]?([^'"]+)['"]?\)/);
|
|
37
|
+
if (urlMatch && urlMatch[1]) {
|
|
38
|
+
currentSrc = urlMatch[1];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!element || !currentSrc)
|
|
44
|
+
return;
|
|
45
|
+
// Don't handle images in modals or the editor itself
|
|
46
|
+
if (element.closest('[data-image-editor]') || element.closest('[role="dialog"]')) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
// Extract semantic ID from data attribute
|
|
52
|
+
let semanticId = element.getAttribute('data-image-id') || element.getAttribute('data-background-image-id');
|
|
53
|
+
// If not found, try to extract from the src URL
|
|
54
|
+
if (!semanticId && currentSrc.includes('/api/uploads/')) {
|
|
55
|
+
const urlPart = currentSrc.split('/api/uploads/')[1]?.split('?')[0];
|
|
56
|
+
// If it looks like a semantic ID (no extension or timestamp), use it
|
|
57
|
+
if (urlPart && !/^\d+-/.test(urlPart) && !/\.(jpg|jpeg|png|webp|gif|svg)$/i.test(urlPart)) {
|
|
58
|
+
semanticId = decodeURIComponent(urlPart);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// If still not found, generate one
|
|
62
|
+
if (!semanticId) {
|
|
63
|
+
semanticId = element.closest('[data-image-id]')?.getAttribute('data-image-id') ||
|
|
64
|
+
`image-${Date.now()}`;
|
|
65
|
+
}
|
|
66
|
+
// Parse image data
|
|
67
|
+
const filterStyle = element.style.filter || window.getComputedStyle(element).filter || '';
|
|
68
|
+
const dataBrightness = element.getAttribute('data-brightness');
|
|
69
|
+
const dataBlur = element.getAttribute('data-blur');
|
|
70
|
+
const currentBrightness = dataBrightness
|
|
71
|
+
? parseInt(dataBrightness)
|
|
72
|
+
: parseInt(filterStyle.match(/brightness\((\d+)%\)/)?.[1] || '100');
|
|
73
|
+
const currentBlur = dataBlur
|
|
74
|
+
? parseInt(dataBlur)
|
|
75
|
+
: parseInt(filterStyle.match(/blur\((\d+)px\)/)?.[1] || '0');
|
|
76
|
+
// Parse image data using the detection utility
|
|
77
|
+
const imageData = parseImageData(element, semanticId, currentBrightness, currentBlur);
|
|
78
|
+
if (!imageData) {
|
|
79
|
+
console.error('[GlobalImageEditor] Failed to parse image data');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Store semantic ID on element for later use
|
|
83
|
+
if (isBackground && !element.hasAttribute('data-background-image-id')) {
|
|
84
|
+
element.setAttribute('data-background-image-id', semanticId);
|
|
85
|
+
}
|
|
86
|
+
else if (!isBackground && !element.hasAttribute('data-image-id')) {
|
|
87
|
+
element.setAttribute('data-image-id', semanticId);
|
|
88
|
+
}
|
|
89
|
+
onImageClick(imageData);
|
|
90
|
+
};
|
|
91
|
+
// Add click listeners and hover effects to all images
|
|
92
|
+
const images = document.querySelectorAll('img[data-image-id]:not([data-no-edit])');
|
|
93
|
+
// Find elements with BackgroundImage components
|
|
94
|
+
const bgElements = [];
|
|
95
|
+
const backgroundImageComponents = document.querySelectorAll('[data-background-image-component]');
|
|
96
|
+
backgroundImageComponents.forEach(el => {
|
|
97
|
+
bgElements.push(el);
|
|
98
|
+
});
|
|
99
|
+
images.forEach((img, index) => {
|
|
100
|
+
const originalPosition = img.style.position;
|
|
101
|
+
img.style.cursor = 'pointer';
|
|
102
|
+
img.setAttribute('data-editable-image', 'true');
|
|
103
|
+
img.addEventListener('click', handleImageClick);
|
|
104
|
+
// Find the best container for the indicator
|
|
105
|
+
let indicatorContainer = img;
|
|
106
|
+
let parent = img.parentElement;
|
|
107
|
+
if (parent && (parent.tagName === 'SPAN' || parent.tagName === 'DIV')) {
|
|
108
|
+
const parentStyle = window.getComputedStyle(parent);
|
|
109
|
+
if (parentStyle.position !== 'static' ||
|
|
110
|
+
(parentStyle.display !== 'inline' && parentStyle.display !== 'inline-block')) {
|
|
111
|
+
indicatorContainer = parent;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Ensure container has relative positioning
|
|
115
|
+
const containerStyle = window.getComputedStyle(indicatorContainer);
|
|
116
|
+
if (containerStyle.position === 'static') {
|
|
117
|
+
indicatorContainer.style.position = 'relative';
|
|
118
|
+
}
|
|
119
|
+
const indicator = document.createElement('div');
|
|
120
|
+
indicator.className = 'image-edit-indicator';
|
|
121
|
+
indicator.setAttribute('data-image-index', index.toString());
|
|
122
|
+
indicator.style.cssText = `
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 0;
|
|
125
|
+
left: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
background: rgba(0, 0, 0, 0.4);
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
opacity: 0;
|
|
133
|
+
transition: opacity 0.2s ease;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
z-index: 10000;
|
|
136
|
+
border-radius: inherit;
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
`;
|
|
139
|
+
const label = document.createElement('div');
|
|
140
|
+
label.style.cssText = `
|
|
141
|
+
background: rgba(0, 0, 0, 0.9);
|
|
142
|
+
color: white;
|
|
143
|
+
padding: 8px 16px;
|
|
144
|
+
border-radius: 8px;
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
font-weight: bold;
|
|
147
|
+
text-transform: uppercase;
|
|
148
|
+
letter-spacing: 0.5px;
|
|
149
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
150
|
+
`;
|
|
151
|
+
label.textContent = 'Click to Edit';
|
|
152
|
+
indicator.appendChild(label);
|
|
153
|
+
indicatorContainer.appendChild(indicator);
|
|
154
|
+
const addHoverEffect = () => {
|
|
155
|
+
indicator.style.opacity = '1';
|
|
156
|
+
};
|
|
157
|
+
const removeHoverEffect = () => {
|
|
158
|
+
indicator.style.opacity = '0';
|
|
159
|
+
};
|
|
160
|
+
img.addEventListener('mouseenter', addHoverEffect);
|
|
161
|
+
img.addEventListener('mouseleave', removeHoverEffect);
|
|
162
|
+
if (indicatorContainer !== img) {
|
|
163
|
+
indicatorContainer.addEventListener('mouseenter', addHoverEffect);
|
|
164
|
+
indicatorContainer.addEventListener('mouseleave', removeHoverEffect);
|
|
165
|
+
}
|
|
166
|
+
cleanupFunctions.push(() => {
|
|
167
|
+
img.removeEventListener('click', handleImageClick);
|
|
168
|
+
img.removeEventListener('mouseenter', addHoverEffect);
|
|
169
|
+
img.removeEventListener('mouseleave', removeHoverEffect);
|
|
170
|
+
if (indicatorContainer !== img) {
|
|
171
|
+
indicatorContainer.removeEventListener('mouseenter', addHoverEffect);
|
|
172
|
+
indicatorContainer.removeEventListener('mouseleave', removeHoverEffect);
|
|
173
|
+
if (indicatorContainer.style.position === 'relative') {
|
|
174
|
+
indicatorContainer.style.position = '';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
img.removeAttribute('data-editable-image');
|
|
178
|
+
img.style.cursor = '';
|
|
179
|
+
img.style.position = originalPosition;
|
|
180
|
+
indicator.remove();
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
// Process background images - show a button instead of hover overlay
|
|
184
|
+
bgElements.forEach((bgEl, index) => {
|
|
185
|
+
if (bgEl.hasAttribute('data-background-image-component')) {
|
|
186
|
+
return; // Skip BackgroundImage components - they have their own edit button
|
|
187
|
+
}
|
|
188
|
+
const originalPosition = bgEl.style.position;
|
|
189
|
+
if (!bgEl.style.position || bgEl.style.position === 'static') {
|
|
190
|
+
bgEl.style.position = 'relative';
|
|
191
|
+
}
|
|
192
|
+
bgEl.setAttribute('data-editable-background', 'true');
|
|
193
|
+
bgEl.setAttribute('data-background-image', 'true');
|
|
194
|
+
const buttonContainer = document.createElement('div');
|
|
195
|
+
buttonContainer.className = 'background-edit-button-container';
|
|
196
|
+
buttonContainer.setAttribute('data-image-index', `bg-${index}`);
|
|
197
|
+
buttonContainer.style.cssText = `
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 12px;
|
|
200
|
+
right: 12px;
|
|
201
|
+
z-index: 10000;
|
|
202
|
+
pointer-events: auto;
|
|
203
|
+
`;
|
|
204
|
+
const editButton = document.createElement('button');
|
|
205
|
+
editButton.className = 'background-edit-button';
|
|
206
|
+
editButton.setAttribute('type', 'button');
|
|
207
|
+
editButton.style.cssText = `
|
|
208
|
+
background: rgba(0, 0, 0, 0.8);
|
|
209
|
+
color: white;
|
|
210
|
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
211
|
+
padding: 10px 20px;
|
|
212
|
+
border-radius: 8px;
|
|
213
|
+
font-size: 12px;
|
|
214
|
+
font-weight: bold;
|
|
215
|
+
text-transform: uppercase;
|
|
216
|
+
letter-spacing: 0.5px;
|
|
217
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
transition: all 0.2s ease;
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 8px;
|
|
223
|
+
`;
|
|
224
|
+
editButton.innerHTML = `
|
|
225
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
226
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
|
|
227
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
|
|
228
|
+
</svg>
|
|
229
|
+
Edit Background
|
|
230
|
+
`;
|
|
231
|
+
editButton.addEventListener('mouseenter', () => {
|
|
232
|
+
editButton.style.background = 'rgba(0, 0, 0, 0.95)';
|
|
233
|
+
editButton.style.borderColor = 'rgba(255, 255, 255, 0.5)';
|
|
234
|
+
editButton.style.transform = 'translateY(-2px)';
|
|
235
|
+
editButton.style.boxShadow = '0 6px 16px rgba(0, 0, 0, 0.5)';
|
|
236
|
+
});
|
|
237
|
+
editButton.addEventListener('mouseleave', () => {
|
|
238
|
+
editButton.style.background = 'rgba(0, 0, 0, 0.8)';
|
|
239
|
+
editButton.style.borderColor = 'rgba(255, 255, 255, 0.3)';
|
|
240
|
+
editButton.style.transform = 'translateY(0)';
|
|
241
|
+
editButton.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.4)';
|
|
242
|
+
});
|
|
243
|
+
editButton.addEventListener('click', (e) => {
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
e.stopPropagation();
|
|
246
|
+
handleImageClick(e);
|
|
247
|
+
});
|
|
248
|
+
buttonContainer.appendChild(editButton);
|
|
249
|
+
bgEl.appendChild(buttonContainer);
|
|
250
|
+
cleanupFunctions.push(() => {
|
|
251
|
+
bgEl.removeAttribute('data-editable-background');
|
|
252
|
+
bgEl.removeAttribute('data-background-image');
|
|
253
|
+
bgEl.style.position = originalPosition;
|
|
254
|
+
buttonContainer.remove();
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
return () => {
|
|
258
|
+
cleanupFunctions.forEach(cleanup => cleanup());
|
|
259
|
+
};
|
|
260
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Save logic for image transforms and effects
|
|
3
|
+
*/
|
|
4
|
+
import type { SelectedImage, PendingTransform } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Normalize position values - convert -50% (centering value) to 0
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePosition(position: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Get filename from element or API
|
|
11
|
+
*/
|
|
12
|
+
export declare function getFilename(semanticId: string, selectedImage: SelectedImage): Promise<string | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Save image transform to API
|
|
15
|
+
*/
|
|
16
|
+
export declare function saveTransformToAPI(semanticId: string, filename: string, scale: number, positionX: number, positionY: number, brightness: number, blur: number): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Flush pending save immediately
|
|
19
|
+
*/
|
|
20
|
+
export declare function flushPendingSave(pending: PendingTransform, selectedImage: SelectedImage): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Save image transform with debouncing support
|
|
23
|
+
* This is a wrapper that handles the debouncing logic
|
|
24
|
+
*/
|
|
25
|
+
export declare function saveImageTransform(semanticId: string, filename: string, scale: number, positionX: number, positionY: number, brightness: number, blur: number): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=saveLogic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveLogic.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalImageEditor/saveLogic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE/D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4BxB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAClC,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,aAAa,GAC7B,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Save logic for image transforms and effects
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalize position values - convert -50% (centering value) to 0
|
|
6
|
+
*/
|
|
7
|
+
export function normalizePosition(position) {
|
|
8
|
+
return position === -50 ? 0 : position;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get filename from element or API
|
|
12
|
+
*/
|
|
13
|
+
export async function getFilename(semanticId, selectedImage) {
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(`/api/plugin-images/resolve?id=${encodeURIComponent(semanticId)}`);
|
|
16
|
+
if (response.ok) {
|
|
17
|
+
const data = await response.json();
|
|
18
|
+
return data.filename || semanticId;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// If not found, try to extract from element
|
|
22
|
+
const { element } = selectedImage;
|
|
23
|
+
if (selectedImage.isBackground) {
|
|
24
|
+
const imgWrapper = element.querySelector('[data-image-id]');
|
|
25
|
+
if (imgWrapper) {
|
|
26
|
+
const img = imgWrapper.querySelector('img');
|
|
27
|
+
if (img && img.src) {
|
|
28
|
+
return img.src.split('/api/uploads/')[1]?.split('?')[0] || semanticId;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const img = element.tagName === 'IMG' ? element : element.querySelector('img');
|
|
34
|
+
if (img && img.src) {
|
|
35
|
+
return img.src.split('/api/uploads/')[1]?.split('?')[0] || semanticId;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Failed to get filename:', error);
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Save image transform to API
|
|
47
|
+
*/
|
|
48
|
+
export async function saveTransformToAPI(semanticId, filename, scale, positionX, positionY, brightness, blur) {
|
|
49
|
+
try {
|
|
50
|
+
const response = await fetch('/api/plugin-images/resolve', {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
headers: { 'Content-Type': 'application/json' },
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
id: semanticId,
|
|
55
|
+
filename,
|
|
56
|
+
brightness,
|
|
57
|
+
blur,
|
|
58
|
+
scale,
|
|
59
|
+
positionX: normalizePosition(positionX),
|
|
60
|
+
positionY: normalizePosition(positionY),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
if (response.ok) {
|
|
64
|
+
// Dispatch event to notify Image components
|
|
65
|
+
window.dispatchEvent(new CustomEvent('image-mapping-updated', {
|
|
66
|
+
detail: {
|
|
67
|
+
id: semanticId,
|
|
68
|
+
filename,
|
|
69
|
+
brightness,
|
|
70
|
+
blur,
|
|
71
|
+
scale,
|
|
72
|
+
positionX: normalizePosition(positionX),
|
|
73
|
+
positionY: normalizePosition(positionY),
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error('Failed to save transform:', error);
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Flush pending save immediately
|
|
86
|
+
*/
|
|
87
|
+
export async function flushPendingSave(pending, selectedImage) {
|
|
88
|
+
const normalizedPositionX = normalizePosition(pending.positionX);
|
|
89
|
+
const normalizedPositionY = normalizePosition(pending.positionY);
|
|
90
|
+
await saveTransformToAPI(pending.semanticId, pending.filename, pending.scale, normalizedPositionX, normalizedPositionY, selectedImage.brightness, selectedImage.blur);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Save image transform with debouncing support
|
|
94
|
+
* This is a wrapper that handles the debouncing logic
|
|
95
|
+
*/
|
|
96
|
+
export async function saveImageTransform(semanticId, filename, scale, positionX, positionY, brightness, blur) {
|
|
97
|
+
await saveTransformToAPI(semanticId, filename, scale, positionX, positionY, brightness, blur);
|
|
98
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for detecting styling from DOM elements
|
|
3
|
+
*/
|
|
4
|
+
import type { DetectedStyling } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Detect styling properties from an element and its parent containers
|
|
7
|
+
*/
|
|
8
|
+
export declare function detectStyling(element: HTMLElement, imgElement: HTMLImageElement | null): DetectedStyling;
|
|
9
|
+
//# sourceMappingURL=stylingDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylingDetection.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalImageEditor/stylingDetection.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;GAEG;AACH,wBAAgB,aAAa,CACzB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,gBAAgB,GAAG,IAAI,GACpC,eAAe,CA6GjB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for detecting styling from DOM elements
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Detect styling properties from an element and its parent containers
|
|
6
|
+
*/
|
|
7
|
+
export function detectStyling(element, imgElement) {
|
|
8
|
+
// Find the container element (could be the element itself or a parent)
|
|
9
|
+
let container = element;
|
|
10
|
+
let parent = element.parentElement;
|
|
11
|
+
// Look for styling in parent containers (up to 3 levels)
|
|
12
|
+
for (let i = 0; i < 3 && parent; i++) {
|
|
13
|
+
const classes = parent.className || '';
|
|
14
|
+
const computedStyle = window.getComputedStyle(parent);
|
|
15
|
+
// Check for rounded-full (circular)
|
|
16
|
+
if (classes.includes('rounded-full')) {
|
|
17
|
+
container = parent;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
parent = parent.parentElement;
|
|
21
|
+
}
|
|
22
|
+
const containerClasses = container.className || '';
|
|
23
|
+
const containerStyle = window.getComputedStyle(container);
|
|
24
|
+
const imgStyle = imgElement ? window.getComputedStyle(imgElement) : null;
|
|
25
|
+
// Detect border radius
|
|
26
|
+
let borderRadius = 'rounded-xl'; // default
|
|
27
|
+
if (containerClasses.includes('rounded-full')) {
|
|
28
|
+
borderRadius = 'rounded-full';
|
|
29
|
+
}
|
|
30
|
+
else if (containerClasses.includes('rounded-3xl')) {
|
|
31
|
+
borderRadius = 'rounded-3xl';
|
|
32
|
+
}
|
|
33
|
+
else if (containerClasses.includes('rounded-2xl')) {
|
|
34
|
+
borderRadius = 'rounded-2xl';
|
|
35
|
+
}
|
|
36
|
+
else if (containerClasses.includes('rounded-xl')) {
|
|
37
|
+
borderRadius = 'rounded-xl';
|
|
38
|
+
}
|
|
39
|
+
else if (containerClasses.includes('rounded-lg')) {
|
|
40
|
+
borderRadius = 'rounded-lg';
|
|
41
|
+
}
|
|
42
|
+
// Detect aspect ratio
|
|
43
|
+
let aspectRatio = '16/9'; // default
|
|
44
|
+
// First check the container's computed style
|
|
45
|
+
const aspectRatioStyle = containerStyle.aspectRatio;
|
|
46
|
+
if (aspectRatioStyle && aspectRatioStyle !== 'auto') {
|
|
47
|
+
// Convert CSS aspect-ratio (e.g., "1 / 1") to our format ("1/1")
|
|
48
|
+
aspectRatio = aspectRatioStyle.replace(/\s+/g, '');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Check for Tailwind aspect ratio classes in container or parents
|
|
52
|
+
let currentElement = container;
|
|
53
|
+
let foundAspectRatio = false;
|
|
54
|
+
// Check up to 3 parent levels for aspect ratio
|
|
55
|
+
for (let i = 0; i < 3 && currentElement && !foundAspectRatio; i++) {
|
|
56
|
+
const classes = currentElement.className || '';
|
|
57
|
+
const computedStyle = window.getComputedStyle(currentElement);
|
|
58
|
+
// Check computed style first
|
|
59
|
+
if (computedStyle.aspectRatio && computedStyle.aspectRatio !== 'auto') {
|
|
60
|
+
aspectRatio = computedStyle.aspectRatio.replace(/\s+/g, '');
|
|
61
|
+
foundAspectRatio = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
// Check for Tailwind aspect ratio classes (aspect-*, aspect-square, aspect-video, etc.)
|
|
65
|
+
const aspectMatch = classes.match(/aspect-(\d+\/\d+)|aspect-square|aspect-video/);
|
|
66
|
+
if (aspectMatch) {
|
|
67
|
+
if (aspectMatch[1]) {
|
|
68
|
+
// Matched aspect-4/5, aspect-16/9, etc.
|
|
69
|
+
aspectRatio = aspectMatch[1];
|
|
70
|
+
}
|
|
71
|
+
else if (aspectMatch[0] === 'aspect-square') {
|
|
72
|
+
aspectRatio = '1/1';
|
|
73
|
+
}
|
|
74
|
+
else if (aspectMatch[0] === 'aspect-video') {
|
|
75
|
+
aspectRatio = '16/9';
|
|
76
|
+
}
|
|
77
|
+
foundAspectRatio = true;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
currentElement = currentElement.parentElement;
|
|
81
|
+
}
|
|
82
|
+
// Fallback checks
|
|
83
|
+
if (!foundAspectRatio) {
|
|
84
|
+
if (containerClasses.includes('rounded-full')) {
|
|
85
|
+
// Circular images are typically 1:1
|
|
86
|
+
aspectRatio = '1/1';
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Try to detect from size classes
|
|
90
|
+
if (containerClasses.includes('size-') || containerClasses.match(/w-\d+.*h-\d+/)) {
|
|
91
|
+
aspectRatio = '1/1';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Detect object-fit
|
|
97
|
+
let objectFit = 'cover';
|
|
98
|
+
if (imgStyle) {
|
|
99
|
+
const objectFitValue = imgStyle.objectFit || containerStyle.objectFit;
|
|
100
|
+
if (objectFitValue && ['cover', 'contain', 'fill', 'none', 'scale-down'].includes(objectFitValue)) {
|
|
101
|
+
objectFit = objectFitValue;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Detect object-position
|
|
105
|
+
let objectPosition = 'center';
|
|
106
|
+
if (imgStyle) {
|
|
107
|
+
objectPosition = imgStyle.objectPosition || containerStyle.objectPosition || 'center';
|
|
108
|
+
}
|
|
109
|
+
return { aspectRatio, borderRadius, objectFit, objectPosition };
|
|
110
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for parsing CSS transforms to extract scale and position values
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parse scale from CSS transform string
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseScaleFromTransform(transform: string, container: HTMLElement | null, imgElement: HTMLImageElement | null): number;
|
|
8
|
+
/**
|
|
9
|
+
* Parse position (X, Y) from CSS transform string
|
|
10
|
+
* Returns container-relative percentages
|
|
11
|
+
*/
|
|
12
|
+
export declare function parsePositionFromTransform(transform: string): {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=transformParsing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformParsing.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalImageEditor/transformParsing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,WAAW,GAAG,IAAI,EAC7B,UAAU,EAAE,gBAAgB,GAAG,IAAI,GACpC,MAAM,CA+BR;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAkCtF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for parsing CSS transforms to extract scale and position values
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parse scale from CSS transform string
|
|
6
|
+
*/
|
|
7
|
+
export function parseScaleFromTransform(transform, container, imgElement) {
|
|
8
|
+
const scaleMatch = transform.match(/scale\(([\d.]+)\)/);
|
|
9
|
+
if (!scaleMatch)
|
|
10
|
+
return 1.0;
|
|
11
|
+
const totalScale = parseFloat(scaleMatch[1]);
|
|
12
|
+
// If totalScale is very small (< 0.1), it's likely wrong
|
|
13
|
+
if (totalScale < 0.1) {
|
|
14
|
+
return 1.0;
|
|
15
|
+
}
|
|
16
|
+
// Calculate baseScale to extract the actual user scale
|
|
17
|
+
if (container && imgElement && imgElement.naturalWidth > 0 && imgElement.naturalHeight > 0) {
|
|
18
|
+
const containerWidth = container.clientWidth || container.offsetWidth;
|
|
19
|
+
const containerHeight = container.clientHeight || container.offsetHeight;
|
|
20
|
+
if (containerWidth > 0 && containerHeight > 0) {
|
|
21
|
+
const widthRatio = containerWidth / imgElement.naturalWidth;
|
|
22
|
+
const heightRatio = containerHeight / imgElement.naturalHeight;
|
|
23
|
+
const baseScale = Math.max(widthRatio, heightRatio);
|
|
24
|
+
if (baseScale > 0 && baseScale < 1) {
|
|
25
|
+
// Extract the actual scale by dividing totalScale by baseScale
|
|
26
|
+
const scale = totalScale / baseScale;
|
|
27
|
+
// Clamp to valid range
|
|
28
|
+
return Math.max(0.1, Math.min(5.0, scale));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return 1.0;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parse position (X, Y) from CSS transform string
|
|
36
|
+
* Returns container-relative percentages
|
|
37
|
+
*/
|
|
38
|
+
export function parsePositionFromTransform(transform) {
|
|
39
|
+
// Match all translate() calls - skip the first one if it's the centering translate(-50%, -50%)
|
|
40
|
+
const allTranslates = transform.matchAll(/translate\(([-\d.]+)%,?\s*([-\d.]+)?%?\)/g);
|
|
41
|
+
const translateArray = Array.from(allTranslates);
|
|
42
|
+
let positionX = 0;
|
|
43
|
+
let positionY = 0;
|
|
44
|
+
if (translateArray.length > 1) {
|
|
45
|
+
// Use the second translate (the position offset)
|
|
46
|
+
const positionTranslate = translateArray[1];
|
|
47
|
+
const appliedX = parseFloat(positionTranslate[1] || '0');
|
|
48
|
+
const appliedY = parseFloat(positionTranslate[2] || '0');
|
|
49
|
+
// Only use if it's not the centering translate (safety check)
|
|
50
|
+
if (appliedX !== -50 || appliedY !== -50) {
|
|
51
|
+
// With new system, applied value IS the stored value (container-relative)
|
|
52
|
+
positionX = appliedX;
|
|
53
|
+
positionY = appliedY;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (translateArray.length === 1) {
|
|
57
|
+
// Only one translate - check if it's the centering one
|
|
58
|
+
const translate = translateArray[0];
|
|
59
|
+
const appliedX = parseFloat(translate[1] || '0');
|
|
60
|
+
const appliedY = parseFloat(translate[2] || '0');
|
|
61
|
+
// If it's not the centering translate, use it as position
|
|
62
|
+
if (appliedX !== -50 || appliedY !== -50) {
|
|
63
|
+
positionX = appliedX;
|
|
64
|
+
positionY = appliedY;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { x: positionX, y: positionY };
|
|
68
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for GlobalImageEditor component
|
|
3
|
+
*/
|
|
4
|
+
export interface SelectedImage {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
originalSrc: string;
|
|
7
|
+
brightness: number;
|
|
8
|
+
blur: number;
|
|
9
|
+
scale: number;
|
|
10
|
+
positionX: number;
|
|
11
|
+
positionY: number;
|
|
12
|
+
isBackground: boolean;
|
|
13
|
+
aspectRatio?: string;
|
|
14
|
+
borderRadius?: string;
|
|
15
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
16
|
+
objectPosition?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginConfig {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
overlayClassName?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DetectedStyling {
|
|
24
|
+
aspectRatio: string;
|
|
25
|
+
borderRadius: string;
|
|
26
|
+
objectFit: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
27
|
+
objectPosition: string;
|
|
28
|
+
}
|
|
29
|
+
export interface PendingTransform {
|
|
30
|
+
scale: number;
|
|
31
|
+
positionX: number;
|
|
32
|
+
positionY: number;
|
|
33
|
+
semanticId: string;
|
|
34
|
+
filename: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalImageEditor/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IAChE,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global Image Editor Component
|
|
3
|
+
* Allows clicking on any image in the client app to edit it (admin/dev only)
|
|
4
|
+
*
|
|
5
|
+
* Reads configuration from window.__JHITS_PLUGIN_PROPS__['plugin-images']
|
|
6
|
+
*/
|
|
7
|
+
export declare function GlobalImageEditor(): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=GlobalImageEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalImageEditor.d.ts","sourceRoot":"","sources":["../../src/components/GlobalImageEditor.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,wBAAgB,iBAAiB,mDAkThC"}
|