ooxml-core 1.11.0 → 1.12.0

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 (58) hide show
  1. package/dist/automation/index.cjs +210 -20
  2. package/dist/automation/index.mjs +210 -20
  3. package/dist/docx/embedded.cjs +1 -1
  4. package/dist/docx/embedded.mjs +1 -1
  5. package/dist/docx/index.cjs +1 -1
  6. package/dist/docx/index.mjs +1 -1
  7. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  8. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  9. package/dist/docx/layout/index.cjs +145 -9
  10. package/dist/docx/layout/index.d.ts +1 -0
  11. package/dist/docx/layout/index.d.ts.map +1 -1
  12. package/dist/docx/layout/index.mjs +145 -10
  13. package/dist/docx/layout/input.d.ts +5 -0
  14. package/dist/docx/layout/input.d.ts.map +1 -1
  15. package/dist/docx/layout/layout-session.d.ts +10 -0
  16. package/dist/docx/layout/layout-session.d.ts.map +1 -0
  17. package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -1
  18. package/dist/docx/layout/paragraph-cache.d.ts +8 -0
  19. package/dist/docx/layout/paragraph-cache.d.ts.map +1 -0
  20. package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
  21. package/dist/docx/layout/paragraph-tokens.d.ts +1 -1
  22. package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
  23. package/dist/docx/layout/table-paragraph-keeps.d.ts +14 -0
  24. package/dist/docx/layout/table-paragraph-keeps.d.ts.map +1 -0
  25. package/dist/docx/load/index.cjs +1 -1
  26. package/dist/docx/load/index.mjs +1 -1
  27. package/dist/docx/ui/index.cjs +83 -6
  28. package/dist/docx/ui/index.mjs +83 -7
  29. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  30. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  31. package/dist/docx/ui/word-count.d.ts +3 -0
  32. package/dist/docx/ui/word-count.d.ts.map +1 -1
  33. package/dist/geometry/element-transform.d.ts +90 -0
  34. package/dist/geometry/element-transform.d.ts.map +1 -0
  35. package/dist/geometry/index.cjs +90 -0
  36. package/dist/geometry/index.d.ts +1 -0
  37. package/dist/geometry/index.d.ts.map +1 -1
  38. package/dist/geometry/index.mjs +83 -1
  39. package/dist/index.cjs +90 -0
  40. package/dist/index.mjs +90 -0
  41. package/dist/visio/index.cjs +314 -39
  42. package/dist/visio/index.d.ts +1 -0
  43. package/dist/visio/index.d.ts.map +1 -1
  44. package/dist/visio/index.mjs +313 -40
  45. package/dist/visio/model.d.ts +12 -0
  46. package/dist/visio/model.d.ts.map +1 -1
  47. package/dist/visio/paper-sizes.d.ts +5 -0
  48. package/dist/visio/paper-sizes.d.ts.map +1 -1
  49. package/dist/visio/parser.d.ts.map +1 -1
  50. package/dist/visio/print-count.d.ts +20 -0
  51. package/dist/visio/print-count.d.ts.map +1 -0
  52. package/dist/visio/print-settings.d.ts +14 -0
  53. package/dist/visio/print-settings.d.ts.map +1 -0
  54. package/dist/visio/ui/index.cjs +194 -4
  55. package/dist/visio/ui/index.mjs +194 -4
  56. package/dist/xlsx/ui/ribbon/parts.d.ts +1 -0
  57. package/dist/xlsx/ui/ribbon/parts.d.ts.map +1 -1
  58. package/package.json +1 -1
@@ -16216,4 +16216,86 @@ function arrowKeyDelta(key, step) {
16216
16216
  }
16217
16217
  }
16218
16218
 
