@swirly/renderer 0.17.6 → 0.18.1

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.
Files changed (55) hide show
  1. package/dist/.tsbuildinfo +1 -1767
  2. package/dist/arrow.js +6 -5
  3. package/dist/arrow.js.map +1 -1
  4. package/dist/decoration/barrier.js +5 -4
  5. package/dist/decoration/barrier.js.map +1 -1
  6. package/dist/decoration/index.js +2 -1
  7. package/dist/decoration/index.js.map +1 -1
  8. package/dist/decoration/range.js +5 -4
  9. package/dist/decoration/range.js.map +1 -1
  10. package/dist/index.js +7 -7
  11. package/dist/index.js.map +1 -1
  12. package/dist/message/complete.js +4 -4
  13. package/dist/message/complete.js.map +1 -1
  14. package/dist/message/error.js +5 -5
  15. package/dist/message/error.js.map +1 -1
  16. package/dist/message/index.js +2 -1
  17. package/dist/message/index.js.map +1 -1
  18. package/dist/message/non-stream.js +1 -1
  19. package/dist/message/non-stream.js.map +1 -1
  20. package/dist/message/scalar.js +8 -8
  21. package/dist/message/scalar.js.map +1 -1
  22. package/dist/message/stream.js +7 -7
  23. package/dist/message/stream.js.map +1 -1
  24. package/dist/operator.js +6 -5
  25. package/dist/operator.js.map +1 -1
  26. package/dist/stream-factory.d.ts +1 -1
  27. package/dist/stream-factory.js +16 -11
  28. package/dist/stream-factory.js.map +1 -1
  29. package/dist/stream.js +9 -8
  30. package/dist/stream.js.map +1 -1
  31. package/dist/util/create-element.js +2 -1
  32. package/dist/util/create-element.js.map +1 -1
  33. package/dist/util/degrees-to-radians.js +2 -1
  34. package/dist/util/degrees-to-radians.js.map +1 -1
  35. package/dist/util/geometry.js +18 -13
  36. package/dist/util/geometry.js.map +1 -1
  37. package/dist/util/hex-to-dec.js +2 -1
  38. package/dist/util/hex-to-dec.js.map +1 -1
  39. package/dist/util/merge-styles.js +3 -2
  40. package/dist/util/merge-styles.js.map +1 -1
  41. package/dist/util/notification-kind.js +4 -3
  42. package/dist/util/notification-kind.js.map +1 -1
  43. package/dist/util/string-to-color.js +4 -3
  44. package/dist/util/string-to-color.js.map +1 -1
  45. package/dist/util/transform.js +8 -5
  46. package/dist/util/transform.js.map +1 -1
  47. package/package.json +5 -5
  48. package/src/decoration/barrier.ts +2 -4
  49. package/src/index.ts +2 -2
  50. package/src/message/non-stream.ts +1 -1
  51. package/src/message/stream.ts +2 -2
  52. package/src/stream-factory.ts +85 -74
  53. package/src/stream.ts +1 -1
  54. package/src/util/geometry.ts +4 -4
  55. package/src/util/merge-styles.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"create-element.js","sourceRoot":"","sources":["../../src/util/create-element.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,CAC3B,QAAqB,EACrB,IAAY,EACZ,QAA6B,EAAE,EAC/B,OAAe,EAAE,EACL,EAAE;IACd,MAAM,GAAG,GAAG,QAAQ,CAAC,eAAe,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;IAExE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;KACtC;IAED,IAAI,IAAI,KAAK,EAAE,EAAE;QACf,GAAG,CAAC,WAAW,GAAG,IAAI,CAAA;KACvB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
1
+ {"version":3,"file":"create-element.js","sourceRoot":"","sources":["../../src/util/create-element.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAC3B,QAAqB,EACrB,IAAY,EACZ,QAA6B,EAAE,EAC/B,OAAe,EAAE,EACL,EAAE;IACd,MAAM,GAAG,GAAG,QAAQ,CAAC,eAAe,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;IAExE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;KACtC;IAED,IAAI,IAAI,KAAK,EAAE,EAAE;QACf,GAAG,CAAC,WAAW,GAAG,IAAI,CAAA;KACvB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAjBY,QAAA,aAAa,iBAiBzB"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.degreesToRadians = void 0;
4
- exports.degreesToRadians = (degrees) => (degrees / 180) * Math.PI;
4
+ const degreesToRadians = (degrees) => (degrees / 180) * Math.PI;
5
+ exports.degreesToRadians = degreesToRadians;
5
6
  //# sourceMappingURL=degrees-to-radians.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"degrees-to-radians.js","sourceRoot":"","sources":["../../src/util/degrees-to-radians.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE,CAC1D,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA"}
1
+ {"version":3,"file":"degrees-to-radians.js","sourceRoot":"","sources":["../../src/util/degrees-to-radians.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE,CAC1D,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;AADd,QAAA,gBAAgB,oBACF"}
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rectangleUnion = exports.rotateRectangle = exports.rotatePoint = exports.translateRectangle = exports.translatePoint = void 0;
4
- exports.translatePoint = (x, y, dx, dy) => ({
4
+ const translatePoint = (x, y, dx, dy) => ({
5
5
  x: x + dx,
6
6
  y: y + dy
7
7
  });
8
- exports.translateRectangle = ({ x1, y1, x2, y2 }, dx, dy) => {
9
- const p1 = exports.translatePoint(x1, y1, dx, dy);
10
- const p2 = exports.translatePoint(x2, y2, dx, dy);
8
+ exports.translatePoint = translatePoint;
9
+ const translateRectangle = ({ x1, y1, x2, y2 }, dx, dy) => {
10
+ const p1 = (0, exports.translatePoint)(x1, y1, dx, dy);
11
+ const p2 = (0, exports.translatePoint)(x2, y2, dx, dy);
11
12
  return {
12
13
  x1: p1.x,
13
14
  y1: p1.y,
@@ -15,7 +16,8 @@ exports.translateRectangle = ({ x1, y1, x2, y2 }, dx, dy) => {
15
16
  y2: p2.y
16
17
  };
17
18
  };
18
- exports.rotatePoint = (x, y, angle, x0, y0) => {
19
+ exports.translateRectangle = translateRectangle;
20
+ const rotatePoint = (x, y, angle, x0, y0) => {
19
21
  const s = Math.sin(angle);
20
22
  const c = Math.cos(angle);
21
23
  x -= x0;
@@ -25,9 +27,10 @@ exports.rotatePoint = (x, y, angle, x0, y0) => {
25
27
  y: x * s + y * c + y0
26
28
  };
27
29
  };
28
- exports.rotateRectangle = ({ x1, y1, x2, y2 }, angle, x0, y0) => {
29
- const p1 = exports.rotatePoint(x1, y1, angle, x0, y0);
30
- const p2 = exports.rotatePoint(x2, y2, angle, x0, y0);
30
+ exports.rotatePoint = rotatePoint;
31
+ const rotateRectangle = ({ x1, y1, x2, y2 }, angle, x0, y0) => {
32
+ const p1 = (0, exports.rotatePoint)(x1, y1, angle, x0, y0);
33
+ const p2 = (0, exports.rotatePoint)(x2, y2, angle, x0, y0);
31
34
  return {
32
35
  x1: p1.x,
33
36
  y1: p1.y,
@@ -35,16 +38,18 @@ exports.rotateRectangle = ({ x1, y1, x2, y2 }, angle, x0, y0) => {
35
38
  y2: p2.y
36
39
  };
37
40
  };
38
- exports.rectangleUnion = (rects) => {
41
+ exports.rotateRectangle = rotateRectangle;
42
+ const rectangleUnion = (rects) => {
39
43
  const nonEmptyRects = rects.filter(({ x1, y1, x2, y2 }) => x2 - x1 !== 0 && y2 - y1 !== 0);
40
44
  if (nonEmptyRects.length === 0) {
41
45
  throw new Error('All rectangles empty');
42
46
  }
43
47
  return {
44
- x1: Math.min(...nonEmptyRects.map(rect => rect.x1)),
45
- y1: Math.min(...nonEmptyRects.map(rect => rect.y1)),
46
- x2: Math.max(...nonEmptyRects.map(rect => rect.x2)),
47
- y2: Math.max(...nonEmptyRects.map(rect => rect.y2))
48
+ x1: Math.min(...nonEmptyRects.map((rect) => rect.x1)),
49
+ y1: Math.min(...nonEmptyRects.map((rect) => rect.y1)),
50
+ x2: Math.max(...nonEmptyRects.map((rect) => rect.x2)),
51
+ y2: Math.max(...nonEmptyRects.map((rect) => rect.y2))
48
52
  };
49
53
  };
54
+ exports.rectangleUnion = rectangleUnion;
50
55
  //# sourceMappingURL=geometry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/util/geometry.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAG,CAC5B,CAAS,EACT,CAAS,EACT,EAAU,EACV,EAAU,EACH,EAAE,CAAC,CAAC;IACX,CAAC,EAAE,CAAC,GAAG,EAAE;IACT,CAAC,EAAE,CAAC,GAAG,EAAE;CACV,CAAC,CAAA;AAEW,QAAA,kBAAkB,GAAG,CAChC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAa,EAC7B,EAAU,EACV,EAAU,EACC,EAAE;IACb,MAAM,EAAE,GAAG,sBAAc,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IACzC,MAAM,EAAE,GAAG,sBAAc,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IACzC,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,CAAC;QACR,EAAE,EAAE,EAAE,CAAC,CAAC;QACR,EAAE,EAAE,EAAE,CAAC,CAAC;QACR,EAAE,EAAE,EAAE,CAAC,CAAC;KACT,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,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e,mBAc3B;AAEM,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAa,EAAE;IACvE,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAChC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CACvD,CAAA;IACD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;KACxC;IACD,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrD,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrD,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrD,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACtD,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hexToDec = void 0;
4
4
  const A = 'A'.charCodeAt(0);
5
5
  const ZERO = '0'.charCodeAt(0);
6
- exports.hexToDec = (hex) => {
6
+ const hexToDec = (hex) => {
7
7
  let dec = 0;
8
8
  hex = hex.toUpperCase();
9
9
  for (let i = 0; i < hex.length; ++i) {
@@ -12,4 +12,5 @@ exports.hexToDec = (hex) => {
12
12
  }
13
13
  return dec;
14
14
  };
15
+ exports.hexToDec = hexToDec;
15
16
  //# sourceMappingURL=hex-to-dec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hex-to-dec.js","sourceRoot":"","sources":["../../src/util/hex-to-dec.ts"],"names":[],"mappings":";;;AAAA,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAEjB,QAAA,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE;IAC9C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACnC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAC3B,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;KACpD;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
1
+ {"version":3,"file":"hex-to-dec.js","sourceRoot":"","sources":["../../src/util/hex-to-dec.ts"],"names":[],"mappings":";;;AAAA,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAEvB,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE;IAC9C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACnC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAC3B,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;KACpD;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AARY,QAAA,QAAQ,YAQpB"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mergeStyles = void 0;
4
- exports.mergeStyles = (globalStyles, localStyles, globalPrefix, localStylesPrefixed = false) => {
4
+ const mergeStyles = (globalStyles, localStyles, globalPrefix, localStylesPrefixed = false) => {
5
5
  const result = {};
6
- const globalKeys = Object.keys(globalStyles).filter(key => key.startsWith(globalPrefix));
6
+ const globalKeys = Object.keys(globalStyles).filter((key) => key.startsWith(globalPrefix));
7
7
  for (const globalKey of globalKeys) {
8
8
  const simpleKey = globalKey.substr(globalPrefix.length);
9
9
  const localKey = localStylesPrefixed ? globalKey : simpleKey;
@@ -14,4 +14,5 @@ exports.mergeStyles = (globalStyles, localStyles, globalPrefix, localStylesPrefi
14
14
  }
15
15
  return result;
16
16
  };
17
+ exports.mergeStyles = mergeStyles;
17
18
  //# sourceMappingURL=merge-styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-styles.js","sourceRoot":"","sources":["../../src/util/merge-styles.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,CACzB,YAA4B,EAC5B,WAA8C,EAC9C,YAAoB,EACpB,sBAA+B,KAAK,EACpB,EAAE;IAClB,MAAM,MAAM,GAAmB,EAAE,CAAA;IAEjC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,Y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D,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACvB,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;KAC9B;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AArBY,QAAA,WAAW,eAqBvB"}
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotificationKind = void 0;
4
4
  class NotificationKind {
5
+ static NEXT = new NotificationKind('N');
6
+ static COMPLETE = new NotificationKind('C');
7
+ static ERROR = new NotificationKind('E');
8
+ char;
5
9
  constructor(char) {
6
10
  this.char = char;
7
11
  }
@@ -10,7 +14,4 @@ class NotificationKind {
10
14
  }
11
15
  }
12
16
  exports.NotificationKind = NotificationKind;
13
- NotificationKind.NEXT = new NotificationKind('N');
14
- NotificationKind.COMPLETE = new NotificationKind('C');
15
- NotificationKind.ERROR = new NotificationKind('E');
16
17
  //# sourceMappingURL=notification-kind.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-kind.js","sourceRoot":"","sources":["../../src/util/notification-kind.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAO3B,YAAqB,IAAY;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAE,CAAM;QACZ,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,IAAI,CAAA;IACzE,CAAC;;AAbH,4CAcC;AAbQ,qBAAI,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAChC,yBAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;AACpC,sBAAK,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA"}
1
+ {"version":3,"file":"notification-kind.js","sourceRoot":"","sources":["../../src/util/notification-kind.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAC3B,MAAM,CAAC,IAAI,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACvC,MAAM,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;IAC3C,MAAM,CAAC,KAAK,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;IAEhC,IAAI,CAAQ;IAEpB,YAAqB,IAAY;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAE,CAAM;QACZ,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,IAAI,CAAA;IACzE,CAAC;;AAbH,4CAcC"}
@@ -4,12 +4,13 @@ exports.stringToColor = void 0;
4
4
  // @ts-ignore
5
5
  const simple_sha1_1 = require("simple-sha1");
6
6
  const hex_to_dec_1 = require("./hex-to-dec");
7
- exports.stringToColor = (str, mode) => {
8
- const hashHex = simple_sha1_1.sync(str);
9
- const hash = hex_to_dec_1.hexToDec(hashHex.substr(4, 4));
7
+ const stringToColor = (str, mode) => {
8
+ const hashHex = (0, simple_sha1_1.sync)(str);
9
+ const hash = (0, hex_to_dec_1.hexToDec)(hashHex.substr(4, 4));
10
10
  const hue = Math.round((hash / (1 << 16)) * 360);
11
11
  const saturation = 60;
12
12
  const lightness = mode === 'dark' ? 20 : 80;
13
13
  return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
14
14
  };
15
+ exports.stringToColor = stringToColor;
15
16
  //# sourceMappingURL=string-to-color.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string-to-color.js","sourceRoot":"","sources":["../../src/util/string-to-color.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,6CAA0C;AAE1C,6CAAuC;AAE1B,QAAA,aAAa,GAAG,CAAC,GAAW,EAAE,IAAsB,EAAU,EAAE;IAC3E,MAAM,OAAO,GAAG,kBAAI,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,IAAI,GAAG,qBAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,EAAE,CAAA;IACrB,MAAM,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,OAAO,OAAO,GAAG,KAAK,UAAU,MAAM,SAAS,IAAI,CAAA;AACrD,CAAC,CAAA"}
1
+ {"version":3,"file":"string-to-color.js","sourceRoot":"","sources":["../../src/util/string-to-color.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,6CAA0C;AAE1C,6CAAuC;AAEhC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,IAAsB,EAAU,EAAE;IAC3E,MAAM,OAAO,GAAG,IAAA,kBAAI,EAAC,GAAG,CAAC,CAAA;IACzB,MAAM,IAAI,GAAG,IAAA,qBAAQ,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,EAAE,CAAA;IACrB,MAAM,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,OAAO,OAAO,GAAG,KAAK,UAAU,MAAM,SAAS,IAAI,CAAA;AACrD,CAAC,CAAA;AAPY,QAAA,aAAa,iBAOzB"}
@@ -1,21 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rotate = exports.translate = exports.transform = void 0;
4
- exports.transform = ($element, value) => {
4
+ const transform = ($element, value) => {
5
5
  const existing = $element.getAttribute('transform');
6
6
  const updated = (existing != null && existing !== '' ? existing + ' ' : '') + value;
7
7
  $element.setAttribute('transform', updated);
8
8
  };
9
- exports.translate = ($element, x, y) => {
9
+ exports.transform = transform;
10
+ const translate = ($element, x, y) => {
10
11
  if (x === 0 && y === 0) {
11
12
  return;
12
13
  }
13
- exports.transform($element, `translate(${x} ${y})`);
14
+ (0, exports.transform)($element, `translate(${x} ${y})`);
14
15
  };
15
- exports.rotate = ($element, angle, x = 0, y = 0) => {
16
+ exports.translate = translate;
17
+ const rotate = ($element, angle, x = 0, y = 0) => {
16
18
  if (angle === 0) {
17
19
  return;
18
20
  }
19
- exports.transform($element, `rotate(${angle} ${x} ${y})`);
21
+ (0, exports.transform)($element, `rotate(${angle} ${x} ${y})`);
20
22
  };
23
+ exports.rotate = rotate;
21
24
  //# sourceMappingURL=transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/util/transform.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,CAAC,QAAoB,EAAE,KAAa,EAAE,EAAE;IAC/D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;IACnD,MAAM,OAAO,GACX,CAAC,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;IACrE,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC,CAAA;AAEY,QAAA,SAAS,GAAG,CAAC,QAAoB,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE;IACtE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACtB,OAAM;KAC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IAAA,iBAAS,EAAC,QAAQ,EAAE,UAAU,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC,CAAA;AAVY,QAAA,MAAM,UAUlB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swirly/renderer",
3
3
  "description": "Renderer for Swirly marble diagrams.",
4
- "version": "0.17.6",
4
+ "version": "0.18.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,19 +30,19 @@
30
30
  "prepare": "yarn run build"
31
31
  },
32
32
  "engines": {
33
- "node": ">=10"
33
+ "node": ">=14"
34
34
  },
35
35
  "dependencies": {
36
- "@swirly/theme-default-light": "^0.17.6",
36
+ "@swirly/theme-default-light": "^0.18.1",
37
37
  "simple-sha1": "^3.1.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@swirly/types": "^0.17.6",
40
+ "@swirly/types": "^0.18.1",
41
41
  "shx": "^0.3.3"
42
42
  },
43
43
  "funding": {
44
44
  "type": "github",
45
45
  "url": "https://github.com/sponsors/timdp"
46
46
  },
47
- "gitHead": "00010869a926a029391961c257911d040cbefe4b"
47
+ "gitHead": "59326f5cae968f4702641aea274f61225d247281"
48
48
  }
@@ -13,10 +13,8 @@ export const renderBarrierDecoration = (
13
13
  { document, styles, bbox, scaleTime }: DecorationRendererContext,
14
14
  decoration: DecorationSpecification
15
15
  ): DecorationRendererResult => {
16
- const {
17
- frame,
18
- styles: ownStyles
19
- } = decoration as BarrierDecorationSpecification
16
+ const { frame, styles: ownStyles } =
17
+ decoration as BarrierDecorationSpecification
20
18
 
21
19
  const s: BarrierDecorationStyles = mergeStyles(styles, ownStyles, 'barrier_')
22
20
 
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ const renderMarbleDiagram = (
35
35
  const parser: DOMParser = new DOMParserImpl()
36
36
  const document: XMLDocument = parser.parseFromString(EMPTY_SVG, MIME_TYPE)
37
37
  // XXX Typings for Document think it's HTML
38
- const $svg = (document.documentElement as unknown) as SVGSVGElement
38
+ const $svg = document.documentElement as unknown as SVGSVGElement
39
39
 
40
40
  const styles = {
41
41
  ...lightStyles,
@@ -54,7 +54,7 @@ const renderMarbleDiagram = (
54
54
  )
55
55
 
56
56
  const streamTitleEnabled = spec.content.some(
57
- item => isStream(item) && item.title != null && item.title !== ''
57
+ (item) => isStream(item) && item.title != null && item.title !== ''
58
58
  )
59
59
 
60
60
  const ctx: RendererContext = {
@@ -23,7 +23,7 @@ const render = (
23
23
  message: MessageSpecification,
24
24
  options: MessageRendererOptions
25
25
  ): RendererResult => {
26
- const renderer = strategies.find(renderer => renderer.supports(message))!
26
+ const renderer = strategies.find((renderer) => renderer.supports(message))!
27
27
  return renderer.render(ctx, message, options)
28
28
  }
29
29
 
@@ -25,12 +25,12 @@ const render = (
25
25
  { verticalOffset }: MessageRendererOptions
26
26
  ): RendererResult => {
27
27
  const { styles, streamHeight } = ctx
28
- const { value } = notification as StreamNextNotificationSpecification
28
+ const { value, isGhost } = notification as StreamNextNotificationSpecification
29
29
 
30
30
  const x = frame * styles.frame_width!
31
31
  const y = streamHeight / 2 + verticalOffset
32
32
 
33
- const { element: $group, bbox } = renderStreamImpl(ctx, true, value)
33
+ const { element: $group, bbox } = renderStreamImpl(ctx, value, true, isGhost)
34
34
 
35
35
  rotate($group, styles.higher_order_angle!, x, y)
36
36
  translate($group, x, 0)
@@ -20,11 +20,11 @@ import { mergeStyles } from './util/merge-styles'
20
20
  import { NotificationKind } from './util/notification-kind'
21
21
  import { translate } from './util/transform'
22
22
 
23
- const nullScaleTime: TimeScaler = time => time
23
+ const nullScaleTime: TimeScaler = (time) => time
24
24
 
25
25
  const createScaleTime = (higherOrderAngleDegrees: number): TimeScaler => {
26
26
  const scale = 1 / Math.cos(degreesToRadians(higherOrderAngleDegrees))
27
- return time => time * scale
27
+ return (time) => time * scale
28
28
  }
29
29
 
30
30
  const isNotification = ({
@@ -45,81 +45,92 @@ const countPriors = (
45
45
  return count
46
46
  }
47
47
 
48
- export const createRenderStream = (renderMessage: MessageRenderer) => (
49
- ctx: RendererContext,
50
- isHigherOrder: boolean,
51
- stream: StreamSpecification
52
- ): RendererResult => {
53
- const { document, styles } = ctx
54
-
55
- const scaleTime = isHigherOrder
56
- ? createScaleTime(styles.higher_order_angle!)
57
- : nullScaleTime
58
-
59
- const $group = createElement(document, 'g')
60
- const bboxes: Rectangle[] = []
61
-
62
- const add = ({ element, bbox }: RendererResult) => {
63
- $group.appendChild(element)
64
- bboxes.push(bbox)
65
- }
66
-
67
- const arrowStyles: ArrowStyles = mergeStyles(
68
- styles,
69
- stream.styles,
70
- 'arrow_',
71
- true
72
- )
73
- const scaledDuration = scaleTime(stream.duration)
74
- add(renderArrow(ctx, arrowStyles, styles.arrowhead_angle!, scaledDuration))
75
-
76
- for (let i = stream.messages.length - 1; i >= 0; --i) {
77
- const message = stream.messages[i]
78
- const scaledMessage = {
79
- ...message,
80
- frame: scaleTime(message.frame)
81
- }
82
-
83
- const priorCount = isNotification(message)
84
- ? countPriors(message, i, stream.messages)
85
- : 0
86
- const dy = priorCount * styles.stacking_height!
87
-
88
- const valueAngle = isHigherOrder
89
- ? styles.higher_order_event_value_angle!
90
- : 0
91
-
92
- const options = {
93
- verticalOffset: dy,
94
- valueAngle
95
- }
96
-
97
- const { element, bbox } = renderMessage(ctx, scaledMessage, options)
48
+ export const createRenderStream =
49
+ (renderMessage: MessageRenderer) =>
50
+ (
51
+ ctx: RendererContext,
52
+ stream: StreamSpecification,
53
+ isHigherOrder: boolean,
54
+ isGhost: boolean
55
+ ): RendererResult => {
56
+ const { document, styles } = ctx
57
+
58
+ const scaleTime = isHigherOrder
59
+ ? createScaleTime(styles.higher_order_angle!)
60
+ : nullScaleTime
61
+
62
+ const $group = createElement(
63
+ document,
64
+ 'g',
65
+ isGhost
66
+ ? {
67
+ style: `filter: opacity(${styles.ghost_opacity}%)`
68
+ }
69
+ : undefined
70
+ )
71
+ const bboxes: Rectangle[] = []
72
+
73
+ const add = ({ element, bbox }: RendererResult) => {
74
+ $group.appendChild(element)
75
+ bboxes.push(bbox)
76
+ }
98
77
 
99
- translate(element, 0, dy)
100
- bbox.y2 += dy
78
+ const arrowStyles: ArrowStyles = mergeStyles(
79
+ styles,
80
+ stream.styles,
81
+ 'arrow_',
82
+ true
83
+ )
84
+ const scaledDuration = scaleTime(stream.duration)
85
+ add(renderArrow(ctx, arrowStyles, styles.arrowhead_angle!, scaledDuration))
86
+
87
+ for (let i = stream.messages.length - 1; i >= 0; --i) {
88
+ const message = stream.messages[i]
89
+ const scaledMessage = {
90
+ ...message,
91
+ frame: scaleTime(message.frame)
92
+ }
93
+
94
+ const priorCount = isNotification(message)
95
+ ? countPriors(message, i, stream.messages)
96
+ : 0
97
+ const dy = priorCount * styles.stacking_height!
98
+
99
+ const valueAngle = isHigherOrder
100
+ ? styles.higher_order_event_value_angle!
101
+ : 0
102
+
103
+ const options = {
104
+ verticalOffset: dy,
105
+ valueAngle
106
+ }
107
+
108
+ const { element, bbox } = renderMessage(ctx, scaledMessage, options)
109
+
110
+ translate(element, 0, dy)
111
+ bbox.y2 += dy
112
+
113
+ add({ element, bbox })
114
+ }
101
115
 
102
- add({ element, bbox })
103
- }
116
+ const innerCtx = {
117
+ ...ctx,
118
+ scaleTime,
119
+ bbox: rectangleUnion(bboxes)
120
+ }
104
121
 
105
- const innerCtx = {
106
- ...ctx,
107
- scaleTime,
108
- bbox: rectangleUnion(bboxes)
109
- }
122
+ if (stream.decorations != null) {
123
+ for (const decoration of stream.decorations) {
124
+ const { element, bbox } = renderDecoration(innerCtx, decoration)
125
+ $group.appendChild(element)
126
+ if (bbox != null) {
127
+ innerCtx.bbox = rectangleUnion([innerCtx.bbox, bbox])
128
+ }
129
+ }
130
+ }
110
131
 
111
- if (stream.decorations != null) {
112
- for (const decoration of stream.decorations) {
113
- const { element, bbox } = renderDecoration(innerCtx, decoration)
114
- $group.appendChild(element)
115
- if (bbox != null) {
116
- innerCtx.bbox = rectangleUnion([innerCtx.bbox, bbox])
132
+ return {
133
+ element: $group,
134
+ bbox: innerCtx.bbox
117
135
  }
118
136
  }
119
- }
120
-
121
- return {
122
- element: $group,
123
- bbox: innerCtx.bbox
124
- }
125
- }
package/src/stream.ts CHANGED
@@ -16,7 +16,7 @@ export const renderStream = (
16
16
  const { document, styles, streamHeight, streamTitleEnabled } = ctx
17
17
  const s: StreamStyles = mergeStyles(styles, stream.styles, 'stream_')
18
18
 
19
- const renderStreamResult = renderStreamImpl(ctx, false, stream)
19
+ const renderStreamResult = renderStreamImpl(ctx, stream, false, false)
20
20
 
21
21
  const { element: $streamGroup, bbox } = renderStreamResult
22
22
 
@@ -66,9 +66,9 @@ export const rectangleUnion = (rects: readonly Rectangle[]): Rectangle => {
66
66
  throw new Error('All rectangles empty')
67
67
  }
68
68
  return {
69
- x1: Math.min(...nonEmptyRects.map(rect => rect.x1)),
70
- y1: Math.min(...nonEmptyRects.map(rect => rect.y1)),
71
- x2: Math.max(...nonEmptyRects.map(rect => rect.x2)),
72
- y2: Math.max(...nonEmptyRects.map(rect => rect.y2))
69
+ x1: Math.min(...nonEmptyRects.map((rect) => rect.x1)),
70
+ y1: Math.min(...nonEmptyRects.map((rect) => rect.y1)),
71
+ x2: Math.max(...nonEmptyRects.map((rect) => rect.x2)),
72
+ y2: Math.max(...nonEmptyRects.map((rect) => rect.y2))
73
73
  }
74
74
  }
@@ -8,7 +8,7 @@ export const mergeStyles = (
8
8
  ): FreeformStyles => {
9
9
  const result: FreeformStyles = {}
10
10
 
11
- const globalKeys = Object.keys(globalStyles).filter(key =>
11
+ const globalKeys = Object.keys(globalStyles).filter((key) =>
12
12
  key.startsWith(globalPrefix)
13
13
  )
14
14
  for (const globalKey of globalKeys) {