@cardenelabs/cdl 0.59.1 → 0.61.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DpwY2hzM.cjs';
2
- export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-DpwY2hzM.cjs';
1
+ import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-Dk8_6ua6.cjs';
2
+ export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-Dk8_6ua6.cjs';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -917,13 +917,15 @@ type InputChain = {
917
917
  label?: string;
918
918
  }) => DiagramBuilder;
919
919
  dropdown: (id: string, opts: {
920
- options: readonly string[];
920
+ options: readonly CdlInputOption[];
921
921
  defaultValue: string;
922
922
  label?: string;
923
923
  }) => DiagramBuilder;
924
924
  toggle: (id: string, opts: {
925
925
  defaultValue: boolean;
926
926
  label?: string;
927
+ onLabel?: string;
928
+ offLabel?: string;
927
929
  }) => DiagramBuilder;
928
930
  /** 2 軸 slider = XY pad、 単一 id で pointer position を保持 (x/y は同 signal に格納) */
929
931
  xypad: (id: string, opts: {
@@ -945,7 +947,7 @@ type InputChain = {
945
947
  }) => DiagramBuilder;
946
948
  /** 排他選択、 dropdown と同じ semantics だが視覚は横並び button */
947
949
  radio: (id: string, opts: {
948
- options: readonly string[];
950
+ options: readonly CdlInputOption[];
949
951
  defaultValue: string;
950
952
  label?: string;
951
953
  }) => DiagramBuilder;
@@ -975,12 +977,12 @@ type InputChain = {
975
977
  label?: string;
976
978
  }) => DiagramBuilder;
977
979
  multiSelect: (id: string, opts: {
978
- options: readonly string[];
980
+ options: readonly CdlInputOption[];
979
981
  defaultValues: readonly string[];
980
982
  label?: string;
981
983
  }) => DiagramBuilder;
982
984
  tabs: (id: string, opts: {
983
- options: readonly string[];
985
+ options: readonly CdlInputOption[];
984
986
  defaultValue: string;
985
987
  label?: string;
986
988
  }) => DiagramBuilder;
@@ -1170,8 +1172,12 @@ type DiagramBuilder = {
1170
1172
  * consumer が createFormulaComputeds() で computed 化して signal と reactive bind する。
1171
1173
  * expression syntax error は本 method 内で throw (fail-fast)。
1172
1174
  * 例 `.formula("gasFee", "gasBase * (1 + delta/8)")`
1175
+ *
1176
+ * `opts.label` は操作部の式の行に描く名札 (#853)。 例 `.formula("total", "baseFee + tip", { label: "合計" })`
1173
1177
  */
1174
- formula: (id: string, expression: string) => DiagramBuilder;
1178
+ formula: (id: string, expression: string, opts?: {
1179
+ label?: string;
1180
+ }) => DiagramBuilder;
1175
1181
  /**
1176
1182
  * derive chain = 「連鎖形 formula」 を N 個宣言的に生成 (CAR: derive chain)。
1177
1183
  * 各 iteration で `{i}` 置換と、 直前 iteration の id (`prev`) を参照可能。
@@ -1181,8 +1187,12 @@ type DiagramBuilder = {
1181
1187
  *
1182
1188
  * baseId は「gas1 / gas2 / gas3」 のように `gas${i+1}` として使われる、
1183
1189
  * expr fn は index (0..count-1) と prev id (前 iteration の完全 id) を受け取る。
1190
+ *
1191
+ * `opts.label` は index を受け取り、その式の名札を返す (#853)。 例 `{ label: (i) => \`${i + 1} 回目\` }`
1184
1192
  */
1185
- deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string) => DiagramBuilder;
1193
+ deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string, opts?: {
1194
+ label?: (i: number) => string;
1195
+ }) => DiagramBuilder;
1186
1196
  /**
1187
1197
  * animation primitive (CAR #245)。 `.animation.scroll(id, opts)` で scroll-driven trigger を追加。
1188
1198
  * 将来的に `.animation.time(...)` 等の time-based primitive を追加する余地を残す namespace。
@@ -3917,6 +3927,14 @@ interface 関係を持つ線 {
3917
3927
  */
3918
3928
  declare function relatedFocusSet(edges: readonly 関係を持つ線[], nodeId: string): Set<string>;
3919
3929
 
