zuljaman-banner-components 1.0.22 → 1.0.24
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 +228 -131
- package/dist/components/BannerRenderer/BannerRenderer.d.ts +8 -0
- package/dist/components/BannerRenderer/BannerRenderer.d.ts.map +1 -0
- package/dist/components/BannerRenderer/BannerRenderer.js +325 -0
- package/dist/components/BannerRenderer/components/CopyElement.d.ts +62 -0
- package/dist/components/BannerRenderer/components/CopyElement.d.ts.map +1 -0
- package/dist/components/BannerRenderer/components/CopyElement.js +220 -0
- package/dist/components/BannerRenderer/components/InteractiveLines.d.ts +26 -0
- package/dist/components/BannerRenderer/components/InteractiveLines.d.ts.map +1 -0
- package/dist/components/BannerRenderer/components/InteractiveLines.js +172 -0
- package/dist/components/BannerRenderer/components/LogoElement.d.ts +55 -0
- package/dist/components/BannerRenderer/components/LogoElement.d.ts.map +1 -0
- package/dist/components/BannerRenderer/components/LogoElement.js +53 -0
- package/dist/components/BannerRenderer/components/VisualGuides.d.ts +43 -0
- package/dist/components/BannerRenderer/components/VisualGuides.d.ts.map +1 -0
- package/dist/components/BannerRenderer/components/VisualGuides.js +110 -0
- package/dist/components/BannerRenderer/components/index.d.ts +12 -0
- package/dist/components/BannerRenderer/components/index.d.ts.map +1 -0
- package/dist/components/BannerRenderer/components/index.js +14 -0
- package/dist/components/BannerRenderer/constants.d.ts +15 -0
- package/dist/components/BannerRenderer/constants.d.ts.map +1 -0
- package/dist/components/BannerRenderer/constants.js +36 -0
- package/dist/components/BannerRenderer/hooks/index.d.ts +14 -0
- package/dist/components/BannerRenderer/hooks/index.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/index.js +16 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/debugPositions.d.ts +30 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/debugPositions.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/debugPositions.js +87 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/index.d.ts +13 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/index.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/index.js +21 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAnchorEdgeLocking.d.ts +71 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAnchorEdgeLocking.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAnchorEdgeLocking.js +151 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAutoPositioningMain.d.ts +66 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAutoPositioningMain.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useAutoPositioningMain.js +332 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useChainPositioning.d.ts +61 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useChainPositioning.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useChainPositioning.js +180 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useHeightCompensation.d.ts +60 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useHeightCompensation.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning/useHeightCompensation.js +178 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning.d.ts +8 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useAutoPositioning.js +12 -0
- package/dist/components/BannerRenderer/hooks/useDragSnap.d.ts +30 -0
- package/dist/components/BannerRenderer/hooks/useDragSnap.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useDragSnap.js +90 -0
- package/dist/components/BannerRenderer/hooks/useElementRefs.d.ts +22 -0
- package/dist/components/BannerRenderer/hooks/useElementRefs.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useElementRefs.js +70 -0
- package/dist/components/BannerRenderer/hooks/useLineDrawing.d.ts +40 -0
- package/dist/components/BannerRenderer/hooks/useLineDrawing.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useLineDrawing.js +198 -0
- package/dist/components/BannerRenderer/hooks/useProximityDetection.d.ts +43 -0
- package/dist/components/BannerRenderer/hooks/useProximityDetection.d.ts.map +1 -0
- package/dist/components/BannerRenderer/hooks/useProximityDetection.js +491 -0
- package/dist/components/BannerRenderer/index.d.ts +6 -0
- package/dist/components/BannerRenderer/index.d.ts.map +1 -0
- package/dist/components/BannerRenderer/index.js +8 -0
- package/dist/components/{BannerRenderer.d.ts → BannerRenderer/types.d.ts} +29 -8
- package/dist/components/BannerRenderer/types.d.ts.map +1 -0
- package/dist/components/BannerRenderer/types.js +5 -0
- package/dist/components/BannerRenderer/utils/alignmentUtils.d.ts +38 -0
- package/dist/components/BannerRenderer/utils/alignmentUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/alignmentUtils.js +138 -0
- package/dist/components/BannerRenderer/utils/elementCheckUtils.d.ts +22 -0
- package/dist/components/BannerRenderer/utils/elementCheckUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/elementCheckUtils.js +37 -0
- package/dist/components/BannerRenderer/utils/elementIdUtils.d.ts +25 -0
- package/dist/components/BannerRenderer/utils/elementIdUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/elementIdUtils.js +56 -0
- package/dist/components/BannerRenderer/utils/fontUtils.d.ts +12 -0
- package/dist/components/BannerRenderer/utils/fontUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/fontUtils.js +26 -0
- package/dist/components/BannerRenderer/utils/graphUtils.d.ts +54 -0
- package/dist/components/BannerRenderer/utils/graphUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/graphUtils.js +138 -0
- package/dist/components/BannerRenderer/utils/index.d.ts +12 -0
- package/dist/components/BannerRenderer/utils/index.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/index.js +27 -0
- package/dist/components/BannerRenderer/utils/snapUtils.d.ts +38 -0
- package/dist/components/BannerRenderer/utils/snapUtils.d.ts.map +1 -0
- package/dist/components/BannerRenderer/utils/snapUtils.js +109 -0
- package/dist/components/BannerVisor.d.ts.map +1 -1
- package/dist/components/BannerVisor.js +8 -1
- package/dist/components/index.js +1 -1
- package/dist/components/shared/DraggableElement.d.ts +11 -0
- package/dist/components/shared/DraggableElement.d.ts.map +1 -1
- package/dist/components/shared/DraggableElement.js +51 -51
- package/dist/components/styles/Style1/substyleConfig.d.ts.map +1 -1
- package/dist/components/styles/Style1/substyleConfig.js +53 -54
- package/dist/components/styles/Style2/substyleConfig.js +78 -78
- package/dist/components/styles/Style3/substyleConfig.d.ts.map +1 -1
- package/dist/components/styles/Style3/substyleConfig.js +40 -37
- package/dist/components/styles/Style4/substyleConfig.js +57 -57
- package/dist/components/styles/types/substyleTypes.d.ts +32 -15
- package/dist/components/styles/types/substyleTypes.d.ts.map +1 -1
- package/dist/components/styles/utils/chainValidation.d.ts +41 -0
- package/dist/components/styles/utils/chainValidation.d.ts.map +1 -0
- package/dist/components/styles/utils/chainValidation.js +148 -0
- package/dist/components/styles/utils/positioningUtils.d.ts +207 -11
- package/dist/components/styles/utils/positioningUtils.d.ts.map +1 -1
- package/dist/components/styles/utils/positioningUtils.js +520 -19
- package/dist/constants/characterLimits.d.ts +4 -16
- package/dist/constants/characterLimits.d.ts.map +1 -1
- package/dist/constants/characterLimits.js +28 -26
- package/dist/constants/styleConfigs.js +6 -6
- package/dist/styleConfig.d.ts +4 -4
- package/dist/styleConfig.d.ts.map +1 -1
- package/dist/styleConfig.js +8 -16
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/components/BannerRenderer.d.ts.map +0 -1
- package/dist/components/BannerRenderer.js +0 -559
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InteractiveLines = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const InteractiveLines = ({ copies, completedLines, drawingFrom, drawingMousePos, hoveredLine, lineRecalcTrigger, sizeMultiplier, logoRef, copyRefs, bannerContainerRef, setCompletedLines, setManualLines, setHoveredLine, }) => {
|
|
6
|
+
// Helper to get element ref by ID (supports both copy-{uuid} and copy-{N} formats)
|
|
7
|
+
const getElementRefLocal = (elementId) => {
|
|
8
|
+
if (elementId === 'logo') {
|
|
9
|
+
return logoRef.current;
|
|
10
|
+
}
|
|
11
|
+
else if (elementId.startsWith('copy-')) {
|
|
12
|
+
const suffix = elementId.substring(5);
|
|
13
|
+
// Check if it's copy-N format (styleSlot)
|
|
14
|
+
if (/^\d+$/.test(suffix)) {
|
|
15
|
+
const styleSlotIndex = parseInt(suffix, 10);
|
|
16
|
+
const copy = copies.find(c => c.styleSlot === styleSlotIndex);
|
|
17
|
+
if (copy) {
|
|
18
|
+
const copyIndex = copies.indexOf(copy);
|
|
19
|
+
return copyRefs.current[copyIndex];
|
|
20
|
+
}
|
|
21
|
+
if (styleSlotIndex < copies.length) {
|
|
22
|
+
return copyRefs.current[styleSlotIndex];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// UUID format
|
|
27
|
+
const copyIndex = copies.findIndex(c => c.id === suffix);
|
|
28
|
+
if (copyIndex !== -1) {
|
|
29
|
+
return copyRefs.current[copyIndex];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
// Helper to get element center position
|
|
36
|
+
// Read from DOM to ensure consistency with getBorderPoint
|
|
37
|
+
const getElementCenter = (elementId) => {
|
|
38
|
+
const ref = getElementRefLocal(elementId);
|
|
39
|
+
if (!ref || !bannerContainerRef.current)
|
|
40
|
+
return null;
|
|
41
|
+
const elementBounds = ref.getBoundingClientRect();
|
|
42
|
+
const bannerBounds = bannerContainerRef.current.getBoundingClientRect();
|
|
43
|
+
const centerX = elementBounds.left + elementBounds.width / 2;
|
|
44
|
+
const centerY = elementBounds.top + elementBounds.height / 2;
|
|
45
|
+
const bannerCenterX = bannerBounds.left + bannerBounds.width / 2;
|
|
46
|
+
const bannerCenterY = bannerBounds.top + bannerBounds.height / 2;
|
|
47
|
+
return {
|
|
48
|
+
x: (centerX - bannerCenterX) / sizeMultiplier,
|
|
49
|
+
y: (centerY - bannerCenterY) / sizeMultiplier,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
// Helper to get border intersection point
|
|
53
|
+
// Calculates where a line from 'from' point to element center intersects the element's border
|
|
54
|
+
const getBorderPoint = (elementId, fromX, fromY) => {
|
|
55
|
+
const ref = getElementRefLocal(elementId);
|
|
56
|
+
if (!ref || !bannerContainerRef.current)
|
|
57
|
+
return null;
|
|
58
|
+
// Get element dimensions and position from DOM
|
|
59
|
+
const elementBounds = ref.getBoundingClientRect();
|
|
60
|
+
const bannerBounds = bannerContainerRef.current.getBoundingClientRect();
|
|
61
|
+
const width = elementBounds.width / sizeMultiplier;
|
|
62
|
+
const height = elementBounds.height / sizeMultiplier;
|
|
63
|
+
// Calculate element center in banner-relative coordinates
|
|
64
|
+
const centerXAbs = elementBounds.left + elementBounds.width / 2;
|
|
65
|
+
const centerYAbs = elementBounds.top + elementBounds.height / 2;
|
|
66
|
+
const bannerCenterX = bannerBounds.left + bannerBounds.width / 2;
|
|
67
|
+
const bannerCenterY = bannerBounds.top + bannerBounds.height / 2;
|
|
68
|
+
const centerX = (centerXAbs - bannerCenterX) / sizeMultiplier;
|
|
69
|
+
const centerY = (centerYAbs - bannerCenterY) / sizeMultiplier;
|
|
70
|
+
// Direction from 'from' point to element center
|
|
71
|
+
const dx = centerX - fromX;
|
|
72
|
+
const dy = centerY - fromY;
|
|
73
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
74
|
+
if (distance === 0)
|
|
75
|
+
return { x: centerX, y: centerY };
|
|
76
|
+
// Normalized direction
|
|
77
|
+
const dirX = dx / distance;
|
|
78
|
+
const dirY = dy / distance;
|
|
79
|
+
// Calculate intersection with element bounding box
|
|
80
|
+
// Using parametric form: point = from + t * dir
|
|
81
|
+
// Find t where the ray intersects the box edges
|
|
82
|
+
const halfW = width / 2;
|
|
83
|
+
const halfH = height / 2;
|
|
84
|
+
// Calculate t for each edge
|
|
85
|
+
const tRight = dirX > 0 ? (halfW) / dirX : Infinity;
|
|
86
|
+
const tLeft = dirX < 0 ? (-halfW) / dirX : Infinity;
|
|
87
|
+
const tBottom = dirY > 0 ? (halfH) / dirY : Infinity;
|
|
88
|
+
const tTop = dirY < 0 ? (-halfH) / dirY : Infinity;
|
|
89
|
+
// Find minimum positive t
|
|
90
|
+
const t = Math.min(tRight, tLeft, tBottom, tTop);
|
|
91
|
+
// Calculate intersection point from element center
|
|
92
|
+
const intersectX = t * dirX;
|
|
93
|
+
const intersectY = t * dirY;
|
|
94
|
+
return {
|
|
95
|
+
x: centerX - intersectX,
|
|
96
|
+
y: centerY - intersectY,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const visibleLines = [];
|
|
100
|
+
const invisibleLines = [];
|
|
101
|
+
// Render completed lines (both visible and invisible for hit detection)
|
|
102
|
+
completedLines.forEach((toId, fromId) => {
|
|
103
|
+
// Get centers of both elements first
|
|
104
|
+
const fromCenter = getElementCenter(fromId);
|
|
105
|
+
const toCenter = getElementCenter(toId);
|
|
106
|
+
// Calculate border points for both elements
|
|
107
|
+
const fromPos = fromCenter && toCenter ? getBorderPoint(fromId, toCenter.x, toCenter.y) : null;
|
|
108
|
+
const toPos = toCenter && fromCenter ? getBorderPoint(toId, fromCenter.x, fromCenter.y) : null;
|
|
109
|
+
const lineId = `${fromId}-${toId}`;
|
|
110
|
+
const isHovered = hoveredLine === lineId;
|
|
111
|
+
if (fromPos && toPos) {
|
|
112
|
+
// Visible line (below elements, z-index: 8)
|
|
113
|
+
visibleLines.push((0, jsx_runtime_1.jsx)("line", { x1: fromPos.x, y1: fromPos.y, x2: toPos.x, y2: toPos.y, stroke: isHovered ? 'rgba(255, 50, 50, 0.9)' : 'rgba(0, 255, 65, 0.9)', strokeWidth: isHovered ? '10' : '8', strokeDasharray: "8,12", strokeLinecap: "round", style: {
|
|
114
|
+
filter: 'drop-shadow(0 0 4px rgba(0, 255, 65, 0.6))',
|
|
115
|
+
pointerEvents: 'none',
|
|
116
|
+
animation: 'marching-ants 0.5s linear infinite',
|
|
117
|
+
} }, `visible-${lineId}`));
|
|
118
|
+
// Invisible line for hit detection (above elements, z-index: 16)
|
|
119
|
+
invisibleLines.push((0, jsx_runtime_1.jsx)("line", { x1: fromPos.x, y1: fromPos.y, x2: toPos.x, y2: toPos.y, stroke: "transparent", strokeWidth: "20" // Wider for easier clicking
|
|
120
|
+
, strokeLinecap: "round", style: {
|
|
121
|
+
cursor: 'pointer',
|
|
122
|
+
pointerEvents: 'auto',
|
|
123
|
+
}, onClick: (e) => {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
setCompletedLines(prev => {
|
|
126
|
+
const newMap = new Map(prev);
|
|
127
|
+
newMap.delete(fromId);
|
|
128
|
+
return newMap;
|
|
129
|
+
});
|
|
130
|
+
// Also remove from manual lines
|
|
131
|
+
setManualLines(prev => {
|
|
132
|
+
const newSet = new Set(prev);
|
|
133
|
+
newSet.delete(`${fromId}->${toId}`);
|
|
134
|
+
return newSet;
|
|
135
|
+
});
|
|
136
|
+
setHoveredLine(null);
|
|
137
|
+
}, onMouseEnter: () => setHoveredLine(lineId), onMouseLeave: () => setHoveredLine(null) }, `invisible-${lineId}`));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
// Render drawing line (following mouse) - only in visible layer
|
|
141
|
+
if (drawingFrom && drawingMousePos) {
|
|
142
|
+
// Get element center and calculate border point towards mouse
|
|
143
|
+
const fromCenter = getElementCenter(drawingFrom);
|
|
144
|
+
const fromPos = fromCenter ? getBorderPoint(drawingFrom, drawingMousePos.x, drawingMousePos.y) : null;
|
|
145
|
+
if (fromPos) {
|
|
146
|
+
visibleLines.push((0, jsx_runtime_1.jsx)("line", { x1: fromPos.x, y1: fromPos.y, x2: drawingMousePos.x, y2: drawingMousePos.y, stroke: "rgba(0, 255, 65, 0.6)", strokeWidth: "4", strokeDasharray: "10,5", strokeLinecap: "round", style: {
|
|
147
|
+
filter: 'drop-shadow(0 0 4px rgba(0, 255, 65, 0.4))',
|
|
148
|
+
pointerEvents: 'none',
|
|
149
|
+
} }, "drawing-line"));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (visibleLines.length === 0 && invisibleLines.length === 0)
|
|
153
|
+
return null;
|
|
154
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [visibleLines.length > 0 && ((0, jsx_runtime_1.jsx)("svg", { className: "absolute", style: {
|
|
155
|
+
top: '50%',
|
|
156
|
+
left: '50%',
|
|
157
|
+
width: '100%',
|
|
158
|
+
height: '100%',
|
|
159
|
+
zIndex: 8,
|
|
160
|
+
overflow: 'visible',
|
|
161
|
+
pointerEvents: 'none',
|
|
162
|
+
}, children: visibleLines }, `lines-${lineRecalcTrigger}`)), invisibleLines.length > 0 && ((0, jsx_runtime_1.jsx)("svg", { className: "absolute", style: {
|
|
163
|
+
top: '50%',
|
|
164
|
+
left: '50%',
|
|
165
|
+
width: '100%',
|
|
166
|
+
height: '100%',
|
|
167
|
+
zIndex: 16,
|
|
168
|
+
overflow: 'visible',
|
|
169
|
+
pointerEvents: 'none', // Container is none, individual lines are auto
|
|
170
|
+
}, children: invisibleLines }, `lines-invisible-${lineRecalcTrigger}`))] }));
|
|
171
|
+
};
|
|
172
|
+
exports.InteractiveLines = InteractiveLines;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LogoElement component
|
|
3
|
+
* Renders the logo with drag, rotation, and resize capabilities
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { ImageProps } from '../../../types';
|
|
7
|
+
import type { AlignmentLine } from '../utils';
|
|
8
|
+
export interface LogoElementProps {
|
|
9
|
+
logoTranslateX: number;
|
|
10
|
+
logoTranslateY: number;
|
|
11
|
+
logoRotation: number;
|
|
12
|
+
logoWidth?: number;
|
|
13
|
+
logoUrl?: string;
|
|
14
|
+
logoSizeMultiplier: number;
|
|
15
|
+
sizeMultiplier: number;
|
|
16
|
+
draggableMode: boolean;
|
|
17
|
+
creationMode: boolean;
|
|
18
|
+
linkingModeActive: boolean;
|
|
19
|
+
selectedElement: string | null;
|
|
20
|
+
completedLines: Map<string, string>;
|
|
21
|
+
drawingFrom: string | null;
|
|
22
|
+
logoRef: React.RefObject<HTMLDivElement | null>;
|
|
23
|
+
bannerContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
ImageComponent: React.ComponentType<ImageProps>;
|
|
25
|
+
onLogoPositionChange?: (pos: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}) => void;
|
|
29
|
+
onLogoRotationChange?: (rotation: number) => void;
|
|
30
|
+
onLogoWidthChange?: (width: number) => void;
|
|
31
|
+
setSelectedElement: (id: string | null) => void;
|
|
32
|
+
setIsDragging: (dragging: boolean) => void;
|
|
33
|
+
setLiveDragPosition: (pos: {
|
|
34
|
+
elementId: string;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | null) => void;
|
|
38
|
+
setAlignmentLines: (lines: AlignmentLine[]) => void;
|
|
39
|
+
setProximityLines: (lines: any[]) => void;
|
|
40
|
+
handleToggleAutoPositioning: (elementId: string) => void;
|
|
41
|
+
handleCompleteLineTo: (targetId: string) => void;
|
|
42
|
+
handleRotationSnap: (angle: number) => number;
|
|
43
|
+
handlePositionSnap: (bounds: DOMRect, position: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}) => {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
calculateAlignments: (elementId: string) => AlignmentLine[];
|
|
51
|
+
calculateProximityLines: (elementId: string) => void;
|
|
52
|
+
detectProximityLines: (elementId: string) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare const LogoElement: React.FC<LogoElementProps>;
|
|
55
|
+
//# sourceMappingURL=LogoElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoElement.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerRenderer/components/LogoElement.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAE/B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IAGvB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChD,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAG3D,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAGhD,oBAAoB,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,mBAAmB,EAAE,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACvF,iBAAiB,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACpD,iBAAiB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC1C,2BAA2B,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,kBAAkB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtG,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;IAC5D,uBAAuB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2HlD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogoElement = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const shared_1 = require("../../shared");
|
|
6
|
+
const defaults_1 = require("../../../constants/defaults");
|
|
7
|
+
const LogoElement = ({ logoTranslateX, logoTranslateY, logoRotation, logoWidth, logoUrl, logoSizeMultiplier, sizeMultiplier, draggableMode, creationMode, linkingModeActive, selectedElement, completedLines, drawingFrom, logoRef, bannerContainerRef, ImageComponent, onLogoPositionChange, onLogoRotationChange, onLogoWidthChange, setSelectedElement, setIsDragging, setLiveDragPosition, setAlignmentLines, setProximityLines, handleToggleAutoPositioning, handleCompleteLineTo, handleRotationSnap, handlePositionSnap, calculateAlignments, calculateProximityLines, detectProximityLines, }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(shared_1.DraggableElement, { enabled: draggableMode, position: { x: logoTranslateX, y: logoTranslateY }, rotation: logoRotation, width: logoWidth, scale: sizeMultiplier, elementId: "logo", isSelected: selectedElement === "logo", creationMode: creationMode, linkingModeActive: linkingModeActive, onStartLinking: creationMode && linkingModeActive ? () => handleToggleAutoPositioning('logo') : undefined, onElementClickWhileDrawing: creationMode && drawingFrom ? handleCompleteLineTo : undefined, onPositionChange: (pos) => {
|
|
9
|
+
// Clear dragging state when drag ends
|
|
10
|
+
setIsDragging(false);
|
|
11
|
+
setLiveDragPosition(null);
|
|
12
|
+
setAlignmentLines([]); // Clear alignment lines
|
|
13
|
+
setProximityLines([]); // Clear proximity lines
|
|
14
|
+
onLogoPositionChange === null || onLogoPositionChange === void 0 ? void 0 : onLogoPositionChange(pos);
|
|
15
|
+
}, onRotationChange: onLogoRotationChange, onWidthChange: onLogoWidthChange, onSelect: (id) => setSelectedElement(id), onDeselect: () => {
|
|
16
|
+
setSelectedElement(null);
|
|
17
|
+
setLiveDragPosition(null);
|
|
18
|
+
setIsDragging(false);
|
|
19
|
+
setProximityLines([]); // Clear proximity lines
|
|
20
|
+
}, onRotationSnap: handleRotationSnap, onPositionSnap: handlePositionSnap, onDragMove: (elementId, bounds) => {
|
|
21
|
+
// Set dragging state to true
|
|
22
|
+
setIsDragging(true);
|
|
23
|
+
// Calculate live position from element bounds
|
|
24
|
+
if (!bannerContainerRef.current)
|
|
25
|
+
return;
|
|
26
|
+
const bannerBounds = bannerContainerRef.current.getBoundingClientRect();
|
|
27
|
+
const elementCenterX = bounds.left + bounds.width / 2;
|
|
28
|
+
const elementCenterY = bounds.top + bounds.height / 2;
|
|
29
|
+
// Banner center in viewport coordinates
|
|
30
|
+
const bannerCenterX = bannerBounds.left + bannerBounds.width / 2;
|
|
31
|
+
const bannerCenterY = bannerBounds.top + bannerBounds.height / 2;
|
|
32
|
+
// Calculate offset from banner center (in scaled pixels)
|
|
33
|
+
const offsetX = (elementCenterX - bannerCenterX) / sizeMultiplier;
|
|
34
|
+
const offsetY = (elementCenterY - bannerCenterY) / sizeMultiplier;
|
|
35
|
+
// Store the live position
|
|
36
|
+
setLiveDragPosition({
|
|
37
|
+
elementId,
|
|
38
|
+
x: offsetX,
|
|
39
|
+
y: offsetY,
|
|
40
|
+
});
|
|
41
|
+
// Calculate alignment lines
|
|
42
|
+
const alignments = calculateAlignments(elementId);
|
|
43
|
+
setAlignmentLines(alignments);
|
|
44
|
+
// Calculate proximity lines (visual distance indicators)
|
|
45
|
+
calculateProximityLines(elementId);
|
|
46
|
+
// Detect proximity and auto-create lines (creation mode only)
|
|
47
|
+
detectProximityLines(elementId);
|
|
48
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { ref: logoRef, className: "relative", style: {
|
|
49
|
+
width: logoWidth ? `${logoWidth}px` : `${defaults_1.DEFAULT_LOGO_SIZE_REM * logoSizeMultiplier}rem`,
|
|
50
|
+
height: logoWidth ? `${logoWidth}px` : `${defaults_1.DEFAULT_LOGO_SIZE_REM * logoSizeMultiplier}rem`,
|
|
51
|
+
}, children: logoUrl && ((0, jsx_runtime_1.jsx)(ImageComponent, { src: logoUrl, alt: "Logo", width: 256, height: 256, className: "object-contain absolute inset-0 w-full h-full", style: { objectFit: "contain", pointerEvents: "none" } })) }) }));
|
|
52
|
+
};
|
|
53
|
+
exports.LogoElement = LogoElement;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VisualGuides component
|
|
3
|
+
* Renders alignment lines, proximity lines, and center guide lines during drag operations
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { CopyConfig } from '../../../types';
|
|
7
|
+
import type { AlignmentLine } from '../utils';
|
|
8
|
+
import type { CopyElementConfig } from '../../styles/types/substyleTypes';
|
|
9
|
+
export interface ProximityLine {
|
|
10
|
+
fromId: string;
|
|
11
|
+
toId: string;
|
|
12
|
+
fromPos: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
toPos: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
distance: number;
|
|
21
|
+
}
|
|
22
|
+
export interface VisualGuidesProps {
|
|
23
|
+
draggableMode: boolean;
|
|
24
|
+
isDragging: boolean;
|
|
25
|
+
selectedElement: string | null;
|
|
26
|
+
alignmentLines: AlignmentLine[];
|
|
27
|
+
proximityLines: ProximityLine[];
|
|
28
|
+
liveDragPosition: {
|
|
29
|
+
elementId: string;
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
} | null;
|
|
33
|
+
logoTranslateX: number;
|
|
34
|
+
logoTranslateY: number;
|
|
35
|
+
copies: CopyConfig[];
|
|
36
|
+
config: {
|
|
37
|
+
copies?: CopyElementConfig[];
|
|
38
|
+
};
|
|
39
|
+
autoOffsets: Record<number, number>;
|
|
40
|
+
yMultiplier: number;
|
|
41
|
+
}
|
|
42
|
+
export declare const VisualGuides: React.FC<VisualGuidesProps>;
|
|
43
|
+
//# sourceMappingURL=VisualGuides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualGuides.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerRenderer/components/VisualGuides.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAEhC,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,cAAc,EAAE,aAAa,EAAE,CAAC;IAGhC,gBAAgB,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IAGvB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;KAC9B,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAmOpD,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualGuides = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const VisualGuides = ({ draggableMode, isDragging, selectedElement, alignmentLines, proximityLines, liveDragPosition, logoTranslateX, logoTranslateY, copies, config, autoOffsets, yMultiplier, }) => {
|
|
6
|
+
// Don't render if not dragging
|
|
7
|
+
if (!draggableMode || !isDragging)
|
|
8
|
+
return null;
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [alignmentLines.length > 0 && ((0, jsx_runtime_1.jsx)("svg", { className: "absolute pointer-events-none", style: {
|
|
10
|
+
top: '50%',
|
|
11
|
+
left: '50%',
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
zIndex: 14,
|
|
15
|
+
overflow: 'visible',
|
|
16
|
+
}, children: alignmentLines.map((line, index) => (line.orientation === 'vertical' ? ((0, jsx_runtime_1.jsx)("line", { x1: line.x, y1: line.y1, x2: line.x, y2: line.y2, stroke: "rgba(255, 0, 255, 0.9)" // Fuschia fosforescente
|
|
17
|
+
, strokeWidth: "3", strokeLinecap: "round", style: {
|
|
18
|
+
filter: 'drop-shadow(0 0 4px rgba(255, 0, 255, 0.6))', // Glow effect
|
|
19
|
+
} }, `alignment-${index}-${line.type}`)) : ((0, jsx_runtime_1.jsx)("line", { x1: line.x1, y1: line.y, x2: line.x2, y2: line.y, stroke: "rgba(255, 0, 255, 0.9)" // Fuschia fosforescente
|
|
20
|
+
, strokeWidth: "3", strokeLinecap: "round", style: {
|
|
21
|
+
filter: 'drop-shadow(0 0 4px rgba(255, 0, 255, 0.6))', // Glow effect
|
|
22
|
+
} }, `alignment-${index}-${line.type}`)))) })), proximityLines.length > 0 && ((0, jsx_runtime_1.jsx)("svg", { className: "absolute pointer-events-none", style: {
|
|
23
|
+
top: '50%',
|
|
24
|
+
left: '50%',
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: '100%',
|
|
27
|
+
zIndex: 13,
|
|
28
|
+
overflow: 'visible',
|
|
29
|
+
}, children: proximityLines.map((line, index) => {
|
|
30
|
+
const midX = (line.fromPos.x + line.toPos.x) / 2;
|
|
31
|
+
const midY = (line.fromPos.y + line.toPos.y) / 2;
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("line", { x1: line.fromPos.x, y1: line.fromPos.y, x2: line.toPos.x, y2: line.toPos.y, stroke: "rgba(255, 0, 255, 0.7)" // Fuschia slightly transparent
|
|
33
|
+
, strokeWidth: "2", strokeDasharray: "5,5", strokeLinecap: "round", style: {
|
|
34
|
+
filter: 'drop-shadow(0 0 3px rgba(255, 0, 255, 0.5))',
|
|
35
|
+
} }), (0, jsx_runtime_1.jsx)("rect", { x: midX - 30, y: midY - 14, width: 60, height: 28, fill: "rgba(255, 0, 255, 0.9)", rx: 6, style: {
|
|
36
|
+
filter: 'drop-shadow(0 0 4px rgba(255, 0, 255, 0.6))',
|
|
37
|
+
} }), (0, jsx_runtime_1.jsxs)("text", { x: midX, y: midY + 6, textAnchor: "middle", fill: "white", fontSize: "16", fontWeight: "bold", style: {
|
|
38
|
+
pointerEvents: 'none',
|
|
39
|
+
userSelect: 'none',
|
|
40
|
+
}, children: [line.distance, "px"] })] }, `proximity-${index}-${line.fromId}-${line.toId}`));
|
|
41
|
+
}) })), selectedElement && (() => {
|
|
42
|
+
var _a, _b, _c, _d, _e;
|
|
43
|
+
let displayX = 0;
|
|
44
|
+
let displayY = 0;
|
|
45
|
+
if (selectedElement === 'logo') {
|
|
46
|
+
// Logo position
|
|
47
|
+
const finalX = logoTranslateX;
|
|
48
|
+
const finalY = logoTranslateY;
|
|
49
|
+
// Use live drag position if available, otherwise use final position
|
|
50
|
+
displayX = liveDragPosition && liveDragPosition.elementId === selectedElement
|
|
51
|
+
? liveDragPosition.x
|
|
52
|
+
: finalX;
|
|
53
|
+
displayY = liveDragPosition && liveDragPosition.elementId === selectedElement
|
|
54
|
+
? liveDragPosition.y
|
|
55
|
+
: finalY;
|
|
56
|
+
}
|
|
57
|
+
else if (selectedElement.startsWith('copy-')) {
|
|
58
|
+
// Copy position
|
|
59
|
+
const selectedCopyId = selectedElement.replace('copy-', '');
|
|
60
|
+
const selectedCopy = copies.find(c => c.id === selectedCopyId);
|
|
61
|
+
if (!selectedCopy)
|
|
62
|
+
return null;
|
|
63
|
+
// Calculate position for selected copy
|
|
64
|
+
const styleSlot = selectedCopy.styleSlot !== undefined ? selectedCopy.styleSlot : 0;
|
|
65
|
+
// DYNAMIC: Check if this styleSlot has config (not limited to 0 and 1)
|
|
66
|
+
const isStyled = ((_a = config.copies) === null || _a === void 0 ? void 0 : _a[styleSlot]) !== undefined;
|
|
67
|
+
const copyConfig = ((_b = config.copies) === null || _b === void 0 ? void 0 : _b[styleSlot]) || ((_c = config.copies) === null || _c === void 0 ? void 0 : _c[0]);
|
|
68
|
+
const configX = (_d = copyConfig === null || copyConfig === void 0 ? void 0 : copyConfig.x) !== null && _d !== void 0 ? _d : 0;
|
|
69
|
+
const configY = (_e = copyConfig === null || copyConfig === void 0 ? void 0 : copyConfig.y) !== null && _e !== void 0 ? _e : 0;
|
|
70
|
+
const autoOffset = autoOffsets[styleSlot] || 0;
|
|
71
|
+
const baseX = isStyled ? configX : 0;
|
|
72
|
+
const baseY = isStyled ? (configY * yMultiplier + autoOffset) : 0;
|
|
73
|
+
const finalX = baseX + (selectedCopy.translateX || 0);
|
|
74
|
+
const finalY = baseY + (selectedCopy.translateY || 0);
|
|
75
|
+
// Use live drag position if available, otherwise use final position
|
|
76
|
+
displayX = liveDragPosition && liveDragPosition.elementId === selectedElement
|
|
77
|
+
? liveDragPosition.x
|
|
78
|
+
: finalX;
|
|
79
|
+
displayY = liveDragPosition && liveDragPosition.elementId === selectedElement
|
|
80
|
+
? liveDragPosition.y
|
|
81
|
+
: finalY;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// Threshold for considering element "centered" (in pixels)
|
|
87
|
+
const CENTER_THRESHOLD = 5;
|
|
88
|
+
// Check if element is centered on each axis
|
|
89
|
+
const isCenteredHorizontally = Math.abs(displayX) <= CENTER_THRESHOLD;
|
|
90
|
+
const isCenteredVertically = Math.abs(displayY) <= CENTER_THRESHOLD;
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isCenteredHorizontally && ((0, jsx_runtime_1.jsx)("div", { className: "absolute pointer-events-none", style: {
|
|
92
|
+
left: '50%',
|
|
93
|
+
top: 0,
|
|
94
|
+
bottom: 0,
|
|
95
|
+
width: '6px',
|
|
96
|
+
backgroundColor: 'rgb(125, 211, 252)', // sky-300
|
|
97
|
+
transform: `translateX(${displayX - 3}px)`, // -3px to center the 6px line
|
|
98
|
+
zIndex: 5,
|
|
99
|
+
} })), isCenteredVertically && ((0, jsx_runtime_1.jsx)("div", { className: "absolute pointer-events-none", style: {
|
|
100
|
+
top: '50%',
|
|
101
|
+
left: 0,
|
|
102
|
+
right: 0,
|
|
103
|
+
height: '6px',
|
|
104
|
+
backgroundColor: 'rgb(125, 211, 252)', // sky-300
|
|
105
|
+
transform: `translateY(${displayY - 3}px)`, // -3px to center the 6px line
|
|
106
|
+
zIndex: 5,
|
|
107
|
+
} }))] }));
|
|
108
|
+
})()] }));
|
|
109
|
+
};
|
|
110
|
+
exports.VisualGuides = VisualGuides;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BannerRenderer sub-components barrel file
|
|
3
|
+
*/
|
|
4
|
+
export { LogoElement } from './LogoElement';
|
|
5
|
+
export type { LogoElementProps } from './LogoElement';
|
|
6
|
+
export { CopyElement } from './CopyElement';
|
|
7
|
+
export type { CopyElementProps } from './CopyElement';
|
|
8
|
+
export { InteractiveLines } from './InteractiveLines';
|
|
9
|
+
export type { InteractiveLinesProps } from './InteractiveLines';
|
|
10
|
+
export { VisualGuides } from './VisualGuides';
|
|
11
|
+
export type { VisualGuidesProps, ProximityLine } from './VisualGuides';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerRenderer/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BannerRenderer sub-components barrel file
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VisualGuides = exports.InteractiveLines = exports.CopyElement = exports.LogoElement = void 0;
|
|
7
|
+
var LogoElement_1 = require("./LogoElement");
|
|
8
|
+
Object.defineProperty(exports, "LogoElement", { enumerable: true, get: function () { return LogoElement_1.LogoElement; } });
|
|
9
|
+
var CopyElement_1 = require("./CopyElement");
|
|
10
|
+
Object.defineProperty(exports, "CopyElement", { enumerable: true, get: function () { return CopyElement_1.CopyElement; } });
|
|
11
|
+
var InteractiveLines_1 = require("./InteractiveLines");
|
|
12
|
+
Object.defineProperty(exports, "InteractiveLines", { enumerable: true, get: function () { return InteractiveLines_1.InteractiveLines; } });
|
|
13
|
+
var VisualGuides_1 = require("./VisualGuides");
|
|
14
|
+
Object.defineProperty(exports, "VisualGuides", { enumerable: true, get: function () { return VisualGuides_1.VisualGuides; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BannerRenderer constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Auto-positioning proximity threshold (in unscaled pixels)
|
|
6
|
+
* Controls both visual green line display and auto-positioning link creation
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROXIMITY_THRESHOLD_PX = 170;
|
|
9
|
+
/**
|
|
10
|
+
* Injects the marching ants animation keyframe into the document head.
|
|
11
|
+
* This animation is used for the dotted line effect in auto-positioning mode.
|
|
12
|
+
* Safe to call multiple times - will only inject once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function injectMarchingAntsAnimation(): void;
|
|
15
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/BannerRenderer/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAgBlD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BannerRenderer constants
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PROXIMITY_THRESHOLD_PX = void 0;
|
|
7
|
+
exports.injectMarchingAntsAnimation = injectMarchingAntsAnimation;
|
|
8
|
+
/**
|
|
9
|
+
* Auto-positioning proximity threshold (in unscaled pixels)
|
|
10
|
+
* Controls both visual green line display and auto-positioning link creation
|
|
11
|
+
*/
|
|
12
|
+
exports.PROXIMITY_THRESHOLD_PX = 170;
|
|
13
|
+
/**
|
|
14
|
+
* Injects the marching ants animation keyframe into the document head.
|
|
15
|
+
* This animation is used for the dotted line effect in auto-positioning mode.
|
|
16
|
+
* Safe to call multiple times - will only inject once.
|
|
17
|
+
*/
|
|
18
|
+
function injectMarchingAntsAnimation() {
|
|
19
|
+
if (typeof document !== 'undefined') {
|
|
20
|
+
const styleId = 'marching-ants-keyframe';
|
|
21
|
+
if (!document.getElementById(styleId)) {
|
|
22
|
+
const style = document.createElement('style');
|
|
23
|
+
style.id = styleId;
|
|
24
|
+
style.textContent = `
|
|
25
|
+
@keyframes marching-ants {
|
|
26
|
+
to {
|
|
27
|
+
stroke-dashoffset: -20;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
document.head.appendChild(style);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Auto-inject on module load (maintains existing behavior)
|
|
36
|
+
injectMarchingAntsAnimation();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BannerRenderer hooks barrel file
|
|
3
|
+
*/
|
|
4
|
+
export { useElementRefs } from './useElementRefs';
|
|
5
|
+
export type { UseElementRefsParams, UseElementRefsReturn } from './useElementRefs';
|
|
6
|
+
export { useDragSnap } from './useDragSnap';
|
|
7
|
+
export type { UseDragSnapParams, UseDragSnapReturn } from './useDragSnap';
|
|
8
|
+
export { useLineDrawing } from './useLineDrawing';
|
|
9
|
+
export type { UseLineDrawingParams, UseLineDrawingReturn } from './useLineDrawing';
|
|
10
|
+
export { useProximityDetection } from './useProximityDetection';
|
|
11
|
+
export type { UseProximityDetectionParams, UseProximityDetectionReturn, ProximityLine } from './useProximityDetection';
|
|
12
|
+
export { useAutoPositioning } from './useAutoPositioning';
|
|
13
|
+
export type { UseAutoPositioningParams, UseAutoPositioningReturn, AutoPositioningConfig, AutoPositioningLink, AutoPositioningOverride, GeneratedAutoPositioningConfig, SubstyleConfig, } from './useAutoPositioning';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerRenderer/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,cAAc,GACf,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BannerRenderer hooks barrel file
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useAutoPositioning = exports.useProximityDetection = exports.useLineDrawing = exports.useDragSnap = exports.useElementRefs = void 0;
|
|
7
|
+
var useElementRefs_1 = require("./useElementRefs");
|
|
8
|
+
Object.defineProperty(exports, "useElementRefs", { enumerable: true, get: function () { return useElementRefs_1.useElementRefs; } });
|
|
9
|
+
var useDragSnap_1 = require("./useDragSnap");
|
|
10
|
+
Object.defineProperty(exports, "useDragSnap", { enumerable: true, get: function () { return useDragSnap_1.useDragSnap; } });
|
|
11
|
+
var useLineDrawing_1 = require("./useLineDrawing");
|
|
12
|
+
Object.defineProperty(exports, "useLineDrawing", { enumerable: true, get: function () { return useLineDrawing_1.useLineDrawing; } });
|
|
13
|
+
var useProximityDetection_1 = require("./useProximityDetection");
|
|
14
|
+
Object.defineProperty(exports, "useProximityDetection", { enumerable: true, get: function () { return useProximityDetection_1.useProximityDetection; } });
|
|
15
|
+
var useAutoPositioning_1 = require("./useAutoPositioning");
|
|
16
|
+
Object.defineProperty(exports, "useAutoPositioning", { enumerable: true, get: function () { return useAutoPositioning_1.useAutoPositioning; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* debugPositions - Extracts and calculates auto-positioning configuration from completed lines
|
|
3
|
+
*
|
|
4
|
+
* This function analyzes the completed proximity lines and generates an AutoPositioningConfig
|
|
5
|
+
* that can be saved and reused to recreate the same positioning in other contexts.
|
|
6
|
+
*/
|
|
7
|
+
import type { CopyConfig } from '../../../../types';
|
|
8
|
+
import type { SubstyleConfig, AutoPositioningConfig } from '../../../styles/types/substyleTypes';
|
|
9
|
+
export interface GeneratedAutoPositioningConfig {
|
|
10
|
+
autoPositioningConfig: AutoPositioningConfig;
|
|
11
|
+
gapRem: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DebugPositionsParams {
|
|
14
|
+
completedLines: Map<string, string>;
|
|
15
|
+
copies: CopyConfig[];
|
|
16
|
+
logoTranslateX: number;
|
|
17
|
+
logoTranslateY: number;
|
|
18
|
+
logoWidth?: number;
|
|
19
|
+
config: SubstyleConfig;
|
|
20
|
+
sizeMultiplier: number;
|
|
21
|
+
logoRef: React.RefObject<HTMLDivElement | null>;
|
|
22
|
+
copyRefs: React.MutableRefObject<(HTMLDivElement | null)[]>;
|
|
23
|
+
bannerContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates the debugPositions function with the given parameters
|
|
27
|
+
* Returns a function that can be called to generate the auto-positioning config
|
|
28
|
+
*/
|
|
29
|
+
export declare function createDebugPositions(params: DebugPositionsParams): () => GeneratedAutoPositioningConfig | null;
|
|
30
|
+
//# sourceMappingURL=debugPositions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugPositions.d.ts","sourceRoot":"","sources":["../../../../../src/components/BannerRenderer/hooks/useAutoPositioning/debugPositions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAuB,MAAM,qCAAqC,CAAC;AAGtH,MAAM,WAAW,8BAA8B;IAC7C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5D,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,8BAA8B,GAAG,IAAI,CAoG9G"}
|