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