3930
+ /** 1 つの入力欄の値ごとの名前。 `複数` は値を `,` でつないで持つ入力欄 (`multi-select`) */
3931
+ type 入力欄の名前 = {
3932
+ readonly 名前: ReadonlyMap<string, string>;
3933
+ readonly 複数: boolean;
3934
+ };
3935
+ /** 入力欄の id → 値ごとの名前の表。 名前を持つ入力欄だけを載せる */
3936
+ type 値の名前の表 = ReadonlyMap<string, 入力欄の名前>;
3937
+
3920
3938
  /**
3921
3939
  * 全 state の現時点 value を計算 (現在 phase + これまでの phase の最終 tween 値を集約)。
3922
3940
  * - set = 即時切替 (phase 到達で value 上書き、 lerp なし)
@@ -3936,7 +3954,11 @@ declare function computeStateValues(laid: LaidDiagram, phaseIdx: number, progres
3936
3954
  *
3937
3955
  * 名前に使える文字は `template-name.ts` が決める (engine 全体で 1 つ)。 ここだけで
3938
3956
  * 定義すると、 式を書ける側との間で「読めるが書けない」 「書けるが読めない」 名前ができる。
3957
+ *
3958
+ * `名前の表` を渡すと、 付け足しの無い `{id}` の値を入力欄の値ごとの名前で差し込む (#855)。
3959
+ * 渡すのは画面に字を描く所 (箱の題・副題・見出し・値・行) だけ。 表示の出し分けと数の差し込みは
3960
+ * 値を綴りのまま読む必要があるので渡さない。
3939
3961
  */
3940
- declare function interpolate(template: string, values: Record<string, string>): string;
3962
+ declare function interpolate(template: string, values: Record<string, string>, 名前の表?: 値の名前の表): string;
3941
3963
 
3942
- 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, CdlLang, 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, type ReferenceContainer, 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, relatedFocusSet, 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, type 関係を持つ線 };
3964
+ 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, CdlInputOption, CdlLane, CdlLang, 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, type ReferenceContainer, 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, relatedFocusSet, 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, type 関係を持つ線 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DpwY2hzM.js';
2
- export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-DpwY2hzM.js';
1
+ import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-Dk8_6ua6.js';
2
+ export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-Dk8_6ua6.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -917,13 +917,15 @@ type InputChain = {
917
917
  label?: string;
918
918
  }) => DiagramBuilder;
919
919
  dropdown: (id: string, opts: {
920
- options: readonly string[];
920
+ options: readonly CdlInputOption[];
921
921
  defaultValue: string;
922
922
  label?: string;
923
923
  }) => DiagramBuilder;
924
924
  toggle: (id: string, opts: {
925
925
  defaultValue: boolean;
926
926
  label?: string;
927
+ onLabel?: string;
928
+ offLabel?: string;
927
929
  }) => DiagramBuilder;
928
930
  /** 2 軸 slider = XY pad、 単一 id で pointer position を保持 (x/y は同 signal に格納) */
929
931
  xypad: (id: string, opts: {
@@ -945,7 +947,7 @@ type InputChain = {
945
947
  }) => DiagramBuilder;
946
948
  /** 排他選択、 dropdown と同じ semantics だが視覚は横並び button */
947
949
  radio: (id: string, opts: {
948
- options: readonly string[];
950
+ options: readonly CdlInputOption[];
949
951
  defaultValue: string;
950
952
  label?: string;
951
953
  }) => DiagramBuilder;
@@ -975,12 +977,12 @@ type InputChain = {
975
977
  label?: string;
976
978
  }) => DiagramBuilder;
977
979
  multiSelect: (id: string, opts: {
978
- options: readonly string[];
980
+ options: readonly CdlInputOption[];
979
981
  defaultValues: readonly string[];
980
982
  label?: string;
981
983
  }) => DiagramBuilder;
982
984
  tabs: (id: string, opts: {
983
- options: readonly string[];
985
+ options: readonly CdlInputOption[];
984
986
  defaultValue: string;
985
987
  label?: string;
986
988
  }) => DiagramBuilder;
