@cardenelabs/cdl 0.103.0 → 0.105.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 +65 -1
- package/dist/index.cjs +67 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +67 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +67 -1
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/spec.ts +116 -0
- package/src/visual-validate.ts +23 -5
package/dist/index.js
CHANGED
|
@@ -12375,6 +12375,71 @@ var KINDS_FITTING_OWN_TITLE = /* @__PURE__ */ new Set([
|
|
|
12375
12375
|
function fitsOwnTitleWidth(kind) {
|
|
12376
12376
|
return KINDS_FITTING_OWN_TITLE.has(kind ?? "");
|
|
12377
12377
|
}
|
|
12378
|
+
var KINDS_DRAWING_TITLE_OUTSIDE = /* @__PURE__ */ new Set([
|
|
12379
|
+
"dyn-rect",
|
|
12380
|
+
"dyn-circle",
|
|
12381
|
+
"dyn-arc",
|
|
12382
|
+
"dyn-wave",
|
|
12383
|
+
"dyn-polygon",
|
|
12384
|
+
...KINDS_DRAWING_OWN_PAYLOAD
|
|
12385
|
+
]);
|
|
12386
|
+
function drawsTitleOutsideBox(kind) {
|
|
12387
|
+
return KINDS_DRAWING_TITLE_OUTSIDE.has(kind ?? "");
|
|
12388
|
+
}
|
|
12389
|
+
var TITLE_FONT_SIZE_DEFAULT = 18;
|
|
12390
|
+
var TITLE_FONT_SIZE = new Map([
|
|
12391
|
+
...["dyn-rect", "dyn-circle", "dyn-arc", "dyn-wave", "dyn-polygon"].map(
|
|
12392
|
+
(k) => [k, 13]
|
|
12393
|
+
),
|
|
12394
|
+
...[
|
|
12395
|
+
"shape-code-block",
|
|
12396
|
+
"shape-cylinder",
|
|
12397
|
+
"shape-diamond",
|
|
12398
|
+
"shape-iot-sensor",
|
|
12399
|
+
"shape-robot-arm",
|
|
12400
|
+
"shape-stack",
|
|
12401
|
+
"shape-terminal"
|
|
12402
|
+
].map((k) => [k, 15]),
|
|
12403
|
+
...[
|
|
12404
|
+
"shape-cloud",
|
|
12405
|
+
"shape-file",
|
|
12406
|
+
"shape-folder",
|
|
12407
|
+
"shape-hexagon",
|
|
12408
|
+
"shape-message-bubble",
|
|
12409
|
+
"shape-window"
|
|
12410
|
+
].map((k) => [k, 16]),
|
|
12411
|
+
["shape-kanban-card", 17],
|
|
12412
|
+
...[
|
|
12413
|
+
"admin",
|
|
12414
|
+
"api",
|
|
12415
|
+
"backend",
|
|
12416
|
+
"cache",
|
|
12417
|
+
"cdn",
|
|
12418
|
+
"cloud",
|
|
12419
|
+
"database",
|
|
12420
|
+
"decision",
|
|
12421
|
+
"developer",
|
|
12422
|
+
"external-user",
|
|
12423
|
+
"frontend",
|
|
12424
|
+
"merkle-tree",
|
|
12425
|
+
"message-bus",
|
|
12426
|
+
"microservice",
|
|
12427
|
+
"oracle",
|
|
12428
|
+
"person",
|
|
12429
|
+
"queue",
|
|
12430
|
+
"service",
|
|
12431
|
+
"signer",
|
|
12432
|
+
"user-group",
|
|
12433
|
+
"webhook"
|
|
12434
|
+
].map((k) => [k, 20]),
|
|
12435
|
+
...["card", "event", "function"].map((k) => [k, 24]),
|
|
12436
|
+
["actor", 32],
|
|
12437
|
+
["storage", 34]
|
|
12438
|
+
]);
|
|
12439
|
+
function titleFontSize(kind) {
|
|
12440
|
+
return TITLE_FONT_SIZE.get(kind ?? "") ?? TITLE_FONT_SIZE_DEFAULT;
|
|
12441
|
+
}
|
|
12442
|
+
var TITLE_BOX_PADDING = 52;
|
|
12378
12443
|
var KINDS_DRAWN_BY_GENERIC = [
|
|
12379
12444
|
"person",
|
|
12380
12445
|
"user-group",
|
|
@@ -17159,7 +17224,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
|
|
|
17159
17224
|
const titleTrimmed = n.title?.trim() ?? "";
|
|
17160
17225
|
if (!titleTrimmed) continue;
|
|
17161
17226
|
const titleLen = titleTrimmed.length;
|
|
17162
|
-
const expectedW = titleLen *
|
|
17227
|
+
const expectedW = titleLen * titleFontSize(n.kind) + (drawsTitleOutsideBox(n.kind) ? 0 : TITLE_BOX_PADDING);
|
|
17163
17228
|
if (expectedW > n.w + 8) {
|
|
17164
17229
|
push(
|
|
17165
17230
|
"text-readability",
|
|
@@ -17375,6 +17440,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
|
|
|
17375
17440
|
}
|
|
17376
17441
|
for (const n of laid.nodes) {
|
|
17377
17442
|
if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
|
|
17443
|
+
if (!isRenderedNode(n)) continue;
|
|
17378
17444
|
const nodeLeft = n.cx - n.w / 2;
|
|
17379
17445
|
const nodeTop = n.cy - n.h / 2;
|
|
17380
17446
|
const nodeRight = n.cx + n.w / 2;
|