@cardenelabs/cdl 0.24.0 → 0.26.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 +75 -1
- package/dist/index.cjs +46 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +33 -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 +33 -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 +46 -0
- package/src/layout/spec.ts +23 -0
- package/src/layout.ts +6 -0
- package/src/presets.ts +38 -2
- 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,
|
|
@@ -10257,6 +10269,7 @@ var ROW_GLYPH_CX = ROW_PAD_X_PX + ROW_GLYPH_HALF + 1;
|
|
|
10257
10269
|
var ROW_GLYPH_LEAD = 40;
|
|
10258
10270
|
var ROW_TYPE_FONT = 22;
|
|
10259
10271
|
var SUBTITLE_BASELINE = 118;
|
|
10272
|
+
var STRIPE_MIN_ROWS = 2;
|
|
10260
10273
|
var SUBTITLE_FONT = 20;
|
|
10261
10274
|
var UNDERLINE_DROP = 7;
|
|
10262
10275
|
function RowGlyph({ mark, x, y, color }) {
|
|
@@ -10314,6 +10327,25 @@ function StorageNode({
|
|
|
10314
10327
|
strokeWidth: active ? 3 : 1.25
|
|
10315
10328
|
}
|
|
10316
10329
|
),
|
|
10330
|
+
node.rowStripe && rows.length >= STRIPE_MIN_ROWS && rows.map((_, idx) => {
|
|
10331
|
+
if (idx % 2 !== 0) return null;
|
|
10332
|
+
const \u5E2F = rowStripeBand("storage", idx, \u884C\u306E\u4E0B\u3052);
|
|
10333
|
+
if (!\u5E2F) return null;
|
|
10334
|
+
if (\u5E2F.y + \u5E2F.h > node.h) return null;
|
|
10335
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10336
|
+
"rect",
|
|
10337
|
+
{
|
|
10338
|
+
"data-cdl-role": "node-row-stripe",
|
|
10339
|
+
"data-cdl-row-index": idx,
|
|
10340
|
+
x: 1,
|
|
10341
|
+
y: \u5E2F.y,
|
|
10342
|
+
width: node.w - 2,
|
|
10343
|
+
height: \u5E2F.h,
|
|
10344
|
+
fill: "var(--cdl-row-stripe, var(--cdl-label-bg, #f3f4f6))"
|
|
10345
|
+
},
|
|
10346
|
+
`stripe-${idx}`
|
|
10347
|
+
);
|
|
10348
|
+
}),
|
|
10317
10349
|
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
10318
10350
|
\u5370\u3067\u5206\u3051\u308B && node.subtitle && // 呼び名は **印で分ける箱でだけ** 出す (#578)。 従来の箱は題の下に区切り線が来るので
|
|
10319
10351
|
// 置き場が無い
|
|
@@ -17161,6 +17193,7 @@ function CdlStage({
|
|
|
17161
17193
|
"aria-label": buildDiagramAltText(laid.topic, currentPhase),
|
|
17162
17194
|
"data-cdl-stage": "",
|
|
17163
17195
|
"data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
|
|
17196
|
+
"data-cdl-palette": laid.palette,
|
|
17164
17197
|
children: [
|
|
17165
17198
|
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
17166
17199
|
Object.entries(TONE).flatMap(
|