@@ -1170,8 +1172,12 @@ type DiagramBuilder = {
1170
1172
  * consumer が createFormulaComputeds() で computed 化して signal と reactive bind する。
1171
1173
  * expression syntax error は本 method 内で throw (fail-fast)。
1172
1174
  * 例 `.formula("gasFee", "gasBase * (1 + delta/8)")`
1175
+ *
1176
+ * `opts.label` は操作部の式の行に描く名札 (#853)。 例 `.formula("total", "baseFee + tip", { label: "合計" })`
1173
1177
  */
1174
- formula: (id: string, expression: string) => DiagramBuilder;
1178
+ formula: (id: string, expression: string, opts?: {
1179
+ label?: string;
1180
+ }) => DiagramBuilder;
1175
1181
  /**
1176
1182
  * derive chain = 「連鎖形 formula」 を N 個宣言的に生成 (CAR: derive chain)。
1177
1183
  * 各 iteration で `{i}` 置換と、 直前 iteration の id (`prev`) を参照可能。
@@ -1181,8 +1187,12 @@ type DiagramBuilder = {
1181
1187
  *
1182
1188
  * baseId は「gas1 / gas2 / gas3」 のように `gas${i+1}` として使われる、
1183
1189
  * expr fn は index (0..count-1) と prev id (前 iteration の完全 id) を受け取る。
1190
+ *
1191
+ * `opts.label` は index を受け取り、その式の名札を返す (#853)。 例 `{ label: (i) => \`${i + 1} 回目\` }`
1184
1192
  */
1185
- deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string) => DiagramBuilder;
1193
+ deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string, opts?: {
1194
+ label?: (i: number) => string;
1195
+ }) => DiagramBuilder;
1186
1196
  /**
1187
1197
  * animation primitive (CAR #245)。 `.animation.scroll(id, opts)` で scroll-driven trigger を追加。
1188
1198
  * 将来的に `.animation.time(...)` 等の time-based primitive を追加する余地を残す namespace。
@@ -3917,6 +3927,14 @@ interface 関係を持つ線 {
3917
3927
  */
3918
3928
  declare function relatedFocusSet(edges: readonly 関係を持つ線[], nodeId: string): Set<string>;
3919
3929
 
3930
+ /** 1 つの入力欄の値ごとの名前。 `複数` は値を `,` でつないで持つ入力欄 (`multi-select`) */
3931
+ type 入力欄の名前 = {
3932
+ readonly 名前: ReadonlyMap<string, string>;
3933
+ readonly 複数: boolean;
3934
+ };
3935
+ /** 入力欄の id → 値ごとの名前の表。 名前を持つ入力欄だけを載せる */
3936
+ type 値の名前の表 = ReadonlyMap<string, 入力欄の名前>;
3937
+
3920
3938
  /**
3921
3939
  * 全 state の現時点 value を計算 (現在 phase + これまでの phase の最終 tween 値を集約)。
3922
3940
  * - set = 即時切替 (phase 到達で value 上書き、 lerp なし)
@@ -3936,7 +3954,11 @@ declare function computeStateValues(laid: LaidDiagram, phaseIdx: number, progres
3936
3954
  *
3937
3955
  * 名前に使える文字は `template-name.ts` が決める (engine 全体で 1 つ)。 ここだけで
3938
3956
  * 定義すると、 式を書ける側との間で「読めるが書けない」 「書けるが読めない」 名前ができる。
3957
+ *
3958
+ * `名前の表` を渡すと、 付け足しの無い `{id}` の値を入力欄の値ごとの名前で差し込む (#855)。
3959
+ * 渡すのは画面に字を描く所 (箱の題・副題・見出し・値・行) だけ。 表示の出し分けと数の差し込みは
3960
+ * 値を綴りのまま読む必要があるので渡さない。
3939
3961
  */
3940
- declare function interpolate(template: string, values: Record<string, string>): string;
3962
+ declare function interpolate(template: string, values: Record<string, string>, 名前の表?: 値の名前の表): string;
3941
3963
 
3942
- 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, CdlLang, 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, type ReferenceContainer, 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, relatedFocusSet, 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, type 関係を持つ線 };
3964
+ 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, CdlInputOption, CdlLane, CdlLang, 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, type ReferenceContainer, 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, relatedFocusSet, 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, type 関係を持つ線 };
package/dist/index.js CHANGED
@@ -753,7 +753,7 @@ function tokenize(src) {
753
753
  `invalid name "{${name}}" at position ${start} (\u7A7A\u767D / { } / . / [ ] \u306F\u540D\u524D\u306B\u4F7F\u3048\u306A\u3044)`
754
754
  );
