@knowvah/dot-engine 2.6.9 → 2.6.10

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/render.js CHANGED
@@ -11292,6 +11292,37 @@ function underlineDraw(ring, coord, filled, ctx) {
11292
11292
  renderShapePolyline([ring[2], ring[3]], coord, ctx);
11293
11293
  }
11294
11294
 
11295
+ // src/common/htmltable-style.ts
11296
+ function htmlStyle(style2) {
11297
+ const s = { radial: false, rounded: false, invisible: false, dotted: false, dashed: false };
11298
+ if (style2 === void 0) return s;
11299
+ for (const tk of style2.split(/[ ,]+/)) {
11300
+ switch (tk.toUpperCase()) {
11301
+ case "ROUNDED":
11302
+ s.rounded = true;
11303
+ break;
11304
+ case "RADIAL":
11305
+ s.radial = true;
11306
+ break;
11307
+ case "SOLID":
11308
+ s.dotted = false;
11309
+ s.dashed = false;
11310
+ break;
11311
+ case "INVISIBLE":
11312
+ case "INVIS":
11313
+ s.invisible = true;
11314
+ break;
11315
+ case "DOTTED":
11316
+ s.dotted = true;
11317
+ break;
11318
+ case "DASHED":
11319
+ s.dashed = true;
11320
+ break;
11321
+ }
11322
+ }
11323
+ return s;
11324
+ }
11325
+
11295
11326
  // src/common/htmltable-emit-rules.ts
11296
11327
  function emitHtmlRules(ctx) {
11297
11328
  withHtmlPaint({ fill: ctx.color, pen: ctx.color, penWidth: 1 }, ctx.job, () => {
@@ -11438,14 +11469,14 @@ function bgFillPaint(ctx) {
11438
11469
  fill: spec[0],
11439
11470
  stop: spec[1],
11440
11471
  gradientAngle: ctx.gradientangle ?? 0,
11441
- radial: ctx.style !== void 0 && ctx.style.includes("radial"),
11472
+ radial: htmlStyle(ctx.style).radial,
11442
11473
  penWidth
11443
11474
  };
11444
11475
  }
11445
11476
  function emitBgFill(ctx) {
11446
11477
  const { box, pos, border: border2, renderer, job } = ctx;
11447
11478
  withHtmlPaint(bgFillPaint(ctx), job, () => {
11448
- if (parseStyleFlags(ctx.style).rounded) {
11479
+ if (htmlStyle(ctx.style).rounded) {
11449
11480
  emitRoundedBezier(mkPts(box, border2, pos), { x: 0, y: 0 }, true, { renderer, job });
11450
11481
  return;
11451
11482
  }
@@ -11511,13 +11542,6 @@ function emitHtmlImg(img, pos, renderer, job) {
11511
11542
  }
11512
11543
  renderer.usershape?.(img.src, b, job);
11513
11544
  }
11514
- function htmlStyleInvisible(style2) {
11515
- if (style2 === void 0) return false;
11516
- return style2.split(/[ ,]+/).some((tok) => {
11517
- const t = tok.toUpperCase();
11518
- return t === "INVIS" || t === "INVISIBLE";
11519
- });
11520
- }
11521
11545
  function emitHtmlCell(cell2, pos, renderer, job) {
11522
11546
  const inAnchor = initHtmlAnchor(
11523
11547
  { href: cell2.href, title: cell2.title, target: cell2.target, id: cell2.id },
@@ -11525,7 +11549,7 @@ function emitHtmlCell(cell2, pos, renderer, job) {
11525
11549
  renderer,
11526
11550
  job
11527
11551
  );
11528
- if (htmlStyleInvisible(cell2.style)) {
11552
+ if (htmlStyle(cell2.style).invisible) {
11529
11553
  if (inAnchor) endHtmlAnchor(renderer, job);
11530
11554
  return;
11531
11555
  }
@@ -11561,7 +11585,7 @@ function emitHtmlLabel(placed, pos, renderer, job) {
11561
11585
  const tblBox = absBox(placed.box, pos);
11562
11586
  const clustersLast = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
11563
11587
  const inAnchor = clustersLast ? false : initHtmlAnchor(anchorData, tblBox, renderer, job);
11564
- const tblInvisible = htmlStyleInvisible(placed.style);
11588
+ const tblInvisible = htmlStyle(placed.style).invisible;
11565
11589
  if (!tblInvisible) {
11566
11590
  if (placed.bgcolor !== void 0) {
11567
11591
  emitBgFill({
@@ -20933,8 +20957,9 @@ function resetHtmlFillPenWidth() {
20933
20957
  htmlFillPen = 1;
20934
20958
  }
20935
20959
  function penTypeOf(style2) {
20936
- if (style2 !== void 0 && style2.includes("dashed")) return 1 /* Dashed */;
20937
- if (style2 !== void 0 && style2.includes("dotted")) return 2 /* Dotted */;
20960
+ const st = htmlStyle(style2);
20961
+ if (st.dashed) return 1 /* Dashed */;
20962
+ if (st.dotted) return 2 /* Dotted */;
20938
20963
  return 3 /* Solid */;
20939
20964
  }
20940
20965
  function withHtmlPaint(paint, job, drawFn) {
@@ -21001,7 +21026,7 @@ function doBorder(spec, renderer, job) {
21001
21026
  const { box, pos, border: border2, color, sides: sides2, style: style2 } = spec;
21002
21027
  htmlFillPen = border2;
21003
21028
  withHtmlPaint({ pen: color, penWidth: border2, penStyle: style2 }, job, () => {
21004
- if (parseStyleFlags(style2).rounded) {
21029
+ if (htmlStyle(style2).rounded) {
21005
21030
  emitRoundedBezier(mkPts(box, border2, pos), { x: 0, y: 0 }, false, { renderer, job });
21006
21031
  return;
21007
21032
  }