@midscene/visualizer 0.0.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 (92) hide show
  1. package/.eslintrc.js +9 -0
  2. package/README.md +24 -0
  3. package/dist/es/assets/logo-plain.16842bbc.svg +70 -0
  4. package/dist/es/assets/logo-plain2.16842bbc.svg +70 -0
  5. package/dist/es/component/blackboard.css +25 -0
  6. package/dist/es/component/blackboard.js +256 -0
  7. package/dist/es/component/color.js +34 -0
  8. package/dist/es/component/common.css +0 -0
  9. package/dist/es/component/detail-panel.css +34 -0
  10. package/dist/es/component/detail-panel.js +106 -0
  11. package/dist/es/component/detail-side.css +99 -0
  12. package/dist/es/component/detail-side.js +285 -0
  13. package/dist/es/component/global-hover-preview.css +19 -0
  14. package/dist/es/component/global-hover-preview.js +44 -0
  15. package/dist/es/component/misc.js +24 -0
  16. package/dist/es/component/panel-title.css +8 -0
  17. package/dist/es/component/panel-title.js +9 -0
  18. package/dist/es/component/side-item.js +0 -0
  19. package/dist/es/component/sidebar.css +87 -0
  20. package/dist/es/component/sidebar.js +175 -0
  21. package/dist/es/component/store.js +128 -0
  22. package/dist/es/component/timeline.css +18 -0
  23. package/dist/es/component/timeline.js +438 -0
  24. package/dist/es/index.css +89 -0
  25. package/dist/es/index.js +174 -0
  26. package/dist/es/utils.js +76 -0
  27. package/dist/lib/assets/logo-plain.16842bbc.svg +70 -0
  28. package/dist/lib/assets/logo-plain2.16842bbc.svg +70 -0
  29. package/dist/lib/component/blackboard.css +25 -0
  30. package/dist/lib/component/blackboard.js +286 -0
  31. package/dist/lib/component/color.js +59 -0
  32. package/dist/lib/component/common.css +0 -0
  33. package/dist/lib/component/detail-panel.css +34 -0
  34. package/dist/lib/component/detail-panel.js +136 -0
  35. package/dist/lib/component/detail-side.css +99 -0
  36. package/dist/lib/component/detail-side.js +313 -0
  37. package/dist/lib/component/global-hover-preview.css +19 -0
  38. package/dist/lib/component/global-hover-preview.js +64 -0
  39. package/dist/lib/component/misc.js +48 -0
  40. package/dist/lib/component/panel-title.css +8 -0
  41. package/dist/lib/component/panel-title.js +29 -0
  42. package/dist/lib/component/side-item.js +1 -0
  43. package/dist/lib/component/sidebar.css +87 -0
  44. package/dist/lib/component/sidebar.js +198 -0
  45. package/dist/lib/component/store.js +153 -0
  46. package/dist/lib/component/timeline.css +18 -0
  47. package/dist/lib/component/timeline.js +466 -0
  48. package/dist/lib/index.css +89 -0
  49. package/dist/lib/index.js +202 -0
  50. package/dist/lib/utils.js +111 -0
  51. package/dist/types/component/blackboard.d.ts +4 -0
  52. package/dist/types/component/color.d.ts +2 -0
  53. package/dist/types/component/detail-panel.d.ts +4 -0
  54. package/dist/types/component/detail-side.d.ts +4 -0
  55. package/dist/types/component/global-hover-preview.d.ts +4 -0
  56. package/dist/types/component/misc.d.ts +2 -0
  57. package/dist/types/component/panel-title.d.ts +6 -0
  58. package/dist/types/component/side-item.d.ts +0 -0
  59. package/dist/types/component/sidebar.d.ts +4 -0
  60. package/dist/types/component/store.d.ts +35 -0
  61. package/dist/types/component/timeline.d.ts +4 -0
  62. package/dist/types/index.d.ts +4 -0
  63. package/dist/types/utils.d.ts +5 -0
  64. package/docs/index.tsx +6 -0
  65. package/modern.config.ts +15 -0
  66. package/package.json +46 -0
  67. package/src/component/assets/logo-plain.svg +70 -0
  68. package/src/component/assets/logo-plain2.svg +70 -0
  69. package/src/component/blackboard.less +37 -0
  70. package/src/component/blackboard.tsx +293 -0
  71. package/src/component/color.tsx +34 -0
  72. package/src/component/common.less +21 -0
  73. package/src/component/detail-panel.less +47 -0
  74. package/src/component/detail-panel.tsx +124 -0
  75. package/src/component/detail-side.less +131 -0
  76. package/src/component/detail-side.tsx +361 -0
  77. package/src/component/global-hover-preview.less +23 -0
  78. package/src/component/global-hover-preview.tsx +50 -0
  79. package/src/component/misc.tsx +20 -0
  80. package/src/component/panel-title.less +11 -0
  81. package/src/component/panel-title.tsx +11 -0
  82. package/src/component/side-item.tsx +0 -0
  83. package/src/component/sidebar.less +122 -0
  84. package/src/component/sidebar.tsx +205 -0
  85. package/src/component/store.tsx +151 -0
  86. package/src/component/timeline.less +25 -0
  87. package/src/component/timeline.tsx +486 -0
  88. package/src/global.d.ts +11 -0
  89. package/src/index.less +113 -0
  90. package/src/index.tsx +210 -0
  91. package/src/utils.ts +58 -0
  92. package/tsconfig.json +24 -0