755
755
  }
756
- tokens.push({ kind: "id", name, pos: start });
756
+ tokens.push({ kind: "id", name, pos: start, end: close + 1 });
757
757
  i = close + 1;
758
758
  continue;
759
759
  }
@@ -802,7 +802,7 @@ function tokenize(src) {
802
802
  `property access "${name}.${src[i + 1] ?? ""}..." at position ${start} is not allowed (only Math.* namespace is accessible)`
803
803
  );
804
804
  }
805
- tokens.push({ kind: "id", name, pos: start });
805
+ tokens.push({ kind: "id", name, pos: start, end: i });
806
806
  continue;
807
807
  }
808
808
  if (c === "+") {
@@ -1027,6 +1027,24 @@ function parseFormula(expression) {
1027
1027
  }
1028
1028
  return new Parser(tokens).parse();
1029
1029
  }
1030
+ function \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(expression, \u540D\u672D) {
1031
+ let tokens;
1032
+ try {
1033
+ tokens = tokenize(expression);
1034
+ } catch {
1035
+ return expression;
1036
+ }
1037
+ let \u8AAD\u307F = "";
1038
+ let \u524D = 0;
1039
+ for (const t of tokens) {
1040
+ if (t.kind !== "id") continue;
1041
+ const \u672D = \u540D\u672D.get(t.name);
1042
+ if (\u672D === void 0 || \u672D === "") continue;
1043
+ \u8AAD\u307F += expression.slice(\u524D, t.pos) + \u672D;
1044
+ \u524D = t.end;
1045
+ }
1046
+ return \u8AAD\u307F + expression.slice(\u524D);
1047
+ }
1030
1048
  function extractIdentifiers(ast, out = /* @__PURE__ */ new Set()) {
1031
1049
  switch (ast.type) {
1032
1050
  case "number":
@@ -1571,6 +1589,34 @@ function warn(message) {
1571
1589
  }
1572
1590
  }
1573
1591
 
1592
+ // src/input-option.ts
1593
+ function \u9078\u629E\u80A2\u306E\u5024(option) {
1594
+ return typeof option === "string" ? option : option.value;
1595
+ }
1596
+ function \u9078\u629E\u80A2\u306E\u540D\u524D(option) {
1597
+ return typeof option === "string" || option.label === "" ? \u9078\u629E\u80A2\u306E\u5024(option) : option.label;
1598
+ }
1599
+ function \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(inputs) {
1600
+ const \u8868 = /* @__PURE__ */ new Map();
1601
+ for (const input of inputs ?? []) {
1602
+ const \u540D\u524D = /* @__PURE__ */ new Map();
1603
+ if (input.kind === "dropdown" || input.kind === "radio" || input.kind === "tabs" || input.kind === "multi-select") {
1604
+ for (const option of input.options) {
1605
+ if (typeof option !== "string" && option.label !== "") \u540D\u524D.set(option.value, option.label);
1606
+ }
1607
+ } else if (input.kind === "toggle") {
1608
+ if (input.onLabel) \u540D\u524D.set("true", input.onLabel);
1609
+ if (input.offLabel) \u540D\u524D.set("false", input.offLabel);
1610
+ }
1611
+ if (\u540D\u524D.size > 0) \u8868.set(input.id, { \u540D\u524D, \u8907\u6570: input.kind === "multi-select" });
1612
+ }
1613
+ return \u8868;
1614
+ }
1615
+ function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024) {
1616
+ if (!\u5165\u529B\u6B04.\u8907\u6570) return \u5165\u529B\u6B04.\u540D\u524D.get(\u5024) ?? \u5024;
1617
+ return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
1618
+ }
1619
+
1574
1620
  // src/kinds/text-width.ts
1575
1621
  var WIDE_RATIO = 1.04;
1576
1622
  var NARROW_RATIO = 0.37;
