@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/dist/react.js CHANGED
@@ -973,6 +973,71 @@ var KINDS_FITTING_OWN_TITLE = /* @__PURE__ */ new Set([
973
973
  function fitsOwnTitleWidth(kind) {
974
974
  return KINDS_FITTING_OWN_TITLE.has(kind ?? "");
975
975
  }
976
+ var KINDS_DRAWING_TITLE_OUTSIDE = /* @__PURE__ */ new Set([
977
+ "dyn-rect",
978
+ "dyn-circle",
979
+ "dyn-arc",
980
+ "dyn-wave",
981
+ "dyn-polygon",
982
+ ...KINDS_DRAWING_OWN_PAYLOAD
983
+ ]);
984
+ function drawsTitleOutsideBox(kind) {
985
+ return KINDS_DRAWING_TITLE_OUTSIDE.has(kind ?? "");
986
+ }
987
+ var TITLE_FONT_SIZE_DEFAULT = 18;
988
+ var TITLE_FONT_SIZE = new Map([
989
+ ...["dyn-rect", "dyn-circle", "dyn-arc", "dyn-wave", "dyn-polygon"].map(
990
+ (k) => [k, 13]
991
+ ),
992
+ ...[
993
+ "shape-code-block",
994
+ "shape-cylinder",
995
+ "shape-diamond",
996
+ "shape-iot-sensor",
997
+ "shape-robot-arm",
998
+ "shape-stack",
999
+ "shape-terminal"
1000
+ ].map((k) => [k, 15]),
1001
+ ...[
1002
+ "shape-cloud",
1003
+ "shape-file",
1004
+ "shape-folder",
1005
+ "shape-hexagon",
1006
+ "shape-message-bubble",
1007
+ "shape-window"
1008
+ ].map((k) => [k, 16]),
1009
+ ["shape-kanban-card", 17],
1010
+ ...[
1011
+ "admin",
1012
+ "api",
1013
+ "backend",
1014
+ "cache",
1015
+ "cdn",
1016
+ "cloud",
1017
+ "database",
1018
+ "decision",
1019
+ "developer",
1020
+ "external-user",
1021
+ "frontend",
1022
+ "merkle-tree",
1023
+ "message-bus",
1024
+ "microservice",
1025
+ "oracle",
1026
+ "person",
1027
+ "queue",
1028
+ "service",
1029
+ "signer",
1030
+ "user-group",
1031
+ "webhook"
1032
+ ].map((k) => [k, 20]),
1033
+ ...["card", "event", "function"].map((k) => [k, 24]),
1034
+ ["actor", 32],
1035
+ ["storage", 34]
1036
+ ]);
1037
+ function titleFontSize(kind) {
1038
+ return TITLE_FONT_SIZE.get(kind ?? "") ?? TITLE_FONT_SIZE_DEFAULT;
1039
+ }
1040
+ var TITLE_BOX_PADDING = 52;
976
1041
  var KINDS_DRAWN_BY_GENERIC = [
977
1042
  "person",
978
1043
  "user-group",
@@ -6067,7 +6132,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
6067
6132
  const titleTrimmed = n.title?.trim() ?? "";
6068
6133
  if (!titleTrimmed) continue;
6069
6134
  const titleLen = titleTrimmed.length;
6070
- const expectedW = titleLen * 22 + 52;
6135
+ const expectedW = titleLen * titleFontSize(n.kind) + (drawsTitleOutsideBox(n.kind) ? 0 : TITLE_BOX_PADDING);
6071
6136
  if (expectedW > n.w + 8) {
6072
6137
  push(
6073
6138
  "text-readability",
@@ -6283,6 +6348,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
6283
6348
  }
6284
6349
  for (const n of laid.nodes) {
6285
6350
  if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
6351
+ if (!isRenderedNode(n)) continue;
6286
6352
  const nodeLeft = n.cx - n.w / 2;
6287
6353
  const nodeTop = n.cy - n.h / 2;
6288
6354
  const nodeRight = n.cx + n.w / 2;