@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/dist/react.cjs CHANGED
@@ -4037,6 +4037,8 @@ function layout(diag) {
4037
4037
  states: diag.states,
4038
4038
  phases: diag.phases,
4039
4039
  ...diag.derived ? { derived: diag.derived } : {},
4040
+ // 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
4041
+ ...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
4040
4042
  bboxes,
4041
4043
  collisions,
4042
4044
  nearCollisions,
@@ -4194,6 +4196,7 @@ var EDGE_HEADS = [
4194
4196
  ];
4195
4197
  var EDGE_HEAD_FILL_DEFAULT = "solid";
4196
4198
  var EDGE_HEAD_FILLS = ["solid", "hollow"];
4199
+ var EDGE_REVEAL_DEFAULT = "phase";
4197
4200
 
4198
4201
  // src/formula/evaluator.ts
4199
4202
  function evaluate(ast, ctxOrResolver) {
@@ -5573,6 +5576,7 @@ function labelTextOpacity(line) {
5573
5576
  function CdlEdgeView({
5574
5577
  edge,
5575
5578
  active,
5579
+ drawing,
5576
5580
  progress,
5577
5581
  stateValues
5578
5582
  }) {
@@ -5597,6 +5601,7 @@ function CdlEdgeView({
5597
5601
  "data-cdl-from": edge.from,
5598
5602
  "data-cdl-to": edge.to,
5599
5603
  "data-cdl-active": active ? "true" : "false",
5604
+ "data-cdl-drawing": drawing ? "true" : "false",
5600
5605
  "data-cdl-path-d": edge.d,
5601
5606
  "data-cdl-label-x": edge.labelX,
5602
5607
  "data-cdl-label-y": edge.labelY,
@@ -5628,6 +5633,7 @@ function CdlEdgeView({
5628
5633
  {
5629
5634
  edge,
5630
5635
  active,
5636
+ drawing,
5631
5637
  progress,
5632
5638
  color,
5633
5639
  marker,
@@ -5655,6 +5661,7 @@ function CdlEdgeView({
5655
5661
  function SolidEdgePath({
5656
5662
  edge,
5657
5663
  active,
5664
+ drawing,
5658
5665
  progress,
5659
5666
  color,
5660
5667
  marker,
@@ -5662,7 +5669,7 @@ function SolidEdgePath({
5662
5669
  dashed,
5663
5670
  stateValues
5664
5671
  }) {
5665
- const visibleD = active ? pathSubpath(edge.d, progress) : edge.d;
5672
+ const visibleD = drawing ? pathSubpath(edge.d, progress) : edge.d;
5666
5673
  const defaultWidth = active ? 5 : 2.5;
5667
5674
  const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
5668
5675
  const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
@@ -14197,6 +14204,36 @@ function CdlStage({
14197
14204
  svgRef
14198
14205
  }) {
14199
14206
  const activeSet = new Set(currentPhase?.activate ?? []);
14207
+ const \u77E2\u5370\u306E\u51FA\u756A = react.useMemo(() => {
14208
+ const \u521D\u51FA = /* @__PURE__ */ new Map();
14209
+ laid.phases.forEach((p, i) => {
14210
+ for (const id of p.activate ?? []) if (!\u521D\u51FA.has(id)) \u521D\u51FA.set(id, i);
14211
+ });
14212
+ const \u4ECA = currentPhase === void 0 ? -1 : laid.phases.findIndex((p) => p.id === currentPhase.id);
14213
+ const \u96A0\u3059 = (laid.edgeReveal ?? EDGE_REVEAL_DEFAULT) !== "all";
14214
+ return {
14215
+ \u51FA\u308B\u304B: (edgeId) => {
14216
+ if (!\u96A0\u3059) return true;
14217
+ const first = \u521D\u51FA.get(edgeId);
14218
+ if (first === void 0) return true;
14219
+ return \u4ECA < 0 || \u4ECA >= first;
14220
+ },
14221
+ /*
14222
+ * この段で初めて出るか (#584)。
14223
+ *
14224
+ * 起点から伸ばすのはこの段だけ。 光っているかで引くと、段をまたいで光り続ける図で
14225
+ * 既に見えている線が毎段引き直される (実測 = 表の図で 3 本とも段が変わるたびに伸び直した)。
14226
+ *
14227
+ * **隠さない図でも初出は数える**。 `all` は「最初から見せる」 だけの指定で、
14228
+ * 伸びる動きまで毎段繰り返してよいという意味ではない。
14229
+ */
14230
+ \u4F38\u3070\u3059\u304B: (edgeId) => {
14231
+ const first = \u521D\u51FA.get(edgeId);
14232
+ if (first === void 0) return false;
14233
+ return \u4ECA === first;
14234
+ }
14235
+ };
14236
+ }, [laid.phases, currentPhase, laid.edgeReveal]);
14200
14237
  const drawSet = new Set(currentPhase?.draw ?? []);
14201
14238
  const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
14202
14239
  const { lifelineStarts, uniformFooterTop } = react.useMemo(() => {
@@ -14356,7 +14393,17 @@ function CdlStage({
14356
14393
  },
14357
14394
  lane.id
14358
14395
  )),
14359
- laid.edges.map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeView, { edge, active: activeSet.has(edge.id), progress, stateValues }, edge.id)),
14396
+ laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
14397
+ CdlEdgeView,
14398
+ {
14399
+ edge,
14400
+ active: activeSet.has(edge.id),
14401
+ drawing: \u77E2\u5370\u306E\u51FA\u756A.\u4F38\u3070\u3059\u304B(edge.id),
14402
+ progress,
14403
+ stateValues
14404
+ },
14405
+ edge.id
14406
+ )),
14360
14407
  laid.nodes.map((node) => {
14361
14408
  const \u63CF\u304F = drawSet.has(node.id);
14362
14409
  const view = /* @__PURE__ */ jsxRuntime.jsx(
@@ -14372,8 +14419,8 @@ function CdlStage({
14372
14419
  );
14373
14420
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: view }, node.id);
14374
14421
  }),
14375
- laid.edges.filter((edge) => Boolean(edge.dThrough)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
14376
- laid.edges.map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
14422
+ 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}`)),
14423
+ laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(
14377
14424
  CdlEdgeLabelView,
14378
14425
  {
14379
14426
  edge,