zuljaman-banner-components 1.0.13 → 1.0.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BannerRenderer.d.ts","sourceRoot":"","sources":["../../src/components/BannerRenderer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAGrF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAUvD,UAAU,mBAAmB;IAE3B,WAAW,EAAE,MAAM,CAAC;IAGpB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IAEtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAGhD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM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KAAK,IAAI,CAAC;IACrE,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqnBxD,CAAC"}
@@ -102,17 +102,6 @@ const BannerRenderer = ({ bannerStyle, copies = [], bannerSubstyle = 1, logoUrl,
102
102
  (0, react_1.useEffect)(() => {
103
103
  setAutoOffsets({});
104
104
  }, [config]);
105
- // Memoize copies without rotation to prevent auto-positioning recalc on rotation changes
106
- const copiesWithoutRotation = (0, react_1.useMemo)(() => {
107
- return copies.map(copy => ({
108
- text: copy.text,
109
- styleSlot: copy.styleSlot,
110
- translateX: copy.translateX,
111
- translateY: copy.translateY,
112
- width: copy.width,
113
- // Exclude rotation from memoization
114
- }));
115
- }, [copies.map(c => `${c.text}-${c.styleSlot}-${c.translateX || 0}-${c.translateY || 0}-${c.width || 'auto'}`).join(',')]);
116
105
  // Auto-positioning calculation
117
106
  (0, react_1.useLayoutEffect)(() => {
118
107
  // Only calculate if auto-positioning is enabled
@@ -126,6 +115,36 @@ const BannerRenderer = ({ bannerStyle, copies = [], bannerSubstyle = 1, logoUrl,
126
115
  direction: config.autoPositioningConfig.direction,
127
116
  gapRem: config.gapRem,
128
117
  });
118
+ // Get anchor copy object to check if it's been dragged
119
+ let anchorCopy;
120
+ if (anchorElement === 'copy1') {
121
+ anchorCopy = copies.find(c => c.styleSlot === 0);
122
+ }
123
+ else if (anchorElement === 'copy2') {
124
+ anchorCopy = copies.find(c => c.styleSlot === 1);
125
+ }
126
+ // Get target copy object to check if it's been dragged
127
+ let targetCopy;
128
+ if (targetElement === 'copy1') {
129
+ targetCopy = copies.find(c => c.styleSlot === 0);
130
+ }
131
+ else if (targetElement === 'copy2') {
132
+ targetCopy = copies.find(c => c.styleSlot === 1);
133
+ }
134
+ // Check if anchor has been manually dragged
135
+ const anchorHasBeenDragged = anchorCopy && ((anchorCopy.translateX !== undefined && anchorCopy.translateX !== 0) ||
136
+ (anchorCopy.translateY !== undefined && anchorCopy.translateY !== 0));
137
+ // Check if target has been manually dragged
138
+ const targetHasBeenDragged = targetCopy && ((targetCopy.translateX !== undefined && targetCopy.translateX !== 0) ||
139
+ (targetCopy.translateY !== undefined && targetCopy.translateY !== 0));
140
+ // Skip auto-positioning if either anchor or target has been manually positioned
141
+ if (anchorHasBeenDragged || targetHasBeenDragged) {
142
+ console.log('⏭️ SKIPPING AUTO-POSITION - Copy has been manually dragged:', {
143
+ anchorDragged: anchorHasBeenDragged,
144
+ targetDragged: targetHasBeenDragged,
145
+ });
146
+ return;
147
+ }
129
148
  // Get anchor element ref
130
149
  let anchorRef = null;
131
150
  if (anchorElement === 'logo') {
@@ -218,7 +237,7 @@ const BannerRenderer = ({ bannerStyle, copies = [], bannerSubstyle = 1, logoUrl,
218
237
  return prev; // No significant change, return same object to prevent re-render
219
238
  });
220
239
  }
221
- }, [config, sizeMultiplier, recalcTrigger, copiesWithoutRotation]);
240
+ }, [config, recalcTrigger, copies]); // Recalculate on style/substyle change and when copy text changes (if not dragged)
222
241
  // Rotation snap function - snaps to 0°, 90°, 180°, 270°
223
242
  const handleRotationSnap = react_1.default.useCallback((angle) => {
224
243
  const snapAngles = [0, 90, 180, 270, -90, -180, -270];
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableElement.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DraggableElement.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS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;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,IAAI,CAAC;IAGvB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAG1D,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAioB5D,CAAC"}
@@ -209,18 +209,16 @@ const DraggableElement = ({ enabled, position, rotation, width, scale, elementId
209
209
  }
210
210
  };
211
211
  const handleDragEnd = () => {
212
+ var _a;
212
213
  console.log('[DraggableElement] Drag mouseup - ending drag');
213
214
  // If we didn't actually drag, set flag to prevent onClick from toggling
214
215
  if (!hasDraggedRef.current) {
215
216
  justStoppedWithoutDragRef.current = true;
216
217
  }
217
218
  setIsDragging(false);
218
- // Use callback form to get latest position
219
- setCurrentPosition((pos) => {
220
- var _a;
221
- (_a = onPositionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onPositionChangeRef, pos);
222
- return pos;
223
- });
219
+ // Notify parent of final position (use ref to avoid state update during render)
220
+ const finalPosition = currentPositionRef.current;
221
+ (_a = onPositionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onPositionChangeRef, finalPosition);
224
222
  // Auto-capture width if not explicitly set
225
223
  if (widthRef.current === undefined && contentOnlyRef.current && onWidthChangeRef.current) {
226
224
  const currentWidth = contentOnlyRef.current.offsetWidth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuljaman-banner-components",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Shared banner components package for Next.js and AWS Lambda platforms",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",