@cardenelabs/cdl 0.30.1 → 0.30.2
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/CHANGELOG.md +30 -1
- package/dist/index.cjs +237 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +237 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +236 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +236 -0
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/layout/collisions.ts +345 -0
- package/src/layout.ts +14 -0
package/dist/index.d.cts
CHANGED
|
@@ -2673,6 +2673,43 @@ pathLabelClearance?: number): {
|
|
|
2673
2673
|
dy: number;
|
|
2674
2674
|
}>;
|
|
2675
2675
|
};
|
|
2676
|
+
/**
|
|
2677
|
+
* 経路を動かす pass の **後** に、 札だけを箱 ・ 札 ・ 線から離す (#659)。
|
|
2678
|
+
*
|
|
2679
|
+
* ## なぜ最終 pass が要るか
|
|
2680
|
+
*
|
|
2681
|
+
* `resolveEdgeLabelOverlapsWithChainAndPropagate` は経路を動かす 4 つの pass
|
|
2682
|
+
* (`bowSharedStraightPaths` / `pullOutgoingFirstCorner` / `fanIncomingEndpoints` /
|
|
2683
|
+
* `separateSharedStraightRuns`) の **前** に走る。 札の初期位置は経路から決まるため、
|
|
2684
|
+
* 後の pass が経路を動かすと札も一緒に動く。 動いた後を見る者が誰も居なかった。
|
|
2685
|
+
*
|
|
2686
|
+
* 0.30.0 で `pullOutgoingFirstCorner` (#651) と `fanIncomingEndpoints` (#649) が経路を
|
|
2687
|
+
* 大きく動かすようになり、 消費側の見本帳で札が 11 件動いた (実測 = 最大 217 world)。
|
|
2688
|
+
* 動いた先が箱の近くだと `clearance` 軸の要求 (箱と札で 32) を割ったまま残る。
|
|
2689
|
+
* 実測 = 0.29.0 で 0 件だった違反が 0.30.1 で 9 件。
|
|
2690
|
+
*
|
|
2691
|
+
* ## 何を動かすか
|
|
2692
|
+
*
|
|
2693
|
+
* **札だけを動かす**。 箱と経路は動かさない = ここで経路を動かすと、 直前の 4 pass が
|
|
2694
|
+
* 確定させた形 (根元の重なり分け / 起点の直進) を崩すことになる。
|
|
2695
|
+
*
|
|
2696
|
+
* 判定は門 (`detectNearCollisions`) と同じ `requiredNearClearance` ・ `computeGap` ・
|
|
2697
|
+
* `measurePathLabelGapSegs` を引く。 別の式で近似すると、 門は落ちるのに押し出しは動かない
|
|
2698
|
+
* 状態に戻る。
|
|
2699
|
+
*
|
|
2700
|
+
* ## 行き先を確かめてから動かす
|
|
2701
|
+
*
|
|
2702
|
+
* 一番安く済む軸へ出すだけだと、 上下や左右の箱に挟まれた札が往復して収束しない
|
|
2703
|
+
* (実測 = 箱 2 つの間で 16 下げて 4 上げるのを繰り返す)。
|
|
2704
|
+
* 軸ごとに行き先を作り、 **他のどの箱 ・ 札 ・ 線とも今より近づかない** 向きだけを採る。
|
|
2705
|
+
* どの向きも安全でなければ動かさない = 直せなかったことは門が引き続き報告する。
|
|
2706
|
+
*
|
|
2707
|
+
* ## 動かしすぎない
|
|
2708
|
+
*
|
|
2709
|
+
* 累積は `CHAIN_SHIFT_MAX_ACCUMULATED` で頭を打つ。 札は自分の線の近くに居ることが
|
|
2710
|
+
* 読みの前提で、 離しすぎるとどの線の札か判らなくなる。
|
|
2711
|
+
*/
|
|
2712
|
+
declare function resolveLabelClearanceAfterPathPasses(edges: LaidEdge[], obstacles: BBox[], maxIter?: number): LaidEdge[];
|
|
2676
2713
|
|
|
2677
2714
|
/**
|
|
2678
2715
|
* Engine が予測する label / node bbox の world 単位 public API。
|
|
@@ -3834,4 +3871,4 @@ declare function computeStateValues(laid: LaidDiagram, phaseIdx: number, progres
|
|
|
3834
3871
|
*/
|
|
3835
3872
|
declare function interpolate(template: string, values: Record<string, string>): string;
|
|
3836
3873
|
|
|
3837
|
-
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, type AnimationChain, type AuthorIntentOptions, type AuthorIntentReport, type BinaryOp, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDerivedValue, CdlDiagram, CdlDiagramThumbnail, CdlEdge, type CdlEventHandler, CdlEventTarget, CdlInput, CdlLane, CdlNode, CdlScrollTrigger, CdlState, type ChartBuilder, type ChartDatum, type ChartPreset, type ChartType, type ClassDiagramBuilder, type ClassDiagramPreset, type ClassRelationType, Computed, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, type DerivedNotice, type DerivedNoticeKind, type DerivedResult, type DiagramAdapter, type DiagramBuilder, type Discrepancy, type DiscrepancyKind, type DomVerifyReport, EDGE_LABEL_TEXT, EDGE_STUB_OUT, ER_CARDINALITY_HEAD, EdgeHead, EdgeHeadFill, type EdgeLabelLine, type EdgeLabelTextSpec, EdgeStyle, type ErBuilder, type ErColumn, type ErEntity, type ErPreset, type ErRelation, type ErRelationCardinality, type EventAttachHandle, type EventChain, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, type FlowBuilder, type FlowPreset, type FlowStepInput, type FlowchartBuilder, type FlowchartEdge, type FlowchartNode, type FlowchartNodeShape, type FlowchartPreset, type FormulaAst, type FormulaContext, type FsmMark, type FsmState, type FsmStateAction, type FsmStateNested, type FsmTransition, type FsmTransitionExt, type FunnelBuilder, type FunnelPreset, type FunnelStage, type GanttBuilder, type GanttPreset, type GanttTask, type GenericDiagramSpec, type GenericDiscrepancy, type GenericDiscrepancyKind, type GenericVerifyOptions, type Rect as GeometryRect, type Segment as GeometrySegment, type InfraConnection, type InfraNode, type InfrastructureBuilder, type InfrastructurePreset, type InputChain, type IntentDiscrepancy, type IntentDiscrepancyKind, JourneyEmotion, type JourneyStep, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, LaidDiagram, LaidEdge, LaidNode, type LayoutWithValidationOptions, type LayoutWithValidationResult, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, type MathFnName, type MindBranch, type MindMapBuilder, type MindMapPreset, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, type NetworkBuilder, type NetworkDevice, type NetworkDeviceKind, type NetworkLink, type NetworkPreset, NodeKind, type OrderEdge, type OrderNode, type OrderResult, type PageLike, type PhaseBuilder, type QuadrantBuilder, type QuadrantItem, type QuadrantPreset, type QuadrantQuadrantLabel, ROW_GAP_VARIANCE_TOL, RowMark, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, type SequenceActor, type SequenceBuilder, type SequenceMessageKind, type SequencePreset, type SequenceStep, Side, Signal, type StateMachine2Builder, type StateMachine2Preset, type StateMachineBuilder, type StateMachinePreset, type SweepReport, type SwimlanePreset, TARGET_LABEL_PATH_DIST, Tone, type TopologyBuilder, type TopologyConnection, type TopologyContainer, type TopologyGroupBuilder, type TopologyPreset, type TreeBuilder, type TreeNode, type TreePreset, type UmlClass, type UmlRelation, type UserJourneyBuilder, type UserJourneyPreset, type ValidateOptions, type ValidationProfile, type VerifyOptions, type Violation, type VisualAxis, type VisualValidationReport, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeScrollProgress, computeStateValues, computeViewportScale, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect, sequence, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
|
3874
|
+
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, type AnimationChain, type AuthorIntentOptions, type AuthorIntentReport, type BinaryOp, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDerivedValue, CdlDiagram, CdlDiagramThumbnail, CdlEdge, type CdlEventHandler, CdlEventTarget, CdlInput, CdlLane, CdlNode, CdlScrollTrigger, CdlState, type ChartBuilder, type ChartDatum, type ChartPreset, type ChartType, type ClassDiagramBuilder, type ClassDiagramPreset, type ClassRelationType, Computed, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, type DerivedNotice, type DerivedNoticeKind, type DerivedResult, type DiagramAdapter, type DiagramBuilder, type Discrepancy, type DiscrepancyKind, type DomVerifyReport, EDGE_LABEL_TEXT, EDGE_STUB_OUT, ER_CARDINALITY_HEAD, EdgeHead, EdgeHeadFill, type EdgeLabelLine, type EdgeLabelTextSpec, EdgeStyle, type ErBuilder, type ErColumn, type ErEntity, type ErPreset, type ErRelation, type ErRelationCardinality, type EventAttachHandle, type EventChain, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, type FlowBuilder, type FlowPreset, type FlowStepInput, type FlowchartBuilder, type FlowchartEdge, type FlowchartNode, type FlowchartNodeShape, type FlowchartPreset, type FormulaAst, type FormulaContext, type FsmMark, type FsmState, type FsmStateAction, type FsmStateNested, type FsmTransition, type FsmTransitionExt, type FunnelBuilder, type FunnelPreset, type FunnelStage, type GanttBuilder, type GanttPreset, type GanttTask, type GenericDiagramSpec, type GenericDiscrepancy, type GenericDiscrepancyKind, type GenericVerifyOptions, type Rect as GeometryRect, type Segment as GeometrySegment, type InfraConnection, type InfraNode, type InfrastructureBuilder, type InfrastructurePreset, type InputChain, type IntentDiscrepancy, type IntentDiscrepancyKind, JourneyEmotion, type JourneyStep, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, LaidDiagram, LaidEdge, LaidNode, type LayoutWithValidationOptions, type LayoutWithValidationResult, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, type MathFnName, type MindBranch, type MindMapBuilder, type MindMapPreset, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, type NetworkBuilder, type NetworkDevice, type NetworkDeviceKind, type NetworkLink, type NetworkPreset, NodeKind, type OrderEdge, type OrderNode, type OrderResult, type PageLike, type PhaseBuilder, type QuadrantBuilder, type QuadrantItem, type QuadrantPreset, type QuadrantQuadrantLabel, ROW_GAP_VARIANCE_TOL, RowMark, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, type SequenceActor, type SequenceBuilder, type SequenceMessageKind, type SequencePreset, type SequenceStep, Side, Signal, type StateMachine2Builder, type StateMachine2Preset, type StateMachineBuilder, type StateMachinePreset, type SweepReport, type SwimlanePreset, TARGET_LABEL_PATH_DIST, Tone, type TopologyBuilder, type TopologyConnection, type TopologyContainer, type TopologyGroupBuilder, type TopologyPreset, type TreeBuilder, type TreeNode, type TreePreset, type UmlClass, type UmlRelation, type UserJourneyBuilder, type UserJourneyPreset, type ValidateOptions, type ValidationProfile, type VerifyOptions, type Violation, type VisualAxis, type VisualValidationReport, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeScrollProgress, computeStateValues, computeViewportScale, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveLabelClearanceAfterPathPasses, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect, sequence, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
package/dist/index.d.ts
CHANGED
|
@@ -2673,6 +2673,43 @@ pathLabelClearance?: number): {
|
|
|
2673
2673
|
dy: number;
|
|
2674
2674
|
}>;
|
|
2675
2675
|
};
|
|
2676
|
+
/**
|
|
2677
|
+
* 経路を動かす pass の **後** に、 札だけを箱 ・ 札 ・ 線から離す (#659)。
|
|
2678
|
+
*
|
|
2679
|
+
* ## なぜ最終 pass が要るか
|
|
2680
|
+
*
|
|
2681
|
+
* `resolveEdgeLabelOverlapsWithChainAndPropagate` は経路を動かす 4 つの pass
|
|
2682
|
+
* (`bowSharedStraightPaths` / `pullOutgoingFirstCorner` / `fanIncomingEndpoints` /
|
|
2683
|
+
* `separateSharedStraightRuns`) の **前** に走る。 札の初期位置は経路から決まるため、
|
|
2684
|
+
* 後の pass が経路を動かすと札も一緒に動く。 動いた後を見る者が誰も居なかった。
|
|
2685
|
+
*
|
|
2686
|
+
* 0.30.0 で `pullOutgoingFirstCorner` (#651) と `fanIncomingEndpoints` (#649) が経路を
|
|
2687
|
+
* 大きく動かすようになり、 消費側の見本帳で札が 11 件動いた (実測 = 最大 217 world)。
|
|
2688
|
+
* 動いた先が箱の近くだと `clearance` 軸の要求 (箱と札で 32) を割ったまま残る。
|
|
2689
|
+
* 実測 = 0.29.0 で 0 件だった違反が 0.30.1 で 9 件。
|
|
2690
|
+
*
|
|
2691
|
+
* ## 何を動かすか
|
|
2692
|
+
*
|
|
2693
|
+
* **札だけを動かす**。 箱と経路は動かさない = ここで経路を動かすと、 直前の 4 pass が
|
|
2694
|
+
* 確定させた形 (根元の重なり分け / 起点の直進) を崩すことになる。
|
|
2695
|
+
*
|
|
2696
|
+
* 判定は門 (`detectNearCollisions`) と同じ `requiredNearClearance` ・ `computeGap` ・
|
|
2697
|
+
* `measurePathLabelGapSegs` を引く。 別の式で近似すると、 門は落ちるのに押し出しは動かない
|
|
2698
|
+
* 状態に戻る。
|
|
2699
|
+
*
|
|
2700
|
+
* ## 行き先を確かめてから動かす
|
|
2701
|
+
*
|
|
2702
|
+
* 一番安く済む軸へ出すだけだと、 上下や左右の箱に挟まれた札が往復して収束しない
|
|
2703
|
+
* (実測 = 箱 2 つの間で 16 下げて 4 上げるのを繰り返す)。
|
|
2704
|
+
* 軸ごとに行き先を作り、 **他のどの箱 ・ 札 ・ 線とも今より近づかない** 向きだけを採る。
|
|
2705
|
+
* どの向きも安全でなければ動かさない = 直せなかったことは門が引き続き報告する。
|
|
2706
|
+
*
|
|
2707
|
+
* ## 動かしすぎない
|
|
2708
|
+
*
|
|
2709
|
+
* 累積は `CHAIN_SHIFT_MAX_ACCUMULATED` で頭を打つ。 札は自分の線の近くに居ることが
|
|
2710
|
+
* 読みの前提で、 離しすぎるとどの線の札か判らなくなる。
|
|
2711
|
+
*/
|
|
2712
|
+
declare function resolveLabelClearanceAfterPathPasses(edges: LaidEdge[], obstacles: BBox[], maxIter?: number): LaidEdge[];
|
|
2676
2713
|
|
|
2677
2714
|
/**
|
|
2678
2715
|
* Engine が予測する label / node bbox の world 単位 public API。
|
|
@@ -3834,4 +3871,4 @@ declare function computeStateValues(laid: LaidDiagram, phaseIdx: number, progres
|
|
|
3834
3871
|
*/
|
|
3835
3872
|
declare function interpolate(template: string, values: Record<string, string>): string;
|
|
3836
3873
|
|
|
3837
|
-
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, type AnimationChain, type AuthorIntentOptions, type AuthorIntentReport, type BinaryOp, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDerivedValue, CdlDiagram, CdlDiagramThumbnail, CdlEdge, type CdlEventHandler, CdlEventTarget, CdlInput, CdlLane, CdlNode, CdlScrollTrigger, CdlState, type ChartBuilder, type ChartDatum, type ChartPreset, type ChartType, type ClassDiagramBuilder, type ClassDiagramPreset, type ClassRelationType, Computed, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, type DerivedNotice, type DerivedNoticeKind, type DerivedResult, type DiagramAdapter, type DiagramBuilder, type Discrepancy, type DiscrepancyKind, type DomVerifyReport, EDGE_LABEL_TEXT, EDGE_STUB_OUT, ER_CARDINALITY_HEAD, EdgeHead, EdgeHeadFill, type EdgeLabelLine, type EdgeLabelTextSpec, EdgeStyle, type ErBuilder, type ErColumn, type ErEntity, type ErPreset, type ErRelation, type ErRelationCardinality, type EventAttachHandle, type EventChain, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, type FlowBuilder, type FlowPreset, type FlowStepInput, type FlowchartBuilder, type FlowchartEdge, type FlowchartNode, type FlowchartNodeShape, type FlowchartPreset, type FormulaAst, type FormulaContext, type FsmMark, type FsmState, type FsmStateAction, type FsmStateNested, type FsmTransition, type FsmTransitionExt, type FunnelBuilder, type FunnelPreset, type FunnelStage, type GanttBuilder, type GanttPreset, type GanttTask, type GenericDiagramSpec, type GenericDiscrepancy, type GenericDiscrepancyKind, type GenericVerifyOptions, type Rect as GeometryRect, type Segment as GeometrySegment, type InfraConnection, type InfraNode, type InfrastructureBuilder, type InfrastructurePreset, type InputChain, type IntentDiscrepancy, type IntentDiscrepancyKind, JourneyEmotion, type JourneyStep, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, LaidDiagram, LaidEdge, LaidNode, type LayoutWithValidationOptions, type LayoutWithValidationResult, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, type MathFnName, type MindBranch, type MindMapBuilder, type MindMapPreset, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, type NetworkBuilder, type NetworkDevice, type NetworkDeviceKind, type NetworkLink, type NetworkPreset, NodeKind, type OrderEdge, type OrderNode, type OrderResult, type PageLike, type PhaseBuilder, type QuadrantBuilder, type QuadrantItem, type QuadrantPreset, type QuadrantQuadrantLabel, ROW_GAP_VARIANCE_TOL, RowMark, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, type SequenceActor, type SequenceBuilder, type SequenceMessageKind, type SequencePreset, type SequenceStep, Side, Signal, type StateMachine2Builder, type StateMachine2Preset, type StateMachineBuilder, type StateMachinePreset, type SweepReport, type SwimlanePreset, TARGET_LABEL_PATH_DIST, Tone, type TopologyBuilder, type TopologyConnection, type TopologyContainer, type TopologyGroupBuilder, type TopologyPreset, type TreeBuilder, type TreeNode, type TreePreset, type UmlClass, type UmlRelation, type UserJourneyBuilder, type UserJourneyPreset, type ValidateOptions, type ValidationProfile, type VerifyOptions, type Violation, type VisualAxis, type VisualValidationReport, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeScrollProgress, computeStateValues, computeViewportScale, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect, sequence, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
|
3874
|
+
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, type AnimationChain, type AuthorIntentOptions, type AuthorIntentReport, type BinaryOp, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDerivedValue, CdlDiagram, CdlDiagramThumbnail, CdlEdge, type CdlEventHandler, CdlEventTarget, CdlInput, CdlLane, CdlNode, CdlScrollTrigger, CdlState, type ChartBuilder, type ChartDatum, type ChartPreset, type ChartType, type ClassDiagramBuilder, type ClassDiagramPreset, type ClassRelationType, Computed, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, type DerivedNotice, type DerivedNoticeKind, type DerivedResult, type DiagramAdapter, type DiagramBuilder, type Discrepancy, type DiscrepancyKind, type DomVerifyReport, EDGE_LABEL_TEXT, EDGE_STUB_OUT, ER_CARDINALITY_HEAD, EdgeHead, EdgeHeadFill, type EdgeLabelLine, type EdgeLabelTextSpec, EdgeStyle, type ErBuilder, type ErColumn, type ErEntity, type ErPreset, type ErRelation, type ErRelationCardinality, type EventAttachHandle, type EventChain, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, type FlowBuilder, type FlowPreset, type FlowStepInput, type FlowchartBuilder, type FlowchartEdge, type FlowchartNode, type FlowchartNodeShape, type FlowchartPreset, type FormulaAst, type FormulaContext, type FsmMark, type FsmState, type FsmStateAction, type FsmStateNested, type FsmTransition, type FsmTransitionExt, type FunnelBuilder, type FunnelPreset, type FunnelStage, type GanttBuilder, type GanttPreset, type GanttTask, type GenericDiagramSpec, type GenericDiscrepancy, type GenericDiscrepancyKind, type GenericVerifyOptions, type Rect as GeometryRect, type Segment as GeometrySegment, type InfraConnection, type InfraNode, type InfrastructureBuilder, type InfrastructurePreset, type InputChain, type IntentDiscrepancy, type IntentDiscrepancyKind, JourneyEmotion, type JourneyStep, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, LaidDiagram, LaidEdge, LaidNode, type LayoutWithValidationOptions, type LayoutWithValidationResult, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, type MathFnName, type MindBranch, type MindMapBuilder, type MindMapPreset, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, type NetworkBuilder, type NetworkDevice, type NetworkDeviceKind, type NetworkLink, type NetworkPreset, NodeKind, type OrderEdge, type OrderNode, type OrderResult, type PageLike, type PhaseBuilder, type QuadrantBuilder, type QuadrantItem, type QuadrantPreset, type QuadrantQuadrantLabel, ROW_GAP_VARIANCE_TOL, RowMark, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, type SequenceActor, type SequenceBuilder, type SequenceMessageKind, type SequencePreset, type SequenceStep, Side, Signal, type StateMachine2Builder, type StateMachine2Preset, type StateMachineBuilder, type StateMachinePreset, type SweepReport, type SwimlanePreset, TARGET_LABEL_PATH_DIST, Tone, type TopologyBuilder, type TopologyConnection, type TopologyContainer, type TopologyGroupBuilder, type TopologyPreset, type TreeBuilder, type TreeNode, type TreePreset, type UmlClass, type UmlRelation, type UserJourneyBuilder, type UserJourneyPreset, type ValidateOptions, type ValidationProfile, type VerifyOptions, type Violation, type VisualAxis, type VisualValidationReport, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeScrollProgress, computeStateValues, computeViewportScale, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveLabelClearanceAfterPathPasses, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect, sequence, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
package/dist/index.js
CHANGED
|
@@ -13355,6 +13355,234 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
|
|
|
13355
13355
|
edgePathShifts: edgePathShiftMap
|
|
13356
13356
|
};
|
|
13357
13357
|
}
|
|
13358
|
+
function resolveLabelClearanceAfterPathPasses(edges, obstacles, maxIter = 8) {
|
|
13359
|
+
if (edges.length === 0) return edges;
|
|
13360
|
+
const labeledIds = new Set(
|
|
13361
|
+
edges.filter((e) => e.label?.trim() || e.sub?.trim()).map((e) => e.id)
|
|
13362
|
+
);
|
|
13363
|
+
if (labeledIds.size === 0) return edges;
|
|
13364
|
+
const \u7BB1\u305F\u3061 = obstacles.filter((o) => o.kind === "node" || o.kind === "lane-label");
|
|
13365
|
+
const edgeById = /* @__PURE__ */ new Map();
|
|
13366
|
+
for (const e of edges) edgeById.set(e.id, e);
|
|
13367
|
+
const \u533A\u9593cache = /* @__PURE__ */ new Map();
|
|
13368
|
+
const \u533A\u9593 = (id, d) => {
|
|
13369
|
+
const hit = \u533A\u9593cache.get(id);
|
|
13370
|
+
if (hit) return hit;
|
|
13371
|
+
const segs = flattenPathSegments(extractPathSegments(d));
|
|
13372
|
+
\u533A\u9593cache.set(id, segs);
|
|
13373
|
+
return segs;
|
|
13374
|
+
};
|
|
13375
|
+
const \u5916\u63A5cache = /* @__PURE__ */ new Map();
|
|
13376
|
+
const \u5916\u63A5 = (id, d) => {
|
|
13377
|
+
const hit = \u5916\u63A5cache.get(id);
|
|
13378
|
+
if (hit !== void 0) return hit;
|
|
13379
|
+
const segs = \u533A\u9593(id, d);
|
|
13380
|
+
if (segs.length === 0) {
|
|
13381
|
+
\u5916\u63A5cache.set(id, null);
|
|
13382
|
+
return null;
|
|
13383
|
+
}
|
|
13384
|
+
let x1 = Infinity, y1 = Infinity, x2 = -Infinity, y2 = -Infinity;
|
|
13385
|
+
for (const g of segs) {
|
|
13386
|
+
x1 = Math.min(x1, g.x1, g.x2);
|
|
13387
|
+
y1 = Math.min(y1, g.y1, g.y2);
|
|
13388
|
+
x2 = Math.max(x2, g.x1, g.x2);
|
|
13389
|
+
y2 = Math.max(y2, g.y1, g.y2);
|
|
13390
|
+
}
|
|
13391
|
+
const box = { x: x1, y: y1, w: x2 - x1, h: y2 - y1 };
|
|
13392
|
+
\u5916\u63A5cache.set(id, box);
|
|
13393
|
+
return box;
|
|
13394
|
+
};
|
|
13395
|
+
const \u9060\u3044 = (box, edgeId, d, \u4F59\u88D5) => {
|
|
13396
|
+
const b = \u5916\u63A5(edgeId, d);
|
|
13397
|
+
if (!b) return true;
|
|
13398
|
+
const dx = Math.max(0, Math.max(box.x - (b.x + b.w), b.x - (box.x + box.w)));
|
|
13399
|
+
const dy = Math.max(0, Math.max(box.y - (b.y + b.h), b.y - (box.y + box.h)));
|
|
13400
|
+
return Math.hypot(dx, dy) >= \u4F59\u88D5;
|
|
13401
|
+
};
|
|
13402
|
+
const \u6700\u5927\u79FB\u52D5 = CHAIN_SHIFT_MAX_ACCUMULATED * 2;
|
|
13403
|
+
const shiftMap = /* @__PURE__ */ new Map();
|
|
13404
|
+
const getShift = (id) => shiftMap.get(id) ?? { dx: 0, dy: 0 };
|
|
13405
|
+
const labelBBoxes = () => {
|
|
13406
|
+
const out = [];
|
|
13407
|
+
for (const e of edges) {
|
|
13408
|
+
if (!labeledIds.has(e.id)) continue;
|
|
13409
|
+
const base = computeLabelBBoxWorld(e);
|
|
13410
|
+
const s = getShift(e.id);
|
|
13411
|
+
out.push({ kind: "edge-label", id: e.id, x: base.x + s.dx, y: base.y + s.dy, w: base.w, h: base.h });
|
|
13412
|
+
}
|
|
13413
|
+
return out;
|
|
13414
|
+
};
|
|
13415
|
+
const \u96E2\u308C\u91CF = (a, b) => ({
|
|
13416
|
+
x: Math.max(a.x - (b.x + b.w), b.x - (a.x + a.w)),
|
|
13417
|
+
y: Math.max(a.y - (b.y + b.h), b.y - (a.y + a.h))
|
|
13418
|
+
});
|
|
13419
|
+
const \u52D5\u304B\u3057\u305F\u7BB1 = (box, axis, sign, amount) => ({
|
|
13420
|
+
...box,
|
|
13421
|
+
x: box.x + (axis === "x" ? sign * amount : 0),
|
|
13422
|
+
y: box.y + (axis === "y" ? sign * amount : 0)
|
|
13423
|
+
});
|
|
13424
|
+
for (let iter = 0; iter < maxIter; iter += 1) {
|
|
13425
|
+
const labels = labelBBoxes();
|
|
13426
|
+
const \u672D\u306E\u8981\u6C42 = requiredNearClearance("edge-label", "edge-label");
|
|
13427
|
+
let \u52D5\u3044\u305F = false;
|
|
13428
|
+
const \u4ECA\u56DE\u52D5\u304B\u3057\u305F = /* @__PURE__ */ new Set();
|
|
13429
|
+
const \u5B89\u5168\u304B = (label, \u884C\u304D\u5148) => {
|
|
13430
|
+
for (const obs of \u7BB1\u305F\u3061) {
|
|
13431
|
+
const \u524D = computeGap(label, obs);
|
|
13432
|
+
const \u5F8C = computeGap(\u884C\u304D\u5148, obs);
|
|
13433
|
+
if (\u5F8C < Math.min(\u524D, requiredNearClearance("edge-label", obs.kind))) return false;
|
|
13434
|
+
}
|
|
13435
|
+
for (const \u4ED6 of labels) {
|
|
13436
|
+
if (\u4ED6.id === label.id) continue;
|
|
13437
|
+
const \u524D = computeGap(label, \u4ED6);
|
|
13438
|
+
const \u5F8C = computeGap(\u884C\u304D\u5148, \u4ED6);
|
|
13439
|
+
if (\u5F8C < Math.min(\u524D, \u672D\u306E\u8981\u6C42)) return false;
|
|
13440
|
+
}
|
|
13441
|
+
const \u81EA\u5206 = edgeById.get(label.id);
|
|
13442
|
+
const \u81EA\u5206\u306E\u533A\u9593 = \u81EA\u5206 ? \u533A\u9593(\u81EA\u5206.id, \u81EA\u5206.d) : [];
|
|
13443
|
+
if (\u81EA\u5206\u306E\u533A\u9593.length > 0) {
|
|
13444
|
+
const \u524D = measurePathLabelGapSegs(\u81EA\u5206\u306E\u533A\u9593, label);
|
|
13445
|
+
const \u5F8C = measurePathLabelGapSegs(\u81EA\u5206\u306E\u533A\u9593, \u884C\u304D\u5148);
|
|
13446
|
+
if (\u5F8C > Math.max(\u524D, DIST_LABEL_PATH_MAX)) return false;
|
|
13447
|
+
}
|
|
13448
|
+
for (const \u76F8\u624B of edges) {
|
|
13449
|
+
if (\u76F8\u624B.id === label.id) continue;
|
|
13450
|
+
if (\u9060\u3044(label, \u76F8\u624B.id, \u76F8\u624B.d, LABEL_TO_PATH_CLEARANCE) && \u9060\u3044(\u884C\u304D\u5148, \u76F8\u624B.id, \u76F8\u624B.d, LABEL_TO_PATH_CLEARANCE)) continue;
|
|
13451
|
+
const segs = segmentsExcludingOwnPath(\u533A\u9593(\u76F8\u624B.id, \u76F8\u624B.d), \u81EA\u5206\u306E\u533A\u9593);
|
|
13452
|
+
if (segs.length === 0) continue;
|
|
13453
|
+
const \u524D = measurePathLabelGapSegs(segs, label);
|
|
13454
|
+
const \u5F8C = measurePathLabelGapSegs(segs, \u884C\u304D\u5148);
|
|
13455
|
+
if (\u5F8C < Math.min(\u524D, LABEL_TO_PATH_CLEARANCE)) return false;
|
|
13456
|
+
}
|
|
13457
|
+
return true;
|
|
13458
|
+
};
|
|
13459
|
+
const \u9003\u304C\u3059 = (label, \u5019\u88DC) => {
|
|
13460
|
+
for (const c of \u5019\u88DC.slice().sort((a, b) => a.amount - b.amount)) {
|
|
13461
|
+
if (c.amount <= 0) continue;
|
|
13462
|
+
const \u884C\u304D\u5148 = \u52D5\u304B\u3057\u305F\u7BB1(label, c.axis, c.sign, c.amount);
|
|
13463
|
+
if (!\u5B89\u5168\u304B(label, \u884C\u304D\u5148)) continue;
|
|
13464
|
+
const cur = getShift(label.id);
|
|
13465
|
+
const dx = c.axis === "x" ? cur.dx + c.sign * c.amount : cur.dx;
|
|
13466
|
+
const dy = c.axis === "y" ? cur.dy + c.sign * c.amount : cur.dy;
|
|
13467
|
+
if (Math.hypot(dx, dy) > \u6700\u5927\u79FB\u52D5) continue;
|
|
13468
|
+
shiftMap.set(label.id, { dx, dy });
|
|
13469
|
+
\u4ECA\u56DE\u52D5\u304B\u3057\u305F.add(label.id);
|
|
13470
|
+
return true;
|
|
13471
|
+
}
|
|
13472
|
+
return false;
|
|
13473
|
+
};
|
|
13474
|
+
const \u77E9\u5F62\u306E\u5019\u88DC = (label, static\u7BB1, required) => {
|
|
13475
|
+
const sep = \u96E2\u308C\u91CF(label, static\u7BB1);
|
|
13476
|
+
const \u5411\u304D = (axis) => {
|
|
13477
|
+
const a = axis === "x" ? label.x + label.w / 2 : label.y + label.h / 2;
|
|
13478
|
+
const b = axis === "x" ? static\u7BB1.x + static\u7BB1.w / 2 : static\u7BB1.y + static\u7BB1.h / 2;
|
|
13479
|
+
return a >= b ? 1 : -1;
|
|
13480
|
+
};
|
|
13481
|
+
return [
|
|
13482
|
+
{ axis: "x", sign: \u5411\u304D("x"), amount: required - sep.x + NEAR_MISS_MARGIN },
|
|
13483
|
+
{ axis: "y", sign: \u5411\u304D("y"), amount: required - sep.y + NEAR_MISS_MARGIN }
|
|
13484
|
+
];
|
|
13485
|
+
};
|
|
13486
|
+
for (const label of labels) {
|
|
13487
|
+
if (\u4ECA\u56DE\u52D5\u304B\u3057\u305F.has(label.id)) continue;
|
|
13488
|
+
for (const obs of \u7BB1\u305F\u3061) {
|
|
13489
|
+
const required = requiredNearClearance(label.kind, obs.kind);
|
|
13490
|
+
if (required <= 0) continue;
|
|
13491
|
+
if (computeGap(label, obs) >= required) continue;
|
|
13492
|
+
if (\u9003\u304C\u3059(label, \u77E9\u5F62\u306E\u5019\u88DC(label, obs, required))) {
|
|
13493
|
+
\u52D5\u3044\u305F = true;
|
|
13494
|
+
break;
|
|
13495
|
+
}
|
|
13496
|
+
}
|
|
13497
|
+
}
|
|
13498
|
+
const \u672D\u9806 = /* @__PURE__ */ new Map();
|
|
13499
|
+
edges.forEach((e, i) => \u672D\u9806.set(e.id, i));
|
|
13500
|
+
for (let i = 0; i < labels.length; i += 1) {
|
|
13501
|
+
for (let j = i + 1; j < labels.length; j += 1) {
|
|
13502
|
+
const a = labels[i];
|
|
13503
|
+
const b = labels[j];
|
|
13504
|
+
if (computeGap(a, b) >= \u672D\u306E\u8981\u6C42) continue;
|
|
13505
|
+
const aIsLater = \u672D\u9806.get(a.id) > \u672D\u9806.get(b.id);
|
|
13506
|
+
const moveBox = aIsLater ? a : b;
|
|
13507
|
+
const staticBox = aIsLater ? b : a;
|
|
13508
|
+
if (\u4ECA\u56DE\u52D5\u304B\u3057\u305F.has(moveBox.id)) continue;
|
|
13509
|
+
if (\u9003\u304C\u3059(moveBox, \u77E9\u5F62\u306E\u5019\u88DC(moveBox, staticBox, \u672D\u306E\u8981\u6C42))) \u52D5\u3044\u305F = true;
|
|
13510
|
+
}
|
|
13511
|
+
}
|
|
13512
|
+
for (const label of labels) {
|
|
13513
|
+
if (\u4ECA\u56DE\u52D5\u304B\u3057\u305F.has(label.id)) continue;
|
|
13514
|
+
const \u81EA\u5206 = edgeById.get(label.id);
|
|
13515
|
+
if (!\u81EA\u5206) continue;
|
|
13516
|
+
const \u81EA\u5206\u306E\u533A\u9593 = \u533A\u9593(\u81EA\u5206.id, \u81EA\u5206.d);
|
|
13517
|
+
for (const \u4ED6 of edges) {
|
|
13518
|
+
if (\u4ED6.id === label.id) continue;
|
|
13519
|
+
if (\u81EA\u5206.from === \u4ED6.from && \u81EA\u5206.to === \u4ED6.to) continue;
|
|
13520
|
+
if (\u9060\u3044(label, \u4ED6.id, \u4ED6.d, LABEL_TO_PATH_CLEARANCE)) continue;
|
|
13521
|
+
const segs = segmentsExcludingOwnPath(\u533A\u9593(\u4ED6.id, \u4ED6.d), \u81EA\u5206\u306E\u533A\u9593);
|
|
13522
|
+
if (segs.length === 0) continue;
|
|
13523
|
+
const gap = measurePathLabelGapSegs(segs, label);
|
|
13524
|
+
if (gap >= LABEL_TO_PATH_CLEARANCE) continue;
|
|
13525
|
+
const \u82AF = { x: label.x + label.w / 2, y: label.y + label.h / 2 };
|
|
13526
|
+
let \u8FD1\u3044\u70B9 = null;
|
|
13527
|
+
let \u6700\u77ED = Infinity;
|
|
13528
|
+
for (const seg of segs) {
|
|
13529
|
+
for (const \u70B9 of [
|
|
13530
|
+
{ x: seg.x1, y: seg.y1 },
|
|
13531
|
+
{ x: seg.x2, y: seg.y2 },
|
|
13532
|
+
{ x: (seg.x1 + seg.x2) / 2, y: (seg.y1 + seg.y2) / 2 }
|
|
13533
|
+
]) {
|
|
13534
|
+
const d = Math.hypot(\u70B9.x - \u82AF.x, \u70B9.y - \u82AF.y);
|
|
13535
|
+
if (d < \u6700\u77ED) {
|
|
13536
|
+
\u6700\u77ED = d;
|
|
13537
|
+
\u8FD1\u3044\u70B9 = \u70B9;
|
|
13538
|
+
}
|
|
13539
|
+
}
|
|
13540
|
+
}
|
|
13541
|
+
if (!\u8FD1\u3044\u70B9) continue;
|
|
13542
|
+
const \u5FC5\u8981\u91CF = (axis, sign) => {
|
|
13543
|
+
const \u6E80\u305F\u3059 = (\u91CF) => measurePathLabelGapSegs(segs, \u52D5\u304B\u3057\u305F\u7BB1(label, axis, sign, \u91CF)) >= LABEL_TO_PATH_CLEARANCE;
|
|
13544
|
+
let lo = 0;
|
|
13545
|
+
let hi = Math.max(4, LABEL_TO_PATH_CLEARANCE - gap);
|
|
13546
|
+
while (!\u6E80\u305F\u3059(hi)) {
|
|
13547
|
+
if (hi >= \u6700\u5927\u79FB\u52D5) return null;
|
|
13548
|
+
lo = hi;
|
|
13549
|
+
hi = Math.min(hi * 2, \u6700\u5927\u79FB\u52D5);
|
|
13550
|
+
}
|
|
13551
|
+
for (let k = 0; k < 12; k += 1) {
|
|
13552
|
+
const mid = (lo + hi) / 2;
|
|
13553
|
+
if (\u6E80\u305F\u3059(mid)) hi = mid;
|
|
13554
|
+
else lo = mid;
|
|
13555
|
+
}
|
|
13556
|
+
return hi + NEAR_MISS_MARGIN;
|
|
13557
|
+
};
|
|
13558
|
+
const dx = \u82AF.x - \u8FD1\u3044\u70B9.x;
|
|
13559
|
+
const dy = \u82AF.y - \u8FD1\u3044\u70B9.y;
|
|
13560
|
+
const \u5019\u88DC = [];
|
|
13561
|
+
for (const c of [
|
|
13562
|
+
{ axis: "x", sign: dx >= 0 ? 1 : -1 },
|
|
13563
|
+
{ axis: "y", sign: dy >= 0 ? 1 : -1 },
|
|
13564
|
+
// 近い点から離れる向きが塞がれていることがある。 反対向きも候補に入れる。
|
|
13565
|
+
{ axis: "x", sign: dx >= 0 ? -1 : 1 },
|
|
13566
|
+
{ axis: "y", sign: dy >= 0 ? -1 : 1 }
|
|
13567
|
+
]) {
|
|
13568
|
+
const \u91CF = \u5FC5\u8981\u91CF(c.axis, c.sign);
|
|
13569
|
+
if (\u91CF !== null) \u5019\u88DC.push({ ...c, amount: \u91CF });
|
|
13570
|
+
}
|
|
13571
|
+
if (\u9003\u304C\u3059(label, \u5019\u88DC)) {
|
|
13572
|
+
\u52D5\u3044\u305F = true;
|
|
13573
|
+
break;
|
|
13574
|
+
}
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13577
|
+
if (!\u52D5\u3044\u305F) break;
|
|
13578
|
+
}
|
|
13579
|
+
if (shiftMap.size === 0) return edges;
|
|
13580
|
+
return edges.map((e) => {
|
|
13581
|
+
const s = shiftMap.get(e.id);
|
|
13582
|
+
if (!s || s.dx === 0 && s.dy === 0) return e;
|
|
13583
|
+
return { ...e, labelX: e.labelX + s.dx, labelY: e.labelY + s.dy };
|
|
13584
|
+
});
|
|
13585
|
+
}
|
|
13358
13586
|
function applyEdgeLabelAndPathShifts(edges, labelShiftMap, edgePathShiftMap) {
|
|
13359
13587
|
if (labelShiftMap.size === 0 && edgePathShiftMap.size === 0) return edges;
|
|
13360
13588
|
return edges.map((e) => {
|
|
@@ -20369,6 +20597,14 @@ function layout(diag) {
|
|
|
20369
20597
|
hopEdgeCrossings(edges);
|
|
20370
20598
|
repositionParallelLabels(edges, nodesFinal);
|
|
20371
20599
|
slideLabelsAlongOwnPath(edges, nodesFinal);
|
|
20600
|
+
if (!isChainEdgeLabelDisabled()) {
|
|
20601
|
+
edges = resolveLabelClearanceAfterPathPasses(
|
|
20602
|
+
edges,
|
|
20603
|
+
collectBBoxes(containedLanesFinal, nodesFinal, []).filter(
|
|
20604
|
+
(b) => b.kind === "node" || b.kind === "lane-label"
|
|
20605
|
+
)
|
|
20606
|
+
);
|
|
20607
|
+
}
|
|
20372
20608
|
const bboxes = collectBBoxes(containedLanesFinal, nodesFinal, edges);
|
|
20373
20609
|
const collisions = detectCollisions(bboxes, edges);
|
|
20374
20610
|
const nearCollisions = detectNearCollisions(bboxes, edges);
|
|
@@ -31563,6 +31799,6 @@ function slugify(s) {
|
|
|
31563
31799
|
return s.toLowerCase().replace(/[^a-z0-9-ゟ゠-ヿ一-龯]+/g, "-").replace(/^-|-$/g, "");
|
|
31564
31800
|
}
|
|
31565
31801
|
|
|
31566
|
-
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDiagramThumbnail, CdlDiagramView, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, EDGE_HEADS, EDGE_HEAD_DEFAULT, EDGE_HEAD_FILLS, EDGE_HEAD_FILL_DEFAULT, EDGE_LABEL_TEXT, EDGE_REVEALS, EDGE_REVEAL_DEFAULT, EDGE_STUB_OUT, EDGE_STYLES, ER_CARDINALITY_HEAD, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, NODE_KINDS, ROW_GAP_VARIANCE_TOL, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, TARGET_LABEL_PATH_DIST, TONES, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeEventBindingKey, computeFormulaKey, computeInputSignalKey, computeScrollProgress, computeScrollTriggerKey, computeStateValues, computeViewportScale, computed, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, createInteractiveSignalsAccessor, createScrollProgressHandle, createScrollProgressSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, hasInteractivePrimitives, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance2 as pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect2 as segmentsIntersect, sequence, sequenceBoardMetrics, sequenceStepId, signal, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
|
31802
|
+
export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDiagramThumbnail, CdlDiagramView, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, EDGE_HEADS, EDGE_HEAD_DEFAULT, EDGE_HEAD_FILLS, EDGE_HEAD_FILL_DEFAULT, EDGE_LABEL_TEXT, EDGE_REVEALS, EDGE_REVEAL_DEFAULT, EDGE_STUB_OUT, EDGE_STYLES, ER_CARDINALITY_HEAD, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, NODE_KINDS, ROW_GAP_VARIANCE_TOL, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, TARGET_LABEL_PATH_DIST, TONES, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeEventBindingKey, computeFormulaKey, computeInputSignalKey, computeScrollProgress, computeScrollTriggerKey, computeStateValues, computeViewportScale, computed, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, createInteractiveSignalsAccessor, createScrollProgressHandle, createScrollProgressSignals, diagram, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, hasInteractivePrimitives, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance2 as pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveLabelClearanceAfterPathPasses, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect2 as segmentsIntersect, sequence, sequenceBoardMetrics, sequenceStepId, signal, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx };
|
|
31567
31803
|
//# sourceMappingURL=index.js.map
|
|
31568
31804
|
//# sourceMappingURL=index.js.map
|