@cardenelabs/cdl 0.17.1 → 0.18.1

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 CHANGED
@@ -5,6 +5,52 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.18.1] - 2026-08-29
9
+
10
+ ### Fixed
11
+
12
+ - **矢印を伸ばすのは初めて出る段だけにした** (#584)
13
+
14
+ 伸ばすかを「その矢印が光っているか」 で引いていたため、段をまたいで光り続ける図で
15
+ **既に見えている線が段の変わるたびに引き直されて** いた (実測 = 表の図で 3 本とも毎段伸び直す)。
16
+
17
+ 「増えた」 のは 1 度だけなので、動くのも 1 度にする。 段の並びから矢印ごとの初出を求め、
18
+ その段でだけ起点から伸ばす。
19
+
20
+ **隠さない図 (`edgeReveal: "all"`) でも初出は数える**。 `all` は「最初から見せる」 だけの
21
+ 指定で、伸びる動きまで毎段繰り返してよいという意味ではない。
22
+
23
+ 段が矢印を 1 度も名指ししない図では伸ばさない = 初出が無く、いつ伸ばすか決められない。
24
+
25
+ 検査が実際の描画から読めるよう、`data-cdl-drawing` を矢印に出す。
26
+
27
+ ## [0.18.0] - 2026-08-29
28
+
29
+ ### Added
30
+
31
+ - **段が来るまで矢印を描かないようにした** (#582)
32
+
33
+ 段を進めるごとに関係が 1 本ずつ増える図で、**全ての矢印が 1 段目から見えていた**。
34
+ 段が矢印を光らせるとその線だけ引き直されるが、既に見えているので「増えた」 とは読めず、
35
+ 無関係な線がちらついたようにしか見えない (user 実機確認)。
36
+
37
+ 判定は **段が矢印を名指ししているか** で行う。 段のどこかで `activate` に載る矢印は、
38
+ その段が来るまで描かない。 1 度出たら以降は出したままにする = 消える向きの動きは、
39
+ 読み手が「戻った」 と読む。
40
+
41
+ **段が矢印を 1 度も名指ししない図では隠さない**。 そういう図では矢印が骨格そのもので、
42
+ 隠すと図が読めなくなる = 既定を変えても既存の図は動かない。
43
+
44
+ 著者が切り替えられるよう `CdlDiagram.edgeReveal` を足した。
45
+
46
+ | 値 | 何が起きるか |
47
+ |---|---|
48
+ | `phase` (既定) | 段が名指しする矢印は、その段が来るまで描かない |
49
+ | `all` | 段に関わらず最初から全部描く |
50
+
51
+ 書ける値の一覧 (`EDGE_REVEALS`) と既定 (`EDGE_REVEAL_DEFAULT`) を公開する。
52
+ 利用側が手で並べると、値を足した時に書けないまま取り残される。
53
+
8
54
  ## [0.17.1] - 2026-08-29
9
55
 
10
56
  ### Changed
@@ -918,7 +964,9 @@ Initial OSS release.
918
964
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
919
965
  行き止まりになる。
920
966
 
921
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.17.1...HEAD
967
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.18.1...HEAD
968
+ [0.18.1]: https://github.com/cardene777/cdl/compare/v0.18.0...v0.18.1
969
+ [0.18.0]: https://github.com/cardene777/cdl/compare/v0.17.1...v0.18.0
922
970
  [0.17.1]: https://github.com/cardene777/cdl/compare/v0.17.0...v0.17.1
923
971
  [0.17.0]: https://github.com/cardene777/cdl/compare/v0.16.0...v0.17.0
924
972
  [0.16.0]: https://github.com/cardene777/cdl/compare/v0.15.0...v0.16.0
package/dist/index.cjs CHANGED
@@ -15373,6 +15373,8 @@ function layout(diag) {
15373
15373
  states: diag.states,
15374
15374
  phases: diag.phases,
15375
15375
  ...diag.derived ? { derived: diag.derived } : {},
15376
+ // 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
15377
+ ...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
15376
15378
  bboxes,
15377
15379
  collisions,
15378
15380
  nearCollisions,
@@ -15531,6 +15533,8 @@ var EDGE_HEADS = [
15531
15533
  ];
15532
15534
  var EDGE_HEAD_FILL_DEFAULT = "solid";
15533
15535
  var EDGE_HEAD_FILLS = ["solid", "hollow"];
15536
+ var EDGE_REVEALS = ["phase", "all"];
15537
+ var EDGE_REVEAL_DEFAULT = "phase";
15534
15538
 
15535
15539
  // src/anim/core/easing.ts
15536
15540
  function cubicBezier(x1, y1, x2, y2) {
@@ -21270,6 +21274,7 @@ function labelTextOpacity(line) {
21270
21274
  function CdlEdgeView({
21271
21275
  edge,
21272
21276
  active,
21277
+ drawing,
21273
21278
  progress,
21274
21279
  stateValues
21275
21280
  }) {
@@ -21294,6 +21299,7 @@ function CdlEdgeView({
21294
21299
  "data-cdl-from": edge.from,
21295
21300
  "data-cdl-to": edge.to,
21296
21301
  "data-cdl-active": active ? "true" : "false",
21302
+ "data-cdl-drawing": drawing ? "true" : "false",
21297
21303
  "data-cdl-path-d": edge.d,
21298
21304
  "data-cdl-label-x": edge.labelX,
21299
21305
  "data-cdl-label-y": edge.labelY,
@@ -21325,6 +21331,7 @@ function CdlEdgeView({
21325
21331
  {
21326
21332
  edge,
21327
21333
  active,
21334
+ drawing,
21328
21335
  progress,
21329
21336
  color,
21330
21337
  marker,
@@ -21352,6 +21359,7 @@ function CdlEdgeView({
21352
21359
  function SolidEdgePath({
21353
21360
  edge,
21354
21361
  active,
21362
+ drawing,
21355
21363
  progress,
21356
21364
  color,
21357
21365
  marker,
@@ -21359,7 +21367,7 @@ function SolidEdgePath({
21359
21367
  dashed,
21360
21368
  stateValues
21361
21369
  }) {
21362
- const visibleD = active ? pathSubpath(edge.d, progress) : edge.d;
21370
+ const visibleD = drawing ? pathSubpath(edge.d, progress) : edge.d;
21363
21371
  const defaultWidth = active ? 5 : 2.5;
21364
21372
  const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
21365
21373
  const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
@@ -28803,6 +28811,36 @@ function CdlStage({
28803
28811
  svgRef
28804
28812
  }) {
28805
28813
  const activeSet = new Set(currentPhase?.activate ?? []);
28814
+ const \u77E2\u5370\u306E\u51FA\u756A = react.useMemo(() => {
28815
+ const \u521D\u51FA = /* @__PURE__ */ new Map();
28816
+ laid.phases.forEach((p, i) => {
28817
+ for (const id of p.activate ?? []) if (!\u521D\u51FA.has(id)) \u521D\u51FA.set(id, i);
28818
+ });
28819
+ const \u4ECA = currentPhase === void 0 ? -1 : laid.phases.findIndex((p) => p.id === currentPhase.id);
28820
+ const \u96A0\u3059 = (laid.edgeReveal ?? EDGE_REVEAL_DEFAULT) !== "all";
28821
+ return {
28822
+ \u51FA\u308B\u304B: (edgeId) => {
28823
+ if (!\u96A0\u3059) return true;
28824
+ const first = \u521D\u51FA.get(edgeId);
28825
+ if (first === void 0) return true;
28826
+ return \u4ECA < 0 || \u4ECA >= first;
28827
+ },
28828
+ /*
28829
+ * この段で初めて出るか (#584)。
28830
+ *
28831
+ * 起点から伸ばすのはこの段だけ。 光っているかで引くと、段をまたいで光り続ける図で
28832
+ * 既に見えている線が毎段引き直される (実測 = 表の図で 3 本とも段が変わるたびに伸び直した)。
28833
+ *
28834
+ * **隠さない図でも初出は数える**。 `all` は「最初から見せる」 だけの指定で、
28835
+ * 伸びる動きまで毎段繰り返してよいという意味ではない。
28836
+ */
28837
+ \u4F38\u3070\u3059\u304B: (edgeId) => {
28838
+ const first = \u521D\u51FA.get(edgeId);
28839
+ if (first === void 0) return false;
28840
+ return \u4ECA === first;
28841
+ }
28842
+ };
28843
+ }, [laid.phases, currentPhase, laid.edgeReveal]);
28806
28844
  const drawSet = new Set(currentPhase?.draw ?? []);
28807
28845
  const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
28808
28846
  const { lifelineStarts, uniformFooterTop } = react.useMemo(() => {
@@ -28962,7 +29000,17 @@ function CdlStage({
28962
29000
  },
28963
29001
  lane.id
28964
29002
  )),
28965
- laid.edges.map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeView, { edge, active: activeSet.has(edge.id), progress, stateValues }, edge.id)),
29003
+ laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
29004
+ CdlEdgeView,
29005
+ {
29006
+ edge,
29007
+ active: activeSet.has(edge.id),
29008
+ drawing: \u77E2\u5370\u306E\u51FA\u756A.\u4F38\u3070\u3059\u304B(edge.id),
29009
+ progress,
29010
+ stateValues
29011
+ },
29012
+ edge.id
29013
+ )),
28966
29014
  laid.nodes.map((node) => {
28967
29015
  const \u63CF\u304F = drawSet.has(node.id);
28968
29016
  const view = /* @__PURE__ */ jsxRuntime.jsx(
@@ -28978,8 +29026,8 @@ function CdlStage({
28978
29026
  );
28979
29027
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: view }, node.id);
28980
29028
  }),
28981
- laid.edges.filter((edge) => Boolean(edge.dThrough)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
28982
- laid.edges.map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
29029
+ laid.edges.filter((edge) => Boolean(edge.dThrough) && \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
29030
+ laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
28983
29031
  CdlEdgeLabelView,
28984
29032
  {
28985
29033
  edge,
@@ -30565,6 +30613,8 @@ exports.EDGE_HEAD_DEFAULT = EDGE_HEAD_DEFAULT;
30565
30613
  exports.EDGE_HEAD_FILLS = EDGE_HEAD_FILLS;
30566
30614
  exports.EDGE_HEAD_FILL_DEFAULT = EDGE_HEAD_FILL_DEFAULT;
30567
30615
  exports.EDGE_LABEL_TEXT = EDGE_LABEL_TEXT;
30616
+ exports.EDGE_REVEALS = EDGE_REVEALS;
30617
+ exports.EDGE_REVEAL_DEFAULT = EDGE_REVEAL_DEFAULT;
30568
30618
  exports.EDGE_STUB_OUT = EDGE_STUB_OUT;
30569
30619
  exports.EDGE_STYLES = EDGE_STYLES;
30570
30620
  exports.ER_CARDINALITY_HEAD = ER_CARDINALITY_HEAD;