@@ -1980,6 +2026,8 @@ function useInteractiveIntegration(diagram2, options = {}) {
1980
2026
  const readouts = diagram2.readouts ?? [];
1981
2027
  if (inputs.length === 0 && scrolls.length === 0 && formulasList.length === 0 && readouts.length === 0)
1982
2028
  return null;
2029
+ const \u540D\u672D = /* @__PURE__ */ new Map();
2030
+ for (const x of [...inputs, ...formulasList]) if (x.label) \u540D\u672D.set(x.id, x.label);
1983
2031
  return (
1984
2032
  // 操作部の中の読み出しと入力欄へ、図の言語を届ける (#849)。 型の外の値は英語に落ちる
1985
2033
  /* @__PURE__ */ jsx(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E.Provider, { value: resolveLang(diagram2.lang), children: /* @__PURE__ */ jsxs("div", { className: "cdl-ip-root", "data-cdl-interactive-panel": "true", children: [
@@ -1988,12 +2036,13 @@ function useInteractiveIntegration(diagram2, options = {}) {
1988
2036
  FormulaReadout,
1989
2037
  {
1990
2038
  id: f.id,
1991
- expression: f.expression,
2039
+ name: f.label || f.id,
2040
+ expression: f.label ? \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(f.expression, \u540D\u672D) : f.expression,
1992
2041
  value: stateOverrides[f.id]
1993
2042
  },
1994
2043
  f.id
1995
2044
  )) }),
1996
- scrolls.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsx(ScrollReadout, { id: s.id, progress: stateOverrides[s.id] }, s.id)) }),
2045
+ scrolls.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsx(ScrollReadout, { id: s.id, name: s.label || s.id, progress: stateOverrides[s.id] }, s.id)) }),
1997
2046
  readouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsx(ReadoutWidget, { readout: r, stateOverrides: mergedStateValues }, r.id)) })
1998
2047
  ] }) })
1999
2048
  );
@@ -2076,7 +2125,7 @@ function InputWidget({
2076
2125
  },
2077
2126
  "data-cdl-input": input.id,
2078
2127
  className: "cdl-ip-dropdown-select",
2079
- children: input.options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
2128
+ children: input.options.map((opt) => /* @__PURE__ */ jsx("option", { value: \u9078\u629E\u80A2\u306E\u5024(opt), children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) }, \u9078\u629E\u80A2\u306E\u5024(opt)))
2080
2129
  }
2081
2130
  )
2082
2131
  ] });
@@ -2093,17 +2142,17 @@ function InputWidget({
2093
2142
  {
2094
2143
  type: "radio",
2095
2144
  name: input.id,
2096
- value: opt,
2097
- checked: value === opt,
2145
+ value: \u9078\u629E\u80A2\u306E\u5024(opt),
2146
+ checked: value === \u9078\u629E\u80A2\u306E\u5024(opt),
2098
2147
  onChange: () => {
2099
- signal2.value = opt;
2148
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
2100
2149
  },
2101
2150
  "data-cdl-input": input.id,
2102
2151
  className: "cdl-ip-radio-input"
2103
2152
  }
2104
2153
  ),
2105
- /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: opt })
2106
- ] }, opt)) })
2154
+ /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) })
2155
+ ] }, \u9078\u629E\u80A2\u306E\u5024(opt))) })
2107
2156
  ] });
2108
2157
  case "color":
2109
2158
  return /* @__PURE__ */ jsxs("label", { className: "cdl-ip-item cdl-ip-color", "data-cdl-input-kind": "color", children: [
@@ -2153,14 +2202,14 @@ function InputWidget({
2153
2202
  {
2154
2203
  type: "button",
2155
2204
  role: "tab",
2156
- className: `cdl-ip-tabs-btn ${value === opt ? "cdl-ip-tabs-active" : ""}`,
2205
+ className: `cdl-ip-tabs-btn ${value === \u9078\u629E\u80A2\u306E\u5024(opt) ? "cdl-ip-tabs-active" : ""}`,
2157
2206
  onClick: () => {
2158
- signal2.value = opt;
2207
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
2159
2208
  },
2160
2209
  "data-cdl-input": input.id,
2161
- children: opt
2210
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
2162
2211
  },
2163
- opt
2212
+ \u9078\u629E\u80A2\u306E\u5024(opt)
2164
2213
  )) })
2165
2214
  ] });
2166
2215
  case "datetime":
