@cardenelabs/cdl 0.17.0 → 0.18.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/react.d.cts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'react';
2
- export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Dc5Pdf7e.cjs';
2
+ export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Czv0tUon.cjs';
package/dist/react.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'react';
2
- export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Dc5Pdf7e.js';
2
+ export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Czv0tUon.js';
package/dist/react.js CHANGED
@@ -638,7 +638,7 @@ function genericTextCentered(kind, hasRows) {
638
638
  function genericTitleBaselineY(kind, h, hasRows) {
639
639
  return genericTextCentered(kind, hasRows) ? h / 2 + GENERIC_TITLE_CENTER_OFFSET : GENERIC_TITLE_TOP + genericTextShift(kind);
640
640
  }
641
- var ROW_TOP_STORAGE = 130;
641
+ var ROW_TOP_STORAGE = 152;
642
642
  var ROW_PITCH_STORAGE = 56;
643
643
  var ROW_TOP_GENERIC = 100;
644
644
  var ROW_PITCH_GENERIC = 28;
@@ -649,7 +649,8 @@ var GENERIC_TITLE_FONT = 20;
649
649
  var GLYPH_CAP_RATIO = 0.72;
650
650
  var ROW_FONT_STORAGE = 26;
651
651
  var ROW_FONT_GENERIC = 21;
652
- var STORAGE_TITLE_BASELINE = 78;
652
+ var STORAGE_TITLE_BASELINE = 86;
653
+ var STORAGE_TITLE_FONT = 34;
653
654
  var SUBTITLE_ROW_SHIFT = 46;
654
655
  var STORAGE_ROW_DIVIDER_Y = Math.round(
655
656
  (STORAGE_TITLE_BASELINE + (ROW_TOP_STORAGE - ROW_FONT_STORAGE * GLYPH_CAP_RATIO)) / 2
@@ -3844,7 +3845,7 @@ function layoutNodes(diag, lanes) {
3844
3845
  const \u6BB5\u306E\u9AD8\u3055 = rowH.get(n.stack);
3845
3846
  const \u81EA\u524D\u306E\u9AD8\u3055 = n.rowMarks !== void 0;
3846
3847
  const h = n.h ?? (\u81EA\u524D\u306E\u9AD8\u3055 ? autoStorageHeight(n, size.h) : \u6BB5\u306E\u9AD8\u3055);
3847
- const cy = \u81EA\u524D\u306E\u9AD8\u3055 ? \u6BB5\u306E\u82AF - \u6BB5\u306E\u9AD8\u3055 / 2 + h / 2 : \u6BB5\u306E\u82AF;
3848
+ const cy = \u6BB5\u306E\u82AF;
3848
3849
  const w = autoRowsWidth(n, size.w);
3849
3850
  out.push({
3850
3851
  ...n,
@@ -4034,6 +4035,8 @@ function layout(diag) {
4034
4035
  states: diag.states,
4035
4036
  phases: diag.phases,
4036
4037
  ...diag.derived ? { derived: diag.derived } : {},
4038
+ // 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
4039
+ ...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
4037
4040
  bboxes,
4038
4041
  collisions,
4039
4042
  nearCollisions,
@@ -4191,6 +4194,7 @@ var EDGE_HEADS = [
4191
4194
  ];
4192
4195
  var EDGE_HEAD_FILL_DEFAULT = "solid";
4193
4196
  var EDGE_HEAD_FILLS = ["solid", "hollow"];
4197
+ var EDGE_REVEAL_DEFAULT = "phase";
4194
4198
 
4195
4199
  // src/formula/evaluator.ts
4196
4200
  function evaluate(ast, ctxOrResolver) {
@@ -6043,7 +6047,7 @@ function SequenceBoardNode({
6043
6047
  const v = Number.parseInt(interpolate(node.sequenceStep, stateValues ?? {}).trim(), 10);
6044
6048
  return Number.isFinite(v) ? v : null;
6045
6049
  })();
6046
- const \u6731 = "var(--cdl-tone-accent, #2d6a8f)";
6050
+ const \u6731 = "var(--cdl-now, var(--cdl-tone-accent, #2d6a8f))";
6047
6051
  const \u58A8 = "var(--cdl-text-2, #4a5162)";
6048
6052
  const \u898B\u305F\u76EE = (i) => {
6049
6053
  if (\u73FE\u5728 === null) return { opacity: 1, color: \u6731 };
@@ -6337,9 +6341,9 @@ function FunctionNode({ node, active }) {
6337
6341
  var ROW_GLYPH_HALF = 7;
6338
6342
  var ROW_GLYPH_CX = ROW_PAD_X_PX + ROW_GLYPH_HALF + 1;
6339
6343
  var ROW_GLYPH_LEAD = 40;
6340
- var ROW_TYPE_FONT = 24;
6341
- var SUBTITLE_BASELINE = 108;
6342
- var SUBTITLE_FONT = 22;
6344
+ var ROW_TYPE_FONT = 22;
6345
+ var SUBTITLE_BASELINE = 118;
6346
+ var SUBTITLE_FONT = 20;
6343
6347
  var UNDERLINE_DROP = 7;
6344
6348
  function RowGlyph({ mark, x, y, color }) {
6345
6349
  const \u534A = ROW_GLYPH_HALF;
@@ -6366,7 +6370,7 @@ function StorageNode({
6366
6370
  const accent = nodeAccent(node, "var(--cdl-tone-accent, #2d6a8f)");
6367
6371
  const x = node.cx - node.w / 2;
6368
6372
  const y = node.cy - node.h / 2;
6369
- const \u540D\u524D = titlePlacement(node, { x: 26, y: STORAGE_TITLE_BASELINE, size: 22 }, { hasEyebrow: Boolean(node.eyebrow) });
6373
+ const \u540D\u524D = titlePlacement(node, { x: 26, y: STORAGE_TITLE_BASELINE, size: STORAGE_TITLE_FONT }, { hasEyebrow: Boolean(node.eyebrow) });
6370
6374
  const splits = rows.map((r) => splitRow(r));
6371
6375
  const leftMaxWidth = splits.reduce((m, s) => Math.max(m, displayWidth(s.left)), 0);
6372
6376
  const rightColX = ROW_PAD_X_PX + leftMaxWidth * STORAGE_CHAR_ADVANCE_PX + STORAGE_COL_GAP_PX;
@@ -14194,6 +14198,19 @@ function CdlStage({
14194
14198
  svgRef
14195
14199
  }) {
14196
14200
  const activeSet = new Set(currentPhase?.activate ?? []);
14201
+ const \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370 = useMemo(() => {
14202
+ if ((laid.edgeReveal ?? EDGE_REVEAL_DEFAULT) === "all") return () => true;
14203
+ const \u521D\u51FA = /* @__PURE__ */ new Map();
14204
+ laid.phases.forEach((p, i) => {
14205
+ for (const id of p.activate ?? []) if (!\u521D\u51FA.has(id)) \u521D\u51FA.set(id, i);
14206
+ });
14207
+ const \u4ECA = currentPhase === void 0 ? -1 : laid.phases.findIndex((p) => p.id === currentPhase.id);
14208
+ return (edgeId) => {
14209
+ const first = \u521D\u51FA.get(edgeId);
14210
+ if (first === void 0) return true;
14211
+ return \u4ECA < 0 || \u4ECA >= first;
14212
+ };
14213
+ }, [laid.phases, currentPhase]);
14197
14214
  const drawSet = new Set(currentPhase?.draw ?? []);
14198
14215
  const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
14199
14216
  const { lifelineStarts, uniformFooterTop } = useMemo(() => {
@@ -14353,7 +14370,7 @@ function CdlStage({
14353
14370
  },
14354
14371
  lane.id
14355
14372
  )),
14356
- laid.edges.map((edge) => /* @__PURE__ */ jsx(CdlEdgeView, { edge, active: activeSet.has(edge.id), progress, stateValues }, edge.id)),
14373
+ laid.edges.filter((edge) => \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).map((edge) => /* @__PURE__ */ jsx(CdlEdgeView, { edge, active: activeSet.has(edge.id), progress, stateValues }, edge.id)),
14357
14374
  laid.nodes.map((node) => {
14358
14375
  const \u63CF\u304F = drawSet.has(node.id);
14359
14376
  const view = /* @__PURE__ */ jsx(
@@ -14369,8 +14386,8 @@ function CdlStage({
14369
14386
  );
14370
14387
  return /* @__PURE__ */ jsx("g", { children: view }, node.id);
14371
14388
  }),
14372
- laid.edges.filter((edge) => Boolean(edge.dThrough)).map((edge) => /* @__PURE__ */ jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
14373
- laid.edges.map((edge) => /* @__PURE__ */ jsx(
14389
+ laid.edges.filter((edge) => Boolean(edge.dThrough) && \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).map((edge) => /* @__PURE__ */ jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
14390
+ laid.edges.filter((edge) => \u51FA\u756A\u306E\u6765\u305F\u77E2\u5370(edge.id)).map((edge) => /* @__PURE__ */ jsx(
14374
14391
  CdlEdgeLabelView,
14375
14392
  {
14376
14393
  edge,
@@ -24273,11 +24290,9 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
24273
24290
  for (const [stack, group] of byStack) {
24274
24291
  if (group.length < 2) continue;
24275
24292
  const cy0 = group[0].cy;
24276
- const top0 = cy0 - (group[0].h ?? 0) / 2;
24277
24293
  for (const n of group.slice(1)) {
24278
24294
  const diff = Math.abs(n.cy - cy0);
24279
- const topDiff = Math.abs(n.cy - (n.h ?? 0) / 2 - top0);
24280
- if (diff > MIN_ROW_ALIGNMENT_TOLERANCE && topDiff > MIN_ROW_ALIGNMENT_TOLERANCE) {
24295
+ if (diff > MIN_ROW_ALIGNMENT_TOLERANCE) {
24281
24296
  push(
24282
24297
  "row-alignment",
24283
24298
  `stack=${stack} row \u5185 node "${n.id}" cy=${n.cy.toFixed(1)} \u304C row \u57FA\u6E96 cy=${cy0.toFixed(1)} \u3068 ${diff.toFixed(1)} world \u5DEE (\u8A31\u5BB9 ${MIN_ROW_ALIGNMENT_TOLERANCE})`
@@ -25326,18 +25341,24 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
25326
25341
  if (group.length < 3) continue;
25327
25342
  const sorted = [...group].sort((a, b) => a.cy - b.cy);
25328
25343
  const gaps = [];
25329
- const tops = [];
25330
25344
  for (let i = 1; i < sorted.length; i++) {
25331
25345
  const prev = sorted[i - 1];
25332
25346
  const cur = sorted[i];
25333
25347
  gaps.push(cur.cy - cur.h / 2 - (prev.cy + prev.h / 2));
25334
- tops.push(cur.cy - cur.h / 2 - (prev.cy - prev.h / 2));
25335
25348
  }
25336
25349
  const maxGap = Math.max(...gaps);
25337
25350
  const minGap = Math.min(...gaps);
25338
25351
  const variance = maxGap - minGap;
25339
- const topVariance = Math.max(...tops) - Math.min(...tops);
25340
- if (variance > COLUMN_GAP_VARIANCE_TOL && topVariance > COLUMN_GAP_VARIANCE_TOL) {
25352
+ const \u683C\u5B50\u306B\u7F6E\u304F = group.every((n) => n.rowMarks !== void 0);
25353
+ const \u7AEF\u304C\u8DB3\u308A\u3066\u3044\u308B = minGap >= requiredNearClearance("node", "node");
25354
+ if (\u683C\u5B50\u306B\u7F6E\u304F) {
25355
+ if (!\u7AEF\u304C\u8DB3\u308A\u3066\u3044\u308B) {
25356
+ push(
25357
+ "column-gap-uniform",
25358
+ `lane "${laneId}" \u5185 node \u9593\u306E\u7AEF\u9593 gap ${minGap.toFixed(0)} world \u304C\u4E0B\u9650 ${requiredNearClearance("node", "node")} \u3092\u5272\u308B`
25359
+ );
25360
+ }
25361
+ } else if (variance > COLUMN_GAP_VARIANCE_TOL) {
25341
25362
  push(
25342
25363
  "column-gap-uniform",
25343
25364
  `lane "${laneId}" \u5185 node \u9593\u306E\u7AEF\u9593 gap variance ${variance.toFixed(1)} world \u304C spec ${COLUMN_GAP_VARIANCE_TOL} \u8D85\u904E (min=${minGap.toFixed(0)} max=${maxGap.toFixed(0)})`