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