16219
- export { ACTION_BUTTON_CONNECTION_SITES, ACTION_BUTTON_PRESET_DEFINITIONS, ACTION_BUTTON_TEXT_RECTS, ANGLE_SCALE, ARROW_CALLOUT_CONNECTION_SITES, ARROW_CALLOUT_PRESET_DEFINITIONS, ARROW_CONNECTION_SITES, ARROW_PRESET_DEFINITIONS, ARROW_TEXT_RECTS, BASIC_SHAPE_CONNECTION_SITES_A, BASIC_SHAPE_CONNECTION_SITES_B, BRACE_CONNECTION_SITES, BRACE_TEXT_RECTS, CALLOUT_CONNECTION_SITES, CALLOUT_TEXT_RECTS, CANVAS_SENTINEL, CARDINAL_SITES, CHART_MARK_PRESET_DEFINITIONS, CIRCULAR_ARROW_CONNECTION_SITES, CIRCULAR_ARROW_TEXT_RECTS, CLIP_PATHS_CORE, CLIP_PATHS_EXTENDED, CLOUD_CALLOUT_PRESET_DEFINITIONS, CLOUD_CALLOUT_TAIL_COUNT, CLOUD_LOBE_COUNT, COM_AVLST_GROUND_TRUTH, CONNECTORS_BRACKETS_PRESET_DEFINITIONS, CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS, CURVED_ARROW_CONNECTION_SITES, EPSILON, EXACT_CURVED_ARROW_PRESET_DEFINITIONS, EXTENDED_SHAPE_DEFINITIONS, FLOWCHART_CONNECTION_SITES, FLOWCHART_PRESET_DEFINITIONS, FLOWCHART_TEXT_RECTS, GEAR9_CONNECTION_SITES, GRAPH_LAYOUT_STYLES, IDENTITY_AFFINE, LEFT_CIRCULAR_ARROW_CONNECTION_SITES, LEFT_RIGHT_CIRCULAR_ARROW_CONNECTION_SITES, MATH_SYMBOL_CONNECTION_SITES, MISC_ARROW_CONNECTION_SITES, MISC_PRESET_DEFINITIONS, MISC_SHAPE_CONNECTION_SITES, MISC_TEXT_RECTS_A, MISC_TEXT_RECTS_B, PADDING_DEFAULT, POLYGON_CONNECTION_SITES, POLYGON_TEXT_RECTS, PRESET_GEOMETRY_ALIASES, PRESET_SHAPE_CATEGORY_LABELS, PRESET_SHAPE_CLIP_PATHS, PRESET_SHAPE_DEFINITIONS, PRESET_SHAPE_GEOMETRY_TABLE, PRIMARY_SHAPE_DEFINITIONS, QUAD_CONNECTION_SITES, QUAD_TEXT_RECTS, RECTS_SNIPS_PRESET_DEFINITIONS, RECT_VARIANT_CONNECTION_SITES, REFINED_ARROW_PRESET_DEFINITIONS, RIBBON_CONNECTION_SITES, RIBBON_TEXT_RECTS, ROUTING_PADDING_DEFAULT, SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS, SNAP_THRESHOLD, STAR_CONNECTION_SITES, STAR_TEXT_RECTS, ST_SHAPE_TYPE_VALUES, TABS_DECORATIONS_PRESET_DEFINITIONS, TAB_CONNECTION_SITES, TAB_TEXT_RECTS, _internalForTests, aStarOrthogonal, alignElements, angleToRadians, arrowKeyDelta, at, autoAlignBoxes, buildCalloutLeaderLineSvgPath, buildGraphNodes, clipPolygons, combineShapes, composeAffine, computeAlign, computeDistribute, computeRotation, computeSnap, computeSnapToShape, computeUnionWalk, convexHull, createBuiltinVariables, createRotationDrag, cross2, curvedElbowPathD, cxn, dedupPoly, directPathClear, distributeElements, elbowCurveSegments, elbowSegmentCount, elbowWaypoints, ensureCCW, ensureCW, evaluateFormula, evaluateGuides, findAllIntersections, flattenSvgPath, fmtNum, fragmentShapes, gd, gear6, gear9, getAdjustmentAwareClipPath, getCalloutLeaderLineGeometry, getCalloutTier, getCalloutViewBoxBounds, getCloudCalloutClipPath, getCloudClipPath, getPresetConnectionSites, getPresetShapeClipPath, getPresetTextRect, heuristic, inflateRect, insertIntersections, intersectPolygons, intersectShapes, intersectSvgPaths, isCalloutShape, isConvex, isHorizontalPrimaryAxis, isStShapeType, layoutGraph, lineIntersection, lookupPresetConnectionSites, lookupPresetTextRectOverride, mergeOverlappingPolygons, mergeShapes, normalizeStShapeType, parseAdjustmentValues, parseFormula, parseGuideDefinitions, pointInPolygon, pointInRect, pointInTriangle, pointKey, polygonArea, polygonsToSvgPath, resolveAlignReferenceBox, resolveCoordinate, resolveOperand, resolveRotateHandlePlacement, routeConnector, routeOrthogonalConnector, segmentIntersection, segmentIntersectsRect, signedArea, simplifyPath, snapAngle, snapBox, snapToGridStep, snapValue, subtractPolygons, subtractShapes, subtractSvgPaths, sutherlandHodgman, svgPathToPolygons, triangulate, unionPolygons, unionShapes, unionSvgPaths, usesSlideReference, vec2Eq, waypointsToPathD, waypointsToPathData };
16219
+ // geometry/element-transform.ts
16220
+ var DEFAULT_INTERACTION_MIN_SIZE = 12;
16221
+ var RESIZE_HANDLES = [
16222
+ "nw",
16223
+ "n",
16224
+ "ne",
16225
+ "e",
16226
+ "se",
16227
+ "s",
16228
+ "sw",
16229
+ "w"
16230
+ ];
16231
+ var RESIZE_HANDLE_GEOMETRY = {
16232
+ nw: { cursor: "nwse-resize", fx: 0, fy: 0 },
16233
+ n: { cursor: "ns-resize", fx: 0.5, fy: 0 },
16234
+ ne: { cursor: "nesw-resize", fx: 1, fy: 0 },
16235
+ e: { cursor: "ew-resize", fx: 1, fy: 0.5 },
16236
+ se: { cursor: "nwse-resize", fx: 1, fy: 1 },
16237
+ s: { cursor: "ns-resize", fx: 0.5, fy: 1 },
16238
+ sw: { cursor: "nesw-resize", fx: 0, fy: 1 },
16239
+ w: { cursor: "ew-resize", fx: 0, fy: 0.5 }
16240
+ };
16241
+ var ROTATE_STEM_PX = 24;
16242
+ var DEG_TO_RAD = Math.PI / 180;
16243
+ function rotationOf(box) {
16244
+ return box.rotation ?? 0;
16245
+ }
16246
+ function rotateDelta(dx, dy, rotationDeg) {
16247
+ if (!rotationDeg) {
16248
+ return { x: dx, y: dy };
16249
+ }
16250
+ const rad = -rotationDeg * DEG_TO_RAD;
16251
+ const cos = Math.cos(rad);
16252
+ const sin = Math.sin(rad);
16253
+ return {
16254
+ x: dx * cos - dy * sin,
16255
+ y: dx * sin + dy * cos
16256
+ };
16257
+ }
16258
+ function boxCenter(box) {
16259
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
16260
+ }
16261
+ function applyDragDelta(box, dxScreen, dyScreen, zoom) {
16262
+ const scale = zoom || 1;
16263
+ return {
16264
+ x: box.x + dxScreen / scale,
16265
+ y: box.y + dyScreen / scale,
16266
+ width: box.width,
16267
+ height: box.height,
16268
+ rotation: rotationOf(box)
16269
+ };
16270
+ }
16271
+ function applyResize(box, handle, dxScreen, dyScreen, zoom, opts = {}) {
16272
+ const scale = zoom || 1;
16273
+ const minSize = opts.minSize ?? DEFAULT_INTERACTION_MIN_SIZE;
16274
+ const rotation = rotationOf(box);
16275
+ const local = rotateDelta(dxScreen / scale, dyScreen / scale, rotation);
16276
+ const dx = local.x;
16277
+ const dy = local.y;
16278
+ let newX = box.x;
16279
+ let newY = box.y;
16280
+ let newW = box.width;
16281
+ let newH = box.height;
16282
+ const affectsLeft = handle === "nw" || handle === "w" || handle === "sw";
16283
+ const affectsRight = handle === "ne" || handle === "e" || handle === "se";
16284
+ const affectsTop = handle === "nw" || handle === "n" || handle === "ne";
16285
+ const affectsBottom = handle === "sw" || handle === "s" || handle === "se";
16286
+ if (affectsRight) {
16287
+ newW = Math.max(minSize, box.width + dx);
16288
+ } else if (affectsLeft) {
16289
+ newW = Math.max(minSize, box.width - dx);
16290
+ newX = box.x + (box.width - newW);
16291
+ }
16292
+ if (affectsBottom) {
16293
+ newH = Math.max(minSize, box.height + dy);
16294
+ } else if (affectsTop) {
16295
+ newH = Math.max(minSize, box.height - dy);
16296
+ newY = box.y + (box.height - newH);
16297
+ }
16298
+ return { x: newX, y: newY, width: newW, height: newH, rotation };
16299
+ }
16300
+
16301
+ export { ACTION_BUTTON_CONNECTION_SITES, ACTION_BUTTON_PRESET_DEFINITIONS, ACTION_BUTTON_TEXT_RECTS, ANGLE_SCALE, ARROW_CALLOUT_CONNECTION_SITES, ARROW_CALLOUT_PRESET_DEFINITIONS, ARROW_CONNECTION_SITES, ARROW_PRESET_DEFINITIONS, ARROW_TEXT_RECTS, BASIC_SHAPE_CONNECTION_SITES_A, BASIC_SHAPE_CONNECTION_SITES_B, BRACE_CONNECTION_SITES, BRACE_TEXT_RECTS, CALLOUT_CONNECTION_SITES, CALLOUT_TEXT_RECTS, CANVAS_SENTINEL, CARDINAL_SITES, CHART_MARK_PRESET_DEFINITIONS, CIRCULAR_ARROW_CONNECTION_SITES, CIRCULAR_ARROW_TEXT_RECTS, CLIP_PATHS_CORE, CLIP_PATHS_EXTENDED, CLOUD_CALLOUT_PRESET_DEFINITIONS, CLOUD_CALLOUT_TAIL_COUNT, CLOUD_LOBE_COUNT, COM_AVLST_GROUND_TRUTH, CONNECTORS_BRACKETS_PRESET_DEFINITIONS, CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS, CURVED_ARROW_CONNECTION_SITES, DEFAULT_INTERACTION_MIN_SIZE, EPSILON, EXACT_CURVED_ARROW_PRESET_DEFINITIONS, EXTENDED_SHAPE_DEFINITIONS, FLOWCHART_CONNECTION_SITES, FLOWCHART_PRESET_DEFINITIONS, FLOWCHART_TEXT_RECTS, GEAR9_CONNECTION_SITES, GRAPH_LAYOUT_STYLES, IDENTITY_AFFINE, LEFT_CIRCULAR_ARROW_CONNECTION_SITES, LEFT_RIGHT_CIRCULAR_ARROW_CONNECTION_SITES, MATH_SYMBOL_CONNECTION_SITES, MISC_ARROW_CONNECTION_SITES, MISC_PRESET_DEFINITIONS, MISC_SHAPE_CONNECTION_SITES, MISC_TEXT_RECTS_A, MISC_TEXT_RECTS_B, PADDING_DEFAULT, POLYGON_CONNECTION_SITES, POLYGON_TEXT_RECTS, PRESET_GEOMETRY_ALIASES, PRESET_SHAPE_CATEGORY_LABELS, PRESET_SHAPE_CLIP_PATHS, PRESET_SHAPE_DEFINITIONS, PRESET_SHAPE_GEOMETRY_TABLE, PRIMARY_SHAPE_DEFINITIONS, QUAD_CONNECTION_SITES, QUAD_TEXT_RECTS, RECTS_SNIPS_PRESET_DEFINITIONS, RECT_VARIANT_CONNECTION_SITES, REFINED_ARROW_PRESET_DEFINITIONS, RESIZE_HANDLES, RESIZE_HANDLE_GEOMETRY, RIBBON_CONNECTION_SITES, RIBBON_TEXT_RECTS, ROTATE_STEM_PX, ROUTING_PADDING_DEFAULT, SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS, SNAP_THRESHOLD, STAR_CONNECTION_SITES, STAR_TEXT_RECTS, ST_SHAPE_TYPE_VALUES, TABS_DECORATIONS_PRESET_DEFINITIONS, TAB_CONNECTION_SITES, TAB_TEXT_RECTS, _internalForTests, aStarOrthogonal, alignElements, angleToRadians, applyDragDelta, applyResize, arrowKeyDelta, at, autoAlignBoxes, boxCenter, buildCalloutLeaderLineSvgPath, buildGraphNodes, clipPolygons, combineShapes, composeAffine, computeAlign, computeDistribute, computeRotation, computeSnap, computeSnapToShape, computeUnionWalk, convexHull, createBuiltinVariables, createRotationDrag, cross2, curvedElbowPathD, cxn, dedupPoly, directPathClear, distributeElements, elbowCurveSegments, elbowSegmentCount, elbowWaypoints, ensureCCW, ensureCW, evaluateFormula, evaluateGuides, findAllIntersections, flattenSvgPath, fmtNum, fragmentShapes, gd, gear6, gear9, getAdjustmentAwareClipPath, getCalloutLeaderLineGeometry, getCalloutTier, getCalloutViewBoxBounds, getCloudCalloutClipPath, getCloudClipPath, getPresetConnectionSites, getPresetShapeClipPath, getPresetTextRect, heuristic, inflateRect, insertIntersections, intersectPolygons, intersectShapes, intersectSvgPaths, isCalloutShape, isConvex, isHorizontalPrimaryAxis, isStShapeType, layoutGraph, lineIntersection, lookupPresetConnectionSites, lookupPresetTextRectOverride, mergeOverlappingPolygons, mergeShapes, normalizeStShapeType, parseAdjustmentValues, parseFormula, parseGuideDefinitions, pointInPolygon, pointInRect, pointInTriangle, pointKey, polygonArea, polygonsToSvgPath, resolveAlignReferenceBox, resolveCoordinate, resolveOperand, resolveRotateHandlePlacement, rotateDelta, routeConnector, routeOrthogonalConnector, segmentIntersection, segmentIntersectsRect, signedArea, simplifyPath, snapAngle, snapBox, snapToGridStep, snapValue, subtractPolygons, subtractShapes, subtractSvgPaths, sutherlandHodgman, svgPathToPolygons, triangulate, unionPolygons, unionShapes, unionSvgPaths, usesSlideReference, vec2Eq, waypointsToPathD, waypointsToPathData };
package/dist/index.cjs CHANGED
@@ -33232,6 +33232,7 @@ __export(geometry_exports, {
33232
33232
  CONNECTORS_BRACKETS_PRESET_DEFINITIONS: () => CONNECTORS_BRACKETS_PRESET_DEFINITIONS,
33233
33233
  CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS: () => CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS,
33234
33234
  CURVED_ARROW_CONNECTION_SITES: () => CURVED_ARROW_CONNECTION_SITES,
33235
+ DEFAULT_INTERACTION_MIN_SIZE: () => DEFAULT_INTERACTION_MIN_SIZE,
33235
33236
  EPSILON: () => EPSILON,
33236
33237
  EXACT_CURVED_ARROW_PRESET_DEFINITIONS: () => EXACT_CURVED_ARROW_PRESET_DEFINITIONS,
33237
33238
  EXTENDED_SHAPE_DEFINITIONS: () => EXTENDED_SHAPE_DEFINITIONS,
@@ -33263,8 +33264,11 @@ __export(geometry_exports, {
33263
33264
  RECTS_SNIPS_PRESET_DEFINITIONS: () => RECTS_SNIPS_PRESET_DEFINITIONS,
33264
33265
  RECT_VARIANT_CONNECTION_SITES: () => RECT_VARIANT_CONNECTION_SITES,
33265
33266
  REFINED_ARROW_PRESET_DEFINITIONS: () => REFINED_ARROW_PRESET_DEFINITIONS,
33267
+ RESIZE_HANDLES: () => RESIZE_HANDLES,
33268
+ RESIZE_HANDLE_GEOMETRY: () => RESIZE_HANDLE_GEOMETRY,
33266
33269
  RIBBON_CONNECTION_SITES: () => RIBBON_CONNECTION_SITES,
33267
33270
  RIBBON_TEXT_RECTS: () => RIBBON_TEXT_RECTS,
33271
+ ROTATE_STEM_PX: () => ROTATE_STEM_PX,
33268
33272
  ROUTING_PADDING_DEFAULT: () => ROUTING_PADDING_DEFAULT,
33269
33273
  SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS: () => SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS,
33270
33274
  SNAP_THRESHOLD: () => SNAP_THRESHOLD,
@@ -33278,9 +33282,12 @@ __export(geometry_exports, {
33278
33282
  aStarOrthogonal: () => aStarOrthogonal,
33279
33283
  alignElements: () => alignElements,
33280
33284
  angleToRadians: () => angleToRadians,
33285
+ applyDragDelta: () => applyDragDelta,
33286
+ applyResize: () => applyResize,
33281
33287
  arrowKeyDelta: () => arrowKeyDelta,
33282
33288
  at: () => at,
33283
33289
  autoAlignBoxes: () => autoAlignBoxes,
33290
+ boxCenter: () => boxCenter,
33284
33291
  buildCalloutLeaderLineSvgPath: () => buildCalloutLeaderLineSvgPath,
33285
33292
  buildGraphNodes: () => buildGraphNodes,
33286
33293
  clipPolygons: () => clipPolygons,
@@ -33354,6 +33361,7 @@ __export(geometry_exports, {
33354
33361
  resolveCoordinate: () => resolveCoordinate,
33355
33362
  resolveOperand: () => resolveOperand,
33356
33363
  resolveRotateHandlePlacement: () => resolveRotateHandlePlacement,
33364
+ rotateDelta: () => rotateDelta,
33357
33365
  routeConnector: () => routeConnector,
33358
33366
  routeOrthogonalConnector: () => routeOrthogonalConnector,
33359
33367
  segmentIntersection: () => segmentIntersection,
@@ -40326,6 +40334,88 @@ function arrowKeyDelta(key, step) {
40326
40334
  }
40327
40335
  }
40328
40336
 
40337
+ // geometry/element-transform.ts
40338
+ var DEFAULT_INTERACTION_MIN_SIZE = 12;
40339
+ var RESIZE_HANDLES = [
40340
+ "nw",
40341
+ "n",
40342
+ "ne",
40343
+ "e",
40344
+ "se",
40345
+ "s",
40346
+ "sw",
40347
+ "w"
40348
+ ];
40349
+ var RESIZE_HANDLE_GEOMETRY = {
40350
+ nw: { cursor: "nwse-resize", fx: 0, fy: 0 },
40351
+ n: { cursor: "ns-resize", fx: 0.5, fy: 0 },
40352
+ ne: { cursor: "nesw-resize", fx: 1, fy: 0 },
40353
+ e: { cursor: "ew-resize", fx: 1, fy: 0.5 },
40354
+ se: { cursor: "nwse-resize", fx: 1, fy: 1 },
40355
+ s: { cursor: "ns-resize", fx: 0.5, fy: 1 },
40356
+ sw: { cursor: "nesw-resize", fx: 0, fy: 1 },
40357
+ w: { cursor: "ew-resize", fx: 0, fy: 0.5 }
40358
+ };
40359
+ var ROTATE_STEM_PX = 24;
40360
+ var DEG_TO_RAD5 = Math.PI / 180;
40361
+ function rotationOf(box) {
40362
+ return box.rotation ?? 0;
40363
+ }
40364
+ function rotateDelta(dx, dy, rotationDeg) {
40365
+ if (!rotationDeg) {
40366
+ return { x: dx, y: dy };
40367
+ }
40368
+ const rad = -rotationDeg * DEG_TO_RAD5;
40369
+ const cos = Math.cos(rad);
40370
+ const sin = Math.sin(rad);
40371
+ return {
40372
+ x: dx * cos - dy * sin,
40373
+ y: dx * sin + dy * cos
40374
+ };
40375
+ }
40376
+ function boxCenter(box) {
40377
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
40378
+ }
40379
+ function applyDragDelta(box, dxScreen, dyScreen, zoom) {
40380
+ const scale = zoom || 1;
40381
+ return {
40382
+ x: box.x + dxScreen / scale,
40383
+ y: box.y + dyScreen / scale,
40384
+ width: box.width,
40385
+ height: box.height,
40386
+ rotation: rotationOf(box)
40387
+ };
40388
+ }
40389
+ function applyResize(box, handle, dxScreen, dyScreen, zoom, opts = {}) {
40390
+ const scale = zoom || 1;
40391
+ const minSize = opts.minSize ?? DEFAULT_INTERACTION_MIN_SIZE;
40392
+ const rotation = rotationOf(box);
40393
+ const local = rotateDelta(dxScreen / scale, dyScreen / scale, rotation);
40394
+ const dx = local.x;
40395
+ const dy = local.y;
40396
+ let newX = box.x;
40397
+ let newY = box.y;
40398
+ let newW = box.width;
40399
+ let newH = box.height;
40400
+ const affectsLeft = handle === "nw" || handle === "w" || handle === "sw";
40401
+ const affectsRight = handle === "ne" || handle === "e" || handle === "se";
40402
+ const affectsTop = handle === "nw" || handle === "n" || handle === "ne";
40403
+ const affectsBottom = handle === "sw" || handle === "s" || handle === "se";
40404
+ if (affectsRight) {
40405
+ newW = Math.max(minSize, box.width + dx);
40406
+ } else if (affectsLeft) {
40407
+ newW = Math.max(minSize, box.width - dx);
40408
+ newX = box.x + (box.width - newW);
40409
+ }
40410
+ if (affectsBottom) {
40411
+ newH = Math.max(minSize, box.height + dy);
40412
+ } else if (affectsTop) {
40413
+ newH = Math.max(minSize, box.height - dy);
40414
+ newY = box.y + (box.height - newH);
40415
+ }
40416
+ return { x: newX, y: newY, width: newW, height: newH, rotation };
40417
+ }
40418
+
40329
40419
  // units/index.ts
40330
40420
  var units_exports = {};
40331
40421
  __export(units_exports, {
package/dist/index.mjs CHANGED
@@ -33226,6 +33226,7 @@ __export(geometry_exports, {
33226
33226
  CONNECTORS_BRACKETS_PRESET_DEFINITIONS: () => CONNECTORS_BRACKETS_PRESET_DEFINITIONS,
33227
33227
  CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS: () => CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS,
33228
33228
  CURVED_ARROW_CONNECTION_SITES: () => CURVED_ARROW_CONNECTION_SITES,
33229
+ DEFAULT_INTERACTION_MIN_SIZE: () => DEFAULT_INTERACTION_MIN_SIZE,
33229
33230
  EPSILON: () => EPSILON,
33230
33231
  EXACT_CURVED_ARROW_PRESET_DEFINITIONS: () => EXACT_CURVED_ARROW_PRESET_DEFINITIONS,
33231
33232
  EXTENDED_SHAPE_DEFINITIONS: () => EXTENDED_SHAPE_DEFINITIONS,
@@ -33257,8 +33258,11 @@ __export(geometry_exports, {
33257
33258
  RECTS_SNIPS_PRESET_DEFINITIONS: () => RECTS_SNIPS_PRESET_DEFINITIONS,
33258
33259
  RECT_VARIANT_CONNECTION_SITES: () => RECT_VARIANT_CONNECTION_SITES,
33259
33260
  REFINED_ARROW_PRESET_DEFINITIONS: () => REFINED_ARROW_PRESET_DEFINITIONS,
33261
+ RESIZE_HANDLES: () => RESIZE_HANDLES,
33262
+ RESIZE_HANDLE_GEOMETRY: () => RESIZE_HANDLE_GEOMETRY,
33260
33263
  RIBBON_CONNECTION_SITES: () => RIBBON_CONNECTION_SITES,
33261
33264
  RIBBON_TEXT_RECTS: () => RIBBON_TEXT_RECTS,
33265
+ ROTATE_STEM_PX: () => ROTATE_STEM_PX,
33262
33266
  ROUTING_PADDING_DEFAULT: () => ROUTING_PADDING_DEFAULT,
33263
33267
  SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS: () => SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS,
33264
33268
  SNAP_THRESHOLD: () => SNAP_THRESHOLD,
@@ -33272,9 +33276,12 @@ __export(geometry_exports, {
33272
33276
  aStarOrthogonal: () => aStarOrthogonal,
33273
33277
  alignElements: () => alignElements,
33274
33278
  angleToRadians: () => angleToRadians,
33279
+ applyDragDelta: () => applyDragDelta,
33280
+ applyResize: () => applyResize,
33275
33281
  arrowKeyDelta: () => arrowKeyDelta,
33276
33282
  at: () => at,
33277
33283
  autoAlignBoxes: () => autoAlignBoxes,
33284
+ boxCenter: () => boxCenter,
33278
33285
  buildCalloutLeaderLineSvgPath: () => buildCalloutLeaderLineSvgPath,
33279
33286
  buildGraphNodes: () => buildGraphNodes,
33280
33287
  clipPolygons: () => clipPolygons,
@@ -33348,6 +33355,7 @@ __export(geometry_exports, {
33348
33355
  resolveCoordinate: () => resolveCoordinate,
33349
33356
  resolveOperand: () => resolveOperand,
33350
33357
  resolveRotateHandlePlacement: () => resolveRotateHandlePlacement,
33358
+ rotateDelta: () => rotateDelta,
33351
33359
  routeConnector: () => routeConnector,
33352
33360
  routeOrthogonalConnector: () => routeOrthogonalConnector,
33353
33361
  segmentIntersection: () => segmentIntersection,
@@ -40320,6 +40328,88 @@ function arrowKeyDelta(key, step) {
40320
40328
  }
40321
40329
  }
40322
40330
 
40331
+ // geometry/element-transform.ts
40332
+ var DEFAULT_INTERACTION_MIN_SIZE = 12;
40333
+ var RESIZE_HANDLES = [
40334
+ "nw",
40335
+ "n",
40336
+ "ne",
40337
+ "e",
40338
+ "se",
40339
+ "s",
40340
+ "sw",
40341
+ "w"
40342
+ ];
40343
+ var RESIZE_HANDLE_GEOMETRY = {
40344
+ nw: { cursor: "nwse-resize", fx: 0, fy: 0 },
40345
+ n: { cursor: "ns-resize", fx: 0.5, fy: 0 },
40346
+ ne: { cursor: "nesw-resize", fx: 1, fy: 0 },
40347
+ e: { cursor: "ew-resize", fx: 1, fy: 0.5 },
40348
+ se: { cursor: "nwse-resize", fx: 1, fy: 1 },
40349
+ s: { cursor: "ns-resize", fx: 0.5, fy: 1 },
40350
+ sw: { cursor: "nesw-resize", fx: 0, fy: 1 },
40351
+ w: { cursor: "ew-resize", fx: 0, fy: 0.5 }
40352
+ };
40353
+ var ROTATE_STEM_PX = 24;
40354
+ var DEG_TO_RAD5 = Math.PI / 180;
40355
+ function rotationOf(box) {
40356
+ return box.rotation ?? 0;
40357
+ }
40358
+ function rotateDelta(dx, dy, rotationDeg) {
40359
+ if (!rotationDeg) {
40360
+ return { x: dx, y: dy };
40361
+ }
40362
+ const rad = -rotationDeg * DEG_TO_RAD5;
40363
+ const cos = Math.cos(rad);
40364
+ const sin = Math.sin(rad);
40365
+ return {
40366
+ x: dx * cos - dy * sin,
40367
+ y: dx * sin + dy * cos
40368
+ };
40369
+ }
40370
+ function boxCenter(box) {
40371
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
40372
+ }
40373
+ function applyDragDelta(box, dxScreen, dyScreen, zoom) {
40374
+ const scale = zoom || 1;
40375
+ return {
40376
+ x: box.x + dxScreen / scale,
40377
+ y: box.y + dyScreen / scale,
40378
+ width: box.width,
40379
+ height: box.height,
40380
+ rotation: rotationOf(box)
40381
+ };
40382
+ }
40383
+ function applyResize(box, handle, dxScreen, dyScreen, zoom, opts = {}) {
40384
+ const scale = zoom || 1;
40385
+ const minSize = opts.minSize ?? DEFAULT_INTERACTION_MIN_SIZE;
40386
+ const rotation = rotationOf(box);
40387
+ const local = rotateDelta(dxScreen / scale, dyScreen / scale, rotation);
40388
+ const dx = local.x;
40389
+ const dy = local.y;
40390
+ let newX = box.x;
40391
+ let newY = box.y;
40392
+ let newW = box.width;
40393
+ let newH = box.height;
40394
+ const affectsLeft = handle === "nw" || handle === "w" || handle === "sw";
40395
+ const affectsRight = handle === "ne" || handle === "e" || handle === "se";
40396
+ const affectsTop = handle === "nw" || handle === "n" || handle === "ne";
40397
+ const affectsBottom = handle === "sw" || handle === "s" || handle === "se";
40398
+ if (affectsRight) {
40399
+ newW = Math.max(minSize, box.width + dx);
40400
+ } else if (affectsLeft) {
40401
+ newW = Math.max(minSize, box.width - dx);
40402
+ newX = box.x + (box.width - newW);
40403
+ }
40404
+ if (affectsBottom) {
40405
+ newH = Math.max(minSize, box.height + dy);
40406
+ } else if (affectsTop) {
40407
+ newH = Math.max(minSize, box.height - dy);
40408
+ newY = box.y + (box.height - newH);
40409
+ }
40410
+ return { x: newX, y: newY, width: newW, height: newH, rotation };
40411
+ }
40412
+
40323
40413
  // units/index.ts
40324
40414
  var units_exports = {};
40325
40415
  __export(units_exports, {