canvu-react 0.4.29 → 0.4.31

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/react.d.cts CHANGED
@@ -158,6 +158,8 @@ type ImagesMenuLabels = {
158
158
  title?: string;
159
159
  dragHandle?: string;
160
160
  focus?: string;
161
+ duplicate?: string;
162
+ /** @deprecated Use `duplicate` instead. */
161
163
  copy?: string;
162
164
  rotate?: string;
163
165
  delete?: string;
@@ -173,14 +175,19 @@ type ImagesMenuProps = {
173
175
  */
174
176
  onFocusItem?: (item: VectorSceneItem) => void;
175
177
  labels?: ImagesMenuLabels;
178
+ /**
179
+ * Whether the menu starts expanded. Defaults to `false` (collapsed), showing
180
+ * only the floating toggle button until the user opens it.
181
+ */
182
+ defaultOpen?: boolean;
176
183
  };
177
184
  /**
178
185
  * Floating side panel that lists images marked as "managed"
179
- * (via `pluginData.managed === true`) and offers copy, rotate, delete, and
186
+ * (via `pluginData.managed === true`) and offers duplicate, rotate, delete, and
180
187
  * drag-to-reorder actions. Managed images are also `locked`, so they do not
181
188
  * respond to direct canvas interaction.
182
189
  */
183
- declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, }: ImagesMenuProps): react_jsx_runtime.JSX.Element | null;
190
+ declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, defaultOpen, }: ImagesMenuProps): react_jsx_runtime.JSX.Element | null;
184
191
 
185
192
  type NavMenuMinimapProps = {
186
193
  className?: string;
package/dist/react.d.ts CHANGED
@@ -158,6 +158,8 @@ type ImagesMenuLabels = {
158
158
  title?: string;
159
159
  dragHandle?: string;
160
160
  focus?: string;
161
+ duplicate?: string;
162
+ /** @deprecated Use `duplicate` instead. */
161
163
  copy?: string;
162
164
  rotate?: string;
163
165
  delete?: string;
@@ -173,14 +175,19 @@ type ImagesMenuProps = {
173
175
  */
174
176
  onFocusItem?: (item: VectorSceneItem) => void;
175
177
  labels?: ImagesMenuLabels;
178
+ /**
179
+ * Whether the menu starts expanded. Defaults to `false` (collapsed), showing
180
+ * only the floating toggle button until the user opens it.
181
+ */
182
+ defaultOpen?: boolean;
176
183
  };
177
184
  /**
178
185
  * Floating side panel that lists images marked as "managed"
179
- * (via `pluginData.managed === true`) and offers copy, rotate, delete, and
186
+ * (via `pluginData.managed === true`) and offers duplicate, rotate, delete, and
180
187
  * drag-to-reorder actions. Managed images are also `locked`, so they do not
181
188
  * respond to direct canvas interaction.
182
189
  */
183
- declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, }: ImagesMenuProps): react_jsx_runtime.JSX.Element | null;
190
+ declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, defaultOpen, }: ImagesMenuProps): react_jsx_runtime.JSX.Element | null;
184
191
 
185
192
  type NavMenuMinimapProps = {
186
193
  className?: string;
package/dist/react.js CHANGED
@@ -3,7 +3,7 @@ import { createContext, forwardRef, useRef, useState, useCallback, useMemo, useI
3
3
  import { useSensors, useSensor, PointerSensor, DndContext } from '@dnd-kit/core';
4
4
  import { SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from '@dnd-kit/sortable';
5
5
  import { CSS } from '@dnd-kit/utilities';
6
- import { Undo2, Redo2, Shapes, ChevronDown, Hand, MousePointer2, Square, Circle, Minus, ArrowUpRight, PenLine, Highlighter, Eraser, Type, Image as Image$1, Lock, LockOpen, Images, ChevronRight, GripVertical, Copy, RotateCw, Trash2 } from 'lucide-react';
6
+ import { Undo2, Redo2, Shapes, ChevronDown, Hand, MousePointer2, Square, Circle, Minus, ArrowUpRight, PenLine, Highlighter, Eraser, Type, Image as Image$1, Lock, LockOpen, Images, ChevronRight, GripVertical, CopyPlus, RotateCw, Trash2 } from 'lucide-react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { createPortal } from 'react-dom';
9
9
 
@@ -2198,7 +2198,7 @@ var defaultLabels = {
2198
2198
  title: "Images",
2199
2199
  dragHandle: "Drag to reorder",
2200
2200
  focus: "Focus on canvas",
2201
- copy: "Copy",
2201
+ duplicate: "Duplicate",
2202
2202
  rotate: "Rotate",
2203
2203
  delete: "Delete",
2204
2204
  collapse: "Collapse images menu",
@@ -2208,7 +2208,8 @@ function ImagesMenu({
2208
2208
  items,
2209
2209
  onItemsChange,
2210
2210
  onFocusItem,
2211
- labels
2211
+ labels,
2212
+ defaultOpen = false
2212
2213
  }) {
2213
2214
  const managed = useMemo(() => items.filter(isManagedImage), [items]);
2214
2215
  const sensors = useSensors(
@@ -2216,14 +2217,18 @@ function ImagesMenu({
2216
2217
  activationConstraint: { distance: 4 }
2217
2218
  })
2218
2219
  );
2219
- const [collapsed, setCollapsed] = useState(false);
2220
+ const [collapsed, setCollapsed] = useState(!defaultOpen);
2220
2221
  useEffect(() => {
2221
2222
  ensureOpenKeyframe();
2222
2223
  }, []);
2223
2224
  if (managed.length === 0) {
2224
2225
  return null;
2225
2226
  }
2226
- const resolvedLabels = { ...defaultLabels, ...labels };
2227
+ const resolvedLabels = {
2228
+ ...defaultLabels,
2229
+ ...labels,
2230
+ duplicate: labels?.duplicate ?? labels?.copy ?? defaultLabels.duplicate
2231
+ };
2227
2232
  if (collapsed) {
2228
2233
  return /* @__PURE__ */ jsx(
2229
2234
  "button",
@@ -2337,7 +2342,7 @@ function ImagesMenuRow({
2337
2342
  ),
2338
2343
  /* @__PURE__ */ jsx(FocusTarget, { label: labels.focus, onFocus, children: /* @__PURE__ */ jsx("div", { style: thumbBoxStyle, children: src ? /* @__PURE__ */ jsx("img", { src, alt: "", style: thumbImgStyle, draggable: false }) : null }) }),
2339
2344
  /* @__PURE__ */ jsxs("div", { style: actionsColumnStyle, children: [
2340
- /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.copy, onClick: onCopy, children: /* @__PURE__ */ jsx(Copy, { size: 18 }) }),
2345
+ /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.duplicate, onClick: onCopy, children: /* @__PURE__ */ jsx(CopyPlus, { size: 18 }) }),
2341
2346
  /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.rotate, onClick: onRotate, children: /* @__PURE__ */ jsx(RotateCw, { size: 18 }) }),
2342
2347
  /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.delete, onClick: onDelete, danger: true, children: /* @__PURE__ */ jsx(Trash2, { size: 18 }) })
2343
2348
  ] })