@@ -0,0 +1,76 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import dayjs from "dayjs";
21
+ function insightDumpToExecutionDump(insightDump) {
22
+ const insightToTask = (insightDump2) => {
23
+ var _a, _b;
24
+ const task = {
25
+ type: "Insight",
26
+ subType: insightDump2.type === "locate" ? "Locate" : "Query",
27
+ status: insightDump2.error ? "fail" : "success",
28
+ param: __spreadProps(__spreadValues(__spreadValues({}, insightDump2.userQuery.element ? { query: insightDump2.userQuery } : {}), insightDump2.userQuery.dataDemand ? { dataDemand: insightDump2.userQuery.dataDemand } : {}), {
29
+ insight: {}
30
+ }),
31
+ log: {
32
+ dump: insightDump2
33
+ },
34
+ timing: {
35
+ end: insightDump2.logTime,
36
+ cost: (_a = insightDump2.taskInfo) == null ? void 0 : _a.durationMs,
37
+ start: insightDump2.logTime - ((_b = insightDump2.taskInfo) == null ? void 0 : _b.durationMs)
38
+ },
39
+ executor: () => {
40
+ }
41
+ };
42
+ return task;
43
+ };
44
+ if (!Array.isArray(insightDump)) {
45
+ const result = {
46
+ sdkVersion: insightDump.sdkVersion,
47
+ logTime: insightDump.logTime,
48
+ name: "Insight",
49
+ tasks: [insightToTask(insightDump)]
50
+ };
51
+ return result;
52
+ } else {
53
+ const result = {
54
+ sdkVersion: insightDump[0].sdkVersion,
55
+ logTime: insightDump[0].logTime,
56
+ name: "Insight",
57
+ tasks: insightDump.map(insightToTask)
58
+ };
59
+ return result;
60
+ }
61
+ }
62
+ function timeStr(timestamp) {
63
+ return timestamp ? dayjs(timestamp).format("YYYY-MM-DD HH:mm:ss") : "-";
64
+ }
65
+ function typeStr(task) {
66
+ return task.subType ? `${task.type} / ${task.subType || ""}` : task.type;
67
+ }
68
+ function filterBase64Value(input) {
69
+ return input.replace(/data:image\/[^"]+"/g, 'data:image..."');
70
+ }
71
+ export {
72
+ filterBase64Value,
73
+ insightDumpToExecutionDump,
74
+ timeStr,
75
+ typeStr
76
+ };
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <!-- Creator: CorelDRAW 2019 (64-Bit) -->
4
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="141.563mm" height="53.8692mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
5
+ viewBox="0 0 16897.65 6430.11"
6
+ xmlns:xlink="http://www.w3.org/1999/xlink"
7
+ xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
8
+ <defs>
9
+ <style type="text/css">
10
+ <![CDATA[
11
+ .str0 {stroke:#E62129;stroke-width:23.87;stroke-miterlimit:22.9256}
12
+ .str1 {stroke:#06B1AB;stroke-width:9.1;stroke-miterlimit:22.9256}
13
+ .fil0 {fill:none}
14
+ .fil8 {fill:#FEFEFE}
15
+ .fil1 {fill:#332C2B}
16
+ .fil12 {fill:#F7B873}
17
+ .fil5 {fill:#F3A04E}
18
+ .fil9 {fill:#52C2F1}
19
+ .fil13 {fill:#06B1AB}
20
+ .fil2 {fill:#F63D55}
21
+ .fil11 {fill:#F9483E}
22
+ .fil6 {fill:url(#id0)}
23
+ .fil4 {fill:url(#id1)}
24
+ .fil10 {fill:url(#id2)}
25
+ .fil3 {fill:url(#id3)}
26
+ .fil7 {fill:url(#id4)}
27
+ ]]>
28
+ </style>
29
+ <linearGradient id="id0" gradientUnits="userSpaceOnUse" x1="11103.21" y1="5027.34" x2="10930.41" y2="1211.98">
30
+ <stop offset="0" style="stop-opacity:1; stop-color:#0A77D4"/>
31
+ <stop offset="1" style="stop-opacity:1; stop-color:#00B1E0"/>
32
+ </linearGradient>
33
+ <linearGradient id="id1" gradientUnits="userSpaceOnUse" xlink:href="#id0" x1="11407.32" y1="5023.83" x2="11286.4" y2="1215.5">
34
+ </linearGradient>
35
+ <linearGradient id="id2" gradientUnits="userSpaceOnUse" x1="6311.87" y1="4699.25" x2="3547.5" y2="1677.39">
36
+ <stop offset="0" style="stop-opacity:1; stop-color:#F65926"/>
37
+ <stop offset="1" style="stop-opacity:1; stop-color:#F0AB1F"/>
38
+ </linearGradient>
39
+ <linearGradient id="id3" gradientUnits="userSpaceOnUse" x1="3105.35" y1="5075.61" x2="2612.67" y2="1311.04">
40
+ <stop offset="0" style="stop-opacity:1; stop-color:#E52652"/>
41
+ <stop offset="1" style="stop-opacity:1; stop-color:#FF4956"/>
42
+ </linearGradient>
43
+ <linearGradient id="id4" gradientUnits="userSpaceOnUse" x1="14599.77" y1="4808.34" x2="12000" y2="1573.25">
44
+ <stop offset="0" style="stop-opacity:1; stop-color:#02C0A7"/>
45
+ <stop offset="1" style="stop-opacity:1; stop-color:#02E097"/>
46
+ </linearGradient>
47
+ </defs>
48
+ <g id="图层_x0020_1">
49
+ <metadata id="CorelCorpID_0Corel-Layer"/>
50
+ <g id="_1978240863120">
51
+ <path class="fil0 str0" d="M2921.92 814.37l2943.46 0c660.05,0 1200.11,540.04 1200.11,1200.11l0 669.56c-180.23,1562.84 -842.69,2686.31 -2539.2,2867.65l-656.9 0c-1403.42,-112.59 -2125.37,-923.3 -2147.58,-2450.77l0 -1086.44c0,-660.07 540.04,-1200.11 1200.11,-1200.11z"/>
52
+ <path class="fil1" d="M908.05 649.1c172.38,0 312.1,139.73 312.1,312.1 0,172.38 -139.73,312.1 -312.1,312.1 -172.38,0 -312.1,-139.73 -312.1,-312.1 0,-172.38 139.73,-312.1 312.1,-312.1zm15081.56 0c-172.38,0 -312.1,139.73 -312.1,312.1 0,172.38 139.73,312.1 312.1,312.1 172.38,0 312.1,-139.73 312.1,-312.1 0,-172.38 -139.73,-312.1 -312.1,-312.1zm315.15 -649.07l-4739.56 0c-332.34,-0.73 -635.61,30.83 -892.17,114.33 -1164.61,314.95 -1684.86,539.69 -2204.5,542.55 -529.24,2.92 -1057.71,-221.77 -2243.89,-542.55 -256.56,-83.5 -559.83,-115.06 -892.17,-114.33l-4739.56 0c-326.11,0 -592.9,266.79 -592.9,592.9l0 727.65c0,326.11 262.25,574.15 588.16,562.9 244.44,-8.44 379.43,161.6 368.56,407.41l0 1401.3c844.04,3884.05 6459.63,3705.54 6872.25,-983.68 37.55,-479.97 225.37,-745.7 619.85,-795.03 394.48,49.33 582.3,315.06 619.85,795.03 221.1,2512.67 1570.99,3564.6 3624.76,3705.62 1575.25,-121.99 2822.57,-766.6 3247.49,-2721.94l0 -1401.3c-10.86,-245.81 124.13,-415.84 368.56,-407.41 325.91,11.24 588.16,-236.8 588.16,-562.9l0 -727.65c0,-326.11 -266.79,-592.9 -592.9,-592.9z"/>
53
+ <path class="fil2" d="M4404.53 5551.69l138.96 0c1696.5,-181.34 2358.97,-1304.82 2539.2,-2867.65l0 -669.56c0,-660.07 -540.06,-1200.11 -1200.11,-1200.11l-2261.28 0 -682.18 0c-660.07,0 -1200.11,540.04 -1200.11,1200.11l0 1086.44c22.21,1527.47 744.16,2338.19 2147.58,2450.77l517.94 0z"/>
54
+ <path class="fil3" d="M2884.03 3833.6c-562.03,-552.91 337.59,-1229.84 756.52,-784.77l-668.1 -718.53c-248.45,-631.92 -96.85,-1153.5 631.64,-1515.94l-682.18 0c-660.07,0 -1200.11,540.04 -1200.11,1200.11l0 1086.44c22.21,1527.47 744.16,2338.19 2147.58,2450.77l517.94 0c447.09,-261.52 828.85,-610.16 1124.32,-1073.8 -192.91,108.48 -371.35,123.1 -530.58,12.63 -269.77,225.61 -533.22,868.1 -809.3,676.82l-1287.75 -1333.74z"/>
55
+ <path class="fil4" d="M12967.79 5585.01c1654.02,-184.97 2231.4,-1330.91 2306.7,-2925.01l-43.57 -682.94c-42.95,-673.27 -608.37,-1224.11 -1256.49,-1224.11l-2220.38 0 -669.84 0c-648.13,0 -1143.27,550.85 -1100.32,1224.11l70.69 1108.16c121.19,1558.01 882.83,2384.94 2268.19,2499.78l645.03 0z"/>
56
+ <circle class="fil5" cx="3266.42" cy="4767.17" r="119.53"/>
57
+ <path class="fil6 str1" d="M11243.45 3832.57c-587.85,-563.96 251.45,-1254.43 691.78,-800.45l-702.77 -732.9c-285.07,-644.56 -170.14,-1176.57 521.59,-1546.26l-669.84 0c-648.13,0 -1143.27,550.85 -1100.32,1224.11l70.69 1108.16c121.19,1558.01 882.83,2384.94 2268.19,2499.78l508.57 0c422,-266.75 774.17,-622.36 1034.13,-1095.27 -182.37,110.65 -356.62,125.56 -520.16,12.88 -250.21,230.12 -467.1,885.46 -750.63,690.36l-1351.23 -1360.42z"/>
58
+ <path class="fil7" d="M11754.05 752.96c-691.73,369.69 -806.66,901.7 -521.59,1546.26l702.77 732.9c-440.33,-453.98 -1279.63,236.49 -691.78,800.45 1571.66,1582.35 780.78,887.85 1587.88,1752.45l136.46 0c1654.02,-184.97 2231.4,-1330.91 2306.7,-2925.01l-43.57 -682.94c-42.95,-673.27 -608.37,-1224.11 -1256.49,-1224.11l-2220.38 0z"/>
59
+ <circle class="fil8" cx="13725.89" cy="2247.09" r="867.65"/>
60
+ <circle class="fil9" cx="11745.99" cy="4944.33" r="119.53"/>
61
+ <path class="fil10" d="M3604.1 814.37c-728.5,362.44 -880.09,884.02 -631.64,1515.94l668.1 718.53c-418.94,-445.08 -1318.56,231.85 -756.52,784.77l1503.3 1718.08 138.96 0c1696.5,-181.34 2358.97,-1304.82 2539.2,-2867.65l0 -669.56c0,-660.07 -540.06,-1200.11 -1200.11,-1200.11l-2261.28 0z"/>
62
+ <path class="fil11" d="M3602.42 3012.57l-2.01 -1.79 -1.22 -1c-433.3,-363.07 -1259.33,288.49 -715.16,823.82l1503.3 1718.08 138.96 0c366.16,-39.14 684.05,-122.25 959.42,-244.11l-1883.3 -2295z"/>
63
+ <circle class="fil8" cx="5652.09" cy="2247.09" r="867.65"/>
64
+ <circle class="fil12" cx="5669.32" cy="4261.82" r="86.65"/>
65
+ <circle class="fil8" cx="3775.08" cy="4120.55" r="174.77"/>
66
+ <path class="fil13" d="M11770.33 2919.17l123.64 74.69c7.2,5.99 14.32,12.27 21.35,18.8l1988.29 2318.88c-264.55,126.79 -574.49,213.07 -935.82,253.47l-136.46 0c-807.1,-864.6 -16.22,-170.1 -1587.88,-1752.45 -520.29,-499.15 77.34,-1097.23 526.88,-913.39z"/>
67
+ <circle class="fil8" cx="12254.65" cy="4297.71" r="174.77"/>
68
+ </g>
69
+ </g>
70
+ </svg>
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <!-- Creator: CorelDRAW 2019 (64-Bit) -->
4
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="141.563mm" height="53.8692mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
5
+ viewBox="0 0 16897.65 6430.11"
6
+ xmlns:xlink="http://www.w3.org/1999/xlink"
7
+ xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
8
+ <defs>
9
+ <style type="text/css">
10
+ <![CDATA[
11
+ .str0 {stroke:#E62129;stroke-width:23.87;stroke-miterlimit:22.9256}
12
+ .str1 {stroke:#06B1AB;stroke-width:9.1;stroke-miterlimit:22.9256}
13
+ .fil0 {fill:none}
14
+ .fil8 {fill:#FEFEFE}
15
+ .fil1 {fill:#332C2B}
16
+ .fil12 {fill:#F7B873}
17
+ .fil5 {fill:#F3A04E}
18
+ .fil9 {fill:#52C2F1}
19
+ .fil13 {fill:#06B1AB}
20
+ .fil2 {fill:#F63D55}
21
+ .fil11 {fill:#F9483E}
22
+ .fil6 {fill:url(#id0)}
23
+ .fil4 {fill:url(#id1)}
24
+ .fil10 {fill:url(#id2)}
25
+ .fil3 {fill:url(#id3)}
26
+ .fil7 {fill:url(#id4)}
27
+ ]]>
28
+ </style>
29
+ <linearGradient id="id0" gradientUnits="userSpaceOnUse" x1="11103.21" y1="5027.34" x2="10930.41" y2="1211.98">
30
+ <stop offset="0" style="stop-opacity:1; stop-color:#0A77D4"/>
31
+ <stop offset="1" style="stop-opacity:1; stop-color:#00B1E0"/>
32
+ </linearGradient>
33
+ <linearGradient id="id1" gradientUnits="userSpaceOnUse" xlink:href="#id0" x1="11407.32" y1="5023.83" x2="11286.4" y2="1215.5">
34
+ </linearGradient>
35
+ <linearGradient id="id2" gradientUnits="userSpaceOnUse" x1="6311.87" y1="4699.25" x2="3547.5" y2="1677.39">
36
+ <stop offset="0" style="stop-opacity:1; stop-color:#F65926"/>
37
+ <stop offset="1" style="stop-opacity:1; stop-color:#F0AB1F"/>
38
+ </linearGradient>
39
+ <linearGradient id="id3" gradientUnits="userSpaceOnUse" x1="3105.35" y1="5075.61" x2="2612.67" y2="1311.04">
40
+ <stop offset="0" style="stop-opacity:1; stop-color:#E52652"/>
41
+ <stop offset="1" style="stop-opacity:1; stop-color:#FF4956"/>
42
+ </linearGradient>
43
+ <linearGradient id="id4" gradientUnits="userSpaceOnUse" x1="14599.77" y1="4808.34" x2="12000" y2="1573.25">
44
+ <stop offset="0" style="stop-opacity:1; stop-color:#02C0A7"/>
45
+ <stop offset="1" style="stop-opacity:1; stop-color:#02E097"/>
46
+ </linearGradient>
47
+ </defs>
48
+ <g id="图层_x0020_1">
49
+ <metadata id="CorelCorpID_0Corel-Layer"/>
50
+ <g id="_1978240863120">
51
+ <path class="fil0 str0" d="M2921.92 814.37l2943.46 0c660.05,0 1200.11,540.04 1200.11,1200.11l0 669.56c-180.23,1562.84 -842.69,2686.31 -2539.2,2867.65l-656.9 0c-1403.42,-112.59 -2125.37,-923.3 -2147.58,-2450.77l0 -1086.44c0,-660.07 540.04,-1200.11 1200.11,-1200.11z"/>
52
+ <path class="fil1" d="M908.05 649.1c172.38,0 312.1,139.73 312.1,312.1 0,172.38 -139.73,312.1 -312.1,312.1 -172.38,0 -312.1,-139.73 -312.1,-312.1 0,-172.38 139.73,-312.1 312.1,-312.1zm15081.56 0c-172.38,0 -312.1,139.73 -312.1,312.1 0,172.38 139.73,312.1 312.1,312.1 172.38,0 312.1,-139.73 312.1,-312.1 0,-172.38 -139.73,-312.1 -312.1,-312.1zm315.15 -649.07l-4739.56 0c-332.34,-0.73 -635.61,30.83 -892.17,114.33 -1164.61,314.95 -1684.86,539.69 -2204.5,542.55 -529.24,2.92 -1057.71,-221.77 -2243.89,-542.55 -256.56,-83.5 -559.83,-115.06 -892.17,-114.33l-4739.56 0c-326.11,0 -592.9,266.79 -592.9,592.9l0 727.65c0,326.11 262.25,574.15 588.16,562.9 244.44,-8.44 379.43,161.6 368.56,407.41l0 1401.3c844.04,3884.05 6459.63,3705.54 6872.25,-983.68 37.55,-479.97 225.37,-745.7 619.85,-795.03 394.48,49.33 582.3,315.06 619.85,795.03 221.1,2512.67 1570.99,3564.6 3624.76,3705.62 1575.25,-121.99 2822.57,-766.6 3247.49,-2721.94l0 -1401.3c-10.86,-245.81 124.13,-415.84 368.56,-407.41 325.91,11.24 588.16,-236.8 588.16,-562.9l0 -727.65c0,-326.11 -266.79,-592.9 -592.9,-592.9z"/>
53
+ <path class="fil2" d="M4404.53 5551.69l138.96 0c1696.5,-181.34 2358.97,-1304.82 2539.2,-2867.65l0 -669.56c0,-660.07 -540.06,-1200.11 -1200.11,-1200.11l-2261.28 0 -682.18 0c-660.07,0 -1200.11,540.04 -1200.11,1200.11l0 1086.44c22.21,1527.47 744.16,2338.19 2147.58,2450.77l517.94 0z"/>
54
+ <path class="fil3" d="M2884.03 3833.6c-562.03,-552.91 337.59,-1229.84 756.52,-784.77l-668.1 -718.53c-248.45,-631.92 -96.85,-1153.5 631.64,-1515.94l-682.18 0c-660.07,0 -1200.11,540.04 -1200.11,1200.11l0 1086.44c22.21,1527.47 744.16,2338.19 2147.58,2450.77l517.94 0c447.09,-261.52 828.85,-610.16 1124.32,-1073.8 -192.91,108.48 -371.35,123.1 -530.58,12.63 -269.77,225.61 -533.22,868.1 -809.3,676.82l-1287.75 -1333.74z"/>
55
+ <path class="fil4" d="M12967.79 5585.01c1654.02,-184.97 2231.4,-1330.91 2306.7,-2925.01l-43.57 -682.94c-42.95,-673.27 -608.37,-1224.11 -1256.49,-1224.11l-2220.38 0 -669.84 0c-648.13,0 -1143.27,550.85 -1100.32,1224.11l70.69 1108.16c121.19,1558.01 882.83,2384.94 2268.19,2499.78l645.03 0z"/>
56
+ <circle class="fil5" cx="3266.42" cy="4767.17" r="119.53"/>
57
+ <path class="fil6 str1" d="M11243.45 3832.57c-587.85,-563.96 251.45,-1254.43 691.78,-800.45l-702.77 -732.9c-285.07,-644.56 -170.14,-1176.57 521.59,-1546.26l-669.84 0c-648.13,0 -1143.27,550.85 -1100.32,1224.11l70.69 1108.16c121.19,1558.01 882.83,2384.94 2268.19,2499.78l508.57 0c422,-266.75 774.17,-622.36 1034.13,-1095.27 -182.37,110.65 -356.62,125.56 -520.16,12.88 -250.21,230.12 -467.1,885.46 -750.63,690.36l-1351.23 -1360.42z"/>
58
+ <path class="fil7" d="M11754.05 752.96c-691.73,369.69 -806.66,901.7 -521.59,1546.26l702.77 732.9c-440.33,-453.98 -1279.63,236.49 -691.78,800.45 1571.66,1582.35 780.78,887.85 1587.88,1752.45l136.46 0c1654.02,-184.97 2231.4,-1330.91 2306.7,-2925.01l-43.57 -682.94c-42.95,-673.27 -608.37,-1224.11 -1256.49,-1224.11l-2220.38 0z"/>
59
+ <circle class="fil8" cx="13725.89" cy="2247.09" r="867.65"/>
60
+ <circle class="fil9" cx="11745.99" cy="4944.33" r="119.53"/>
61
+ <path class="fil10" d="M3604.1 814.37c-728.5,362.44 -880.09,884.02 -631.64,1515.94l668.1 718.53c-418.94,-445.08 -1318.56,231.85 -756.52,784.77l1503.3 1718.08 138.96 0c1696.5,-181.34 2358.97,-1304.82 2539.2,-2867.65l0 -669.56c0,-660.07 -540.06,-1200.11 -1200.11,-1200.11l-2261.28 0z"/>
62
+ <path class="fil11" d="M3602.42 3012.57l-2.01 -1.79 -1.22 -1c-433.3,-363.07 -1259.33,288.49 -715.16,823.82l1503.3 1718.08 138.96 0c366.16,-39.14 684.05,-122.25 959.42,-244.11l-1883.3 -2295z"/>
63
+ <circle class="fil8" cx="5652.09" cy="2247.09" r="867.65"/>
64
+ <circle class="fil12" cx="5669.32" cy="4261.82" r="86.65"/>
65
+ <circle class="fil8" cx="3775.08" cy="4120.55" r="174.77"/>
66
+ <path class="fil13" d="M11770.33 2919.17l123.64 74.69c7.2,5.99 14.32,12.27 21.35,18.8l1988.29 2318.88c-264.55,126.79 -574.49,213.07 -935.82,253.47l-136.46 0c-807.1,-864.6 -16.22,-170.1 -1587.88,-1752.45 -520.29,-499.15 77.34,-1097.23 526.88,-913.39z"/>
67
+ <circle class="fil8" cx="12254.65" cy="4297.71" r="174.77"/>
68
+ </g>
69
+ </g>
70
+ </svg>
@@ -0,0 +1,25 @@
1
+ .blackboard .footer {
2
+ color: #aaa;
3
+ }
4
+ .blackboard ul {
5
+ padding-left: 0px;
6
+ }
7
+ .blackboard li {
8
+ list-style: none;
9
+ }
10
+ .blackboard .bottom-tip {
11
+ height: 30px;
12
+ }
13
+ .blackboard .bottom-tip-item {
14
+ max-width: 500px;
15
+ color: #AAA;
16
+ text-overflow: ellipsis;
17
+ word-wrap: break-word;
18
+ }
19
+ .blackboard-filter {
20
+ margin: 10px 0;
21
+ }
22
+ .blackboard-main-content canvas {
23
+ width: 100%;
24
+ border: 1px solid #888;
25
+ }
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __async = (__this, __arguments, generator) => {
31
+ return new Promise((resolve, reject) => {
32
+ var fulfilled = (value) => {
33
+ try {
34
+ step(generator.next(value));
35
+ } catch (e) {
36
+ reject(e);
37
+ }
38
+ };
39
+ var rejected = (value) => {
40
+ try {
41
+ step(generator.throw(value));
42
+ } catch (e) {
43
+ reject(e);
44
+ }
45
+ };
46
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
47
+ step((generator = generator.apply(__this, __arguments)).next());
48
+ });
49
+ };
50
+ var blackboard_exports = {};
51
+ __export(blackboard_exports, {
52
+ default: () => blackboard_default
53
+ });
54
+ module.exports = __toCommonJS(blackboard_exports);
55
+ var import_jsx_runtime = require("react/jsx-runtime");
56
+ var PIXI = __toESM(require("pixi.js"));
57
+ var import_react = require("react");
58
+ var import_antd = require("antd");
59
+ var import_color = require("./color");
60
+ var import_blackboard = require("./blackboard.css");
61
+ var import_store = require("./store");
62
+ const itemFillAlpha = 0.3;
63
+ const bgOnAlpha = 0.8;
64
+ const bgOffAlpha = 0.3;
65
+ const noop = () => {
66
+ };
67
+ const BlackBoard = () => {
68
+ const dump = (0, import_store.useInsightDump)((store) => store.data);
69
+ const setHighlightSectionNames = (0, import_store.useInsightDump)((store) => store.setHighlightSectionNames);
70
+ const setHighlightElements = (0, import_store.useInsightDump)((store) => store.setHighlightElements);
71
+ const highlightSectionNames = (0, import_store.useInsightDump)((store) => store.highlightSectionNames);
72
+ const highlightElements = (0, import_store.useInsightDump)((store) => store.highlightElements);
73
+ const { context, matchedSection: sections, matchedElement: elements } = dump;
74
+ const { size, screenshotBase64 } = context;
75
+ const screenWidth = size.width;
76
+ const screenHeight = size.height;
77
+ const domRef = (0, import_react.useRef)(null);
78
+ const app = (0, import_react.useMemo)(() => new PIXI.Application(), []);
79
+ const [appInitialed, setAppInitialed] = (0, import_react.useState)(false);
80
+ const itemMarkContainer = (0, import_react.useMemo)(() => new PIXI.Container(), []);
81
+ const textContainer = (0, import_react.useMemo)(() => new PIXI.Container(), []);
82
+ const pixiBgRef = (0, import_react.useRef)();
83
+ const { bgVisible, setBgVisible, textsVisible, setTextsVisible } = (0, import_store.useBlackboardPreference)();
84
+ (0, import_react.useEffect)(() => {
85
+ Promise.resolve(
86
+ (() => __async(void 0, null, function* () {
87
+ if (!domRef.current || !screenWidth) {
88
+ return;
89
+ }
90
+ yield app.init({ width: screenWidth, height: screenHeight, background: 16777215 });
91
+ const canvasEl = domRef.current;
92
+ domRef.current.appendChild(app.canvas);
93
+ const { clientWidth } = domRef.current.parentElement;
94
+ const targetHeight = window.innerHeight * 0.7;
95
+ const viewportRatio = clientWidth / targetHeight;
96
+ if (screenWidth / screenHeight <= viewportRatio) {
97
+ const ratio = targetHeight / screenHeight;
98
+ canvasEl.style.width = `${Math.floor(screenWidth * ratio)}px`;
99
+ canvasEl.style.height = `${Math.floor(screenHeight * ratio)}px`;
100
+ }
101
+ app.stage.addChild(itemMarkContainer);
102
+ app.stage.addChild(textContainer);
103
+ setAppInitialed(true);
104
+ }))()
105
+ );
106
+ return () => {
107
+ console.log("will destroy");
108
+ app == null ? void 0 : app.destroy(true, { children: true, texture: true });
109
+ };
110
+ }, [app, screenWidth, screenHeight]);
111
+ (0, import_react.useEffect)(() => {
112
+ if (!appInitialed) {
113
+ return;
114
+ }
115
+ const img = new Image();
116
+ img.src = screenshotBase64;
117
+ img.onload = () => {
118
+ const screenshotTexture = PIXI.Texture.from(img);
119
+ const screenshotSprite = new PIXI.Sprite(screenshotTexture);
120
+ screenshotSprite.x = 0;
121
+ screenshotSprite.y = 0;
122
+ screenshotSprite.width = screenWidth;
123
+ screenshotSprite.height = screenHeight;
124
+ app.stage.addChildAt(screenshotSprite, 0);
125
+ pixiBgRef.current = screenshotSprite;
126
+ screenshotSprite.alpha = bgVisible ? bgOnAlpha : bgOffAlpha;
127
+ };
128
+ }, [app.stage, appInitialed]);
129
+ const rectMarkForItem = (rect, name, themeColor, alpha, onPointOver, onPointerOut) => {
130
+ const { left, top, width, height } = rect;
131
+ const graphics = new PIXI.Graphics();
132
+ graphics.beginFill(themeColor, alpha);
133
+ graphics.lineStyle(1, themeColor, 1);
134
+ graphics.drawRect(left, top, width, height);
135
+ graphics.endFill();
136
+ graphics.interactive = true;
137
+ graphics.on("pointerover", onPointOver);
138
+ graphics.on("pointerout", onPointerOut);
139
+ const nameFontSize = 18;
140
+ const texts = new PIXI.Text(name, {
141
+ fontSize: nameFontSize,
142
+ fill: 0
143
+ });
144
+ texts.x = left;
145
+ texts.y = Math.max(top - (nameFontSize + 4), 0);
146
+ return [graphics, texts];
147
+ };
148
+ const { highlightSectionRects, highlightElementRects } = (0, import_react.useMemo)(() => {
149
+ const highlightSectionRects2 = [];
150
+ const highlightElementRects2 = [];
151
+ itemMarkContainer.removeChildren();
152
+ textContainer.removeChildren();
153
+ sections.forEach((section) => {
154
+ const ifHighlight = highlightSectionNames.includes(section.name);
155
+ if (ifHighlight) {
156
+ highlightSectionRects2.push(section.rect);
157
+ }
158
+ const [graphics, texts] = rectMarkForItem(
159
+ section.rect,
160
+ section.name,
161
+ ifHighlight ? (0, import_color.highlightColorForType)("section") : (0, import_color.colorForName)("section", section.name),
162
+ ifHighlight ? 1 : itemFillAlpha,
163
+ () => {
164
+ setHighlightSectionNames([section.name]);
165
+ },
166
+ () => {
167
+ setHighlightSectionNames([]);
168
+ }
169
+ );
170
+ itemMarkContainer.addChild(graphics);
171
+ textContainer.addChild(texts);
172
+ });
173
+ highlightElements.forEach((element) => {
174
+ const { rect } = element;
175
+ highlightElementRects2.push(rect);
176
+ if (elements.includes(element)) {
177
+ return;
178
+ }
179
+ const [graphics, texts] = rectMarkForItem(rect, "", (0, import_color.highlightColorForType)("element"), 1, noop, noop);
180
+ itemMarkContainer.addChild(graphics);
181
+ textContainer.addChild(texts);
182
+ });
183
+ elements.forEach((element) => {
184
+ const { rect, content } = element;
185
+ const ifHighlight = highlightElements.includes(element);
186
+ const [graphics, texts] = rectMarkForItem(
187
+ rect,
188
+ content,
189
+ ifHighlight ? (0, import_color.highlightColorForType)("element") : (0, import_color.colorForName)("element", content),
190
+ ifHighlight ? 1 : itemFillAlpha,
191
+ () => {
192
+ setHighlightElements([element]);
193
+ },
194
+ () => {
195
+ setHighlightElements([]);
196
+ }
197
+ );
198
+ itemMarkContainer.addChild(graphics);
199
+ textContainer.addChild(texts);
200
+ });
201
+ sections.forEach((section) => {
202
+ const { content } = section;
203
+ const ifHighlight = highlightSectionNames.includes(section.name);
204
+ const sectionTheme = ifHighlight ? "#FFFFFF" : (0, import_color.colorForName)("section", section.name);
205
+ content.forEach((text) => {
206
+ const { content: content2, rect } = text;
207
+ const { left, top } = rect;
208
+ const style = new PIXI.TextStyle({
209
+ wordWrap: true,
210
+ wordWrapWidth: rect.width,
211
+ fontSize: 18,
212
+ fill: sectionTheme
213
+ });
214
+ const textElement = new PIXI.Text(content2, style);
215
+ textElement.x = left;
216
+ textElement.y = top;
217
+ textContainer.addChild(textElement);
218
+ const textBorder = new PIXI.Graphics();
219
+ textBorder.beginFill(11184810, 0.2);
220
+ textBorder.lineStyle(1, 0, 1);
221
+ textBorder.drawRect(left, top, rect.width, rect.height);
222
+ textBorder.endFill();
223
+ textContainer.addChild(textBorder);
224
+ });
225
+ });
226
+ textContainer.visible = textsVisible;
227
+ return {
228
+ highlightSectionRects: highlightSectionRects2,
229
+ highlightElementRects: highlightElementRects2
230
+ };
231
+ }, [
232
+ app,
233
+ appInitialed,
234
+ sections,
235
+ highlightSectionNames,
236
+ highlightElements
237
+ // bgVisible,
238
+ // textsVisible,
239
+ ]);
240
+ const onSetBg = (e) => {
241
+ setBgVisible(e.target.checked);
242
+ if (pixiBgRef.current) {
243
+ pixiBgRef.current.alpha = e.target.checked ? bgOnAlpha : bgOffAlpha;
244
+ }
245
+ };
246
+ const onSetTextsVisible = (e) => {
247
+ setTextsVisible(e.target.checked);
248
+ textContainer.visible = e.target.checked;
249
+ };
250
+ let bottomTipA = null;
251
+ if (highlightElementRects.length === 1) {
252
+ bottomTipA = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-tip", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bottom-tip-item", children: [
253
+ "Element: ",
254
+ JSON.stringify(highlightElementRects[0])
255
+ ] }) });
256
+ } else if (highlightElementRects.length > 1) {
257
+ bottomTipA = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-tip", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bottom-tip-item", children: [
258
+ "Element: ",
259
+ JSON.stringify(highlightElementRects)
260
+ ] }) });
261
+ }
262
+ let bottomTipB = null;
263
+ if (highlightSectionRects.length === 1) {
264
+ bottomTipB = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-tip", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bottom-tip-item", children: [
265
+ "Section: ",
266
+ JSON.stringify(highlightSectionRects[0])
267
+ ] }) });
268
+ } else if (highlightSectionRects.length > 1) {
269
+ bottomTipB = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-tip", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bottom-tip-item", children: [
270
+ "Sections: ",
271
+ JSON.stringify(highlightSectionRects)
272
+ ] }) });
273
+ }
274
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "blackboard", children: [
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "blackboard-main-content", style: { width: "100%" }, ref: domRef }),
276
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "blackboard-filter", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "overlay-control", children: [
277
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Checkbox, { checked: bgVisible, onChange: onSetBg, children: "Screenshot" }),
278
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Checkbox, { checked: textsVisible, onChange: onSetTextsVisible, children: "Text Mark" })
279
+ ] }) }),
280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bottom-tip", children: [
281
+ bottomTipA,
282
+ bottomTipB
283
+ ] })
284
+ ] });
285
+ };
286
+ var blackboard_default = BlackBoard;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var color_exports = {};
20
+ __export(color_exports, {
21
+ colorForName: () => colorForName,
22
+ highlightColorForType: () => highlightColorForType
23
+ });
24
+ module.exports = __toCommonJS(color_exports);
25
+ const sectionColor = ["#028391"];
26
+ const elementColor = ["#fb6107"];
27
+ const highlightColorForSection = "#01204E";
28
+ const highlightColorForElement = "#F56824";
29
+ function djb2Hash(str) {
30
+ if (!str) {
31
+ console.warn("djb2Hash: empty string");
32
+ str = "unnamed";
33
+ }
34
+ let hash = 5381;
35
+ for (let i = 0; i < str.length; i++) {
36
+ hash = (hash << 5) + hash + str.charCodeAt(i);
37
+ }
38
+ return hash >>> 0;
39
+ }
40
+ function colorForName(type, name) {
41
+ const hashNumber = djb2Hash(name);
42
+ if (type === "section") {
43
+ return sectionColor[hashNumber % sectionColor.length];
44
+ } else {
45
+ return elementColor[hashNumber % elementColor.length];
46
+ }
47
+ }
48
+ function highlightColorForType(type) {
49
+ if (type === "section") {
50
+ return highlightColorForSection;
51
+ } else {
52
+ return highlightColorForElement;
53
+ }
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ colorForName,
58
+ highlightColorForType
59
+ });
File without changes
@@ -0,0 +1,34 @@
1
+ .detail-panel {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ padding: 10px;
6
+ background: #FFF;
7
+ }
8
+ .detail-panel .ant-segmented {
9
+ padding: 0;
10
+ }
11
+ .detail-panel .view-switcher {
12
+ margin-bottom: 10px;
13
+ flex-shrink: 0;
14
+ }
15
+ .detail-panel .detail-content {
16
+ box-sizing: border-box;
17
+ justify-content: center;
18
+ flex-direction: column;
19
+ display: flex;
20
+ flex-grow: 1;
21
+ }
22
+ .detail-panel .blackboard {
23
+ margin: 0 auto;
24
+ }
25
+ .detail-panel .screenshot-item {
26
+ margin-bottom: 10px;
27
+ }
28
+ .detail-panel .screenshot-item .screenshot-item-title {
29
+ margin-bottom: 5px;
30
+ }
31
+ .detail-panel .screenshot-item img {
32
+ border: 1px solid #888;
33
+ max-width: 100%;
34
+ }