@cardenelabs/cdl 0.24.0 → 0.25.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 +45 -0
- package/dist/index.cjs +40 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +32 -0
- 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 +32 -0
- package/dist/react.js.map +1 -1
- package/dist/{render-CfXUl0Yz.d.cts → render-ViWKnlu1.d.cts} +23 -0
- package/dist/{render-CfXUl0Yz.d.ts → render-ViWKnlu1.d.ts} +23 -0
- package/package.json +1 -1
- package/src/builder.ts +6 -0
- package/src/kinds/storage.tsx +32 -0
- package/src/layout/spec.ts +23 -0
- package/src/layout.ts +6 -0
- package/src/presets.ts +22 -1
- package/src/render/stage.tsx +7 -0
- package/src/render/template-fields.ts +2 -0
- package/src/types.ts +23 -0
package/dist/react.cjs
CHANGED
|
@@ -629,6 +629,12 @@ function rowBaselineY(kind, index) {
|
|
|
629
629
|
if (!rendersRows(kind)) return null;
|
|
630
630
|
return kind === "storage" ? ROW_TOP_STORAGE + index * ROW_PITCH_STORAGE : ROW_TOP_GENERIC + genericTextShift(kind) + index * ROW_PITCH_GENERIC;
|
|
631
631
|
}
|
|
632
|
+
function rowStripeBand(kind, index, shift) {
|
|
633
|
+
const baseline = rowBaselineY(kind, index);
|
|
634
|
+
if (baseline === null) return null;
|
|
635
|
+
const pitch = ROW_PITCH_STORAGE ;
|
|
636
|
+
return { y: baseline + shift - pitch / 2, h: pitch };
|
|
637
|
+
}
|
|
632
638
|
function genericTextShift(kind) {
|
|
633
639
|
return KINDS_SHAPE_CYLINDER.has(kind ?? "") ? GENERIC_TEXT_SHIFT_CYLINDER : 0;
|
|
634
640
|
}
|
|
@@ -8980,6 +8986,12 @@ function layout(diag) {
|
|
|
8980
8986
|
...diag.derived ? { derived: diag.derived } : {},
|
|
8981
8987
|
// 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
|
|
8982
8988
|
...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
|
|
8989
|
+
// どの配色で描くか (#1553)。 空文字は書かなかった扱いにする = 空の目印を出すと、
|
|
8990
|
+
// 消費側の `[data-cdl-palette]` が配色を書いていない図にも当たる。
|
|
8991
|
+
//
|
|
8992
|
+
// **遮断はここだけに置く**。 描画は必ず組み立てを通り、組み立て API も `er` も
|
|
8993
|
+
// 素通しにしてある。 上流にも置くと、どの入力でも通らない分岐が残る
|
|
8994
|
+
...diag.palette ? { palette: diag.palette } : {},
|
|
8983
8995
|
bboxes,
|
|
8984
8996
|
collisions,
|
|
8985
8997
|
nearCollisions,
|
|
@@ -10314,6 +10326,25 @@ function StorageNode({
|
|
|
10314
10326
|
strokeWidth: active ? 3 : 1.25
|
|
10315
10327
|
}
|
|
10316
10328
|
),
|
|
10329
|
+
node.rowStripe && rows.map((_, idx) => {
|
|
10330
|
+
if (idx % 2 !== 0) return null;
|
|
10331
|
+
const \u5E2F = rowStripeBand("storage", idx, \u884C\u306E\u4E0B\u3052);
|
|
10332
|
+
if (!\u5E2F) return null;
|
|
10333
|
+
if (\u5E2F.y + \u5E2F.h > node.h) return null;
|
|
10334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10335
|
+
"rect",
|
|
10336
|
+
{
|
|
10337
|
+
"data-cdl-role": "node-row-stripe",
|
|
10338
|
+
"data-cdl-row-index": idx,
|
|
10339
|
+
x: 1,
|
|
10340
|
+
y: \u5E2F.y,
|
|
10341
|
+
width: node.w - 2,
|
|
10342
|
+
height: \u5E2F.h,
|
|
10343
|
+
fill: "var(--cdl-row-stripe, var(--cdl-label-bg, #f3f4f6))"
|
|
10344
|
+
},
|
|
10345
|
+
`stripe-${idx}`
|
|
10346
|
+
);
|
|
10347
|
+
}),
|
|
10317
10348
|
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
10318
10349
|
\u5370\u3067\u5206\u3051\u308B && node.subtitle && // 呼び名は **印で分ける箱でだけ** 出す (#578)。 従来の箱は題の下に区切り線が来るので
|
|
10319
10350
|
// 置き場が無い
|
|
@@ -17161,6 +17192,7 @@ function CdlStage({
|
|
|
17161
17192
|
"aria-label": buildDiagramAltText(laid.topic, currentPhase),
|
|
17162
17193
|
"data-cdl-stage": "",
|
|
17163
17194
|
"data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
|
|
17195
|
+
"data-cdl-palette": laid.palette,
|
|
17164
17196
|
children: [
|
|
17165
17197
|
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
17166
17198
|
Object.entries(TONE).flatMap(
|