UNPKG

generic-interceptor

Version:

Provide proxy handler for getting properties and executing functions

581 lines (548 loc) 27.6 kB
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8" /> <title>dependency graph</title> <style> .node:active path, .node:hover path, .node.current path, .node:active polygon, .node:hover polygon, .node.current polygon { stroke: fuchsia; stroke-width: 2; } .edge:active path, .edge:hover path, .edge.current path, .edge:active ellipse, .edge:hover ellipse, .edge.current ellipse { stroke: fuchsia; stroke-width: 3; stroke-opacity: 1; } .edge:active polygon, .edge:hover polygon, .edge.current polygon { stroke: fuchsia; stroke-width: 3; fill: fuchsia; stroke-opacity: 1; fill-opacity: 1; } .edge:active text, .edge:hover text { fill: fuchsia; } .cluster path { stroke-width: 3; } .cluster:active path, .cluster:hover path { fill: #ffff0011; } div.hint { background-color: #000000aa; color: white; font-family: Arial, Helvetica, sans-serif; border-radius: 1rem; position: fixed; top: calc(50% - 4em); right: calc(50% - 10em); border: none; padding: 1em 3em 1em 1em; } .hint button { position: absolute; font-weight: bolder; right: 0.6em; top: 0.6em; color: inherit; background-color: inherit; border: 1px solid currentColor; border-radius: 1em; margin-left: 0.6em; } .hint a { color: inherit; } #button_help { color: white; background-color: #00000011; border-radius: 1em; position: fixed; top: 1em; right: 1em; font-size: 24pt; font-weight: bolder; width: 2em; height: 2em; border: none; } #button_help:hover { cursor: pointer; background-color: #00000077; } @media print { #button_help { display: none; } div.hint { display: none; } } </style> </head> <body> <button id="button_help">?</button> <div id="hints" class="hint" style="display: none"> <button id="close-hints">x</button> <span id="hint-text"></span> <ul> <li><b>Hover</b> - highlight</li> <li><b>Left-click</b> - pin highlight</li> <li><b>ESC</b> - clear</li> </ul> </div> <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!-- Generated by graphviz version 2.43.0 (0) --> <!-- Title: dependency&#45;cruiser output Pages: 1 --> <svg width="395pt" height="260pt" viewBox="0.00 0.00 395.00 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)"> <title>dependency&#45;cruiser output</title> <polygon fill="white" stroke="transparent" points="-4,4 -4,-256 391,-256 391,4 -4,4"/> <g id="clust1" class="cluster"> <title>cluster_tests</title> <path fill="#ffffff" stroke="black" stroke-width="2" d="M20,-8C20,-8 367,-8 367,-8 373,-8 379,-14 379,-20 379,-20 379,-232 379,-232 379,-238 373,-244 367,-244 367,-244 20,-244 20,-244 14,-244 8,-238 8,-232 8,-232 8,-20 8,-20 8,-14 14,-8 20,-8"/> <text text-anchor="middle" x="193.5" y="-232.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00">tests</text> </g> <g id="clust2" class="cluster"> <title>cluster_tests/case</title> <path fill="#ffffff" stroke="black" stroke-width="2" d="M29,-106C29,-106 166,-106 166,-106 172,-106 178,-112 178,-118 178,-118 178,-206 178,-206 178,-212 172,-218 166,-218 166,-218 29,-218 29,-218 23,-218 17,-212 17,-206 17,-206 17,-118 17,-118 17,-112 23,-106 29,-106"/> <text text-anchor="middle" x="97.5" y="-206.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00">case</text> </g> <g id="clust3" class="cluster"> <title>cluster_tests/common</title> <path fill="#ffffff" stroke="black" stroke-width="2" d="M28,-16C28,-16 167,-16 167,-16 173,-16 179,-22 179,-28 179,-28 179,-86 179,-86 179,-92 173,-98 167,-98 167,-98 28,-98 28,-98 22,-98 16,-92 16,-86 16,-86 16,-28 16,-28 16,-22 22,-16 28,-16"/> <text text-anchor="middle" x="97.5" y="-86.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00">common</text> </g> <g id="clust4" class="cluster"> <title>cluster_tests/shared</title> <path fill="#ffffff" stroke="black" stroke-width="2" d="M199,-26C199,-26 359,-26 359,-26 365,-26 371,-32 371,-38 371,-38 371,-156 371,-156 371,-162 365,-168 359,-168 359,-168 199,-168 199,-168 193,-168 187,-162 187,-156 187,-156 187,-38 187,-38 187,-32 193,-26 199,-26"/> <text text-anchor="middle" x="279" y="-156.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00">shared</text> </g> <!-- tests/case/arrow&#45;function&#45;case.spec.ts --> <g id="node1" class="node"> <title>tests/case/arrow&#45;function&#45;case.spec.ts</title> <g id="a_node1"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/case/arrow-function-case.spec.ts" xlink:title="arrow&#45;function&#45;case.spec.ts"> <path fill="#c79cbc" stroke="black" d="M162,-132C162,-132 33,-132 33,-132 30,-132 27,-129 27,-126 27,-126 27,-120 27,-120 27,-117 30,-114 33,-114 33,-114 162,-114 162,-114 165,-114 168,-117 168,-120 168,-120 168,-126 168,-126 168,-129 165,-132 162,-132"/> <text text-anchor="start" x="35" y="-120.8" font-family="Helvetica,sans-Serif" font-size="9.00">arrow&#45;function&#45;case.spec.ts</text> </a> </g> </g> <!-- tests/shared/enum.ts --> <g id="node2" class="node"> <title>tests/shared/enum.ts</title> <g id="a_node2"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/shared/enum.ts" xlink:title="enum.ts"> <path fill="#c8e0c2" stroke="black" d="M357,-142C357,-142 315,-142 315,-142 312,-142 309,-139 309,-136 309,-136 309,-130 309,-130 309,-127 312,-124 315,-124 315,-124 357,-124 357,-124 360,-124 363,-127 363,-130 363,-130 363,-136 363,-136 363,-139 360,-142 357,-142"/> <text text-anchor="start" x="317" y="-130.8" font-family="Helvetica,sans-Serif" font-size="9.00">enum.ts</text> </a> </g> </g> <!-- tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge1" class="edge"> <title>tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M166.99,-132.14C171.18,-133.8 175.22,-135.73 179,-138 183.88,-140.93 181.87,-145.53 187,-148 230.66,-168.99 248.37,-156.84 296,-148 300.61,-147.14 305.39,-145.76 309.94,-144.18"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="310.68,-146.14 315.57,-142.08 309.21,-142.21 310.68,-146.14"/> </g> <!-- tests/shared/generic&#45;strategy.ts --> <g id="node3" class="node"> <title>tests/shared/generic&#45;strategy.ts</title> <g id="a_node3"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/shared/generic-strategy.ts" xlink:title="generic&#45;strategy.ts"> <path fill="#c8e0c2" stroke="black" d="M290,-112C290,-112 201,-112 201,-112 198,-112 195,-109 195,-106 195,-106 195,-100 195,-100 195,-97 198,-94 201,-94 201,-94 290,-94 290,-94 293,-94 296,-97 296,-100 296,-100 296,-106 296,-106 296,-109 293,-112 290,-112"/> <text text-anchor="start" x="203" y="-100.8" font-family="Helvetica,sans-Serif" font-size="9.00">generic&#45;strategy.ts</text> </a> </g> </g> <!-- tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts --> <g id="edge2" class="edge"> <title>tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M164.24,-113.99C172.44,-112.87 180.77,-111.73 188.8,-110.63"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="189.21,-112.69 194.87,-109.8 188.64,-108.53 189.21,-112.69"/> </g> <!-- tests/shared/jest.ts --> <g id="node4" class="node"> <title>tests/shared/jest.ts</title> <g id="a_node4"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/shared/jest.ts" xlink:title="jest.ts"> <path fill="#c8e0c2" stroke="black" d="M266.5,-82C266.5,-82 224.5,-82 224.5,-82 221.5,-82 218.5,-79 218.5,-76 218.5,-76 218.5,-70 218.5,-70 218.5,-67 221.5,-64 224.5,-64 224.5,-64 266.5,-64 266.5,-64 269.5,-64 272.5,-67 272.5,-70 272.5,-70 272.5,-76 272.5,-76 272.5,-79 269.5,-82 266.5,-82"/> <text text-anchor="start" x="231.5" y="-70.8" font-family="Helvetica,sans-Serif" font-size="9.00">jest.ts</text> </a> </g> </g> <!-- tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts --> <g id="edge3" class="edge"> <title>tests/case/arrow&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M153.48,-113.96C162.56,-110.84 171.46,-106.65 179,-101 184.43,-96.93 181.55,-92.04 187,-88 194.34,-82.56 203.49,-79.09 212.31,-76.88"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="212.94,-78.89 218.34,-75.54 212.02,-74.79 212.94,-78.89"/> </g> <!-- tests/shared/generic&#45;strategy.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge14" class="edge"> <title>tests/shared/generic&#45;strategy.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M277.51,-112.02C283.66,-113.91 290.05,-115.96 296,-118 299.51,-119.21 303.18,-120.53 306.8,-121.87"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="306.06,-123.84 312.42,-123.99 307.54,-119.91 306.06,-123.84"/> </g> <!-- tests/case/class&#45;instance&#45;case.spec.ts --> <g id="node5" class="node"> <title>tests/case/class&#45;instance&#45;case.spec.ts</title> <g id="a_node5"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/case/class-instance-case.spec.ts" xlink:title="class&#45;instance&#45;case.spec.ts"> <path fill="#c79cbc" stroke="black" d="M160.5,-162C160.5,-162 34.5,-162 34.5,-162 31.5,-162 28.5,-159 28.5,-156 28.5,-156 28.5,-150 28.5,-150 28.5,-147 31.5,-144 34.5,-144 34.5,-144 160.5,-144 160.5,-144 163.5,-144 166.5,-147 166.5,-150 166.5,-150 166.5,-156 166.5,-156 166.5,-159 163.5,-162 160.5,-162"/> <text text-anchor="start" x="36.5" y="-150.8" font-family="Helvetica,sans-Serif" font-size="9.00">class&#45;instance&#45;case.spec.ts</text> </a> </g> </g> <!-- tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge4" class="edge"> <title>tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M149.04,-162.03C189.57,-167.37 247.49,-170.73 296,-157 304.01,-154.73 311.99,-150.31 318.62,-145.87"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="320.16,-147.35 323.85,-142.18 317.74,-143.92 320.16,-147.35"/> </g> <!-- tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts --> <g id="edge5" class="edge"> <title>tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M166.69,-145.64C171.1,-143.58 175.26,-141.07 179,-138 186.4,-131.93 179.82,-124.33 187,-118 188.07,-117.06 189.19,-116.17 190.35,-115.34"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="191.7,-116.98 195.71,-112.04 189.5,-113.4 191.7,-116.98"/> </g> <!-- tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts --> <g id="edge6" class="edge"> <title>tests/case/class&#45;instance&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M166.76,-146.93C171.27,-144.6 175.43,-141.66 179,-138 194.71,-121.88 171.87,-104.66 187,-88 193.48,-80.86 202.9,-76.93 212.25,-74.82"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="212.84,-76.85 218.35,-73.69 212.07,-72.72 212.84,-76.85"/> </g> <!-- tests/case/classic&#45;function&#45;case.spec.ts --> <g id="node6" class="node"> <title>tests/case/classic&#45;function&#45;case.spec.ts</title> <g id="a_node6"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/case/classic-function-case.spec.ts" xlink:title="classic&#45;function&#45;case.spec.ts"> <path fill="#c79cbc" stroke="black" d="M164,-192C164,-192 31,-192 31,-192 28,-192 25,-189 25,-186 25,-186 25,-180 25,-180 25,-177 28,-174 31,-174 31,-174 164,-174 164,-174 167,-174 170,-177 170,-180 170,-180 170,-186 170,-186 170,-189 167,-192 164,-192"/> <text text-anchor="start" x="33" y="-180.8" font-family="Helvetica,sans-Serif" font-size="9.00">classic&#45;function&#45;case.spec.ts</text> </a> </g> </g> <!-- tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge7" class="edge"> <title>tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M170.37,-186.49C208.92,-185.92 256.5,-181.19 296,-165 306.01,-160.9 315.44,-153.31 322.52,-146.55"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="324.25,-147.78 327.02,-142.05 321.29,-144.8 324.25,-147.78"/> </g> <!-- tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts --> <g id="edge8" class="edge"> <title>tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M170.07,-175.06C173.31,-173.08 176.32,-170.75 179,-168 194.71,-151.88 171.87,-134.66 187,-118 187.86,-117.05 188.77,-116.17 189.72,-115.33"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="191.24,-116.82 194.83,-111.58 188.75,-113.44 191.24,-116.82"/> </g> <!-- tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts --> <g id="edge9" class="edge"> <title>tests/case/classic&#45;function&#45;case.spec.ts&#45;&gt;tests/shared/jest.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M170.27,-175.25C173.46,-173.22 176.4,-170.83 179,-168 191.09,-154.84 175.39,-101.58 187,-88 193.33,-80.6 202.8,-76.62 212.24,-74.54"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="212.87,-76.56 218.4,-73.43 212.13,-72.43 212.87,-76.56"/> </g> <!-- tests/common/no&#45;function&#45;common.spec.ts --> <g id="node7" class="node"> <title>tests/common/no&#45;function&#45;common.spec.ts</title> <g id="a_node7"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/common/no-function-common.spec.ts" xlink:title="no&#45;function&#45;common.spec.ts"> <path fill="#c79cbc" stroke="black" d="M165,-72C165,-72 30,-72 30,-72 27,-72 24,-69 24,-66 24,-66 24,-60 24,-60 24,-57 27,-54 30,-54 30,-54 165,-54 165,-54 168,-54 171,-57 171,-60 171,-60 171,-66 171,-66 171,-69 168,-72 165,-72"/> <text text-anchor="start" x="32" y="-60.8" font-family="Helvetica,sans-Serif" font-size="9.00">no&#45;function&#45;common.spec.ts</text> </a> </g> </g> <!-- tests/common/no&#45;function&#45;common.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts --> <g id="edge10" class="edge"> <title>tests/common/no&#45;function&#45;common.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M130,-72.06C146.88,-76.88 168.05,-82.85 187,-88 192.34,-89.45 197.96,-90.95 203.52,-92.42"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="203.16,-94.5 209.5,-93.99 204.23,-90.43 203.16,-94.5"/> </g> <!-- tests/common/no&#45;function&#45;common.spec.ts&#45;&gt;tests/shared/jest.ts --> <g id="edge11" class="edge"> <title>tests/common/no&#45;function&#45;common.spec.ts&#45;&gt;tests/shared/jest.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M171.07,-67.97C185.45,-68.96 199.86,-69.94 212.05,-70.78"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="212.09,-72.88 218.22,-71.2 212.37,-68.69 212.09,-72.88"/> </g> <!-- tests/common/on&#45;before&#45;common.spec.ts --> <g id="node8" class="node"> <title>tests/common/on&#45;before&#45;common.spec.ts</title> <g id="a_node8"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/common/on-before-common.spec.ts" xlink:title="on&#45;before&#45;common.spec.ts"> <path fill="#c79cbc" stroke="black" d="M160,-42C160,-42 35,-42 35,-42 32,-42 29,-39 29,-36 29,-36 29,-30 29,-30 29,-27 32,-24 35,-24 35,-24 160,-24 160,-24 163,-24 166,-27 166,-30 166,-30 166,-36 166,-36 166,-39 163,-42 160,-42"/> <text text-anchor="start" x="37" y="-30.8" font-family="Helvetica,sans-Serif" font-size="9.00">on&#45;before&#45;common.spec.ts</text> </a> </g> </g> <!-- tests/common/on&#45;before&#45;common.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts --> <g id="edge12" class="edge"> <title>tests/common/on&#45;before&#45;common.spec.ts&#45;&gt;tests/shared/generic&#45;strategy.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M166.22,-39.04C170.91,-41.37 175.26,-44.31 179,-48 191.9,-60.74 174.56,-74.82 187,-88 187.88,-88.93 188.8,-89.8 189.77,-90.62"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="188.84,-92.54 194.94,-94.32 191.28,-89.12 188.84,-92.54"/> </g> <!-- tests/common/on&#45;before&#45;common.spec.ts&#45;&gt;tests/shared/jest.ts --> <g id="edge13" class="edge"> <title>tests/common/on&#45;before&#45;common.spec.ts&#45;&gt;tests/shared/jest.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M166.17,-41.82C170.65,-43.55 174.98,-45.59 179,-48 183.88,-50.93 182.23,-54.9 187,-58 194.59,-62.93 203.74,-66.24 212.48,-68.46"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="212.12,-70.54 218.44,-69.84 213.06,-66.44 212.12,-70.54"/> </g> <!-- tests/shared/run&#45;per&#45;case.ts --> <g id="node9" class="node"> <title>tests/shared/run&#45;per&#45;case.ts</title> <g id="a_node9"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/shared/run-per-case.ts" xlink:title="run&#45;per&#45;case.ts"> <path fill="#c8e0c2" stroke="black" d="M281.5,-142C281.5,-142 209.5,-142 209.5,-142 206.5,-142 203.5,-139 203.5,-136 203.5,-136 203.5,-130 203.5,-130 203.5,-127 206.5,-124 209.5,-124 209.5,-124 281.5,-124 281.5,-124 284.5,-124 287.5,-127 287.5,-130 287.5,-130 287.5,-136 287.5,-136 287.5,-139 284.5,-142 281.5,-142"/> <text text-anchor="start" x="211.5" y="-130.8" font-family="Helvetica,sans-Serif" font-size="9.00">run&#45;per&#45;case.ts</text> </a> </g> </g> <!-- tests/shared/run&#45;per&#45;case.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge15" class="edge"> <title>tests/shared/run&#45;per&#45;case.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M287.64,-133C292.72,-133 297.85,-133 302.77,-133"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="302.87,-135.1 308.87,-133 302.87,-130.9 302.87,-135.1"/> </g> <!-- tests/shared/validation.ts --> <g id="node10" class="node"> <title>tests/shared/validation.ts</title> <g id="a_node10"><a xlink:href="https://github.com/czlowiek488/generic-interceptor/blob/master/tests/shared/validation.ts" xlink:title="validation.ts"> <path fill="#c8e0c2" stroke="black" d="M275,-52C275,-52 216,-52 216,-52 213,-52 210,-49 210,-46 210,-46 210,-40 210,-40 210,-37 213,-34 216,-34 216,-34 275,-34 275,-34 278,-34 281,-37 281,-40 281,-40 281,-46 281,-46 281,-49 278,-52 275,-52"/> <text text-anchor="start" x="218" y="-40.8" font-family="Helvetica,sans-Serif" font-size="9.00">validation.ts</text> </a> </g> </g> <!-- tests/shared/validation.ts&#45;&gt;tests/shared/enum.ts --> <g id="edge16" class="edge"> <title>tests/shared/validation.ts&#45;&gt;tests/shared/enum.ts</title> <path fill="none" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" d="M281.06,-49.56C286.44,-51.64 291.65,-54.39 296,-58 314.84,-73.64 325.69,-100.75 330.96,-117.74"/> <polygon fill="#000000" fill-opacity="0.200000" stroke="#000000" stroke-width="2" stroke-opacity="0.200000" points="329.07,-118.75 332.77,-123.92 333.1,-117.57 329.07,-118.75"/> </g> </g> </svg> <script>document.addEventListener("contextmenu", getSelectHandler(title2ElementMap)); document.addEventListener("mouseover", getHoverHandler(title2ElementMap)); document.addEventListener("keydown", keyboardEventHandler); var gMode = new Mode(); var title2ElementMap = (function makeElementMap() { /** @type {NodeListOf<SVGGElement>} */ var nodes = document.querySelectorAll(".node"); /** @type {NodeListOf<SVGGElement>} */ var edges = document.querySelectorAll(".edge"); return new Title2ElementMap(edges, nodes); })(); function getHoverHandler() { /** @type {string} */ var currentHighlightedTitle; /** @param {MouseEvent} pMouseEvent */ return function hoverHighlightHandler(pMouseEvent) { var closestNodeOrEdge = pMouseEvent.target.closest(".edge, .node"); var closestTitleText = getTitleText(closestNodeOrEdge); if ( !(currentHighlightedTitle === closestTitleText) && gMode.get() === gMode.HOVER ) { resetNodesAndEdges(); addHighlight(closestNodeOrEdge); title2ElementMap.get(closestTitleText).forEach(addHighlight); currentHighlightedTitle = closestTitleText; } }; } function getSelectHandler() { /** @type {string} */ var currentHighlightedTitle; /** @param {MouseEvent} pMouseEvent */ return function selectHighlightHandler(pMouseEvent) { pMouseEvent.preventDefault(); var closestNodeOrEdge = pMouseEvent.target.closest(".edge, .node"); var closestTitleText = getTitleText(closestNodeOrEdge); if (!!closestNodeOrEdge) { gMode.setToSelect(); } else { gMode.setToHover(); } if (!(currentHighlightedTitle === closestTitleText)) { resetNodesAndEdges(); addHighlight(closestNodeOrEdge); title2ElementMap.get(closestTitleText).forEach(addHighlight); currentHighlightedTitle = closestTitleText; } }; } function Mode() { var HOVER = 1; var SELECT = 2; function setToHover() { this._mode = HOVER; } function setToSelect() { this._mode = SELECT; } function get() { return this._mode || HOVER; } return { HOVER: HOVER, SELECT: SELECT, setToHover: setToHover, setToSelect: setToSelect, get: get, }; } /** * * @param {SVGGelement[]} pEdges * @param {SVGGElement[]} pNodes * @return {{get: (pTitleText:string) => SVGGElement[]}} */ function Title2ElementMap(pEdges, pNodes) { /* {{[key: string]: SVGGElement[]}} */ var elementMap = buildMap(pEdges, pNodes); /** * @param {NodeListOf<SVGGElement>} pEdges * @param {NodeListOf<SVGGElement>} pNodes * @return {{[key: string]: SVGGElement[]}} */ function buildMap(pEdges, pNodes) { var title2NodeMap = buildTitle2NodeMap(pNodes); return nodeListToArray(pEdges).reduce(addEdgeToMap(title2NodeMap), {}); } /** * @param {NodeListOf<SVGGElement>} pNodes * @return {{[key: string]: SVGGElement}} */ function buildTitle2NodeMap(pNodes) { return nodeListToArray(pNodes).reduce(addNodeToMap, {}); } function addNodeToMap(pMap, pNode) { var titleText = getTitleText(pNode); if (titleText) { pMap[titleText] = pNode; } return pMap; } function addEdgeToMap(pNodeMap) { return function (pEdgeMap, pEdge) { /** @type {string} */ var titleText = getTitleText(pEdge); if (titleText) { var edge = pryEdgeFromTitle(titleText); pEdgeMap[titleText] = [pNodeMap[edge.from], pNodeMap[edge.to]]; (pEdgeMap[edge.from] || (pEdgeMap[edge.from] = [])).push(pEdge); (pEdgeMap[edge.to] || (pEdgeMap[edge.to] = [])).push(pEdge); } return pEdgeMap; }; } /** * * @param {string} pString * @return {{from?: string; to?:string;}} */ function pryEdgeFromTitle(pString) { var nodeNames = pString.split(/\s*->\s*/); return { from: nodeNames.shift(), to: nodeNames.shift(), }; } /** * * @param {string} pTitleText * @return {SVGGElement[]} */ function get(pTitleText) { return (pTitleText && elementMap[pTitleText]) || []; } return { get: get, }; } /** * @param {SVGGElement} pGElement * @return {string?} */ function getTitleText(pGElement) { /** @type {SVGTitleElement} */ var title = pGElement && pGElement.querySelector("title"); /** @type {string} */ var titleText = title && title.textContent; if (titleText) { titleText = titleText.trim(); } return titleText; } /** * @param {NodeListOf<Element>} pNodeList * @return {Element[]} */ function nodeListToArray(pNodeList) { var lReturnValue = []; pNodeList.forEach(function (pElement) { lReturnValue.push(pElement); }); return lReturnValue; } function resetNodesAndEdges() { nodeListToArray(document.querySelectorAll(".current")).forEach( removeHighlight ); } /** * @param {SVGGElement} pGElement */ function removeHighlight(pGElement) { if (pGElement && pGElement.classList) { pGElement.classList.remove("current"); } } /** * @param {SVGGElement} pGroup */ function addHighlight(pGroup) { if (pGroup && pGroup.classList) { pGroup.classList.add("current"); } } var hints = { HIDDEN: 1, SHOWN: 2, state: this.HIDDEN, show: function () { document.getElementById("hints").removeAttribute("style"); hints.state = hints.SHOWN; }, hide: function () { document.getElementById("hints").style = "display:none"; hints.state = hints.HIDDEN; }, toggle: function () { if ((hints.state || hints.HIDDEN) === hints.HIDDEN) { hints.show(); } else { hints.hide(); } }, }; /** @param {KeyboardEvent} pKeyboardEvent */ function keyboardEventHandler(pKeyboardEvent) { if (pKeyboardEvent.key === "Escape") { resetNodesAndEdges(); gMode.setToHover(); hints.hide(); } if (pKeyboardEvent.key === "F1") { pKeyboardEvent.preventDefault(); hints.toggle(); } } document.getElementById("close-hints").addEventListener("click", hints.hide); document.getElementById("button_help").addEventListener("click", hints.toggle); </script> </body> </html>