@aivex/ui 1.2.0-dev.49 → 1.2.0-dev.50

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.
Files changed (63) hide show
  1. package/dist/components/Avatar/Avatar.cjs +1 -1
  2. package/dist/components/Avatar/Avatar.cjs.map +1 -1
  3. package/dist/components/Avatar/Avatar.d.ts +2 -4
  4. package/dist/components/Avatar/Avatar.js +31 -29
  5. package/dist/components/Avatar/Avatar.js.map +1 -1
  6. package/dist/components/Calendar/Calendar.cjs +1 -1
  7. package/dist/components/Calendar/Calendar.js +25 -25
  8. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  9. package/dist/components/Checkbox/Checkbox.js +10 -10
  10. package/dist/components/Comment/MentionInput.cjs +1 -1
  11. package/dist/components/Comment/MentionInput.js +8 -8
  12. package/dist/components/Comment/MentionList.cjs +1 -1
  13. package/dist/components/Comment/MentionList.js +36 -36
  14. package/dist/components/DataGrid/DataGrid.cjs +1 -1
  15. package/dist/components/DataGrid/DataGrid.js +108 -108
  16. package/dist/components/DataGrid/DataGrid.js.map +1 -1
  17. package/dist/components/DataGrid/DataGridColumnSettings.cjs +1 -1
  18. package/dist/components/DataGrid/DataGridColumnSettings.js +36 -36
  19. package/dist/components/DataGrid/DataGridPrimitives.cjs +1 -1
  20. package/dist/components/DataGrid/DataGridPrimitives.js +48 -48
  21. package/dist/components/DataGrid/DataGridRows.cjs +1 -1
  22. package/dist/components/DataGrid/DataGridRows.js +24 -24
  23. package/dist/components/DraggableScroll/DraggableScroll.cjs +1 -1
  24. package/dist/components/DraggableScroll/DraggableScroll.js +5 -5
  25. package/dist/components/Field/Field.cjs +1 -1
  26. package/dist/components/Field/Field.js +34 -34
  27. package/dist/components/FilterModal/FilterModal.cjs +1 -1
  28. package/dist/components/FilterModal/FilterModal.js +24 -24
  29. package/dist/components/Modal/Modal.cjs +1 -1
  30. package/dist/components/Modal/Modal.js +51 -51
  31. package/dist/components/Pagination/Pagination.cjs +1 -1
  32. package/dist/components/Pagination/Pagination.js +24 -24
  33. package/dist/components/Radio/Radio.cjs +1 -1
  34. package/dist/components/Radio/Radio.js +9 -9
  35. package/dist/components/Segmented/Segmented.cjs +1 -1
  36. package/dist/components/Segmented/Segmented.js +12 -12
  37. package/dist/components/SelectBox/SelectBox.cjs +1 -1
  38. package/dist/components/SelectBox/SelectBox.js +12 -12
  39. package/dist/components/ShapeEditor/ShapeEditor.cjs +1 -1
  40. package/dist/components/ShapeEditor/ShapeEditor.js +367 -367
  41. package/dist/components/ShapeEditor/ShapeEditor.js.map +1 -1
  42. package/dist/components/ShapeEditor/ShapeViewer.cjs +1 -1
  43. package/dist/components/ShapeEditor/ShapeViewer.js +17 -17
  44. package/dist/components/ShapeEditor/_components/CursorGuide.cjs +1 -1
  45. package/dist/components/ShapeEditor/_components/CursorGuide.js +7 -7
  46. package/dist/components/ShapeEditor/_components/Minimap.cjs +1 -1
  47. package/dist/components/ShapeEditor/_components/Minimap.js +29 -29
  48. package/dist/components/ShapeEditor/_components/MinimapShape.cjs +1 -1
  49. package/dist/components/ShapeEditor/_components/MinimapShape.cjs.map +1 -1
  50. package/dist/components/ShapeEditor/_components/MinimapShape.js +9 -9
  51. package/dist/components/Slider/Slider.cjs +1 -1
  52. package/dist/components/Slider/Slider.js +10 -10
  53. package/dist/components/Switch/Switch.cjs +1 -1
  54. package/dist/components/Switch/Switch.js +7 -7
  55. package/dist/components/Tagbox/Tagbox.cjs +1 -1
  56. package/dist/components/Tagbox/Tagbox.js +7 -7
  57. package/dist/components/Textarea/Textarea.cjs +1 -1
  58. package/dist/components/Textarea/Textarea.js +9 -9
  59. package/dist/components/Textbox/Textbox.cjs +1 -1
  60. package/dist/components/Textbox/Textbox.js +7 -7
  61. package/dist/components/UploadArea/UploadArea.cjs +1 -1
  62. package/dist/components/UploadArea/UploadArea.js +19 -19
  63. package/package.json +1 -1
@@ -2,226 +2,226 @@
2
2
  "use client";
3
3
  import { SHAPE_TYPE as e, canEditVertices as t, generateId as n, isShapeVisible as r } from "./_model/geometry.js";
4
4
  import { mergeEditorStrings as i } from "./_model/strings.js";
