@cardenelabs/cdl 0.18.0 → 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
@@ -5576,6 +5576,7 @@ function labelTextOpacity(line) {
5576
5576
  function CdlEdgeView({
5577
5577
  edge,
5578
5578
  active,
5579
+ drawing,
5579
5580
  progress,
5580
5581
  stateValues
5581
5582
  }) {
@@ -5600,6 +5601,7 @@ function CdlEdgeView({
5600
5601
  "data-cdl-from": edge.from,
5601
5602
  "data-cdl-to": edge.to,
5602
5603
  "data-cdl-active": active ? "true" : "false",
5604
+ "data-cdl-drawing": drawing ? "true" : "false",
5603
5605
  "data-cdl-path-d": edge.d,
5604
5606
  "data-cdl-label-x": edge.labelX,
5605
5607
  "data-cdl-label-y": edge.labelY,
@@ -5631,6 +5633,7 @@ function CdlEdgeView({
5631
5633
  {
5632
5634
  edge,
5633
5635
  active,
5636
+ drawing,
5634
5637
  progress,
5635
5638
  color,
5636
5639
  marker,
@@ -5658,6 +5661,7 @@ function CdlEdgeView({
5658
5661
  function SolidEdgePath({
5659
5662
  edge,
5660
5663
  active,
5664
+ drawing,
5661
5665
  progress,
5662
5666
  color,
5663
5667
  marker,
@@ -5665,7 +5669,7 @@ function SolidEdgePath({
5665
5669
  dashed,
5666
5670
  stateValues
5667
5671
  }) {
5668
- const visibleD = active ? pathSubpath(edge.d, progress) : edge.d;
5672
+ const visibleD = drawing ? pathSubpath(edge.d, progress) : edge.d;
5669
5673
  const defaultWidth = active ? 5 : 2.5;
5670
5674
  const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
5671
5675
  const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
@@ -14200,19 +14204,36 @@ function CdlStage({
14200
14204
  svgRef
14201
14205
  }) {
14202
14206
  const activeSet = new Set(currentPhase?.activate ?? []);
14203
- const \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370 = react.useMemo(() => {
14204
- if ((laid.edgeReveal ?? EDGE_REVEAL_DEFAULT) === "all") return () => true;
14207
+ const \u77E2\u5370\u306E\u51FA\u756A = react.useMemo(() => {
14205
14208
  const \u521D\u51FA = /* @__PURE__ */ new Map();
14206
14209
  laid.phases.forEach((p, i) => {
14207
14210
  for (const id of p.activate ?? []) if (!\u521D\u51FA.has(id)) \u521D\u51FA.set(id, i);
14208
14211
  });
14209
14212
  const \u4ECA = currentPhase === void 0 ? -1 : laid.phases.findIndex((p) => p.id === currentPhase.id);
14210
- return (edgeId) => {
14211
- const first = \u521D\u51FA.get(edgeId);
14212
- if (first === void 0) return true;
14213
- return \u4ECA < 0 || \u4ECA >= first;
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
+ }
14214
14235
  };
14215
- }, [laid.phases, currentPhase]);
14236
+ }, [laid.phases, currentPhase, laid.edgeReveal]);
14216
14237
  const drawSet = new Set(currentPhase?.draw ?? []);
14217
14238
  const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
14218
14239
  const { lifelineStarts, uniformFooterTop } = react.useMemo(() => {
@@ -14372,7 +14393,17 @@ function CdlStage({
14372
14393
  },
14373
14394
  lane.id
14374
14395
  )),
14375
- laid.edges.filter((edge) => \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).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
+ )),
14376
14407
  laid.nodes.map((node) => {
14377
14408
  const \u63CF\u304F = drawSet.has(node.id);
14378
14409
  const view = /* @__PURE__ */ jsxRuntime.jsx(
@@ -14388,8 +14419,8 @@ function CdlStage({
14388
14419
  );
14389
14420
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: view }, node.id);
14390
14421
  }),
14391
- laid.edges.filter((edge) => Boolean(edge.dThrough) && \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).map((edge) => /* @__PURE__ */ jsxRuntime.jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
14392
- laid.edges.filter((edge) => \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).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(
14393
14424
  CdlEdgeLabelView,
14394
14425
  {
14395
14426
  edge,