@sheetxl/react 0.8.0-beta.10 → 0.8.0-beta.11
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/browser/esm/{CYoUd5KIl7W3AsxH.mjs → 1-LEUre9ZLG0OYYB.mjs} +24 -23
- package/browser/esm/94dxo1A-z8lgiiGw.mjs +128 -0
- package/browser/esm/{BwRduT8FTrk5n72r.mjs → B26QVfjer2oY2ewK.mjs} +1 -1
- package/browser/esm/B93LSmhnvkxNXTq-.mjs +42 -0
- package/browser/esm/{BZcQ-KYwS62Ut45c.mjs → BQYS2Yf-EAV_tBLr.mjs} +1 -1
- package/browser/esm/BegvsXeRs7e-9t8k.mjs +8 -0
- package/browser/esm/Bl2BFCQ00fotauKB.mjs +36 -0
- package/browser/esm/{Cfe0kofqVKGxLqO6.mjs → Bos4Rkp8UTF7QXUB.mjs} +1 -1
- package/browser/esm/{Dd-ZybXAgoq9pgGv.mjs → C1pc9F4Rt2C5FKUo.mjs} +1 -1
- package/browser/esm/{C6urN77szrYwODXF.mjs → CPnnESfZz2jjJd82.mjs} +1 -1
- package/browser/esm/CRi6DQ3UXmPEv-w_.mjs +729 -0
- package/browser/esm/{BuvXl14hs-1CvjeA.mjs → ClAtIfYbsUPA073B.mjs} +1 -1
- package/browser/esm/CzRIbc-Lk__VMLKM.mjs +60 -0
- package/browser/esm/{DyU9UInRnfkPYYlR.mjs → D2u6THGErqw64KQI.mjs} +1 -1
- package/browser/esm/{cYjYjqEsyd63x8t4.mjs → DMdsMPT0fWBbTkNn.mjs} +1 -1
- package/browser/esm/{Bow9CzRJrYxak2i5.mjs → DS66lAIM-9M-YoZQ.mjs} +5 -8
- package/browser/esm/DgL7Dy-Lqcr1TvW6.mjs +23528 -0
- package/browser/esm/{DjiBz4H74I6nPUY6.mjs → Dnh1kpz3v1JKtRD_.mjs} +2 -2
- package/browser/esm/{Sp6PJavGKpF8SJzA.mjs → cQ6xdPFkEcuDlNTN.mjs} +1 -1
- package/browser/esm/chart.mjs +32 -52
- package/browser/esm/control.mjs +2 -2
- package/browser/esm/group.mjs +3 -3
- package/browser/esm/index.mjs +6590 -4824
- package/browser/esm/note.mjs +73 -47
- package/browser/esm/picture.mjs +2 -2
- package/browser/esm/shape.mjs +2 -2
- package/browser/esm/slicer.mjs +5 -5
- package/browser/esm/ugfE7YeZALQURDKF.mjs +241 -0
- package/licenses/dependencies.txt +313 -1
- package/node/esm/6zApGj9DozhFy-bx.mjs +35 -0
- package/node/esm/{DPN0n6MGYQ9vZ2KO.mjs → BMVK5plvmBOAIlxP.mjs} +1 -1
- package/node/esm/{Dxbm6ryIDCEi26RO.mjs → BaRfst1euuhquupX.mjs} +1 -1
- package/node/esm/{BJ7ZZm63j5O6cvrB.mjs → Be9c1GwQkPo8Piuh.mjs} +1 -1
- package/node/esm/{DhSq680c5tgMFFbj.mjs → BiaDWnN3tT7neoRL.mjs} +1 -1
- package/node/esm/BlxXufqBBg1PtsXd.mjs +8 -0
- package/node/esm/{CM5BT7h-hMtST2bE.mjs → C_SNx7TlFEcwbYjx.mjs} +1 -1
- package/node/esm/DJPgbB1X22YmhbaR.mjs +242 -0
- package/node/esm/DTMTIrYIK1eZswsM.mjs +37 -0
- package/node/esm/{Buw-VKYJy3y5dbaJ.mjs → D_pCpfdQowV_4Aje.mjs} +23 -22
- package/node/esm/{DYosMUJKp-3MSO4q.mjs → DgGEHydEjD7nfsDB.mjs} +1 -1
- package/node/esm/{CFFlJxNwgyInjEnh.mjs → Dj5FM7_-YWhCtCCt.mjs} +1 -1
- package/node/esm/{GkmuxU7OwRZtm2Rf.mjs → DxQZmb-j4NLUO9Af.mjs} +1 -1
- package/node/esm/{BfRn5S5V4X8xIAEa.mjs → JiQGhLkoL8CJpVvA.mjs} +1 -1
- package/node/esm/b-XRVRI1fYQQMkTC.mjs +1664 -0
- package/node/esm/chart.mjs +32 -52
- package/node/esm/control.mjs +2 -2
- package/node/esm/{C_ANM4feA1xV-pri.mjs → gpD-9LDW92phhoma.mjs} +1 -1
- package/node/esm/group.mjs +3 -3
- package/node/esm/index.mjs +9005 -7225
- package/node/esm/note.mjs +86 -60
- package/node/esm/picture.mjs +2 -2
- package/node/esm/shape.mjs +292 -340
- package/node/esm/sigD1UFqvPlWUw_9.mjs +128 -0
- package/node/esm/slicer.mjs +15 -15
- package/node/esm/{D3YXHeOyFp00Xk3m.mjs → umljAT66yb3_rURh.mjs} +53 -56
- package/package.json +8 -6
- package/resources/contents.json +6 -0
- package/resources/locales/contents.json +14 -0
- package/resources/locales/de/chart.cmd.json +82 -0
- package/resources/locales/de/sheet.cmd.json +11 -0
- package/resources/locales/de/table.cmd.json +1 -1
- package/resources/locales/de/ui.msg.json +12 -0
- package/resources/locales/de/workbook.cmd.json +5 -0
- package/resources/locales/en/chart.cmd.json +82 -0
- package/resources/locales/en/sheet.cmd.json +11 -0
- package/resources/locales/en/table.cmd.json +1 -1
- package/resources/locales/en/ui.msg.json +12 -0
- package/resources/locales/en/workbook.cmd.json +5 -0
- package/types/src/autoFill/FillMenu.d.ts +2 -2
- package/types/src/autoFill/FillSeries.d.ts +2 -2
- package/types/src/border/StaticBorderRenderer.d.ts +18 -1
- package/types/src/border/useBorders.d.ts +74 -1
- package/types/src/cell/FormulaCellRenderer.d.ts +5 -2
- package/types/src/cell/useFormulaViewAnchor.d.ts +2 -2
- package/types/src/chart/ChartCommands.d.ts +15 -0
- package/types/src/chart/ChartEditor.d.ts +10 -2
- package/types/src/chart/ChartElement.d.ts +111 -0
- package/types/src/chart/ChartKind.d.ts +7 -0
- package/types/src/chart/PresetChartTypeDescriptors.d.ts +3 -1
- package/types/src/chart/index.d.ts +2 -0
- package/types/src/chart/paint/_fills.d.ts +24 -0
- package/types/src/chart/paint/_graphics.d.ts +46 -0
- package/types/src/chart/paint/echarts.d.ts +30 -0
- package/types/src/chart/paint/index.d.ts +12 -0
- package/types/src/chart/paint/kinds/ChartPaintKind.d.ts +132 -0
- package/types/src/chart/paint/kinds/_Area.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Bar.d.ts +3 -0
- package/types/src/chart/paint/kinds/_BoxWhisker.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Bubble.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Funnel.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Histogram.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Line.d.ts +10 -0
- package/types/src/chart/paint/kinds/_OfPie.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Pie.d.ts +21 -0
- package/types/src/chart/paint/kinds/_Placeholder.d.ts +7 -0
- package/types/src/chart/paint/kinds/_Radar.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Scatter.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Sunburst.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Surface.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Treemap.d.ts +3 -0
- package/types/src/chart/paint/kinds/_Waterfall.d.ts +3 -0
- package/types/src/chart/paint/kinds/_builtIns.d.ts +12 -0
- package/types/src/chart/paint/toEChartsOption.d.ts +31 -0
- package/types/src/clipboard/ClipboardCommands.d.ts +3 -3
- package/types/src/clipboard/SheetClipboardLayer.d.ts +2 -2
- package/types/src/comment/CommentCardRequest.d.ts +9 -9
- package/types/src/comment/useSheetComments.d.ts +2 -2
- package/types/src/context/WorksheetContext.d.ts +18 -0
- package/types/src/context/index.d.ts +1 -1
- package/types/src/editor/EditorCommands.d.ts +3 -3
- package/types/src/editor/SheetCellEditorLayer.d.ts +2 -2
- package/types/src/editor/SheetCellEditorStartLayer.d.ts +22 -5
- package/types/src/editor/SheetEditable.d.ts +6 -6
- package/types/src/editor/SheetReferenceLayer.d.ts +4 -4
- package/types/src/editor/VirtualKeyboardLayer.d.ts +49 -0
- package/types/src/editor/formulaAnchor.d.ts +12 -0
- package/types/src/editor/index.d.ts +1 -0
- package/types/src/editor/pickedReference.d.ts +3 -3
- package/types/src/editor/useEditRejectedNotice.d.ts +3 -3
- package/types/src/editor/useFormulaHints.d.ts +2 -2
- package/types/src/editor/validationAlert.d.ts +3 -3
- package/types/src/frame/CommandContext.d.ts +7 -7
- package/types/src/index.d.ts +2 -0
- package/types/src/layer/BorderLayer.d.ts +2 -2
- package/types/src/layer/CellErrorLayer.d.ts +2 -2
- package/types/src/layer/CellFillLayer.d.ts +2 -2
- package/types/src/layer/CellInsertLayer.d.ts +71 -0
- package/types/src/layer/CircularIndicatorLayer.d.ts +2 -2
- package/types/src/layer/CommentCardLayer.d.ts +2 -2
- package/types/src/layer/CommentsLayer.d.ts +2 -2
- package/types/src/layer/ConditionalBarLayer.d.ts +2 -2
- package/types/src/layer/ConditionalIconsLayer.d.ts +2 -2
- package/types/src/layer/ContextMenuLayer.d.ts +2 -2
- package/types/src/layer/GridFreezeLayer.d.ts +2 -2
- package/types/src/layer/HyperlinkLayer.d.ts +3 -3
- package/types/src/layer/MovableKindScope.d.ts +2 -2
- package/types/src/layer/ProtectionLayer.d.ts +3 -3
- package/types/src/layer/RangeAnnotationLayer.d.ts +2 -2
- package/types/src/layer/ResizeIndicator.d.ts +2 -2
- package/types/src/layer/SheetBackgroundLayer.d.ts +3 -3
- package/types/src/layer/SheetCellLayer.d.ts +4 -4
- package/types/src/layer/SheetColumnButtonLayer.d.ts +2 -2
- package/types/src/layer/SheetGridLineLayer.d.ts +11 -13
- package/types/src/layer/SheetLayers.d.ts +115 -0
- package/types/src/layer/SheetMovableLayer.d.ts +2 -2
- package/types/src/layer/SheetOutlineLayer.d.ts +2 -2
- package/types/src/layer/SheetTableCommandLayer.d.ts +2 -2
- package/types/src/layer/SpillLayer.d.ts +2 -2
- package/types/src/layer/TableLayer.d.ts +2 -2
- package/types/src/layer/TableToolbar.d.ts +3 -3
- package/types/src/layer/ValidationDropdownLayer.d.ts +2 -2
- package/types/src/layer/ValidationIndicatorLayer.d.ts +2 -2
- package/types/src/layer/ValidationPromptLayer.d.ts +5 -4
- package/types/src/layer/_tableColor.d.ts +2 -2
- package/types/src/layer/index.d.ts +2 -0
- package/types/src/layer/useFreezeDrag.d.ts +2 -2
- package/types/src/layer/useNormalBorderLines.d.ts +15 -0
- package/types/src/layer/useSheetFeatureRegions.d.ts +2 -2
- package/types/src/layer/useSheetVisibleCells.d.ts +2 -2
- package/types/src/layer/useSheetVisibleDecorations.d.ts +2 -2
- package/types/src/layer/useTableHeaderCells.d.ts +2 -2
- package/types/src/layer/useValidationPicker.d.ts +2 -2
- package/types/src/layer/useVisibleTables.d.ts +2 -2
- package/types/src/layer/validationMark.d.ts +3 -3
- package/types/src/listener/index.d.ts +5 -0
- package/types/src/listener/useCell.d.ts +29 -0
- package/types/src/listener/useCellRange.d.ts +23 -0
- package/types/src/listener/useCellValue.d.ts +26 -0
- package/types/src/listener/useModelListener.d.ts +4 -4
- package/types/src/listener/useRangeSnapshot.d.ts +35 -0
- package/types/src/listener/useTable.d.ts +26 -0
- package/types/src/movable/DefaultMovable.d.ts +8 -0
- package/types/src/movable/MovableCommands.d.ts +2 -2
- package/types/src/movable/MovableRenderers.d.ts +3 -3
- package/types/src/movable/index.d.ts +1 -0
- package/types/src/picker/cellPickerOpen.d.ts +3 -3
- package/types/src/picker/useCellPicker.d.ts +2 -2
- package/types/src/richText/RichTextEditor.d.ts +2 -2
- package/types/src/selection/SelectionCommands.d.ts +2 -2
- package/types/src/selection/SheetSelectionLayer.d.ts +2 -2
- package/types/src/sheet/ISheetHeaderElement.d.ts +1 -1
- package/types/src/sheet/{ISheetElement.d.ts → IWorksheetElement.d.ts} +46 -13
- package/types/src/sheet/OpaqueSheetElement.d.ts +21 -0
- package/types/src/sheet/SheetCommandProvider.d.ts +2 -2
- package/types/src/sheet/SheetCommands.d.ts +2 -2
- package/types/src/sheet/SheetKindIcon.d.ts +14 -0
- package/types/src/sheet/SheetOutlineElement.d.ts +4 -4
- package/types/src/sheet/SheetPanels.d.ts +11 -0
- package/types/src/sheet/SheetScrollbar.d.ts +3 -3
- package/types/src/sheet/TopLeftCorner.d.ts +2 -2
- package/types/src/sheet/WorksheetElement.d.ts +12 -0
- package/types/src/sheet/_freezeAt.d.ts +2 -2
- package/types/src/sheet/circularReferences.d.ts +3 -3
- package/types/src/sheet/index.d.ts +5 -2
- package/types/src/sheet/useCycleHighlight.d.ts +2 -2
- package/types/src/tabStrip/SheetTab.d.ts +1 -1
- package/types/src/table/TableCommands.d.ts +2 -2
- package/types/src/taskPane/TaskPaneArea.d.ts +7 -0
- package/types/src/theme/buildOOXMLThemeCSS.d.ts +2 -2
- package/types/src/theme/useGridColorScheme.d.ts +1 -1
- package/types/src/theme/useSystemColors.d.ts +2 -2
- package/types/src/workbook/DefaultRenderers.d.ts +3 -2
- package/types/src/workbook/IWorkbookElement.d.ts +27 -5
- package/browser/esm/BHjeSMaycUkS5dVL.mjs +0 -66
- package/browser/esm/CYMRbtPIr6SklGpp.mjs +0 -775
- package/browser/esm/CiRN-woJZWYOgTn4.mjs +0 -36
- package/browser/esm/J8cPagZBeXz86Lnd.mjs +0 -777
- package/node/esm/BpwE3HqTnrLLzE3C.mjs +0 -775
- package/node/esm/CV3bT3Hql74GcHoU.mjs +0 -37
- package/types/src/chart/templates/area-stacked-percent-template.json.d.ts +0 -10
- package/types/src/chart/templates/area-stacked-template.json.d.ts +0 -10
- package/types/src/chart/templates/area-template.json.d.ts +0 -9
- package/types/src/chart/templates/bar-stacked-percent-template.json.d.ts +0 -10
- package/types/src/chart/templates/bar-stacked-template.json.d.ts +0 -10
- package/types/src/chart/templates/bar-template.json.d.ts +0 -9
- package/types/src/chart/templates/column-stacked-percent-template.json.d.ts +0 -10
- package/types/src/chart/templates/column-stacked-template.json.d.ts +0 -10
- package/types/src/chart/templates/column-template.json.d.ts +0 -9
- package/types/src/chart/templates/line-markers-template.json.d.ts +0 -10
- package/types/src/chart/templates/line-stacked-markers-template.json.d.ts +0 -11
- package/types/src/chart/templates/line-stacked-percent-markers-template.json.d.ts +0 -11
- package/types/src/chart/templates/line-stacked-percent-template.json.d.ts +0 -10
- package/types/src/chart/templates/line-stacked-template.json.d.ts +0 -10
- package/types/src/chart/templates/line-template.json.d.ts +0 -9
- package/types/src/chart/templates/pie-doughnut-template.json.d.ts +0 -10
- package/types/src/chart/templates/pie-template.json.d.ts +0 -9
- package/types/src/chart/templates/scatter-lines-markers-smooth-template.json.d.ts +0 -10
- package/types/src/chart/templates/scatter-lines-markers-template.json.d.ts +0 -10
- package/types/src/chart/templates/scatter-lines-smooth-template.json.d.ts +0 -10
- package/types/src/chart/templates/scatter-lines-template.json.d.ts +0 -10
- package/types/src/chart/templates/scatter-markers-template.json.d.ts +0 -10
- package/types/src/context/SheetContext.d.ts +0 -18
- package/types/src/sheet/SheetElement.d.ts +0 -15
package/node/esm/shape.mjs
CHANGED
|
@@ -1,125 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.11
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { t as e } from "./
|
|
8
|
-
import { n as t } from "./
|
|
9
|
-
import { t as n } from "./
|
|
10
|
-
import { t as r } from "./
|
|
11
|
-
import { Color as o, IFill as s, IGeometry as i, IStroke as l,
|
|
12
|
-
import { forwardRef as h, memo as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { BufferUtils as
|
|
15
|
-
import { ReactUtils as
|
|
16
|
-
import { useSurfaceState as
|
|
17
|
-
import { createPortal as
|
|
18
|
-
var
|
|
7
|
+
import { t as e } from "./Dj5FM7_-YWhCtCCt.mjs";
|
|
8
|
+
import { n as t } from "./JiQGhLkoL8CJpVvA.mjs";
|
|
9
|
+
import { t as n } from "./DxQZmb-j4NLUO9Af.mjs";
|
|
10
|
+
import { t as r } from "./Be9c1GwQkPo8Piuh.mjs";
|
|
11
|
+
import { Color as o, IFill as s, IGeometry as i, IStroke as l, PaintUtils as a, ShapeStyleUtils as c } from "@sheetxl/sdk";
|
|
12
|
+
import { forwardRef as h, memo as u, useCallback as p, useEffect as d, useId as f, useMemo as m, useReducer as g, useRef as y, useState as x } from "react";
|
|
13
|
+
import { Fragment as v, jsx as b, jsxs as k } from "react/jsx-runtime";
|
|
14
|
+
import { BufferUtils as M, messageKey as w } from "@sheetxl/utils";
|
|
15
|
+
import { ReactUtils as T, useImperativeElement as C } from "@sheetxl/utils-react";
|
|
16
|
+
import { useSurfaceState as $ } from "@sheetxl/grid-react";
|
|
17
|
+
import { createPortal as S } from "react-dom";
|
|
18
|
+
var P = 96 / 72, j = (e, t) => {
|
|
19
19
|
if ("string" != typeof e || !e) return null;
|
|
20
20
|
try {
|
|
21
21
|
return (t ? t.parseColor(e) : new o(e))?.toCSS("adaptive") ?? null;
|
|
22
22
|
} catch {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, L = (e) => {
|
|
26
26
|
if (!e) return null;
|
|
27
27
|
switch (e.type) {
|
|
28
|
-
case s.Type.
|
|
29
|
-
case s.Type.Solid: return C(e.color, t);
|
|
28
|
+
case s.Type.Solid: return e.color ?? null;
|
|
30
29
|
case s.Type.Gradient: {
|
|
31
|
-
const
|
|
32
|
-
return
|
|
30
|
+
const t = e.stops?.[0];
|
|
31
|
+
return ("string" == typeof t ? t : t?.color) ?? null;
|
|
33
32
|
}
|
|
34
|
-
case s.Type.Pattern: return
|
|
33
|
+
case s.Type.Pattern: return e.foreground ?? e.background ?? null;
|
|
35
34
|
case s.Type.Image:
|
|
36
35
|
default: return null;
|
|
37
36
|
}
|
|
38
|
-
},
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[l.DashStyle.LongDashDot]: [
|
|
50
|
-
8,
|
|
51
|
-
3,
|
|
52
|
-
1,
|
|
53
|
-
3
|
|
54
|
-
],
|
|
55
|
-
[l.DashStyle.LongDashDotDot]: [
|
|
56
|
-
8,
|
|
57
|
-
3,
|
|
58
|
-
1,
|
|
59
|
-
3,
|
|
60
|
-
1,
|
|
61
|
-
3
|
|
62
|
-
],
|
|
63
|
-
[l.DashStyle.SysDot]: [1, 1],
|
|
64
|
-
[l.DashStyle.SysDash]: [3, 1],
|
|
65
|
-
[l.DashStyle.SysDashDot]: [
|
|
66
|
-
3,
|
|
67
|
-
1,
|
|
68
|
-
1,
|
|
69
|
-
1
|
|
70
|
-
],
|
|
71
|
-
[l.DashStyle.SysDashDotDot]: [
|
|
72
|
-
3,
|
|
73
|
-
1,
|
|
74
|
-
1,
|
|
75
|
-
1,
|
|
76
|
-
1,
|
|
77
|
-
1
|
|
78
|
-
]
|
|
79
|
-
}, L = (e) => {
|
|
80
|
-
if (Array.isArray(e)) {
|
|
81
|
-
const t = e.map((e) => Math.max(0, e) / 100);
|
|
82
|
-
return t.length > 0 && t.some((e) => e > 0) ? t : null;
|
|
83
|
-
}
|
|
84
|
-
return (e && j[e]) ?? null;
|
|
85
|
-
}, N = (e) => Math.max(0, Math.min(1, e ?? 0)), E = (e, t) => {
|
|
86
|
-
const n = e.stops ?? [];
|
|
87
|
-
if (n.length < 2) return null;
|
|
88
|
-
const r = n.length - 1, o = [];
|
|
89
|
-
for (let e = 0; e < n.length; e++) {
|
|
90
|
-
const s = n[e], i = C("string" == typeof s ? s : s?.color, t);
|
|
91
|
-
if (!i) return null;
|
|
92
|
-
const l = "object" == typeof s && "number" == typeof s.offset ? s.offset : e / r;
|
|
93
|
-
o.push({
|
|
94
|
-
offset: N(l),
|
|
95
|
-
color: i
|
|
37
|
+
}, N = (e) => Math.max(0, Math.min(1, e ?? 0)), E = (e) => {
|
|
38
|
+
const t = e.stops ?? [];
|
|
39
|
+
if (t.length < 2) return null;
|
|
40
|
+
const n = t.length - 1, r = [];
|
|
41
|
+
for (let e = 0; e < t.length; e++) {
|
|
42
|
+
const o = t[e], s = "string" == typeof o ? o : o?.color;
|
|
43
|
+
if (!s) return null;
|
|
44
|
+
const i = "object" == typeof o && "number" == typeof o.offset ? o.offset : e / n;
|
|
45
|
+
r.push({
|
|
46
|
+
offset: N(i),
|
|
47
|
+
color: s
|
|
96
48
|
});
|
|
97
49
|
}
|
|
98
|
-
if (
|
|
50
|
+
if (r.sort((e, t) => e.offset - t.offset), (e.gradientType ?? s.GradientType.Linear) === s.GradientType.Linear) return {
|
|
99
51
|
kind: "linear",
|
|
100
52
|
angle: (((e.angle ?? 0) - 90) % 360 + 360) % 360,
|
|
101
53
|
scaled: e.scaled ?? !0,
|
|
102
|
-
stops:
|
|
54
|
+
stops: r
|
|
103
55
|
};
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
56
|
+
const o = e.focus, i = N(o?.left), l = N(o?.top), a = N(o?.right), c = N(o?.bottom);
|
|
57
|
+
if (i > a || l > c) return null;
|
|
58
|
+
const h = (i + a) / 2, u = (l + c) / 2, p = Math.max(h, 1 - h), d = Math.max(u, 1 - u);
|
|
107
59
|
return {
|
|
108
60
|
kind: "radial",
|
|
109
|
-
cx:
|
|
110
|
-
cy:
|
|
111
|
-
r: Math.hypot(
|
|
112
|
-
stops:
|
|
61
|
+
cx: h,
|
|
62
|
+
cy: u,
|
|
63
|
+
r: Math.hypot(p, d),
|
|
64
|
+
stops: r
|
|
113
65
|
};
|
|
114
|
-
},
|
|
66
|
+
}, z = c.inheritedGroupFill, A = /[MLQCAZ]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g, I = {
|
|
115
67
|
M: 1,
|
|
116
68
|
L: 1,
|
|
117
69
|
Q: 2,
|
|
118
70
|
C: 3,
|
|
119
71
|
A: 1,
|
|
120
72
|
Z: 0
|
|
121
|
-
},
|
|
122
|
-
const t = e.match(
|
|
73
|
+
}, F = (e) => String(Math.round(1e5 * e) / 1e5), G = (e) => {
|
|
74
|
+
const t = e.match(A) ?? [], n = [], r = [], o = [];
|
|
123
75
|
let s = {
|
|
124
76
|
x: 0,
|
|
125
77
|
y: 0
|
|
@@ -139,22 +91,22 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
139
91
|
}), s = i, i = null);
|
|
140
92
|
continue;
|
|
141
93
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
for (let e = 0; e < I[a]; e++)
|
|
94
|
+
const c = "A" === a ? t.slice(l, l + 5) : void 0;
|
|
95
|
+
c && (l += 5);
|
|
96
|
+
const h = [];
|
|
97
|
+
for (let e = 0; e < I[a]; e++) h.push({
|
|
146
98
|
x: Number(t[l++]),
|
|
147
99
|
y: Number(t[l++])
|
|
148
100
|
});
|
|
149
|
-
const u =
|
|
101
|
+
const u = h[h.length - 1];
|
|
150
102
|
if (!u || Number.isNaN(u.x) || Number.isNaN(u.y)) break;
|
|
151
103
|
"M" === a ? (i && o.push(s), i = u, o.push(u)) : ("L" === a && r.push({
|
|
152
104
|
from: s,
|
|
153
105
|
to: u
|
|
154
106
|
}), i || (i = s, o.push(s))), n.push({
|
|
155
107
|
c: a,
|
|
156
|
-
pts:
|
|
157
|
-
arc:
|
|
108
|
+
pts: h,
|
|
109
|
+
arc: c
|
|
158
110
|
}), s = u;
|
|
159
111
|
}
|
|
160
112
|
return i && o.push(s), {
|
|
@@ -162,30 +114,30 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
162
114
|
straight: r,
|
|
163
115
|
ends: o
|
|
164
116
|
};
|
|
165
|
-
},
|
|
117
|
+
}, D = (e) => {
|
|
166
118
|
const t = [];
|
|
167
119
|
for (const n of e) {
|
|
168
|
-
const e = n.pts.map((e) => `${
|
|
120
|
+
const e = n.pts.map((e) => `${F(e.x)} ${F(e.y)}`).join(" ");
|
|
169
121
|
t.push("Z" === n.c ? "Z" : `${n.c}${n.arc ? `${n.arc.join(" ")} ` : ""}${e}`);
|
|
170
122
|
}
|
|
171
123
|
return t.join(" ");
|
|
172
|
-
},
|
|
173
|
-
const s = r ? (o - e) * t.zoom : e * t.zoom, i =
|
|
124
|
+
}, R = 1e-6, H = (e, t, n, r, o) => {
|
|
125
|
+
const s = r ? (o - e) * t.zoom : e * t.zoom, i = T.snapLineCenter(s, n, t.dpr);
|
|
174
126
|
return r ? o - i / t.zoom : i / t.zoom;
|
|
175
|
-
},
|
|
176
|
-
const r =
|
|
127
|
+
}, W = (e, t, n) => {
|
|
128
|
+
const r = G(e), o = r.ends.map((e) => ({
|
|
177
129
|
x: e.x,
|
|
178
130
|
y: e.y
|
|
179
131
|
})), s = n * t.zoom, i = [];
|
|
180
132
|
for (const e of r.straight) {
|
|
181
|
-
const t = Math.abs(e.to.y - e.from.y) <
|
|
182
|
-
t !== Math.abs(e.to.x - e.from.x) <
|
|
133
|
+
const t = Math.abs(e.to.y - e.from.y) < R;
|
|
134
|
+
t !== Math.abs(e.to.x - e.from.x) < R && i.push({
|
|
183
135
|
seg: e,
|
|
184
136
|
level: t,
|
|
185
137
|
at: t ? e.from.y : e.from.x
|
|
186
138
|
});
|
|
187
139
|
}
|
|
188
|
-
for (const { seg: e, level: n, at: r } of i) n ? e.from.y = e.to.y =
|
|
140
|
+
for (const { seg: e, level: n, at: r } of i) n ? e.from.y = e.to.y = H(r, t, s, t.flipV, t.height) : e.from.x = e.to.x = H(r, t, s, t.flipH, t.width);
|
|
189
141
|
const l = [];
|
|
190
142
|
return r.ends.forEach((e, t) => {
|
|
191
143
|
const n = {
|
|
@@ -197,12 +149,12 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
197
149
|
by: n
|
|
198
150
|
});
|
|
199
151
|
}), {
|
|
200
|
-
d:
|
|
152
|
+
d: D(r.cmds),
|
|
201
153
|
ends: l
|
|
202
154
|
};
|
|
203
|
-
},
|
|
155
|
+
}, B = (e, t) => {
|
|
204
156
|
if (0 === t.length) return e;
|
|
205
|
-
const n =
|
|
157
|
+
const n = G(e);
|
|
206
158
|
let r = [], o = null;
|
|
207
159
|
const s = /* @__PURE__ */ new Set(), i = () => {
|
|
208
160
|
if (!o) return;
|
|
@@ -218,20 +170,20 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
218
170
|
"M" === e.c && (i(), o = e.pts[0]);
|
|
219
171
|
for (const t of e.pts) r.push(t);
|
|
220
172
|
}
|
|
221
|
-
return i(),
|
|
222
|
-
},
|
|
223
|
-
const [t, n] =
|
|
224
|
-
return
|
|
173
|
+
return i(), D(n.cmds);
|
|
174
|
+
}, O = /* @__PURE__ */ new WeakMap(), U = (e) => {
|
|
175
|
+
const [t, n] = x(null);
|
|
176
|
+
return d(() => {
|
|
225
177
|
if (!e) return;
|
|
226
178
|
let t = !0;
|
|
227
179
|
return ((e) => {
|
|
228
|
-
let t =
|
|
180
|
+
let t = O.get(e);
|
|
229
181
|
return t || (t = (async () => {
|
|
230
182
|
const t = await e.getExternalURI();
|
|
231
183
|
if (t) return t;
|
|
232
184
|
const [n, r] = await Promise.all([e.toBuffer(), e.getType()]);
|
|
233
|
-
return `data:${r?.mime ?? "image/png"};base64,${
|
|
234
|
-
})(),
|
|
185
|
+
return `data:${r?.mime ?? "image/png"};base64,${M.arrayBufferToBase64(n)}`;
|
|
186
|
+
})(), O.set(e, t)), t;
|
|
235
187
|
})(e).then((r) => {
|
|
236
188
|
t && n({
|
|
237
189
|
resource: e,
|
|
@@ -241,8 +193,8 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
241
193
|
t = !1;
|
|
242
194
|
};
|
|
243
195
|
}, [e]), e && t?.resource === e ? t.url : null;
|
|
244
|
-
},
|
|
245
|
-
const o = t.stops.map((e, t) =>
|
|
196
|
+
}, Z = (e, t, n, r) => {
|
|
197
|
+
const o = t.stops.map((e, t) => b("stop", {
|
|
246
198
|
offset: e.offset,
|
|
247
199
|
stopColor: e.color
|
|
248
200
|
}, t));
|
|
@@ -254,18 +206,18 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
254
206
|
const e = Math.hypot(i, l) || 1;
|
|
255
207
|
i /= e, l /= e;
|
|
256
208
|
}
|
|
257
|
-
const a = (Math.abs(n * i) + Math.abs(r * l)) / 2,
|
|
258
|
-
return
|
|
209
|
+
const a = (Math.abs(n * i) + Math.abs(r * l)) / 2, c = n / 2, h = r / 2;
|
|
210
|
+
return b("linearGradient", {
|
|
259
211
|
id: e,
|
|
260
212
|
gradientUnits: "userSpaceOnUse",
|
|
261
|
-
x1:
|
|
262
|
-
y1:
|
|
263
|
-
x2:
|
|
264
|
-
y2:
|
|
213
|
+
x1: c - a * i,
|
|
214
|
+
y1: h - a * l,
|
|
215
|
+
x2: c + a * i,
|
|
216
|
+
y2: h + a * l,
|
|
265
217
|
children: o
|
|
266
218
|
}, e);
|
|
267
219
|
}
|
|
268
|
-
return
|
|
220
|
+
return b("radialGradient", {
|
|
269
221
|
id: e,
|
|
270
222
|
gradientUnits: "userSpaceOnUse",
|
|
271
223
|
cx: t.cx * n,
|
|
@@ -274,18 +226,18 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
274
226
|
gradientTransform: `scale(1 ${r / n})`,
|
|
275
227
|
children: o
|
|
276
228
|
}, e);
|
|
277
|
-
},
|
|
278
|
-
const a =
|
|
229
|
+
}, J = u(({ paths: e, style: t, width: n, height: r, zoom: o, grid: s, hit: l }) => {
|
|
230
|
+
const a = f().replace(/[^A-Za-z0-9_-]/g, ""), c = U(t.image?.resource ?? null), h = ((e, t, n = 1) => {
|
|
279
231
|
const r = (t > 0 ? t : 1) * (n > 0 ? n : 1);
|
|
280
232
|
return Math.max(1, Math.round(Math.max(0, e || 0) * r)) / r;
|
|
281
|
-
})(t.strokeWidth, o, s?.dpr ??
|
|
233
|
+
})(t.strokeWidth, o, s?.dpr ?? T.getDevicePixelRatio()), u = n > 0 && r > 0, p = u ? t.gradient ?? null : null, d = u ? t.strokeGradient ?? null : null, g = t.image ? c ? `url(#${a}-image)` : null : p ? `url(#${a}-fill)` : t.fill, y = d ? `url(#${a}-stroke)` : t.stroke, x = null !== t.stroke && h > 0, M = x ? ((e, t, n) => {
|
|
282
234
|
if (!(e && t > 0)) return;
|
|
283
235
|
const r = "butt" !== n, o = e.map((e, n) => {
|
|
284
236
|
const o = e * t;
|
|
285
237
|
return r ? n % 2 == 0 ? Math.max(0, o - t) : o + t : o;
|
|
286
238
|
});
|
|
287
239
|
return o.length % 2 == 1 && o.push(r ? t : 0), o.map((e) => +e.toFixed(3)).join(" ");
|
|
288
|
-
})(t.dash,
|
|
240
|
+
})(t.dash, h, t.lineCap) : void 0, w = m(() => ((e, t, n) => {
|
|
289
241
|
const r = /* @__PURE__ */ new Map();
|
|
290
242
|
if (!t) return r;
|
|
291
243
|
const o = /* @__PURE__ */ new Map(), s = [];
|
|
@@ -293,7 +245,7 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
293
245
|
if (l.layer !== i.PathLayer.Stroke) continue;
|
|
294
246
|
let e = o.get(l.d);
|
|
295
247
|
if (void 0 === e) {
|
|
296
|
-
const r =
|
|
248
|
+
const r = W(l.d, t, n);
|
|
297
249
|
e = r.d, o.set(l.d, e), s.push(...r.ends);
|
|
298
250
|
}
|
|
299
251
|
r.set(l.index, e);
|
|
@@ -301,31 +253,31 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
301
253
|
for (const t of e) if (t.layer === i.PathLayer.Fill) {
|
|
302
254
|
const e = o.get(t.d);
|
|
303
255
|
void 0 !== e && r.set(t.index, e);
|
|
304
|
-
} else t.layer === i.PathLayer.Marker && r.set(t.index,
|
|
256
|
+
} else t.layer === i.PathLayer.Marker && r.set(t.index, B(t.d, s));
|
|
305
257
|
return r;
|
|
306
|
-
})(e,
|
|
258
|
+
})(e, x ? s : null, h), [
|
|
307
259
|
e,
|
|
308
|
-
|
|
260
|
+
x,
|
|
309
261
|
s,
|
|
310
|
-
|
|
311
|
-
]),
|
|
262
|
+
h
|
|
263
|
+
]), C = /* @__PURE__ */ new Set(), $ = [];
|
|
312
264
|
for (const n of e) {
|
|
313
265
|
const e = `p${n.index}`, r = w.get(n.index) ?? n.d;
|
|
314
266
|
switch (n.layer) {
|
|
315
267
|
case i.PathLayer.Fill:
|
|
316
|
-
if (null ===
|
|
317
|
-
"norm" !== n.fill &&
|
|
268
|
+
if (null === g) break;
|
|
269
|
+
"norm" !== n.fill && C.add(n.fill), $.push(b("path", {
|
|
318
270
|
d: r,
|
|
319
|
-
fill:
|
|
271
|
+
fill: g,
|
|
320
272
|
filter: "norm" !== n.fill ? `url(#${a}-${n.fill})` : void 0,
|
|
321
273
|
stroke: "none",
|
|
322
274
|
pointerEvents: l
|
|
323
275
|
}, e));
|
|
324
276
|
break;
|
|
325
277
|
case i.PathLayer.Stroke: {
|
|
326
|
-
if (!
|
|
278
|
+
if (!x) break;
|
|
327
279
|
const n = 8 / (o > 0 ? o : 1);
|
|
328
|
-
"none" !== l && n >
|
|
280
|
+
"none" !== l && n > h && $.push(b("path", {
|
|
329
281
|
className: "shape-hit",
|
|
330
282
|
d: r,
|
|
331
283
|
fill: "none",
|
|
@@ -334,11 +286,11 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
334
286
|
strokeLinejoin: "round",
|
|
335
287
|
strokeLinecap: "round",
|
|
336
288
|
pointerEvents: "stroke"
|
|
337
|
-
}, `${e}-hit`)),
|
|
289
|
+
}, `${e}-hit`)), $.push(b("path", {
|
|
338
290
|
d: r,
|
|
339
291
|
fill: "none",
|
|
340
|
-
stroke:
|
|
341
|
-
strokeWidth:
|
|
292
|
+
stroke: y,
|
|
293
|
+
strokeWidth: h,
|
|
342
294
|
strokeLinejoin: t.lineJoin,
|
|
343
295
|
strokeLinecap: t.lineCap,
|
|
344
296
|
strokeMiterlimit: "miter" === t.lineJoin ? t.miterLimit : void 0,
|
|
@@ -347,32 +299,32 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
347
299
|
}, e));
|
|
348
300
|
break;
|
|
349
301
|
}
|
|
350
|
-
case i.PathLayer.Marker:
|
|
302
|
+
case i.PathLayer.Marker: x && $.push(b("path", {
|
|
351
303
|
d: r,
|
|
352
|
-
fill:
|
|
304
|
+
fill: y,
|
|
353
305
|
stroke: "none",
|
|
354
306
|
pointerEvents: l
|
|
355
307
|
}, e));
|
|
356
308
|
}
|
|
357
309
|
}
|
|
358
|
-
const
|
|
359
|
-
for (const e of
|
|
310
|
+
const S = [];
|
|
311
|
+
for (const e of C) {
|
|
360
312
|
const [t, n] = i.FillTransfer[e];
|
|
361
|
-
|
|
313
|
+
S.push(b("filter", {
|
|
362
314
|
id: `${a}-${e}`,
|
|
363
315
|
colorInterpolationFilters: "sRGB",
|
|
364
|
-
children:
|
|
365
|
-
|
|
316
|
+
children: k("feComponentTransfer", { children: [
|
|
317
|
+
b("feFuncR", {
|
|
366
318
|
type: "linear",
|
|
367
319
|
slope: t,
|
|
368
320
|
intercept: n
|
|
369
321
|
}),
|
|
370
|
-
|
|
322
|
+
b("feFuncG", {
|
|
371
323
|
type: "linear",
|
|
372
324
|
slope: t,
|
|
373
325
|
intercept: n
|
|
374
326
|
}),
|
|
375
|
-
|
|
327
|
+
b("feFuncB", {
|
|
376
328
|
type: "linear",
|
|
377
329
|
slope: t,
|
|
378
330
|
intercept: n
|
|
@@ -380,17 +332,17 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
380
332
|
] })
|
|
381
333
|
}, e));
|
|
382
334
|
}
|
|
383
|
-
if (p && !t.image &&
|
|
335
|
+
if (p && !t.image && S.push(Z(`${a}-fill`, p, n, r)), d && x && S.push(Z(`${a}-stroke`, d, n, r)), t.image && c) {
|
|
384
336
|
const e = t.image.fill.stretch ?? {}, o = n * (e.left ?? 0) / 100, s = r * (e.top ?? 0) / 100, i = Math.max(0, n - o - n * (e.right ?? 0) / 100), l = Math.max(0, r - s - r * (e.bottom ?? 0) / 100);
|
|
385
|
-
|
|
337
|
+
S.push(b("pattern", {
|
|
386
338
|
id: `${a}-image`,
|
|
387
339
|
patternUnits: "userSpaceOnUse",
|
|
388
340
|
x: 0,
|
|
389
341
|
y: 0,
|
|
390
342
|
width: Math.max(n, 1),
|
|
391
343
|
height: Math.max(r, 1),
|
|
392
|
-
children:
|
|
393
|
-
href:
|
|
344
|
+
children: b("image", {
|
|
345
|
+
href: c,
|
|
394
346
|
x: o,
|
|
395
347
|
y: s,
|
|
396
348
|
width: i,
|
|
@@ -399,15 +351,15 @@ var $ = 96 / 72, C = (e, t) => {
|
|
|
399
351
|
})
|
|
400
352
|
}, "image"));
|
|
401
353
|
}
|
|
402
|
-
return
|
|
354
|
+
return k(v, { children: [S.length > 0 ? b("defs", { children: S }) : null, $] });
|
|
403
355
|
});
|
|
404
|
-
|
|
405
|
-
var
|
|
406
|
-
const s =
|
|
356
|
+
J.displayName = "PathRun";
|
|
357
|
+
var Q = u(({ geometry: e, style: t, zoom: n, grid: r = null, hit: o }) => {
|
|
358
|
+
const s = m(() => {
|
|
407
359
|
const t = [];
|
|
408
360
|
return e.forEachPath((e) => t.push(e)), t;
|
|
409
361
|
}, [e]);
|
|
410
|
-
return
|
|
362
|
+
return b(J, {
|
|
411
363
|
paths: s,
|
|
412
364
|
style: t,
|
|
413
365
|
width: e.getWidth(),
|
|
@@ -417,9 +369,9 @@ var V = c(({ geometry: e, style: t, zoom: n, grid: r = null, hit: o }) => {
|
|
|
417
369
|
hit: o
|
|
418
370
|
});
|
|
419
371
|
});
|
|
420
|
-
|
|
421
|
-
var
|
|
422
|
-
const s = y(null), i = y(null), [l, a] =
|
|
372
|
+
Q.displayName = "ShapePaths";
|
|
373
|
+
var V = u(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
374
|
+
const s = y(null), i = y(null), [l, a] = x(!1), c = p((e) => {
|
|
423
375
|
const t = s.current, n = t?.getScreenCTM();
|
|
424
376
|
if (!t || !n) return null;
|
|
425
377
|
const r = new DOMPoint(e.clientX, e.clientY).matrixTransform(n.inverse());
|
|
@@ -427,30 +379,30 @@ var X = c(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
|
427
379
|
x: r.x,
|
|
428
380
|
y: r.y
|
|
429
381
|
};
|
|
430
|
-
}, []),
|
|
382
|
+
}, []), h = p((e, t) => {
|
|
431
383
|
0 === e.button && (e.stopPropagation(), e.preventDefault(), i.current = {
|
|
432
384
|
index: t,
|
|
433
385
|
pointerId: e.pointerId
|
|
434
386
|
}, e.currentTarget.setPointerCapture(e.pointerId), a(!0));
|
|
435
|
-
}, []),
|
|
387
|
+
}, []), u = p((e) => {
|
|
436
388
|
const t = i.current;
|
|
437
389
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
438
390
|
e.stopPropagation();
|
|
439
|
-
const n =
|
|
391
|
+
const n = c(e);
|
|
440
392
|
n && o(t.index, n.x, n.y, "move");
|
|
441
|
-
}, [
|
|
393
|
+
}, [c, o]), d = p((e) => {
|
|
442
394
|
const t = i.current;
|
|
443
395
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
444
396
|
e.stopPropagation(), i.current = null, a(!1);
|
|
445
|
-
const n =
|
|
397
|
+
const n = c(e);
|
|
446
398
|
n ? o(t.index, n.x, n.y, "end") : o(t.index, 0, 0, "cancel");
|
|
447
|
-
}, [
|
|
399
|
+
}, [c, o]), f = p((e) => {
|
|
448
400
|
const t = i.current;
|
|
449
401
|
t && t.pointerId === e.pointerId && (i.current = null, a(!1), o(t.index, 0, 0, "cancel"));
|
|
450
402
|
}, [o]);
|
|
451
403
|
if (!(0 !== e.length && t > 0 && n > 0)) return null;
|
|
452
|
-
const m = r > 0 ? r : 1,
|
|
453
|
-
return
|
|
404
|
+
const m = r > 0 ? r : 1, g = 4.5 / m;
|
|
405
|
+
return b("svg", {
|
|
454
406
|
ref: s,
|
|
455
407
|
className: l ? "shape-handles movable-gesture" : "shape-handles",
|
|
456
408
|
viewBox: `0 0 ${t} ${n}`,
|
|
@@ -466,30 +418,30 @@ var X = c(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
|
466
418
|
pointerEvents: "none",
|
|
467
419
|
touchAction: "none"
|
|
468
420
|
},
|
|
469
|
-
children: e.map((e) =>
|
|
421
|
+
children: e.map((e) => k("g", {
|
|
470
422
|
className: "shape-handle",
|
|
471
423
|
style: { "--shape-scale": m },
|
|
472
|
-
children: [
|
|
424
|
+
children: [b("circle", {
|
|
473
425
|
cx: e.x,
|
|
474
426
|
cy: e.y,
|
|
475
|
-
r:
|
|
427
|
+
r: g,
|
|
476
428
|
fill: "#ffc000",
|
|
477
429
|
stroke: "#7f6000",
|
|
478
430
|
strokeWidth: 1 / m,
|
|
479
431
|
style: { pointerEvents: "none" }
|
|
480
|
-
}),
|
|
432
|
+
}), b("circle", {
|
|
481
433
|
className: "shape-handle-hit",
|
|
482
434
|
cx: e.x,
|
|
483
435
|
cy: e.y,
|
|
484
|
-
r:
|
|
436
|
+
r: g,
|
|
485
437
|
fill: "transparent",
|
|
486
438
|
style: {
|
|
487
439
|
pointerEvents: "all",
|
|
488
440
|
cursor: "crosshair",
|
|
489
441
|
touchAction: "none"
|
|
490
442
|
},
|
|
491
|
-
onPointerDown: (t) =>
|
|
492
|
-
onPointerMove:
|
|
443
|
+
onPointerDown: (t) => h(t, e.index),
|
|
444
|
+
onPointerMove: u,
|
|
493
445
|
onPointerUp: d,
|
|
494
446
|
onPointerCancel: f,
|
|
495
447
|
onMouseDown: (e) => e.stopPropagation()
|
|
@@ -497,181 +449,181 @@ var X = c(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
|
497
449
|
}, e.index))
|
|
498
450
|
});
|
|
499
451
|
});
|
|
500
|
-
|
|
501
|
-
var
|
|
452
|
+
V.displayName = "ShapeHandles";
|
|
453
|
+
var X = (e, t) => e > 0 || t > 0, Y = (e, t, n) => !e || e.getWidth() === t && e.getHeight() === n ? e : X(t, n) ? e.resize(t, n) : null, _ = (e) => {
|
|
502
454
|
const t = [];
|
|
503
455
|
return e.forEachConnection((e) => t.push(e)), t;
|
|
504
|
-
},
|
|
505
|
-
const { children:
|
|
506
|
-
e(
|
|
507
|
-
onBoundsChange:
|
|
508
|
-
onSelectionChange:
|
|
456
|
+
}, q = u(h((o, i) => {
|
|
457
|
+
const { children: h, disabled: u, style: f, shape: v, movable: M, zoom: N = 1, isDragging: A, onHide: I, onShow: F, onDragZone: G, adornmentHost: D, flip: R, gesture: H, debugGeometry: W = !1, ...B } = o, O = t()?.getStyles() ?? null, [U, Z] = g((e) => e + 1, 0);
|
|
458
|
+
e(v, { onAnyChange: Z }), e(M ?? null, {
|
|
459
|
+
onBoundsChange: Z,
|
|
460
|
+
onSelectionChange: Z
|
|
509
461
|
});
|
|
510
|
-
const
|
|
511
|
-
const [t] =
|
|
462
|
+
const J = v.toJSON(), { width: q, height: K, rotation: ee, content: te } = ((e) => {
|
|
463
|
+
const [t] = $("movable-drag", null), n = e ? t?.[e.getId()] : void 0, r = n?.bounds ?? e?.getBounds();
|
|
512
464
|
return {
|
|
513
465
|
width: r?.width ?? 0,
|
|
514
466
|
height: r?.height ?? 0,
|
|
515
467
|
rotation: n?.rotation ?? (e?.getRotation() || 0),
|
|
516
468
|
content: n?.content ?? null
|
|
517
469
|
};
|
|
518
|
-
})(
|
|
519
|
-
|
|
520
|
-
if (!
|
|
521
|
-
const e = ++
|
|
522
|
-
|
|
523
|
-
|
|
470
|
+
})(M), ne = v.getShapeType(), re = v.getAdjustments(), oe = X(q, K), [se, ie] = x(null), le = y(0);
|
|
471
|
+
d(() => {
|
|
472
|
+
if (!oe) return void ie(null);
|
|
473
|
+
const e = ++le.current, t = v.getShapeType();
|
|
474
|
+
v.getGeometry(q, K).then((n) => {
|
|
475
|
+
le.current === e && ie(n ? {
|
|
524
476
|
shapeType: t,
|
|
525
477
|
geometry: n
|
|
526
478
|
} : null);
|
|
527
479
|
}, () => {
|
|
528
|
-
|
|
480
|
+
le.current === e && ie(null);
|
|
529
481
|
});
|
|
530
482
|
}, [
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
483
|
+
v,
|
|
484
|
+
q,
|
|
485
|
+
K,
|
|
486
|
+
U
|
|
535
487
|
]);
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
if (!
|
|
488
|
+
const ae = void 0 !== te?.shapeType && te.shapeType !== ne ? te.shapeType : null, [ce, he] = x(null);
|
|
489
|
+
d(() => {
|
|
490
|
+
if (!ae || !oe || ce?.shapeType === ae) return;
|
|
539
491
|
let e = !0;
|
|
540
|
-
return
|
|
492
|
+
return v.getGeometry(q, K, { shapeType: ae }).then((t) => {
|
|
541
493
|
e && t && he({
|
|
542
|
-
shapeType:
|
|
494
|
+
shapeType: ae,
|
|
543
495
|
geometry: t
|
|
544
496
|
});
|
|
545
497
|
}, () => {}), () => {
|
|
546
498
|
e = !1;
|
|
547
499
|
};
|
|
548
500
|
}, [
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
501
|
+
v,
|
|
502
|
+
ae,
|
|
503
|
+
oe
|
|
552
504
|
]);
|
|
553
|
-
const
|
|
554
|
-
const e =
|
|
555
|
-
return e ?
|
|
505
|
+
const ue = m(() => {
|
|
506
|
+
const e = se?.shapeType === ne ? se : ce?.shapeType === ne ? ce : null;
|
|
507
|
+
return e ? Y(e.geometry, q, K)?.withAdjustments(re) ?? null : Y(se?.geometry ?? null, q, K);
|
|
556
508
|
}, [
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
te,
|
|
509
|
+
se,
|
|
510
|
+
ce,
|
|
560
511
|
ne,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
p(() =>
|
|
512
|
+
re,
|
|
513
|
+
q,
|
|
514
|
+
K
|
|
515
|
+
]), pe = p((e) => v.getResource(e), [v]);
|
|
516
|
+
d(() => {
|
|
565
517
|
const e = [];
|
|
566
|
-
for (let t =
|
|
518
|
+
for (let t = M?.getParent() ?? null; t; t = t.getParent()) e.push(t.getContent().addListeners({ onAnyChange: Z }));
|
|
567
519
|
return () => {
|
|
568
520
|
for (const t of e) t();
|
|
569
521
|
};
|
|
570
|
-
}, [
|
|
571
|
-
const
|
|
522
|
+
}, [M]);
|
|
523
|
+
const de = z(M), fe = m(() => ((e, t, n, r) => {
|
|
572
524
|
let o = null;
|
|
573
525
|
try {
|
|
574
526
|
o = t?.getTheme()?.toJSON() ?? null;
|
|
575
527
|
} catch {
|
|
576
528
|
o = null;
|
|
577
529
|
}
|
|
578
|
-
const i =
|
|
579
|
-
let
|
|
580
|
-
if (
|
|
581
|
-
const e = void 0 ===
|
|
582
|
-
e && (
|
|
530
|
+
const i = c.resolve(e, o, r), { stroke: h } = i, u = (e) => j(e, t), p = a.toConcreteFill(i.fill, u), d = a.toConcreteFill(h?.fill, u), f = L(d), m = d?.type === s.Type.Gradient ? E(d) ?? void 0 : void 0, g = L(p), y = p?.type === s.Type.Gradient ? E(p) ?? void 0 : void 0;
|
|
531
|
+
let x;
|
|
532
|
+
if (p?.type === s.Type.Image) {
|
|
533
|
+
const e = void 0 === p.resId ? null : n?.(p.resId) ?? null;
|
|
534
|
+
e && (x = {
|
|
583
535
|
resource: e,
|
|
584
|
-
fill:
|
|
536
|
+
fill: p
|
|
585
537
|
});
|
|
586
538
|
}
|
|
587
539
|
return {
|
|
588
|
-
fill:
|
|
589
|
-
gradient:
|
|
590
|
-
image:
|
|
591
|
-
stroke:
|
|
592
|
-
strokeGradient:
|
|
593
|
-
strokeWidth:
|
|
540
|
+
fill: g,
|
|
541
|
+
gradient: y,
|
|
542
|
+
image: x,
|
|
543
|
+
stroke: f,
|
|
544
|
+
strokeGradient: m,
|
|
545
|
+
strokeWidth: f ? Math.max(0, i.strokeWidth) * P : 0,
|
|
594
546
|
lineJoin: h?.lineJoin ?? "miter",
|
|
595
547
|
lineCap: h?.lineCap ?? "butt",
|
|
596
548
|
miterLimit: "number" == typeof h?.miterLimit ? h.miterLimit : 18.5,
|
|
597
|
-
dash:
|
|
598
|
-
textColor:
|
|
549
|
+
dash: l.toDashLengths(h?.dash),
|
|
550
|
+
textColor: j(i.fontColor, t)
|
|
599
551
|
};
|
|
600
|
-
})(
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
]), [
|
|
606
|
-
if (
|
|
607
|
-
const e =
|
|
552
|
+
})(J, O, pe, de), [
|
|
553
|
+
J,
|
|
554
|
+
O,
|
|
555
|
+
pe,
|
|
556
|
+
de
|
|
557
|
+
]), [me, ge] = x(null), ye = void 0 !== te?.adjustments ? te.adjustments : me ?? void 0, xe = m(() => {
|
|
558
|
+
if (ae && ce?.shapeType !== ae) return ue;
|
|
559
|
+
const e = ae ? Y(ce.geometry, q, K) : ue;
|
|
608
560
|
return e && void 0 !== ye ? e.withAdjustments(ye) : e;
|
|
609
561
|
}, [
|
|
610
|
-
|
|
611
|
-
le,
|
|
562
|
+
ue,
|
|
612
563
|
ae,
|
|
613
|
-
|
|
614
|
-
|
|
564
|
+
ce,
|
|
565
|
+
q,
|
|
566
|
+
K,
|
|
615
567
|
ye
|
|
616
|
-
]),
|
|
617
|
-
if ("cancel" === r) return
|
|
618
|
-
if (!
|
|
619
|
-
const o =
|
|
568
|
+
]), ve = y(null), [be, ke] = x(!1), Me = p((e, t, n, r) => {
|
|
569
|
+
if ("cancel" === r) return ve.current && (ve.current = null, ke(!1), H?.cancel()), void ge(null);
|
|
570
|
+
if (!xe || !ue) return;
|
|
571
|
+
const o = xe.adjustmentsFromHandle(e, t, n);
|
|
620
572
|
if ("move" === r) {
|
|
621
|
-
if (
|
|
622
|
-
if (!
|
|
573
|
+
if (H && !u) {
|
|
574
|
+
if (!ve.current) {
|
|
623
575
|
const e = { adjustments: o }, t = (t) => {
|
|
624
576
|
t.getContent().setAdjustments(e.adjustments);
|
|
625
577
|
};
|
|
626
|
-
if (!
|
|
627
|
-
|
|
578
|
+
if (!H.start(w("op.setShapeAdjustments"), t)) return;
|
|
579
|
+
ve.current = e, ke(!0);
|
|
628
580
|
}
|
|
629
|
-
|
|
581
|
+
ve.current.adjustments = o, H.preview({ content: { adjustments: o } });
|
|
630
582
|
return;
|
|
631
583
|
}
|
|
632
|
-
|
|
584
|
+
ge(o);
|
|
633
585
|
return;
|
|
634
586
|
}
|
|
635
|
-
const s =
|
|
636
|
-
if (s) return
|
|
637
|
-
|
|
587
|
+
const s = ve.current;
|
|
588
|
+
if (s) return ve.current = null, ke(!1), s.adjustments = o, void H?.finish();
|
|
589
|
+
ge(null), u || v.setAdjustments(o);
|
|
638
590
|
}, [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
]),
|
|
591
|
+
xe,
|
|
592
|
+
ue,
|
|
593
|
+
v,
|
|
594
|
+
u,
|
|
595
|
+
H
|
|
596
|
+
]), we = m(() => {
|
|
645
597
|
const e = [];
|
|
646
|
-
return
|
|
647
|
-
}, [
|
|
648
|
-
dpr:
|
|
649
|
-
zoom:
|
|
650
|
-
width:
|
|
651
|
-
height:
|
|
652
|
-
flipH:
|
|
653
|
-
flipV:
|
|
598
|
+
return xe?.forEachHandle((t) => e.push(t)), e;
|
|
599
|
+
}, [xe]), Te = C(i, () => ({ isShapeEditor: () => !0 }), []), Ce = R ?? M?.getFlip(), $e = Ce?.horizontal ?? !1, Se = Ce?.vertical ?? !1, Pe = ee % 360 != 0, je = m(() => !Pe && X(q, K) ? {
|
|
600
|
+
dpr: T.getDevicePixelRatio(),
|
|
601
|
+
zoom: N,
|
|
602
|
+
width: q,
|
|
603
|
+
height: K,
|
|
604
|
+
flipH: $e,
|
|
605
|
+
flipV: Se
|
|
654
606
|
} : null, [
|
|
607
|
+
Pe,
|
|
608
|
+
N,
|
|
609
|
+
q,
|
|
610
|
+
K,
|
|
655
611
|
$e,
|
|
656
|
-
|
|
657
|
-
J,
|
|
658
|
-
Q,
|
|
659
|
-
De,
|
|
660
|
-
Te
|
|
612
|
+
Se
|
|
661
613
|
]);
|
|
662
|
-
if (
|
|
663
|
-
const
|
|
664
|
-
transform:
|
|
614
|
+
if (v.isDeleted() || !J) return null;
|
|
615
|
+
const Le = "none" === f?.pointerEvents, Ne = Le ? "none" : "visiblePainted", Ee = !Le && !u && (!A || be) && !!M?.isSelected(), ze = {
|
|
616
|
+
transform: $e || Se ? `scale(${$e ? -1 : 1}, ${Se ? -1 : 1})` : void 0,
|
|
665
617
|
transformOrigin: "center"
|
|
666
618
|
};
|
|
667
|
-
let
|
|
668
|
-
|
|
669
|
-
handles:
|
|
670
|
-
width:
|
|
671
|
-
height:
|
|
672
|
-
zoom:
|
|
673
|
-
onDrag:
|
|
674
|
-
}),
|
|
619
|
+
let Ae = null;
|
|
620
|
+
Ee && we.length > 0 && (Ae = b(V, {
|
|
621
|
+
handles: we,
|
|
622
|
+
width: q,
|
|
623
|
+
height: K,
|
|
624
|
+
zoom: N,
|
|
625
|
+
onDrag: Me
|
|
626
|
+
}), D && (Ae = S(b("div", {
|
|
675
627
|
className: "shape-adornment",
|
|
676
628
|
style: {
|
|
677
629
|
position: "absolute",
|
|
@@ -679,32 +631,32 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
679
631
|
top: 0,
|
|
680
632
|
width: "100%",
|
|
681
633
|
height: "100%",
|
|
682
|
-
...
|
|
634
|
+
...ze,
|
|
683
635
|
pointerEvents: "none"
|
|
684
636
|
},
|
|
685
|
-
children:
|
|
686
|
-
}),
|
|
687
|
-
const
|
|
688
|
-
return
|
|
637
|
+
children: Ae
|
|
638
|
+
}), D)));
|
|
639
|
+
const Ie = $e !== Se ? "scaleX(-1)" : void 0, Fe = xe?.getTextRect(), Ge = J.text, De = !!Ge && Ge.paragraphs.some((e) => e.runs.some((e) => "" !== e.text));
|
|
640
|
+
return k("div", {
|
|
689
641
|
className: "shape-editor",
|
|
690
|
-
...
|
|
691
|
-
ref:
|
|
642
|
+
...B,
|
|
643
|
+
ref: Te,
|
|
692
644
|
style: {
|
|
693
645
|
width: "100%",
|
|
694
646
|
height: "100%",
|
|
695
647
|
position: "relative",
|
|
696
648
|
overflow: "visible",
|
|
697
|
-
filter:
|
|
698
|
-
...
|
|
699
|
-
...
|
|
649
|
+
filter: u ? "blur(1px)" : void 0,
|
|
650
|
+
...ze,
|
|
651
|
+
...f,
|
|
700
652
|
pointerEvents: "none"
|
|
701
653
|
},
|
|
702
654
|
children: [
|
|
703
|
-
|
|
655
|
+
X(q, K) ? k("svg", {
|
|
704
656
|
className: "shape-geometry",
|
|
705
|
-
viewBox: `0 0 ${
|
|
706
|
-
width:
|
|
707
|
-
height:
|
|
657
|
+
viewBox: `0 0 ${q > 0 ? q : 1 / N} ${K > 0 ? K : 1 / N}`,
|
|
658
|
+
width: q > 0 ? "100%" : "1px",
|
|
659
|
+
height: K > 0 ? "100%" : "1px",
|
|
708
660
|
preserveAspectRatio: "none",
|
|
709
661
|
overflow: "visible",
|
|
710
662
|
style: {
|
|
@@ -713,50 +665,50 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
713
665
|
top: 0,
|
|
714
666
|
display: "block",
|
|
715
667
|
pointerEvents: "none",
|
|
716
|
-
filter:
|
|
668
|
+
filter: Ee ? "drop-shadow(1px 1px 2px rgba(0,0,0,.15))" : void 0
|
|
717
669
|
},
|
|
718
|
-
children: [
|
|
719
|
-
geometry:
|
|
720
|
-
style:
|
|
721
|
-
zoom:
|
|
722
|
-
grid:
|
|
723
|
-
hit:
|
|
724
|
-
}) : null,
|
|
670
|
+
children: [xe ? b(Q, {
|
|
671
|
+
geometry: xe,
|
|
672
|
+
style: fe,
|
|
673
|
+
zoom: N,
|
|
674
|
+
grid: je,
|
|
675
|
+
hit: Ne
|
|
676
|
+
}) : null, W && xe && Fe ? k("g", {
|
|
725
677
|
pointerEvents: "none",
|
|
726
|
-
children: [
|
|
727
|
-
x:
|
|
728
|
-
y:
|
|
729
|
-
width: Math.max(0,
|
|
730
|
-
height: Math.max(0,
|
|
678
|
+
children: [b("rect", {
|
|
679
|
+
x: Fe.l,
|
|
680
|
+
y: Fe.t,
|
|
681
|
+
width: Math.max(0, Fe.r - Fe.l),
|
|
682
|
+
height: Math.max(0, Fe.b - Fe.t),
|
|
731
683
|
fill: "none",
|
|
732
684
|
stroke: "#c00",
|
|
733
|
-
strokeWidth: 1 /
|
|
734
|
-
strokeDasharray: `${4 /
|
|
735
|
-
}),
|
|
736
|
-
x: e.x - 3 /
|
|
737
|
-
y: e.y - 3 /
|
|
738
|
-
width: 6 /
|
|
739
|
-
height: 6 /
|
|
685
|
+
strokeWidth: 1 / N,
|
|
686
|
+
strokeDasharray: `${4 / N} ${2 / N}`
|
|
687
|
+
}), _(xe).map((e) => b("rect", {
|
|
688
|
+
x: e.x - 3 / N,
|
|
689
|
+
y: e.y - 3 / N,
|
|
690
|
+
width: 6 / N,
|
|
691
|
+
height: 6 / N,
|
|
740
692
|
fill: "#0a0"
|
|
741
693
|
}, e.index))]
|
|
742
694
|
}) : null]
|
|
743
695
|
}) : null,
|
|
744
|
-
|
|
696
|
+
De && Fe ? b("div", {
|
|
745
697
|
className: "shape-text-frame",
|
|
746
698
|
style: {
|
|
747
699
|
position: "absolute",
|
|
748
|
-
left:
|
|
749
|
-
top:
|
|
750
|
-
width: Math.max(0,
|
|
751
|
-
height: Math.max(0,
|
|
752
|
-
zoom:
|
|
753
|
-
transform:
|
|
700
|
+
left: Fe.l,
|
|
701
|
+
top: Fe.t,
|
|
702
|
+
width: Math.max(0, Fe.r - Fe.l),
|
|
703
|
+
height: Math.max(0, Fe.b - Fe.t),
|
|
704
|
+
zoom: N,
|
|
705
|
+
transform: Ie,
|
|
754
706
|
transformOrigin: "center",
|
|
755
|
-
pointerEvents:
|
|
756
|
-
color:
|
|
707
|
+
pointerEvents: Le ? "none" : "auto",
|
|
708
|
+
color: fe.textColor ?? void 0
|
|
757
709
|
},
|
|
758
|
-
children:
|
|
759
|
-
movable:
|
|
710
|
+
children: b(n, {
|
|
711
|
+
movable: M,
|
|
760
712
|
disabled: !0,
|
|
761
713
|
style: {
|
|
762
714
|
fontFamily: "Calibri, Carlito, sans-serif",
|
|
@@ -768,16 +720,16 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
768
720
|
padding: 0,
|
|
769
721
|
overflow: "hidden"
|
|
770
722
|
},
|
|
771
|
-
children:
|
|
772
|
-
text:
|
|
773
|
-
styles:
|
|
774
|
-
color:
|
|
723
|
+
children: b(r, {
|
|
724
|
+
text: Ge,
|
|
725
|
+
styles: O,
|
|
726
|
+
color: fe.textColor
|
|
775
727
|
})
|
|
776
728
|
})
|
|
777
729
|
}) : null,
|
|
778
|
-
|
|
730
|
+
Ae
|
|
779
731
|
]
|
|
780
732
|
});
|
|
781
733
|
}));
|
|
782
|
-
|
|
783
|
-
export {
|
|
734
|
+
q.displayName = "ShapeEditor";
|
|
735
|
+
export { q as ShapeEditor };
|