@hussmartinez/image-sdk 0.7.0 → 0.7.1

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,4 +1,4 @@
1
- import { A as dragHandle, At as createImageRenderer, B as outputSize, C as drawingBounds, Ct as MAX_SCENE_COORDINATE, D as aspectRatio, E as ASPECT_PRESETS, F as wholeCrop, Ft as createImageProcessor, I as compositionSize, It as createImageEngine, J as FORBIDDEN_IN_TEXT, Jt as isImageError, Kt as asImageError, L as compositionToSource, Lt as engineInternals, M as handleInSource, N as moveCrop, Nt as fittedView, O as compositionDeltaToSource, P as nudgeCropOnScreen, Pt as placement, R as cropRect, Rt as ANIMATION_LIMITS, T as simplifyStroke, Tt as MAX_STROKE_WIDTH, _ as layerToScene, _t as MAX_FRAME_DELAY, a as compositionRectToScene, at as MAX_METADATA_LENGTH, b as createImageKey, bt as MAX_LAYER_TEXT_LENGTH, ct as DEVELOP_ADJUSTMENTS, d as sceneRectToComposition, dt as LAYER_ALIGNMENTS, f as applyMatrix, ft as LAYER_FONTS, g as layerToOutput, i as newLayerBox, j as fitAspect, k as cropInComposition, kt as createPlan, lt as FILTER_PRESETS, m as invertMatrix, n as createImageSession, o as fitRedactionRegion, q as createImageReducer, r as keepsFields, st as longerThan, t as imageMessages, x as arrowBounds, y as sceneToOutput } from "./core-A001a7oa.js";
1
+ import { A as dragHandle, At as createImageRenderer, B as outputSize, C as drawingBounds, Ct as MAX_SCENE_COORDINATE, D as aspectRatio, E as ASPECT_PRESETS, F as wholeCrop, Ft as createImageProcessor, I as compositionSize, It as createImageEngine, J as FORBIDDEN_IN_TEXT, Jt as isImageError, Kt as asImageError, L as compositionToSource, Lt as engineInternals, M as handleInSource, N as moveCrop, Nt as fittedView, O as compositionDeltaToSource, P as nudgeCropOnScreen, Pt as placement, R as cropRect, Rt as ANIMATION_LIMITS, T as simplifyStroke, Tt as MAX_STROKE_WIDTH, _ as layerToScene, _t as MAX_FRAME_DELAY, a as compositionRectToScene, at as MAX_METADATA_LENGTH, b as createImageKey, bt as MAX_LAYER_TEXT_LENGTH, ct as DEVELOP_ADJUSTMENTS, d as sceneRectToComposition, dt as LAYER_ALIGNMENTS, f as applyMatrix, ft as LAYER_FONTS, g as layerToOutput, i as newLayerBox, j as fitAspect, k as cropInComposition, kt as createPlan, lt as FILTER_PRESETS, m as invertMatrix, n as createImageSession, o as fitRedactionRegion, q as createImageReducer, r as keepsFields, st as longerThan, t as imageMessages, x as arrowBounds, y as sceneToOutput } from "./core-BPCYhBPk.js";
2
2
  import { applyCommands, createMessages, createShortcutRegistry, createStore, createToolRegistry, defineMessages, defineTool, plural } from "@hussmartinez/sdk-core";
3
3
  import { AddIcon, AnnouncerProvider, ArrowIcon, Button, CloseIcon, ColorField, CropIcon, DeleteIcon, Dialog, DownloadIcon, DuplicateIcon, EllipseIcon, Field, FileDropZone, FitIcon, FlipHorizontalIcon, FlipVerticalIcon, HiddenIcon, IconButton, LayersIcon, MoveDownIcon, MoveUpIcon, NumberField, OpenIcon, PageGridIcon, PauseIcon, PenIcon, PlayIcon, ProgressBar, RectangleIcon, RedactIcon, RedoIcon, ReorderableList, ReorderableListItem, RotateLeftIcon, RotateRightIcon, SearchIcon, SegmentedControl, Slider, Spinner, TextArea, TextField, TextIcon, ToggleButton, Toolbar, ToolbarGroup, Tooltip, UiMessagesProvider, UndoIcon, VisibleIcon, ZoomInIcon, ZoomOutIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
4
4
  import { createContext, forwardRef, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
@@ -4709,7 +4709,7 @@ function ImageInspector(props) {
4709
4709
  ] });
4710
4710
  }
4711
4711
  // src/react/timeline/AnimationBar.tsx
4712
- function usePlayback(animation, playback, set) {
4712
+ function usePlayback(animation, playback, editor) {
4713
4713
  const played = useRef(0);
4714
4714
  useEffect(() => {
4715
4715
  if (!playback.playing) played.current = 0;
@@ -4719,9 +4719,11 @@ function usePlayback(animation, playback, set) {
4719
4719
  const frame = Math.min(playback.frame, animation.frames.length - 1);
4720
4720
  const delay = shownDelay(animation.frames[frame]?.delay ?? 0);
4721
4721
  const timer = setTimeout(() => {
4722
+ const now = editor.getSnapshot().playback;
4723
+ if (!now.playing || now.frame !== playback.frame) return;
4722
4724
  const next = nextFrame(animation, frame, played.current);
4723
4725
  if (next) played.current = next.played;
4724
- set((state) => ({
4726
+ editor.set((state) => ({
4725
4727
  ...state,
4726
4728
  playback: next ? {
4727
4729
  frame: next.frame,
@@ -4737,7 +4739,7 @@ function usePlayback(animation, playback, set) {
4737
4739
  animation,
4738
4740
  playback.frame,
4739
4741
  playback.playing,
4740
- set
4742
+ editor
4741
4743
  ]);
4742
4744
  }
4743
4745
  function AnimationBar(props) {
@@ -4746,7 +4748,7 @@ function AnimationBar(props) {
4746
4748
  const messages = useImageMessages();
4747
4749
  const animation = status === "ready" ? plan?.animation ?? null : null;
4748
4750
  const { playback } = editorState;
4749
- usePlayback(animation, playback, editor.set);
4751
+ usePlayback(animation, playback, editor);
4750
4752
  if (!animation || !plan) return null;
4751
4753
  const count = animation.frames.length;
4752
4754
  const frame = shownFrame(plan, playback.frame);
@@ -5129,4 +5131,4 @@ var ImageEditor = forwardRef(function ImageEditor(props, ref) {
5129
5131
  });
5130
5132
  export { imageTools as S, useImageDocument as _, ImageFilterPanel as a, useImageSession as b, ImageLayersPanel as c, imageEditorMessages as d, ImageExportDialog as f, ImageCropPanel as g, ImageDrawPanel as h, ImageInfoPanel as i, ImageFramesPanel as l, ImageStage as m, imageIcons as n, ImageAdjustPanel as o, ExportListenerContext as p, ImageToolbar as r, ImageRedactPanel as s, ImageEditor as t, ImageEditorProvider as u, useImageEditorState as v, useImageView as x, useImageMessages as y };
5131
5133
 
5132
- //# sourceMappingURL=editor-CV39S-zb.js.map
5134
+ //# sourceMappingURL=editor-MivFzZ2M.js.map