@@ -2250,11 +2299,12 @@ function NumberInputWidget({
2250
2299
  }
2251
2300
  function FormulaReadout({
2252
2301
  id,
2302
+ name,
2253
2303
  expression,
2254
2304
  value
2255
2305
  }) {
2256
2306
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-formula", "data-cdl-formula": id, children: [
2257
- /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: id }),
2307
+ /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
2258
2308
  /* @__PURE__ */ jsxs("code", { className: "cdl-ip-formula-expr", children: [
2259
2309
  "= ",
2260
2310
  expression
@@ -2262,11 +2312,11 @@ function FormulaReadout({
2262
2312
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-formula-value", children: String(value ?? "") })
2263
2313
  ] });
2264
2314
  }
2265
- function ScrollReadout({ id, progress }) {
2315
+ function ScrollReadout({ id, name, progress }) {
2266
2316
  const p = typeof progress === "number" ? progress : 0;
2267
2317
  const pct = Math.round(p * 100);
2268
2318
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-scroll", "data-cdl-scroll": id, children: [
2269
- /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: id }),
2319
+ /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
2270
2320
  /* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-track", children: /* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-fill", style: { width: `${pct}%` } }) }),
2271
2321
  /* @__PURE__ */ jsxs("span", { className: "cdl-ip-scroll-value", children: [
2272
2322
  pct,
@@ -4214,13 +4264,13 @@ function MultiSelectWidget({
4214
4264
  "button",
4215
4265
  {
4216
4266
  type: "button",
4217
- className: `cdl-ip-multi-select-chip ${selected.has(opt) ? "cdl-ip-multi-select-active" : ""}`,
4218
- onClick: () => toggle(opt),
4267
+ className: `cdl-ip-multi-select-chip ${selected.has(\u9078\u629E\u80A2\u306E\u5024(opt)) ? "cdl-ip-multi-select-active" : ""}`,
4268
+ onClick: () => toggle(\u9078\u629E\u80A2\u306E\u5024(opt)),
4219
4269
  "data-cdl-input": input.id,
4220
- "data-cdl-multi-value": opt,
4221
- children: opt
4270
+ "data-cdl-multi-value": \u9078\u629E\u80A2\u306E\u5024(opt),
4271
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
4222
4272
  },
4223
- opt
4273
+ \u9078\u629E\u80A2\u306E\u5024(opt)
4224
4274
  )) })
4225
4275
  ] });
4226
4276
  }