5
- import { TOOL as a } from "./_model/tools.js";
6
- import { AssistantOverlay as ee } from "./_components/AssistantOverlay.js";
7
- import { ContextMenu as te } from "./_components/ContextMenu.js";
8
- import { CursorGuide as ne } from "./_components/CursorGuide.js";
9
- import { ImageStateOverlay as re } from "./_components/ImageStateOverlay.js";
10
- import { Minimap as ie } from "./_components/Minimap.js";
11
- import { SelectionInfo as ae } from "./_components/SelectionInfo.js";
12
- import { createClipboardDocumentId as oe } from "./_model/clipboard.js";
13
- import { resolveEditorCursor as se } from "./_model/cursors.js";
14
- import { buildRegionOverlayData as ce } from "./_model/overlays.js";
15
- import { buildContextMenuItems as le } from "./_state/buildContextMenuItems.js";
16
- import { buildHotkeyActions as ue } from "./_state/buildHotkeyActions.js";
17
- import { createInteractionController as de } from "./_state/createInteractionController.js";
18
- import { useAssistant as fe } from "./_state/useAssistant.js";
19
- import { useLatestRef as o } from "./_state/useLatestRef.js";
20
- import { useDrawSession as pe } from "./_state/useDrawSession.js";
21
- import { useEditorDocument as me } from "./_state/useEditorDocument.js";
22
- import { useEditorHandle as he } from "./_state/useEditorHandle.js";
23
- import { useEditorHotkeys as ge } from "./_state/useEditorHotkeys.js";
24
- import { useEditorView as _e } from "./_state/useEditorView.js";
25
- import { useEngineLifecycle as ve } from "./_state/useEngineLifecycle.js";
26
- import { useMinimapNavigation as ye } from "./_state/useMinimapNavigation.js";
27
- import { useMinimapSync as be } from "./_state/useMinimapSync.js";
28
- import { useSelectionActions as xe } from "./_state/useSelectionActions.js";
29
- import { useSelectionInfoOverlay as Se } from "./_state/useSelectionInfoOverlay.js";
30
- import { useSelectionModel as Ce } from "./_state/useSelectionModel.js";
31
- import { useViewportControls as we } from "./_state/useViewportControls.js";
32
- import { jsx as s, jsxs as Te } from "react/jsx-runtime";
33
- import { useCallback as c, useEffect as l, useId as Ee, useLayoutEffect as De, useMemo as u, useRef as d, useState as f } from "react";
5
+ import { TOOL as ee } from "./_model/tools.js";
6
+ import { AssistantOverlay as te } from "./_components/AssistantOverlay.js";
7
+ import { ContextMenu as ne } from "./_components/ContextMenu.js";
8
+ import { CursorGuide as re } from "./_components/CursorGuide.js";
9
+ import { ImageStateOverlay as ie } from "./_components/ImageStateOverlay.js";
10
+ import { Minimap as ae } from "./_components/Minimap.js";
11
+ import { SelectionInfo as oe } from "./_components/SelectionInfo.js";
12
+ import { createClipboardDocumentId as se } from "./_model/clipboard.js";
13
+ import { resolveEditorCursor as ce } from "./_model/cursors.js";
14
+ import { buildRegionOverlayData as le } from "./_model/overlays.js";
15
+ import { buildContextMenuItems as ue } from "./_state/buildContextMenuItems.js";
16
+ import { buildHotkeyActions as de } from "./_state/buildHotkeyActions.js";
17
+ import { createInteractionController as fe } from "./_state/createInteractionController.js";
18
+ import { useAssistant as pe } from "./_state/useAssistant.js";
19
+ import { useLatestRef as a } from "./_state/useLatestRef.js";
20
+ import { useDrawSession as me } from "./_state/useDrawSession.js";
21
+ import { useEditorDocument as he } from "./_state/useEditorDocument.js";
22
+ import { useEditorHandle as ge } from "./_state/useEditorHandle.js";
23
+ import { useEditorHotkeys as _e } from "./_state/useEditorHotkeys.js";
24
+ import { useEditorView as ve } from "./_state/useEditorView.js";
25
+ import { useEngineLifecycle as ye } from "./_state/useEngineLifecycle.js";
26
+ import { useMinimapNavigation as be } from "./_state/useMinimapNavigation.js";
27
+ import { useMinimapSync as xe } from "./_state/useMinimapSync.js";
28
+ import { useSelectionActions as Se } from "./_state/useSelectionActions.js";
29
+ import { useSelectionInfoOverlay as Ce } from "./_state/useSelectionInfoOverlay.js";
30
+ import { useSelectionModel as we } from "./_state/useSelectionModel.js";
31
+ import { useViewportControls as Te } from "./_state/useViewportControls.js";
32
+ import { useCallback as o, useEffect as s, useId as Ee, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
33
+ import { jsx as f, jsxs as De } from "react/jsx-runtime";
34
34
  //#region src/components/ShapeEditor/ShapeEditor.tsx
35
35
  function p({ document: p, clipboardScope: Oe, renderImageState: ke, dimmed: Ae = !1, selectedIds: je, activeTool: m, draftStyle: Me, draftMeta: h, readOnly: Ne, disableMarquee: Pe, locked: g, onLockedInteraction: Fe, onDrawAttemptWithoutDraft: Ie, onIdleEscape: Le, overrideShapeInteraction: _, defaultViewSettings: Re, viewSettings: ze, onViewSettingsChange: Be, showMinimap: Ve = !0, minimapPosition: He = "bottom-left", showViewSettings: Ue = !0, getContextMenuItems: We, strings: Ge, viewSettingItems: Ke, canMergeSelection: qe, brushSize: Je = 20, zoomBound: Ye, zoomAnimationDuration: Xe = 300, decorationShapes: Ze, regionMask: v, overlayMarkers: Qe, renderOverlayMarker: $e, onOverlayMarkerClick: et, renderImageOverlay: tt, getSelectionLabel: nt, hideSelectionLabelDot: rt, formatSelectionInfo: it, externalTools: at, assistant: ot, keymap: st, handleRef: ct, onActiveToolChange: lt, onSelectionChange: ut, onEditingChange: dt, onShapesCreated: ft, onShapesUpdated: pt, onShapesDeleted: mt, onDrawSessionChange: ht, onDraftShapeChange: gt, onViewportChange: _t, onShapesTransformPreview: vt }) {
36
- let yt = d(null), y = d(null), bt = d(null), xt = d(null), St = d(null), Ct = `${Ee()}-minimap`, [b, wt] = f(null), [x, Tt] = f(!1), [S, Et] = f(!1), [C, Dt] = f(null), [Ot, kt] = f({
36
+ let y = u(null), b = u(null), yt = u(null), bt = u(null), xt = u(null), St = `${Ee()}-minimap`, [x, Ct] = d(null), [wt, Tt] = d(!1), [S, Et] = d(!1), [C, w] = d(null), [Dt, Ot] = d({
37
37
  active: !1,
38
38
  kind: "none",
39
39
  canUndo: !1,
40
40
  canRedo: !1
41
- }), [At, jt] = f(!0), [Mt, Nt] = f(!1), w = p?.id ?? "", Pt = p?.imageUrl ?? "", Ft = p?.displayImageUrl, It = p?.coordinateSize, Lt = p?.initialShapes, Rt = p?.initialSelectedIds, zt = Ft ?? Pt, [Bt, Vt] = f("loading"), Ht = Bt === "loading" && p !== null && !zt ? "missing" : Bt, [Ut, Wt] = f(null), Gt = c((e, t) => {
42
- Vt(e), Wt(e === "error" ? t ?? null : null);
43
- }, []), T = me({
41
+ }), [kt, At] = d(!0), [jt, Mt] = d(!1), T = p?.id ?? "", Nt = p?.imageUrl ?? "", Pt = p?.displayImageUrl, Ft = p?.coordinateSize, It = p?.initialShapes, Lt = p?.initialSelectedIds, Rt = Pt ?? Nt, [zt, Bt] = d("loading"), Vt = zt === "loading" && p !== null && !Rt ? "missing" : zt, [Ht, Ut] = d(null), Wt = o((e, t) => {
42
+ Bt(e), Ut(e === "error" ? t ?? null : null);
43
+ }, []), E = he({
44
44
  onShapesCreated: ft,
45
45
  onShapesUpdated: pt,
46
46
  onShapesDeleted: mt
47
- }), E = u(() => new Map((at ?? []).map((e) => [e.id, e])), [at]), D = d(E);
48
- De(() => {
49
- D.current = E;
50
- }, [E]);
51
- let Kt = o(Ot), O = u(() => i(Ge), [Ge]), { seededDefaults: qt, view: k, setView: Jt, updateView: Yt } = _e({
47
+ }), D = l(() => new Map((at ?? []).map((e) => [e.id, e])), [at]), O = u(D);
48
+ c(() => {
49
+ O.current = D;
50
+ }, [D]);
51
+ let Gt = a(Dt), k = l(() => i(Ge), [Ge]), { seededDefaults: Kt, view: A, setView: qt, updateView: Jt } = ve({
52
52
  defaultViewSettings: Re,
53
53
  viewSettings: ze,
54
54
  onViewSettingsChange: Be
55
- }), A = u(() => !b || !v ? null : ce(v, b.w, b.h), [b, v]), Xt = o(A), Zt = o(Ae), Qt = o(b), $t = o(It), en = o(It?.imageSize), j = o(m), M = o(Me), tn = o(h), nn = o(Je), rn = o(k.simplifyStrength), N = !!Ne || !!g, P = o(N), an = o(Pe), on = o(g), sn = o(Fe), cn = o(Ne), ln = c((e = !0) => cn.current || !on.current || !e ? !1 : (sn.current?.(), !0), []), un = o(Ie), dn = o(_), F = o(T), I = d(null), { selectedIds: L, selRef: R, changeSelection: z } = Ce({
55
+ }), j = l(() => !x || !v ? null : le(v, x.w, x.h), [x, v]), Yt = a(j), Xt = a(Ae), Zt = a(x), Qt = a(Ft), $t = a(Ft?.imageSize), M = a(m), N = a(Me), en = a(h), tn = a(Je), nn = a(A.simplifyStrength), P = !!Ne || !!g, F = a(P), rn = a(Pe), an = a(g), on = a(Fe), sn = a(Ne), cn = o((e = !0) => sn.current || !an.current || !e ? !1 : (on.current?.(), !0), []), ln = a(Ie), un = a(_), I = a(E), L = u(null), { selectedIds: R, selRef: z, changeSelection: B } = we({
56
56
  controlledSelectedIds: je,
57
57
  onSelectionChange: ut,
58
- docShapes: T.shapes,
59
- docRef: F,
60
- overrideInteractionRef: dn,
61
- interactionControllerRef: I,
62
- engineRef: y
63
- }), fn = d(!1), B = d("idle"), V = d(null), H = c(() => {
64
- let e = y.current;
58
+ docShapes: E.shapes,
59
+ docRef: I,
60
+ overrideInteractionRef: un,
61
+ interactionControllerRef: L,
62
+ engineRef: b
63
+ }), dn = u(!1), V = u("idle"), H = u(null), U = o(() => {
64
+ let e = b.current;
65
65
  if (!e) return;
66
- let t = j.current, n = D.current.get(t), r = Kt.current;
67
- e.setCursor(se({
66
+ let t = M.current, n = O.current.get(t), r = Gt.current;
67
+ e.setCursor(ce({
68
68
  tool: t,
69
69
  externalToolCursor: n?.cursor,
70
- isSpacePressed: fn.current,
71
- interactionMode: B.current,
72
- rendererCursorHint: V.current,
70
+ isSpacePressed: dn.current,
71
+ interactionMode: V.current,
72
+ rendererCursorHint: H.current,
73
73
  isPolygonDrawing: r.kind === "polygon" && r.active
74
74
  }));
75
- }, []), pn = c((e) => {
76
- B.current !== e && (B.current = e, H());
77
- }, [H]), mn = c((e) => {
78
- V.current !== e && (V.current = e, H());
79
- }, [H]), hn = o(z), [U, W] = f(null), gn = o(c((e) => W(e), [])), _n = o(U), vn = o(_t), yn = d(null), { registerMinimapShape: bn, applyMinimapPreview: xn, syncMinimap: G } = be({
80
- engineRef: y,
81
- docRef: F,
82
- overlayRef: xt,
83
- zoomLabelRef: St,
84
- minimapRectRef: bt,
75
+ }, []), fn = o((e) => {
76
+ V.current !== e && (V.current = e, U());
77
+ }, [U]), pn = o((e) => {
78
+ H.current !== e && (H.current = e, U());
79
+ }, [U]), mn = a(B), [W, G] = d(null), hn = a(o((e) => G(e), [])), gn = a(W), _n = a(_t), vn = u(null), { registerMinimapShape: yn, applyMinimapPreview: bn, syncMinimap: K } = xe({
80
+ engineRef: b,
81
+ docRef: I,
82
+ overlayRef: bt,
83
+ zoomLabelRef: xt,
84
+ minimapRectRef: yt,
85
85
  minimapSize: 204,
86
- onViewportChangeRef: vn,
87
- onScreenOverlaySyncRef: yn
88
- }), K = Se({
89
- engineRef: y,
90
- docRef: F,
91
- draftRef: M,
92
- draftMetaRef: tn,
93
- screenOverlaySyncRef: yn,
86
+ onViewportChangeRef: _n,
87
+ onScreenOverlaySyncRef: vn
88
+ }), q = Ce({
89
+ engineRef: b,
90
+ docRef: I,
91
+ draftRef: N,
92
+ draftMetaRef: en,
93
+ screenOverlaySyncRef: vn,
94
94
  formatSelectionInfo: it,
95
95
  onDraftShapeChange: gt
96
- }), Sn = K.applyPreview, Cn = o(c((e) => {
97
- xn(e), Sn(e), vt?.(e);
96
+ }), xn = q.applyPreview, Sn = a(o((e) => {
97
+ bn(e), xn(e), vt?.(e);
98
98
  }, [
99
+ bn,
99
100
  xn,
100
- Sn,
101
101
  vt
102
- ])), wn = o(K.onDrawPreview), Tn = c((e, t) => {
103
- let r = M.current;
104
- if (!r || P.current) return;
102
+ ])), Cn = a(q.onDrawPreview), wn = o((e, t) => {
103
+ let r = N.current;
104
+ if (!r || F.current) return;
105
105
  let i = n();
106
- F.current.create({
106
+ I.current.create({
107
107
  id: i,
108
108
  type: e,
109
109
  points: t,
110
110
  style: r,
111
111
  meta: h
112
- }), hn.current([i]);
113
- }, [h]), En = o(Tn), q = pe({
114
- toolRef: j,
115
- selRef: R,
116
- docRef: F,
117
- readOnlyRef: P,
118
- draftRef: M,
119
- brushSizeRef: nn,
120
- simplifyEpsilonRef: rn,
112
+ }), mn.current([i]);
113
+ }, [h]), Tn = a(wn), J = me({
114
+ toolRef: M,
115
+ selRef: z,
116
+ docRef: I,
117
+ readOnlyRef: F,
118
+ draftRef: N,
119
+ brushSizeRef: tn,
120
+ simplifyEpsilonRef: nn,
121
121
  draftMeta: h,
122
- engineRef: y,
123
- onDrawSessionChange: c((e) => {
124
- kt(e), ht?.(e);
122
+ engineRef: b,
123
+ onDrawSessionChange: o((e) => {
124
+ Ot(e), ht?.(e);
125
125
  }, [ht]),
126
126
  onDraftShapeChange: gt,
127
- changeSelection: z,
128
- createShape: Tn
129
- }), Dn = o(q), { reset: On, undoSession: kn, redoSession: An, canUndoSession: jn, canRedoSession: Mn, handleToolChange: Nn, handleBrushSelectionChange: Pn } = q, J = fe({
130
- docRef: F,
131
- draftRef: M,
127
+ changeSelection: B,
128
+ createShape: wn
129
+ }), En = a(J), { reset: Dn, undoSession: On, redoSession: kn, canUndoSession: An, canRedoSession: jn, handleToolChange: Mn, handleBrushSelectionChange: Nn } = J, Y = pe({
130
+ docRef: I,
131
+ draftRef: N,
132
132
  draftMeta: h,
133
- changeSelection: z,
134
- assistantRef: o(ot)
135
- }), Fn = o(J), In = u(() => oe(w), [w]), Y = xe({
136
- doc: T,
137
- selRef: R,
138
- effectiveReadOnly: N,
139
- changeSelection: z,
133
+ changeSelection: B,
134
+ assistantRef: a(ot)
135
+ }), Pn = a(Y), Fn = l(() => se(T), [T]), X = Se({
136
+ doc: E,
137
+ selRef: z,
138
+ effectiveReadOnly: P,
139
+ changeSelection: B,
140
140
  canMergeSelection: qe,
141
- clipboardDocumentId: In,
142
- clipboardScope: Oe ?? In
143
- }), Ln = u(() => ({
141
+ clipboardDocumentId: Fn,
142
+ clipboardScope: Oe ?? Fn
143
+ }), In = l(() => ({
144
144
  undo: () => {
145
- P.current || kn() || T.undo();
145
+ F.current || On() || E.undo();
146
146
  },
147
147
  redo: () => {
148
- P.current || An() || T.redo();
148
+ F.current || kn() || E.redo();
149
149
  },
150
- canUndo: () => jn() || T.canUndo(),
151
- canRedo: () => Mn() || T.canRedo()
150
+ canUndo: () => An() || E.canUndo(),
151
+ canRedo: () => jn() || E.canRedo()
152
152
  }), [
153
- T,
153
+ E,
154
+ On,
154
155
  kn,
155
156
  An,
156
- jn,
157
- Mn
158
- ]), { zoomToBounds: Rn, zoomToShapes: zn, zoomToSelection: Bn, zoomAtCenter: Vn } = we({
159
- engineRef: y,
160
- doc: T,
161
- selRef: R,
157
+ jn
158
+ ]), { zoomToBounds: Ln, zoomToShapes: Rn, zoomToSelection: zn, zoomAtCenter: Bn } = Te({
159
+ engineRef: b,
160
+ doc: E,
161
+ selRef: z,
162
162
  zoomAnimationDuration: Xe,
163
163
  zoomBound: Ye,
164
164
  ready: S
165
- }), Hn = o(k);
166
- he({
165
+ }), Vn = a(A);
166
+ ge({
167
167
  handleRef: ct,
168
- engineRef: y,
169
- loadedImageRef: Qt,
170
- regionOverlayRef: Xt,
171
- viewRef: Hn,
172
- doc: T,
173
- history: Ln,
174
- drawSession: q,
175
- selection: Y,
176
- changeSelection: z,
177
- rejectLockedEdit: ln,
168
+ engineRef: b,
169
+ loadedImageRef: Zt,
170
+ regionOverlayRef: Yt,
171
+ viewRef: Vn,
172
+ doc: E,
173
+ history: In,
174
+ drawSession: J,
175
+ selection: X,
176
+ changeSelection: B,
177
+ rejectLockedEdit: cn,
178
178
  viewport: {
179
- zoomToBounds: Rn,
180
- zoomToShapes: zn,
181
- zoomToSelection: Bn,
182
- zoomAtCenter: Vn
179
+ zoomToBounds: Ln,
180
+ zoomToShapes: Rn,
181
+ zoomToSelection: zn,
182
+ zoomAtCenter: Bn
183
183
  }
184
184
  });
185
- let Un = o({ strokeWidth: k.strokeSize }), Wn = c(() => {
186
- let e = de({
187
- engineRef: y,
188
- toolRef: j,
189
- externalToolMapRef: D,
190
- spaceRef: fn,
191
- docRef: F,
192
- renderShapesRef: Gn,
193
- renderDefaultsRef: Un,
194
- selRef: R,
195
- draftRef: M,
196
- readOnlyRef: P,
197
- disableMarqueeRef: an,
198
- lockedRef: on,
199
- onLockedInteraction: () => sn.current?.(),
200
- onDrawAttemptWithoutDraft: () => un.current?.(),
201
- createRef: En,
202
- selectRef: hn,
203
- enterEditRef: gn,
204
- editingIdRef: _n,
205
- drawSessionRef: Dn,
206
- assistantRef: Fn,
207
- setCursorHint: mn,
208
- setInteractionMode: pn,
209
- syncMinimap: G,
210
- onTransformPreview: (e) => Cn.current(e),
211
- onDrawPreview: (e) => wn.current(e)
185
+ let Hn = a({ strokeWidth: A.strokeSize }), Un = o(() => {
186
+ let e = fe({
187
+ engineRef: b,
188
+ toolRef: M,
189
+ externalToolMapRef: O,
190
+ spaceRef: dn,
191
+ docRef: I,
192
+ renderShapesRef: Wn,
193
+ renderDefaultsRef: Hn,
194
+ selRef: z,
195
+ draftRef: N,
196
+ readOnlyRef: F,
197
+ disableMarqueeRef: rn,
198
+ lockedRef: an,
199
+ onLockedInteraction: () => on.current?.(),
200
+ onDrawAttemptWithoutDraft: () => ln.current?.(),
201
+ createRef: Tn,
202
+ selectRef: mn,
203
+ enterEditRef: hn,
204
+ editingIdRef: gn,
205
+ drawSessionRef: En,
206
+ assistantRef: Pn,
207
+ setCursorHint: pn,
208
+ setInteractionMode: fn,
209
+ syncMinimap: K,
210
+ onTransformPreview: (e) => Sn.current(e),
211
+ onDrawPreview: (e) => Cn.current(e)
212
212
  });
213
- return I.current = e, e;
213
+ return L.current = e, e;
214
214
  }, [
215
- R,
216
- mn,
215
+ z,
217
216
  pn,
218
- G
217
+ fn,
218
+ K
219
219
  ]);
220
- l(() => () => {
221
- I.current = null;
220
+ s(() => () => {
221
+ L.current = null;
222
222
  }, []);
223
- let X = u(() => {
224
- let e = _ ? T.shapes.map((e) => {
223
+ let Z = l(() => {
224
+ let e = _ ? E.shapes.map((e) => {
225
225
  let t = _(e);
226
226
  return t ? {
227
227
  ...e,
@@ -230,7 +230,7 @@ function p({ document: p, clipboardScope: Oe, renderImageState: ke, dimmed: Ae =
230
230
  ...t
231
231
  }
232
232
  } : e;
233
- }) : T.shapes;
233
+ }) : E.shapes;
234
234
  return Ze?.length ? [...Ze.map((e) => ({
235
235
  ...e,
236
236
  interaction: {
@@ -242,267 +242,267 @@ function p({ document: p, clipboardScope: Oe, renderImageState: ke, dimmed: Ae =
242
242
  }
243
243
  })), ...e] : e;
244
244
  }, [
245
- T.shapes,
245
+ E.shapes,
246
246
  _,
247
247
  Ze
248
- ]), Gn = o(X);
249
- ve({
250
- hostRef: yt,
251
- engineRef: y,
252
- documentId: w,
253
- renderedImageUrl: zt,
254
- makeCallbacks: Wn,
255
- viewRef: Hn,
256
- readOnlyRef: P,
257
- toolRef: j,
258
- renderShapesRef: Gn,
259
- coordinateSizeRef: $t,
260
- imageSizeRef: en,
261
- selRef: R,
262
- regionOverlayRef: Xt,
263
- dimmedRef: Zt,
264
- syncMinimap: G,
265
- setImage: wt,
248
+ ]), Wn = a(Z);
249
+ ye({
250
+ hostRef: y,
251
+ engineRef: b,
252
+ documentId: T,
253
+ renderedImageUrl: Rt,
254
+ makeCallbacks: Un,
255
+ viewRef: Vn,
256
+ readOnlyRef: F,
257
+ toolRef: M,
258
+ renderShapesRef: Wn,
259
+ coordinateSizeRef: Qt,
260
+ imageSizeRef: $t,
261
+ selRef: z,
262
+ regionOverlayRef: Yt,
263
+ dimmedRef: Xt,
264
+ syncMinimap: K,
265
+ setImage: Ct,
266
266
  setImageVisible: Tt,
267
267
  setReady: Et,
268
- setImageStatus: Gt,
269
- onContextMenuRequest: Dt
270
- }), l(() => {
271
- y.current?.setShapes(X, R.current), G();
268
+ setImageStatus: Wt,
269
+ onContextMenuRequest: w
270
+ }), s(() => {
271
+ b.current?.setShapes(Z, z.current), K();
272
272
  }, [
273
- X,
274
- R,
275
- G
276
- ]), l(() => {
277
- y.current?.setSelection(L);
278
- }, [L]), l(() => {
279
- y.current?.setEditing(U);
280
- }, [U, S]);
281
- let Kn = o(dt);
282
- l(() => {
283
- Kn.current?.(U);
284
- }, [U]), De(() => {
285
- I.current?.cancelGesture(), W(null);
286
- }, [m, w]), l(() => {
287
- U && (L.length !== 1 || L[0] !== U) && W(null);
288
- }, [L, U]), l(() => {
289
- let e = y.current;
290
- e && (e.setFilter(k.brightness, k.contrast), e.setRenderDefaults({ strokeWidth: k.strokeSize }), e.setImageSmoothing(k.imageSmoothing), G());
273
+ Z,
274
+ z,
275
+ K
276
+ ]), s(() => {
277
+ b.current?.setSelection(R);
278
+ }, [R]), s(() => {
279
+ b.current?.setEditing(W);
280
+ }, [W, S]);
281
+ let Gn = a(dt);
282
+ s(() => {
283
+ Gn.current?.(W);
284
+ }, [W]), c(() => {
285
+ L.current?.cancelGesture(), G(null);
286
+ }, [m, T]), s(() => {
287
+ W && (R.length !== 1 || R[0] !== W) && G(null);
288
+ }, [R, W]), s(() => {
289
+ let e = b.current;
290
+ e && (e.setFilter(A.brightness, A.contrast), e.setRenderDefaults({ strokeWidth: A.strokeSize }), e.setImageSmoothing(A.imageSmoothing), K());
291
291
  }, [
292
- k.brightness,
293
- k.contrast,
294
- k.strokeSize,
295
- k.imageSmoothing,
296
- G
297
- ]), De(() => {
298
- S && y.current?.setOverlays(k.showRegionMask ? A : null, Ae);
292
+ A.brightness,
293
+ A.contrast,
294
+ A.strokeSize,
295
+ A.imageSmoothing,
296
+ K
297
+ ]), c(() => {
298
+ S && b.current?.setOverlays(A.showRegionMask ? j : null, Ae);
299
299
  }, [
300
300
  S,
301
- A,
302
- k.showRegionMask,
301
+ j,
302
+ A.showRegionMask,
303
303
  Ae
304
- ]), l(() => {
305
- !S || !b || G();
304
+ ]), s(() => {
305
+ !S || !x || K();
306
306
  }, [
307
307
  S,
308
- b,
309
- k.showRegionMask,
308
+ x,
309
+ A.showRegionMask,
310
310
  v,
311
- G
312
- ]), l(() => {
313
- S && y.current?.setTransformEnabled(!N && m !== a.BRUSH);
311
+ K
312
+ ]), s(() => {
313
+ S && b.current?.setTransformEnabled(!P && m !== ee.BRUSH);
314
314
  }, [
315
- N,
315
+ P,
316
316
  S,
317
317
  m
318
- ]), l(() => {
319
- g && W(null);
320
- }, [g]), l(() => {
321
- Nn(m, D.current.has(m));
322
- }, [m, Nn]);
323
- let Z = J.finalize;
324
- l(() => {
325
- Z();
326
- }, [m, Z]), l(() => {
327
- B.current = "idle", V.current = null, H();
328
- }, [m, H]), l(() => {
329
- Pn(L, N);
318
+ ]), s(() => {
319
+ g && G(null);
320
+ }, [g]), s(() => {
321
+ Mn(m, O.current.has(m));
322
+ }, [m, Mn]);
323
+ let Q = Y.finalize;
324
+ s(() => {
325
+ Q();
326
+ }, [m, Q]), s(() => {
327
+ V.current = "idle", H.current = null, U();
328
+ }, [m, U]), s(() => {
329
+ Nn(R, P);
330
330
  }, [
331
- L,
331
+ R,
332
332
  m,
333
- N,
334
- Pn
335
- ]), l(() => {
336
- S && H();
333
+ P,
334
+ Nn
335
+ ]), s(() => {
336
+ S && U();
337
337
  }, [
338
338
  m,
339
- Ot,
340
- E,
339
+ Dt,
340
+ D,
341
341
  S,
342
- H
342
+ U
343
343
  ]);
344
- let qn = o(Rt), Q = p !== null, Jn = d(null);
345
- l(() => {
346
- let e = Q ? w : null;
347
- Jn.current !== e && (Jn.current = e, Dt(null), W(null), B.current = "idle", V.current = null, T.reset(Q ? Lt ?? [] : []), z(Q ? qn.current ?? [] : []), On(), Z(), H());
344
+ let Kn = a(Lt), $ = p !== null, qn = u(null);
345
+ s(() => {
346
+ let e = $ ? T : null;
347
+ qn.current !== e && (qn.current = e, w(null), G(null), V.current = "idle", H.current = null, E.reset($ ? It ?? [] : []), B($ ? Kn.current ?? [] : []), Dn(), Q(), U());
348
348
  }, [
349
+ $,
350
+ T,
351
+ It,
352
+ E.reset,
353
+ B,
354
+ Dn,
349
355
  Q,
350
- w,
351
- Lt,
352
- T.reset,
353
- z,
354
- On,
355
- Z,
356
- H
357
- ]), ge({
356
+ U
357
+ ]), _e({
358
358
  keymap: st,
359
- hostRef: yt,
360
- actions: ue({
361
- history: Ln,
362
- selection: Y,
363
- drawSession: q,
364
- assistant: J,
365
- controller: () => I.current,
366
- externalTool: () => D.current.get(j.current),
367
- hasSelection: () => R.current.length > 0,
368
- rejectLockedEdit: ln,
369
- editLocked: N,
370
- editingId: U,
371
- setEditingId: W,
359
+ hostRef: y,
360
+ actions: de({
361
+ history: In,
362
+ selection: X,
363
+ drawSession: J,
364
+ assistant: Y,
365
+ controller: () => L.current,
366
+ externalTool: () => O.current.get(M.current),
367
+ hasSelection: () => z.current.length > 0,
368
+ rejectLockedEdit: cn,
369
+ editLocked: P,
370
+ editingId: W,
371
+ setEditingId: G,
372
372
  vertexEditTarget: () => {
373
- let e = R.current;
373
+ let e = z.current;
374
374
  if (e.length !== 1) return null;
375
- let n = F.current.getShapes().find((t) => t.id === e[0]);
375
+ let n = I.current.getShapes().find((t) => t.id === e[0]);
376
376
  return n && t(n) ? n.id : null;
377
377
  },
378
- deleteEditingVertices: c(() => {
379
- let t = _n.current;
380
- if (!t || N) return !1;
381
- let n = y.current, r = new Set(n?.getVertexSelection() ?? []);
378
+ deleteEditingVertices: o(() => {
379
+ let t = gn.current;
380
+ if (!t || P) return !1;
381
+ let n = b.current, r = new Set(n?.getVertexSelection() ?? []);
382
382
  if (!r.size) return !1;
383
- let i = F.current.getShapes().find((e) => e.id === t);
383
+ let i = I.current.getShapes().find((e) => e.id === t);
384
384
  if (!i) return !1;
385
- let a = i.points.filter((e, t) => !r.has(t)), ee = i.type === e.LINE ? 2 : 3;
386
- return a.length < ee ? !1 : (F.current.update([{
385
+ let ee = i.points.filter((e, t) => !r.has(t)), te = i.type === e.LINE ? 2 : 3;
386
+ return ee.length < te ? !1 : (I.current.update([{
387
387
  ...i,
388
- points: a
388
+ points: ee
389
389
  }]), n?.setVertexSelection([]), !0);
390
- }, [N]),
391
- zoomAtCenter: Vn,
392
- zoom100: () => y.current?.zoom100(),
393
- zoomFit: () => y.current?.fit(),
394
- toggleMinimap: () => jt((e) => !e),
395
- toggleCursorGuide: () => Jt((e) => ({
390
+ }, [P]),
391
+ zoomAtCenter: Bn,
392
+ zoom100: () => b.current?.zoom100(),
393
+ zoomFit: () => b.current?.fit(),
394
+ toggleMinimap: () => At((e) => !e),
395
+ toggleCursorGuide: () => qt((e) => ({
396
396
  ...e,
397
397
  showCursorGuide: !e.showCursorGuide
398
398
  })),
399
- togglePixelation: () => Jt((e) => ({
399
+ togglePixelation: () => qt((e) => ({
400
400
  ...e,
401
401
  imageSmoothing: !e.imageSmoothing
402
402
  })),
403
403
  selectTool: (e) => lt?.(e),
404
404
  onIdleEscape: Le
405
405
  }),
406
- spaceRef: fn,
406
+ spaceRef: dn,
407
407
  onSpaceDown: () => {
408
- y.current?.setPanMode(!0), H();
408
+ b.current?.setPanMode(!0), U();
409
409
  },
410
410
  onSpaceUp: () => {
411
- y.current?.setPanMode(!1), B.current === "panning" ? pn("idle") : H();
411
+ b.current?.setPanMode(!1), V.current === "panning" ? fn("idle") : U();
412
412
  },
413
- nudge: (e, t) => ln(Y.getEditableSelection().length > 0) || Y.nudgeSelection(e, t)
413
+ nudge: (e, t) => cn(X.getEditableSelection().length > 0) || X.nudgeSelection(e, t)
414
414
  });
415
- let $ = u(() => X.filter((e) => L.includes(e.id) && r(e)), [X, L]), Yn = u(() => K.drawPreviewShape ? [...$, K.drawPreviewShape] : $, [$, K.drawPreviewShape]), Xn = C ? le({
416
- strings: O.contextMenu,
415
+ let Jn = l(() => Z.filter((e) => R.includes(e.id) && r(e)), [Z, R]), Yn = l(() => q.drawPreviewShape ? [...Jn, q.drawPreviewShape] : Jn, [Jn, q.drawPreviewShape]), Xn = C ? ue({
416
+ strings: k.contextMenu,
417
417
  point: C.img,
418
- shapes: T.shapes,
419
- selectedIds: L,
418
+ shapes: E.shapes,
419
+ selectedIds: R,
420
420
  hostReadOnly: !!Ne,
421
- editLocked: N,
422
- selection: Y,
421
+ editLocked: P,
422
+ selection: X,
423
423
  canMergeSelection: qe,
424
- history: Ln,
425
- enterVertexEdit: W,
426
- zoomToSelection: Bn,
427
- refineShape: ot ? J.refineShape : void 0
424
+ history: In,
425
+ enterVertexEdit: G,
426
+ zoomToSelection: zn,
427
+ refineShape: ot ? Y.refineShape : void 0
428
428
  }) : [], Zn = C && We ? We(Xn, {
429
- selectedIds: L,
430
- readOnly: N
431
- }) : Xn, Qn = ye({
432
- engineRef: y,
433
- image: b,
434
- wheelZoom: k.wheelZoom,
429
+ selectedIds: R,
430
+ readOnly: P
431
+ }) : Xn, Qn = be({
432
+ engineRef: b,
433
+ image: x,
434
+ wheelZoom: A.wheelZoom,
435
435
  minimapSize: 204
436
- }), $n = c(() => {
437
- y.current?.zoom100();
438
- }, []), er = c(() => {
439
- jt((e) => !e);
440
- }, []), tr = c(() => {
441
- Nt((e) => !e);
442
- }, []), nr = c(() => {
443
- Nt(!1);
436
+ }), $n = o(() => {
437
+ b.current?.zoom100();
438
+ }, []), er = o(() => {
439
+ At((e) => !e);
440
+ }, []), tr = o(() => {
441
+ Mt((e) => !e);
442
+ }, []), nr = o(() => {
443
+ Mt(!1);
444
444
  }, []);
445
- return /* @__PURE__ */ Te("div", {
445
+ return /* @__PURE__ */ De("div", {
446
446
  className: "aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black",
447
447
  children: [
448
- /* @__PURE__ */ s("div", {
449
- ref: yt,
448
+ /* @__PURE__ */ f("div", {
449
+ ref: y,
450
450
  role: "application",
451
- "aria-label": O.canvasLabel,
451
+ "aria-label": k.canvasLabel,
452
452
  tabIndex: 0,
453
453
  onPointerDownCapture: (e) => e.currentTarget.focus({ preventScroll: !0 }),
454
454
  className: "aivex:h-full aivex:w-full",
455
455
  style: {
456
- opacity: +!!x,
457
- transition: x ? "opacity 0.3s ease" : "none"
456
+ opacity: +!!wt,
457
+ transition: wt ? "opacity 0.3s ease" : "none"
458
458
  }
459
459
  }),
460
- Ht !== "ready" && /* @__PURE__ */ s(re, {
461
- status: Ht,
462
- error: Ut,
460
+ Vt !== "ready" && /* @__PURE__ */ f(ie, {
461
+ status: Vt,
462
+ error: Ht,
463
463
  render: ke,
464
- loadingLabel: O.imageLoading,
465
- missingLabel: O.imageMissing,
466
- errorLabel: O.imageLoadError,
467
- errorHints: O.imageErrorHints
464
+ loadingLabel: k.imageLoading,
465
+ missingLabel: k.imageMissing,
466
+ errorLabel: k.imageLoadError,
467
+ errorHints: k.imageErrorHints
468
468
  }),
469
- S && b && /* @__PURE__ */ Te("div", {
469
+ S && x && /* @__PURE__ */ De("div", {
470
470
  className: "aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden",
471
- children: [Yn.length > 0 && /* @__PURE__ */ s("div", {
471
+ children: [Yn.length > 0 && /* @__PURE__ */ f("div", {
472
472
  className: "aivex:absolute aivex:inset-0",
473
- children: /* @__PURE__ */ s(ae, {
473
+ children: /* @__PURE__ */ f(oe, {
474
474
  shapes: Yn,
475
475
  getLabel: nt,
476
476
  hideDot: rt,
477
477
  formatInfo: it,
478
- register: K.register,
479
- viewport: y.current?.viewport ?? {
478
+ register: q.register,
479
+ viewport: b.current?.viewport ?? {
480
480
  scale: 1,
481
481
  x: 0,
482
482
  y: 0
483
483
  }
484
484
  })
485
- }), /* @__PURE__ */ Te("div", {
486
- ref: xt,
485
+ }), /* @__PURE__ */ De("div", {
486
+ ref: bt,
487
487
  style: {
488
488
  position: "absolute",
489
489
  top: 0,
490
490
  left: 0,
491
- width: b.w,
492
- height: b.h,
491
+ width: x.w,
492
+ height: x.h,
493
493
  transformOrigin: "0 0"
494
494
  },
495
495
  children: [
496
- !!Qe?.length && $e && /* @__PURE__ */ s("div", {
496
+ !!Qe?.length && $e && /* @__PURE__ */ f("div", {
497
497
  style: {
498
498
  position: "absolute",
499
499
  left: 0,
500
500
  top: 0,
501
- width: b.w,
502
- height: b.h,
501
+ width: x.w,
502
+ height: x.h,
503
503
  pointerEvents: "none"
504
504
  },
505
- children: Qe.map((e) => /* @__PURE__ */ s("div", {
505
+ children: Qe.map((e) => /* @__PURE__ */ f("div", {
506
506
  role: e.disabled ? void 0 : "button",
507
507
  tabIndex: e.disabled ? void 0 : 0,
508
508
  "aria-pressed": e.selected || void 0,
@@ -526,55 +526,55 @@ function p({ document: p, clipboardScope: Oe, renderImageState: ke, dimmed: Ae =
526
526
  }, e.id))
527
527
  }),
528
528
  tt?.({
529
- image: b,
530
- viewport: y.current?.viewport ?? {
529
+ image: x,
530
+ viewport: b.current?.viewport ?? {
531
531
  scale: 1,
532
532
  x: 0,
533
533
  y: 0
534
534
  }
535
535
  }),
536
- ot && (J.status === "loading" || J.boxes.length > 0) && /* @__PURE__ */ s(ee, {
537
- image: b,
538
- points: J.points,
539
- boxes: J.boxes,
540
- status: J.status
536
+ ot && (Y.status === "loading" || Y.boxes.length > 0) && /* @__PURE__ */ f(te, {
537
+ image: x,
538
+ points: Y.points,
539
+ boxes: Y.boxes,
540
+ status: Y.status
541
541
  })
542
542
  ]
543
543
  })]
544
544
  }),
545
- S && k.showCursorGuide && /* @__PURE__ */ s(ne, { color: "#1e88e5" }),
546
- b && Ve && /* @__PURE__ */ s(ie, {
547
- image: b,
548
- imageUrl: zt,
549
- imageVisible: x,
545
+ S && A.showCursorGuide && /* @__PURE__ */ f(re, { color: "#1e88e5" }),
546
+ x && Ve && /* @__PURE__ */ f(ae, {
547
+ image: x,
548
+ imageUrl: Rt,
549
+ imageVisible: wt,
550
550
  loading: !S,
551
- region: A,
552
- roiMaskId: Ct,
553
- shapes: X,
554
- view: k,
555
- viewDefaults: qt,
556
- onChangeView: Yt,
551
+ region: j,
552
+ roiMaskId: St,
553
+ shapes: Z,
554
+ view: A,
555
+ viewDefaults: Kt,
556
+ onChangeView: Jt,
557
557
  nav: Qn,
558
- registerShape: bn,
559
- rectRef: bt,
560
- zoomLabelRef: St,
558
+ registerShape: yn,
559
+ rectRef: yt,
560
+ zoomLabelRef: xt,
561
561
  onZoom100: $n,
562
- open: At,
562
+ open: kt,
563
563
  onToggleOpen: er,
564
564
  position: He,
565
- labels: O.minimap,
566
- settingsLabels: O.viewSettings,
565
+ labels: k.minimap,
566
+ settingsLabels: k.viewSettings,
567
567
  settingsItems: Ke,
568
568
  showSettings: Ue,
569
- settingsOpen: Mt,
569
+ settingsOpen: jt,
570
570
  onToggleSettings: tr,
571
571
  onCloseSettings: nr
572
572
  }),
573
- C && /* @__PURE__ */ s(te, {
573
+ C && /* @__PURE__ */ f(ne, {
574
574
  x: C.x,
575
575
  y: C.y,
576
576
  items: Zn,
577
- onClose: () => Dt(null)
577
+ onClose: () => w(null)
578
578
  })
579
579
  ]
580
580
  });