@cardenelabs/cdl 0.21.1 → 0.22.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 +36 -1
- package/dist/index.cjs +79 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +79 -33
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +79 -33
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +79 -33
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/kinds/actor.tsx +15 -6
- package/src/kinds/card.tsx +15 -4
- package/src/kinds/event.tsx +13 -4
- package/src/kinds/function.tsx +13 -4
- package/src/kinds/generic.tsx +36 -17
- package/src/layout/spec.ts +57 -0
package/dist/index.js
CHANGED
|
@@ -12024,6 +12024,25 @@ function \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \
|
|
|
12024
12024
|
return Math.max(MIN_BOX_H, \u6E80\u8F09h - \u5F15\u304F);
|
|
12025
12025
|
}
|
|
12026
12026
|
var MIN_BOX_H = 44;
|
|
12027
|
+
var CLOUD_CIRCLES = [
|
|
12028
|
+
{ cx: -0.8, cy: -0.05 + 0.08, r: 0.32 },
|
|
12029
|
+
{ cx: -0.4, cy: -0.05 - 0.05, r: 0.4 },
|
|
12030
|
+
{ cx: 0, cy: -0.05 - 0.1, r: 0.46 },
|
|
12031
|
+
{ cx: 0.4, cy: -0.05 - 0.05, r: 0.4 },
|
|
12032
|
+
{ cx: 0.8, cy: -0.05 + 0.08, r: 0.32 }
|
|
12033
|
+
];
|
|
12034
|
+
var CLOUD_ART_CENTER_RISE = (() => {
|
|
12035
|
+
const \u4E0A = Math.min(...CLOUD_CIRCLES.map((c) => c.cy - c.r));
|
|
12036
|
+
const \u4E0B = Math.max(...CLOUD_CIRCLES.map((c) => c.cy + c.r));
|
|
12037
|
+
return -(\u4E0A + \u4E0B) / 2;
|
|
12038
|
+
})();
|
|
12039
|
+
function \u4F59\u308A\u3092\u5206\u3051\u308B(kind, \u6E80\u8F09h, \u5B9F\u969B\u306Eh, \u4E2D\u8EAB) {
|
|
12040
|
+
if (!\u6BB5\u3092\u7A4D\u3080\u7BB1\u304B(kind, \u4E2D\u8EAB.hasRows)) return 0;
|
|
12041
|
+
if (\u4E2D\u8EAB.hasValue) return 0;
|
|
12042
|
+
const \u8981\u308B\u9AD8\u3055 = \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \u4E2D\u8EAB);
|
|
12043
|
+
const \u4F59\u308A = \u5B9F\u969B\u306Eh - \u8981\u308B\u9AD8\u3055;
|
|
12044
|
+
return \u4F59\u308A > 0 ? Math.round(\u4F59\u308A / 2) : 0;
|
|
12045
|
+
}
|
|
12027
12046
|
|
|
12028
12047
|
// src/layout/footer-shape.ts
|
|
12029
12048
|
var SHAPE_DRAW_UP_EXTENT = {
|
|
@@ -21703,7 +21722,14 @@ function ActorNode({ node, active, value }) {
|
|
|
21703
21722
|
const x = node.cx - node.w / 2;
|
|
21704
21723
|
const y = node.cy - node.h / 2;
|
|
21705
21724
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("actor");
|
|
21706
|
-
const \
|
|
21725
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("actor", NODE_SIZE.actor.h, node.h, {
|
|
21726
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
21727
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
21728
|
+
hasValue: Boolean(value),
|
|
21729
|
+
hasRows: false
|
|
21730
|
+
});
|
|
21731
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
21732
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 32 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
21707
21733
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, children: [
|
|
21708
21734
|
/* @__PURE__ */ jsx(
|
|
21709
21735
|
"rect",
|
|
@@ -21719,7 +21745,7 @@ function ActorNode({ node, active, value }) {
|
|
|
21719
21745
|
strokeWidth: active ? 3 : 1.25
|
|
21720
21746
|
}
|
|
21721
21747
|
),
|
|
21722
|
-
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
21748
|
+
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
21723
21749
|
/* @__PURE__ */ jsx(
|
|
21724
21750
|
"text",
|
|
21725
21751
|
{
|
|
@@ -21738,13 +21764,13 @@ function ActorNode({ node, active, value }) {
|
|
|
21738
21764
|
{
|
|
21739
21765
|
"data-cdl-role": "node-row-divider",
|
|
21740
21766
|
x1: 26,
|
|
21741
|
-
y1: 110 - \
|
|
21767
|
+
y1: 110 - \u305A\u3089\u3057,
|
|
21742
21768
|
x2: node.w - 26,
|
|
21743
|
-
y2: 110 - \
|
|
21769
|
+
y2: 110 - \u305A\u3089\u3057,
|
|
21744
21770
|
stroke: "var(--cdl-row-divider, #7e848e)"
|
|
21745
21771
|
}
|
|
21746
21772
|
),
|
|
21747
|
-
node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 140 - \
|
|
21773
|
+
node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 140 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
|
|
21748
21774
|
value && /* @__PURE__ */ jsx(
|
|
21749
21775
|
"text",
|
|
21750
21776
|
{
|
|
@@ -21770,7 +21796,14 @@ function CardNode({ node, active }) {
|
|
|
21770
21796
|
const compact = isCompactBox(node.h);
|
|
21771
21797
|
const \u5C0F\u578B\u306B\u547C\u3073\u540D = compact && Boolean(node.subtitle);
|
|
21772
21798
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("card");
|
|
21773
|
-
const
|
|
21799
|
+
const \u4F59\u308A = compact ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B("card", NODE_SIZE.card.h, node.h, {
|
|
21800
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
21801
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
21802
|
+
hasValue: false,
|
|
21803
|
+
hasRows: false
|
|
21804
|
+
});
|
|
21805
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
21806
|
+
const titleY = compact ? \u5C0F\u578B\u306B\u547C\u3073\u540D ? node.h / 2 - 2 : node.h / 2 + 8 : 86 - \u305A\u3089\u3057;
|
|
21774
21807
|
const titleX = compact ? node.w / 2 : 26;
|
|
21775
21808
|
const paddingX = compact ? 16 : 52;
|
|
21776
21809
|
const availableW = node.w - paddingX;
|
|
@@ -21793,7 +21826,7 @@ function CardNode({ node, active }) {
|
|
|
21793
21826
|
strokeWidth: active ? 3 : 1.25
|
|
21794
21827
|
}
|
|
21795
21828
|
),
|
|
21796
|
-
!compact && node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
21829
|
+
!compact && node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
21797
21830
|
/* @__PURE__ */ jsx(
|
|
21798
21831
|
"text",
|
|
21799
21832
|
{
|
|
@@ -21807,7 +21840,7 @@ function CardNode({ node, active }) {
|
|
|
21807
21840
|
children: node.title
|
|
21808
21841
|
}
|
|
21809
21842
|
),
|
|
21810
|
-
!compact && node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 124 - \
|
|
21843
|
+
!compact && node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 124 - \u305A\u3089\u3057, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
|
|
21811
21844
|
\u5C0F\u578B\u306B\u547C\u3073\u540D && /* @__PURE__ */ jsx(
|
|
21812
21845
|
"text",
|
|
21813
21846
|
{
|
|
@@ -22072,7 +22105,14 @@ function EventNode({
|
|
|
22072
22105
|
const x = node.cx - node.w / 2;
|
|
22073
22106
|
const y = node.cy - node.h / 2;
|
|
22074
22107
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("event");
|
|
22075
|
-
const \
|
|
22108
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("event", NODE_SIZE.event.h, node.h, {
|
|
22109
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
22110
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
22111
|
+
hasValue: false,
|
|
22112
|
+
hasRows: false
|
|
22113
|
+
});
|
|
22114
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
22115
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 88 - \u305A\u3089\u3057, size: 26 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
22076
22116
|
const scale = active ? 0.78 + 0.22 * progress : 0.92;
|
|
22077
22117
|
const opacity = active ? 0.5 + 0.5 * progress : 0.65;
|
|
22078
22118
|
return /* @__PURE__ */ jsx(
|
|
@@ -22095,7 +22135,7 @@ function EventNode({
|
|
|
22095
22135
|
strokeWidth: active ? 3 : 1.25
|
|
22096
22136
|
}
|
|
22097
22137
|
),
|
|
22098
|
-
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
22138
|
+
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
22099
22139
|
/* @__PURE__ */ jsx(
|
|
22100
22140
|
"text",
|
|
22101
22141
|
{
|
|
@@ -22114,7 +22154,7 @@ function EventNode({
|
|
|
22114
22154
|
"text",
|
|
22115
22155
|
{
|
|
22116
22156
|
x: 26,
|
|
22117
|
-
y: 128 - \
|
|
22157
|
+
y: 128 - \u305A\u3089\u3057,
|
|
22118
22158
|
fontSize: 21,
|
|
22119
22159
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
22120
22160
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
@@ -22131,7 +22171,14 @@ function FunctionNode({ node, active }) {
|
|
|
22131
22171
|
const x = node.cx - node.w / 2;
|
|
22132
22172
|
const y = node.cy - node.h / 2;
|
|
22133
22173
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("function");
|
|
22134
|
-
const \
|
|
22174
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("function", NODE_SIZE.function.h, node.h, {
|
|
22175
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
22176
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
22177
|
+
hasValue: false,
|
|
22178
|
+
hasRows: false
|
|
22179
|
+
});
|
|
22180
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
22181
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 24 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
22135
22182
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, children: [
|
|
22136
22183
|
/* @__PURE__ */ jsx(
|
|
22137
22184
|
"rect",
|
|
@@ -22148,7 +22195,7 @@ function FunctionNode({ node, active }) {
|
|
|
22148
22195
|
strokeOpacity: active ? 1 : 0.5
|
|
22149
22196
|
}
|
|
22150
22197
|
),
|
|
22151
|
-
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
22198
|
+
node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
22152
22199
|
/* @__PURE__ */ jsx(
|
|
22153
22200
|
"text",
|
|
22154
22201
|
{
|
|
@@ -22163,7 +22210,7 @@ function FunctionNode({ node, active }) {
|
|
|
22163
22210
|
children: node.title
|
|
22164
22211
|
}
|
|
22165
22212
|
),
|
|
22166
|
-
node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 126 - \
|
|
22213
|
+
node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 126 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
|
|
22167
22214
|
] });
|
|
22168
22215
|
}
|
|
22169
22216
|
var ROW_GLYPH_HALF = 7;
|
|
@@ -22502,21 +22549,12 @@ function GenericNode({
|
|
|
22502
22549
|
if (shape === "cloud") {
|
|
22503
22550
|
const cx = w / 2;
|
|
22504
22551
|
const cy = h / 2;
|
|
22505
|
-
const
|
|
22506
|
-
const
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
{ cx: cx - halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
|
|
22512
|
-
// 左
|
|
22513
|
-
{ cx, cy: cloudCenterY - h * 0.1, r: h * 0.46 },
|
|
22514
|
-
// 中央 (最大)
|
|
22515
|
-
{ cx: cx + halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
|
|
22516
|
-
// 右
|
|
22517
|
-
{ cx: cx + halfW * 0.8, cy: cloudCenterY + h * 0.08, r: h * 0.32 }
|
|
22518
|
-
// 右端
|
|
22519
|
-
];
|
|
22552
|
+
const halfW = w * 0.85 / 2;
|
|
22553
|
+
const circles = CLOUD_CIRCLES.map((c) => ({
|
|
22554
|
+
cx: cx + halfW * c.cx,
|
|
22555
|
+
cy: cy + h * c.cy,
|
|
22556
|
+
r: h * c.r
|
|
22557
|
+
}));
|
|
22520
22558
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
22521
22559
|
circles.map((c, i) => /* @__PURE__ */ jsx("circle", { cx: c.cx, cy: c.cy, r: c.r, fill: "var(--cdl-node-fill, #ffffff)" }, `fill-${i}`)),
|
|
22522
22560
|
circles.map((c, i) => /* @__PURE__ */ jsx(
|
|
@@ -22555,11 +22593,19 @@ function GenericNode({
|
|
|
22555
22593
|
const textX = centered ? w / 2 : 20;
|
|
22556
22594
|
const cylinderShift = genericTextShift(node.kind);
|
|
22557
22595
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow || centered ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052(node.kind, hasRows);
|
|
22558
|
-
const
|
|
22559
|
-
|
|
22560
|
-
|
|
22596
|
+
const \u4F59\u308A = centered ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B(node.kind, NODE_SIZE[node.kind]?.h ?? h, h, {
|
|
22597
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
22598
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
22599
|
+
hasValue: Boolean(resolvedValue),
|
|
22600
|
+
hasRows
|
|
22601
|
+
});
|
|
22602
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
22603
|
+
const \u7D75\u306E\u82AF = centered && STYLES[node.kind]?.shape === "cloud" ? h * CLOUD_ART_CENTER_RISE : 0;
|
|
22604
|
+
const eyebrowY = centered ? h / 2 - 26 - \u7D75\u306E\u82AF : 32 + cylinderShift + \u4F59\u308A;
|
|
22605
|
+
const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u305A\u3089\u3057 - \u7D75\u306E\u82AF;
|
|
22606
|
+
const subtitleY = centered ? h / 2 + 28 - \u7D75\u306E\u82AF : 96 + cylinderShift - \u305A\u3089\u3057;
|
|
22561
22607
|
const iconX = centered ? w / 2 + 40 : w - 48;
|
|
22562
|
-
const iconY = centered ? h / 2 - 44 : 18 + cylinderShift;
|
|
22608
|
+
const iconY = centered ? h / 2 - 44 - \u7D75\u306E\u82AF : 18 + cylinderShift;
|
|
22563
22609
|
const dominantBaseline = centered ? "middle" : void 0;
|
|
22564
22610
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, "data-cdl-role": "node-body", children: [
|
|
22565
22611
|
shapeEl,
|