@@ -10106,9 +10156,9 @@ function diagram(id, options) {
10106
10156
  if (opts.options.length === 0) {
10107
10157
  throw new Error(`input.dropdown '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059 (\u6700\u4F4E 1 \u4EF6\u5FC5\u8981)`);
10108
10158
  }
10109
- if (!opts.options.includes(opts.defaultValue)) {
10159
+ if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
10110
10160
  throw new Error(
10111
- `input.dropdown '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093 (options: ${opts.options.join(", ")})`
10161
+ `input.dropdown '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093 (options: ${opts.options.map(\u9078\u629E\u80A2\u306E\u5024).join(", ")})`
10112
10162
  );
10113
10163
  }
10114
10164
  inputs.push({
@@ -10126,6 +10176,9 @@ function diagram(id, options) {
10126
10176
  id: inputId,
10127
10177
  kind: "toggle",
10128
10178
  defaultValue: opts.defaultValue,
10179
+ // 名前を渡さない切り替えは変更前と同じ形に保つ (空の名前も渡さないのと同じ)
10180
+ ...opts.onLabel ? { onLabel: opts.onLabel } : {},
10181
+ ...opts.offLabel ? { offLabel: opts.offLabel } : {},
10129
10182
  label: opts.label
10130
10183
  });
10131
10184
  return api;
@@ -10193,9 +10246,9 @@ function diagram(id, options) {
10193
10246
  if (opts.options.length === 0) {
10194
10247
  throw new Error(`input.radio '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059`);
10195
10248
  }
10196
- if (!opts.options.includes(opts.defaultValue)) {
10249
+ if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
10197
10250
  throw new Error(
10198
- `input.radio '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093`
10251
+ `input.radio '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093`
10199
10252
  );
10200
10253
  }
10201
10254
  inputs.push({
@@ -10280,8 +10333,8 @@ function diagram(id, options) {
10280
10333
  if (opts.options.length === 0) {
10281
10334
  throw new Error(`input.tabs '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059`);
10282
10335
  }
10283
- if (!opts.options.includes(opts.defaultValue)) {
10284
- throw new Error(`input.tabs '${inputId}' \u306E defaultValue \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093`);
10336
+ if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
10337
+ throw new Error(`input.tabs '${inputId}' \u306E defaultValue \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093`);
10285
10338
  }
10286
10339
  inputs.push({
10287
10340
  id: inputId,
@@ -10315,7 +10368,7 @@ function diagram(id, options) {
10315
10368
  return api;
10316
10369
  }
10317
10370
  },
10318
- formula(formulaId, expression) {
10371
+ formula(formulaId, expression, opts) {
10319
10372
  assertUniqueFormulaId(formulaId);
10320
10373
  try {
10321
10374
  parseFormula(expression);
@@ -10323,10 +10376,10 @@ function diagram(id, options) {
10323
10376
  const msg = e instanceof Error ? e.message : String(e);
10324
10377
  throw new Error(`formula '${formulaId}' \u306E expression syntax error: ${msg}`);
10325
10378
  }
10326
- formulas.push({ id: formulaId, expression });
10379
+ formulas.push({ id: formulaId, expression, ...opts?.label ? { label: opts.label } : {} });
10327
10380
  return api;
10328
10381
  },
10329
- deriveChain(baseId, count, exprFn) {
10382
+ deriveChain(baseId, count, exprFn, opts) {
10330
10383
  if (!Number.isInteger(count) || count < 1 || count > 100) {
10331
10384
  throw new Error(`deriveChain: count (${count}) \u306F 1..100 \u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`);
10332
10385
  }
@@ -10342,7 +10395,8 @@ function diagram(id, options) {
10342
10395
  const msg = e instanceof Error ? e.message : String(e);
10343
10396
  throw new Error(`deriveChain '${id2}' \u306E expression syntax error: ${msg}`);
10344
10397
  }
10345
- formulas.push({ id: id2, expression: expr });
10398
+ const label = opts?.label?.(i);
10399
+ formulas.push({ id: id2, expression: expr, ...label ? { label } : {} });
10346
10400
  prev = id2;
10347
10401
  }
10348
10402
  return api;
@@ -14911,11 +14965,14 @@ function mergeStateValues(base, overrides) {
14911
14965
  }
14912
14966
  return merged;
14913
14967
  }
14914
- function interpolate(template, values) {
14968
+ function interpolate(template, values, \u540D\u524D\u306E\u8868) {
14915
14969
  return template.replace(TEMPLATE_REF_RE, (_, id, accessor) => {
14916
14970
  const raw = Object.hasOwn(values, id) ? values[id] : void 0;
14917
14971
  if (raw === void 0) return `{${id}${accessor ?? ""}}`;
14918
- if (!accessor) return raw;
14972
+ if (!accessor) {
14973
+ const \u5165\u529B\u6B04 = \u540D\u524D\u306E\u8868?.get(id);
14974
+ return \u5165\u529B\u6B04 ? \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, raw) : raw;
14975
+ }
14919
14976
  const arr = parseArraySignal(raw);
14920
14977
  if (!arr) return `{${id}${accessor}}`;
14921
14978
  if (accessor === ".length") return String(arr.length);
@@ -24559,7 +24616,8 @@ function GenericNode({
24559
24616
  node,
24560
24617
  active,
24561
24618
  value,
24562
- stateValues
24619
+ stateValues,
24620
+ \u5024\u306E\u540D\u524D
24563
24621
  }) {
24564
24622
  const base = STYLES[node.kind] ?? FALLBACK;
24565
24623
  const toned = toneColor3(node.tone);
@@ -24645,7 +24703,7 @@ function GenericNode({
24645
24703
  style.look === "ledger" && /* @__PURE__ */ jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
24646
24704
  ] });
24647
24705
  })();
24648
- const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
24706
+ const resolvedValue = value !== void 0 ? interpolate(value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
24649
24707
  const hasRows = (node.rows?.length ?? 0) > 0;
24650
24708
  const centered = genericTextCentered(node.kind, hasRows);
24651
24709
  const textAnchor = centered ? "middle" : "start";
@@ -24695,7 +24753,7 @@ function GenericNode({
24695
24753
  }
24696
24754
  ),
24697
24755
  node.rows && node.rows.length > 0 && (() => {
24698
- const resolved = node.rows.map((row) => interpolate(row, stateValues));
24756
+ const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
24699
24757
  const splits = resolved.map(splitRow);
24700
24758
  const leftMaxWidth = splits.reduce(
24701
24759
  (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
@@ -31360,10 +31418,11 @@ function CdlNodeView({
31360
31418
  currentPhaseId,
31361
31419
  chartLineScale,
31362
31420
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
31363
- lang
31421
+ lang,
31422
+ \u5024\u306E\u540D\u524D
31364
31423
  }) {
31365
- const value = node.value ? interpolate(node.value, stateValues) : void 0;
31366
- const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
31424
+ const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
31425
+ const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues, \u5024\u306E\u540D\u524D));
31367
31426
  const boundW = node.wBind ? resolveNumericAttr(node.wBind, stateValues, node.w) : node.w;
31368
31427
  const boundH = node.hBind ? resolveNumericAttr(node.hBind, stateValues, node.h) : node.h;
31369
31428
  const boundOpacity = node.opacity !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(node.opacity, stateValues, 1))) : void 0;
@@ -31377,9 +31436,9 @@ function CdlNodeView({
31377
31436
  }
31378
31437
  const resolvedNode = {
31379
31438
  ...node,
31380
- title: interpolate(node.title, stateValues),
31381
- subtitle: node.subtitle ? interpolate(node.subtitle, stateValues) : node.subtitle,
31382
- eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues) : node.eyebrow,
31439
+ title: interpolate(node.title, stateValues, \u5024\u306E\u540D\u524D),
31440
+ subtitle: node.subtitle ? interpolate(node.subtitle, stateValues, \u5024\u306E\u540D\u524D) : node.subtitle,
31441
+ eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues, \u5024\u306E\u540D\u524D) : node.eyebrow,
31383
31442
  w: boundW,
31384
31443
  h: boundH
31385
31444
  };
@@ -31660,7 +31719,7 @@ function CdlNodeView({
31660
31719
  case "mark-end":
31661
31720
  return /* @__PURE__ */ jsx(MarkEndNode, { node: resolvedNode, active });
31662
31721
  default:
31663
- return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
31722
+ return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
31664
31723
  }
31665
31724
  })();
31666
31725
  const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
@@ -31742,7 +31801,8 @@ function CdlStage({
31742
31801
  stateValues,
31743
31802
  debug,
31744
31803
  compact = false,
31745
- svgRef
31804
+ svgRef,
31805
+ \u5024\u306E\u540D\u524D
31746
31806
  }) {
31747
31807
  const [\u7126\u70B9, set\u7126\u70B9] = useState(null);
31748
31808
  const \u95A2\u4FC2\u3092\u5149\u3089\u305B\u308B = (laid.relationFocus ?? RELATION_FOCUS_DEFAULT) === "hover";
@@ -32022,6 +32082,7 @@ function CdlStage({
32022
32082
  drawing: \u63CF\u304F,
32023
32083
  progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
32024
32084
  stateValues,
32085
+ \u5024\u306E\u540D\u524D,
32025
32086
  currentPhaseId: currentPhase?.id,
32026
32087
  chartLineScale: chartLineScales.get(node.id)
32027
32088
  }
@@ -32263,6 +32324,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
32263
32324
  if (!isInteractive) return baseStateValues;
32264
32325
  return mergeStateValues(baseStateValues, interactive.stateOverrides);
32265
32326
  }, [isInteractive, baseStateValues, interactive.stateOverrides]);
32327
+ const \u5024\u306E\u540D\u524D = useMemo(() => \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(diagram2.inputs), [diagram2.inputs]);
32266
32328
  return /* @__PURE__ */ jsxs(
32267
32329
  "div",
32268
32330
  {
@@ -32291,7 +32353,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
32291
32353
  }
32292
32354
  ),
32293
32355
  isInteractive && interactive.panel,
32294
- /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
32356
+ /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, \u5024\u306E\u540D\u524D, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
32295
32357
  hideHeader && !hideMiniPhaseIndicator && currentPhase && laid.phases.length > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-[var(--cdl-divider,#d4d4d8)]/40 bg-[var(--cdl-stage-bg,#f1f5f9)]/50 px-3 py-2 text-xs", children: [
32296
32358
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
32297
32359
  laid.phases.map((p, i) => /* @__PURE__ */ jsx(