@cardenelabs/cdl 0.21.2 → 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 +20 -1
- package/dist/index.cjs +59 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -17
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +59 -17
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +59 -17
- 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 +15 -3
- package/src/layout/spec.ts +26 -0
package/dist/react.cjs
CHANGED
|
@@ -860,6 +860,13 @@ var CLOUD_ART_CENTER_RISE = (() => {
|
|
|
860
860
|
const \u4E0B = Math.max(...CLOUD_CIRCLES.map((c) => c.cy + c.r));
|
|
861
861
|
return -(\u4E0A + \u4E0B) / 2;
|
|
862
862
|
})();
|
|
863
|
+
function \u4F59\u308A\u3092\u5206\u3051\u308B(kind, \u6E80\u8F09h, \u5B9F\u969B\u306Eh, \u4E2D\u8EAB) {
|
|
864
|
+
if (!\u6BB5\u3092\u7A4D\u3080\u7BB1\u304B(kind, \u4E2D\u8EAB.hasRows)) return 0;
|
|
865
|
+
if (\u4E2D\u8EAB.hasValue) return 0;
|
|
866
|
+
const \u8981\u308B\u9AD8\u3055 = \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \u4E2D\u8EAB);
|
|
867
|
+
const \u4F59\u308A = \u5B9F\u969B\u306Eh - \u8981\u308B\u9AD8\u3055;
|
|
868
|
+
return \u4F59\u308A > 0 ? Math.round(\u4F59\u308A / 2) : 0;
|
|
869
|
+
}
|
|
863
870
|
|
|
864
871
|
// src/layout/footer-shape.ts
|
|
865
872
|
var SHAPE_DRAW_UP_EXTENT = {
|
|
@@ -6071,7 +6078,14 @@ function ActorNode({ node, active, value }) {
|
|
|
6071
6078
|
const x = node.cx - node.w / 2;
|
|
6072
6079
|
const y = node.cy - node.h / 2;
|
|
6073
6080
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("actor");
|
|
6074
|
-
const \
|
|
6081
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("actor", NODE_SIZE.actor.h, node.h, {
|
|
6082
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
6083
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
6084
|
+
hasValue: Boolean(value),
|
|
6085
|
+
hasRows: false
|
|
6086
|
+
});
|
|
6087
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
6088
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 32 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
6075
6089
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x} ${y})`, children: [
|
|
6076
6090
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6077
6091
|
"rect",
|
|
@@ -6087,7 +6101,7 @@ function ActorNode({ node, active, value }) {
|
|
|
6087
6101
|
strokeWidth: active ? 3 : 1.25
|
|
6088
6102
|
}
|
|
6089
6103
|
),
|
|
6090
|
-
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6104
|
+
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6091
6105
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6092
6106
|
"text",
|
|
6093
6107
|
{
|
|
@@ -6106,13 +6120,13 @@ function ActorNode({ node, active, value }) {
|
|
|
6106
6120
|
{
|
|
6107
6121
|
"data-cdl-role": "node-row-divider",
|
|
6108
6122
|
x1: 26,
|
|
6109
|
-
y1: 110 - \
|
|
6123
|
+
y1: 110 - \u305A\u3089\u3057,
|
|
6110
6124
|
x2: node.w - 26,
|
|
6111
|
-
y2: 110 - \
|
|
6125
|
+
y2: 110 - \u305A\u3089\u3057,
|
|
6112
6126
|
stroke: "var(--cdl-row-divider, #7e848e)"
|
|
6113
6127
|
}
|
|
6114
6128
|
),
|
|
6115
|
-
node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 140 - \
|
|
6129
|
+
node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 140 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
|
|
6116
6130
|
value && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6117
6131
|
"text",
|
|
6118
6132
|
{
|
|
@@ -6138,7 +6152,14 @@ function CardNode({ node, active }) {
|
|
|
6138
6152
|
const compact = isCompactBox(node.h);
|
|
6139
6153
|
const \u5C0F\u578B\u306B\u547C\u3073\u540D = compact && Boolean(node.subtitle);
|
|
6140
6154
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("card");
|
|
6141
|
-
const
|
|
6155
|
+
const \u4F59\u308A = compact ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B("card", NODE_SIZE.card.h, node.h, {
|
|
6156
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
6157
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
6158
|
+
hasValue: false,
|
|
6159
|
+
hasRows: false
|
|
6160
|
+
});
|
|
6161
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
6162
|
+
const titleY = compact ? \u5C0F\u578B\u306B\u547C\u3073\u540D ? node.h / 2 - 2 : node.h / 2 + 8 : 86 - \u305A\u3089\u3057;
|
|
6142
6163
|
const titleX = compact ? node.w / 2 : 26;
|
|
6143
6164
|
const paddingX = compact ? 16 : 52;
|
|
6144
6165
|
const availableW = node.w - paddingX;
|
|
@@ -6161,7 +6182,7 @@ function CardNode({ node, active }) {
|
|
|
6161
6182
|
strokeWidth: active ? 3 : 1.25
|
|
6162
6183
|
}
|
|
6163
6184
|
),
|
|
6164
|
-
!compact && node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6185
|
+
!compact && node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6165
6186
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6166
6187
|
"text",
|
|
6167
6188
|
{
|
|
@@ -6175,7 +6196,7 @@ function CardNode({ node, active }) {
|
|
|
6175
6196
|
children: node.title
|
|
6176
6197
|
}
|
|
6177
6198
|
),
|
|
6178
|
-
!compact && node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 124 - \
|
|
6199
|
+
!compact && node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 124 - \u305A\u3089\u3057, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
|
|
6179
6200
|
\u5C0F\u578B\u306B\u547C\u3073\u540D && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6180
6201
|
"text",
|
|
6181
6202
|
{
|
|
@@ -6437,7 +6458,14 @@ function EventNode({
|
|
|
6437
6458
|
const x = node.cx - node.w / 2;
|
|
6438
6459
|
const y = node.cy - node.h / 2;
|
|
6439
6460
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("event");
|
|
6440
|
-
const \
|
|
6461
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("event", NODE_SIZE.event.h, node.h, {
|
|
6462
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
6463
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
6464
|
+
hasValue: false,
|
|
6465
|
+
hasRows: false
|
|
6466
|
+
});
|
|
6467
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
6468
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 88 - \u305A\u3089\u3057, size: 26 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
6441
6469
|
const scale = active ? 0.78 + 0.22 * progress : 0.92;
|
|
6442
6470
|
const opacity = active ? 0.5 + 0.5 * progress : 0.65;
|
|
6443
6471
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6460,7 +6488,7 @@ function EventNode({
|
|
|
6460
6488
|
strokeWidth: active ? 3 : 1.25
|
|
6461
6489
|
}
|
|
6462
6490
|
),
|
|
6463
|
-
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6491
|
+
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6464
6492
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6465
6493
|
"text",
|
|
6466
6494
|
{
|
|
@@ -6479,7 +6507,7 @@ function EventNode({
|
|
|
6479
6507
|
"text",
|
|
6480
6508
|
{
|
|
6481
6509
|
x: 26,
|
|
6482
|
-
y: 128 - \
|
|
6510
|
+
y: 128 - \u305A\u3089\u3057,
|
|
6483
6511
|
fontSize: 21,
|
|
6484
6512
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
6485
6513
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
@@ -6496,7 +6524,14 @@ function FunctionNode({ node, active }) {
|
|
|
6496
6524
|
const x = node.cx - node.w / 2;
|
|
6497
6525
|
const y = node.cy - node.h / 2;
|
|
6498
6526
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("function");
|
|
6499
|
-
const \
|
|
6527
|
+
const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("function", NODE_SIZE.function.h, node.h, {
|
|
6528
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
6529
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
6530
|
+
hasValue: false,
|
|
6531
|
+
hasRows: false
|
|
6532
|
+
});
|
|
6533
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
6534
|
+
const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 24 }, { hasEyebrow: Boolean(node.eyebrow) });
|
|
6500
6535
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x} ${y})`, children: [
|
|
6501
6536
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6502
6537
|
"rect",
|
|
@@ -6513,7 +6548,7 @@ function FunctionNode({ node, active }) {
|
|
|
6513
6548
|
strokeOpacity: active ? 1 : 0.5
|
|
6514
6549
|
}
|
|
6515
6550
|
),
|
|
6516
|
-
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6551
|
+
node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
|
|
6517
6552
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6518
6553
|
"text",
|
|
6519
6554
|
{
|
|
@@ -6528,7 +6563,7 @@ function FunctionNode({ node, active }) {
|
|
|
6528
6563
|
children: node.title
|
|
6529
6564
|
}
|
|
6530
6565
|
),
|
|
6531
|
-
node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 126 - \
|
|
6566
|
+
node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 126 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
|
|
6532
6567
|
] });
|
|
6533
6568
|
}
|
|
6534
6569
|
var ROW_GLYPH_HALF = 7;
|
|
@@ -6911,10 +6946,17 @@ function GenericNode({
|
|
|
6911
6946
|
const textX = centered ? w / 2 : 20;
|
|
6912
6947
|
const cylinderShift = genericTextShift(node.kind);
|
|
6913
6948
|
const \u7E70\u308A\u4E0A\u3052 = node.eyebrow || centered ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052(node.kind, hasRows);
|
|
6949
|
+
const \u4F59\u308A = centered ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B(node.kind, NODE_SIZE[node.kind]?.h ?? h, h, {
|
|
6950
|
+
hasEyebrow: Boolean(node.eyebrow),
|
|
6951
|
+
hasSubtitle: Boolean(node.subtitle),
|
|
6952
|
+
hasValue: Boolean(resolvedValue),
|
|
6953
|
+
hasRows
|
|
6954
|
+
});
|
|
6955
|
+
const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
|
|
6914
6956
|
const \u7D75\u306E\u82AF = centered && STYLES[node.kind]?.shape === "cloud" ? h * CLOUD_ART_CENTER_RISE : 0;
|
|
6915
|
-
const eyebrowY = centered ? h / 2 - 26 - \u7D75\u306E\u82AF : 32 + cylinderShift;
|
|
6916
|
-
const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \
|
|
6917
|
-
const subtitleY = centered ? h / 2 + 28 - \u7D75\u306E\u82AF : 96 + cylinderShift - \
|
|
6957
|
+
const eyebrowY = centered ? h / 2 - 26 - \u7D75\u306E\u82AF : 32 + cylinderShift + \u4F59\u308A;
|
|
6958
|
+
const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u305A\u3089\u3057 - \u7D75\u306E\u82AF;
|
|
6959
|
+
const subtitleY = centered ? h / 2 + 28 - \u7D75\u306E\u82AF : 96 + cylinderShift - \u305A\u3089\u3057;
|
|
6918
6960
|
const iconX = centered ? w / 2 + 40 : w - 48;
|
|
6919
6961
|
const iconY = centered ? h / 2 - 44 - \u7D75\u306E\u82AF : 18 + cylinderShift;
|
|
6920
6962
|
const dominantBaseline = centered ? "middle" : void 0;
|