@sqaitech/visualizer 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/assets/sqai-logo.mjs +2 -0
- package/dist/es/component/blackboard/index.css +33 -0
- package/dist/es/component/blackboard/index.mjs +278 -0
- package/dist/es/component/config-selector/index.mjs +104 -0
- package/dist/es/component/context-preview/index.mjs +38 -0
- package/dist/es/component/env-config/index.mjs +112 -0
- package/dist/es/component/env-config-reminder/index.css +22 -0
- package/dist/es/component/env-config-reminder/index.mjs +28 -0
- package/dist/es/component/form-field/index.mjs +163 -0
- package/dist/es/component/history-selector/index.css +135 -0
- package/dist/es/component/history-selector/index.mjs +170 -0
- package/dist/es/component/index.mjs +1 -0
- package/dist/es/component/logo/index.css +13 -0
- package/dist/es/component/logo/index.mjs +21 -0
- package/dist/es/component/misc/index.mjs +94 -0
- package/dist/es/component/nav-actions/index.mjs +32 -0
- package/dist/es/component/nav-actions/style.css +35 -0
- package/dist/es/component/player/index.css +185 -0
- package/dist/es/component/player/index.mjs +856 -0
- package/dist/es/component/playground/index.css +431 -0
- package/dist/es/component/playground/index.mjs +8 -0
- package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/es/component/playground-result/index.css +34 -0
- package/dist/es/component/playground-result/index.mjs +62 -0
- package/dist/es/component/prompt-input/index.css +391 -0
- package/dist/es/component/prompt-input/index.mjs +730 -0
- package/dist/es/component/service-mode-control/index.mjs +105 -0
- package/dist/es/component/shiny-text/index.css +75 -0
- package/dist/es/component/shiny-text/index.mjs +15 -0
- package/dist/es/component/universal-playground/index.css +341 -0
- package/dist/es/component/universal-playground/index.mjs +302 -0
- package/dist/es/component/universal-playground/providers/context-provider.mjs +52 -0
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +207 -0
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +210 -0
- package/dist/es/hooks/usePlaygroundExecution.mjs +180 -0
- package/dist/es/hooks/usePlaygroundState.mjs +203 -0
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +24 -0
- package/dist/es/hooks/useServerValid.mjs +30 -0
- package/dist/es/icons/avatar.mjs +28 -0
- package/dist/es/icons/close.mjs +19 -0
- package/dist/es/icons/global-perspective.mjs +16 -0
- package/dist/es/icons/history.mjs +30 -0
- package/dist/es/icons/magnifying-glass.mjs +39 -0
- package/dist/es/icons/player-setting.mjs +26 -0
- package/dist/es/icons/setting.mjs +20 -0
- package/dist/es/icons/show-marker.mjs +16 -0
- package/dist/es/index.mjs +25 -0
- package/dist/es/static/image/sqai-logo.png +0 -0
- package/dist/es/store/history.mjs +89 -0
- package/dist/es/store/store.mjs +186 -0
- package/dist/es/types.mjs +70 -0
- package/dist/es/utils/color.mjs +35 -0
- package/dist/es/utils/constants.mjs +99 -0
- package/dist/es/utils/index.mjs +10 -0
- package/dist/es/utils/pixi-loader.mjs +16 -0
- package/dist/es/utils/playground-utils.mjs +67 -0
- package/dist/es/utils/replay-scripts.mjs +312 -0
- package/dist/lib/assets/sqai-logo.js +24 -0
- package/dist/lib/component/blackboard/index.css +33 -0
- package/dist/lib/component/blackboard/index.js +321 -0
- package/dist/lib/component/config-selector/index.js +148 -0
- package/dist/lib/component/context-preview/index.js +83 -0
- package/dist/lib/component/env-config/index.js +146 -0
- package/dist/lib/component/env-config-reminder/index.css +22 -0
- package/dist/lib/component/env-config-reminder/index.js +62 -0
- package/dist/lib/component/form-field/index.js +209 -0
- package/dist/lib/component/history-selector/index.css +135 -0
- package/dist/lib/component/history-selector/index.js +216 -0
- package/dist/lib/component/index.js +60 -0
- package/dist/lib/component/logo/index.css +13 -0
- package/dist/lib/component/logo/index.js +68 -0
- package/dist/lib/component/misc/index.js +150 -0
- package/dist/lib/component/nav-actions/index.js +66 -0
- package/dist/lib/component/nav-actions/style.css +35 -0
- package/dist/lib/component/player/index.css +185 -0
- package/dist/lib/component/player/index.js +902 -0
- package/dist/lib/component/playground/index.css +431 -0
- package/dist/lib/component/playground/index.js +113 -0
- package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/lib/component/playground-result/index.css +34 -0
- package/dist/lib/component/playground-result/index.js +106 -0
- package/dist/lib/component/prompt-input/index.css +391 -0
- package/dist/lib/component/prompt-input/index.js +774 -0
- package/dist/lib/component/service-mode-control/index.js +139 -0
- package/dist/lib/component/shiny-text/index.css +75 -0
- package/dist/lib/component/shiny-text/index.js +49 -0
- package/dist/lib/component/universal-playground/index.css +341 -0
- package/dist/lib/component/universal-playground/index.js +350 -0
- package/dist/lib/component/universal-playground/providers/context-provider.js +95 -0
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +247 -0
- package/dist/lib/component/universal-playground/providers/storage-provider.js +268 -0
- package/dist/lib/hooks/usePlaygroundExecution.js +214 -0
- package/dist/lib/hooks/usePlaygroundState.js +237 -0
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +61 -0
- package/dist/lib/hooks/useServerValid.js +64 -0
- package/dist/lib/icons/avatar.js +62 -0
- package/dist/lib/icons/close.js +53 -0
- package/dist/lib/icons/global-perspective.js +50 -0
- package/dist/lib/icons/history.js +64 -0
- package/dist/lib/icons/magnifying-glass.js +73 -0
- package/dist/lib/icons/player-setting.js +60 -0
- package/dist/lib/icons/setting.js +54 -0
- package/dist/lib/icons/show-marker.js +50 -0
- package/dist/lib/index.js +187 -0
- package/dist/lib/static/image/sqai-logo.png +0 -0
- package/dist/lib/store/history.js +96 -0
- package/dist/lib/store/store.js +196 -0
- package/dist/lib/types.js +116 -0
- package/dist/lib/utils/color.js +75 -0
- package/dist/lib/utils/constants.js +154 -0
- package/dist/lib/utils/index.js +63 -0
- package/dist/lib/utils/pixi-loader.js +56 -0
- package/dist/lib/utils/playground-utils.js +110 -0
- package/dist/lib/utils/replay-scripts.js +355 -0
- package/dist/types/component/blackboard/index.d.ts +15 -0
- package/dist/types/component/config-selector/index.d.ts +9 -0
- package/dist/types/component/context-preview/index.d.ts +9 -0
- package/dist/types/component/env-config/index.d.ts +6 -0
- package/dist/types/component/env-config-reminder/index.d.ts +6 -0
- package/dist/types/component/form-field/index.d.ts +17 -0
- package/dist/types/component/history-selector/index.d.ts +10 -0
- package/dist/types/component/index.d.ts +1 -0
- package/dist/types/component/logo/index.d.ts +5 -0
- package/dist/types/component/misc/index.d.ts +6 -0
- package/dist/types/component/nav-actions/index.d.ts +10 -0
- package/dist/types/component/player/index.d.ts +13 -0
- package/dist/types/component/playground/index.d.ts +7 -0
- package/dist/types/component/playground-result/index.d.ts +20 -0
- package/dist/types/component/prompt-input/index.d.ts +22 -0
- package/dist/types/component/service-mode-control/index.d.ts +6 -0
- package/dist/types/component/shiny-text/index.d.ts +12 -0
- package/dist/types/component/universal-playground/index.d.ts +4 -0
- package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
- package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
- package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +10 -0
- package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
- package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
- package/dist/types/hooks/useServerValid.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/store/history.d.ts +16 -0
- package/dist/types/store/store.d.ts +36 -0
- package/dist/types/types.d.ts +161 -0
- package/dist/types/utils/color.d.ts +4 -0
- package/dist/types/utils/constants.d.ts +74 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/pixi-loader.d.ts +5 -0
- package/dist/types/utils/playground-utils.d.ts +6 -0
- package/dist/types/utils/replay-scripts.d.ts +34 -0
- package/package.json +85 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
pointMarkForItem: ()=>pointMarkForItem,
|
|
29
|
+
default: ()=>blackboard,
|
|
30
|
+
Blackboard: ()=>Blackboard,
|
|
31
|
+
rectMarkForItem: ()=>rectMarkForItem
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
+
require("pixi.js/unsafe-eval");
|
|
35
|
+
const external_antd_namespaceObject = require("antd");
|
|
36
|
+
const external_pixi_js_namespaceObject = require("pixi.js");
|
|
37
|
+
const external_react_namespaceObject = require("react");
|
|
38
|
+
const color_js_namespaceObject = require("../../utils/color.js");
|
|
39
|
+
require("./index.css");
|
|
40
|
+
const extractor_namespaceObject = require("@sqaitech/shared/extractor");
|
|
41
|
+
const external_pixi_filters_namespaceObject = require("pixi-filters");
|
|
42
|
+
const store_js_namespaceObject = require("../../store/store.js");
|
|
43
|
+
const itemFillAlpha = 0.4;
|
|
44
|
+
const highlightAlpha = 0.4;
|
|
45
|
+
const pointRadius = 10;
|
|
46
|
+
const pointMarkForItem = (point, type)=>{
|
|
47
|
+
const [x, y] = point;
|
|
48
|
+
const themeColor = (0, color_js_namespaceObject.highlightColorForType)('element');
|
|
49
|
+
const graphics = new external_pixi_js_namespaceObject.Graphics();
|
|
50
|
+
graphics.beginFill(themeColor, itemFillAlpha);
|
|
51
|
+
graphics.drawCircle(x, y, pointRadius);
|
|
52
|
+
graphics.endFill();
|
|
53
|
+
return graphics;
|
|
54
|
+
};
|
|
55
|
+
const rectMarkForItem = (rect, name, type)=>{
|
|
56
|
+
const { left, top, width, height } = rect;
|
|
57
|
+
let themeColor;
|
|
58
|
+
themeColor = 'element' === type ? (0, color_js_namespaceObject.colorForName)(name) : 'searchArea' === type ? (0, color_js_namespaceObject.highlightColorForType)('searchArea') : (0, color_js_namespaceObject.highlightColorForType)('element');
|
|
59
|
+
const alpha = 'highlight' === type ? highlightAlpha : itemFillAlpha;
|
|
60
|
+
const graphics = new external_pixi_js_namespaceObject.Graphics();
|
|
61
|
+
graphics.beginFill(themeColor, alpha);
|
|
62
|
+
graphics.lineStyle(1, themeColor, 1);
|
|
63
|
+
graphics.drawRect(left, top, width, height);
|
|
64
|
+
graphics.endFill();
|
|
65
|
+
const dropShadowFilter = new external_pixi_filters_namespaceObject.DropShadowFilter({
|
|
66
|
+
blur: 2,
|
|
67
|
+
quality: 3,
|
|
68
|
+
alpha: 0.4,
|
|
69
|
+
offset: {
|
|
70
|
+
x: 4,
|
|
71
|
+
y: 4
|
|
72
|
+
},
|
|
73
|
+
color: 0x333333
|
|
74
|
+
});
|
|
75
|
+
graphics.filters = [
|
|
76
|
+
dropShadowFilter
|
|
77
|
+
];
|
|
78
|
+
const nameFontSize = 18;
|
|
79
|
+
if (!name) return [
|
|
80
|
+
graphics
|
|
81
|
+
];
|
|
82
|
+
const texts = new external_pixi_js_namespaceObject.Text(name, {
|
|
83
|
+
fontSize: nameFontSize,
|
|
84
|
+
fill: 0x0
|
|
85
|
+
});
|
|
86
|
+
texts.x = left;
|
|
87
|
+
texts.y = Math.max(top - (nameFontSize + 4), 0);
|
|
88
|
+
return [
|
|
89
|
+
graphics,
|
|
90
|
+
texts
|
|
91
|
+
];
|
|
92
|
+
};
|
|
93
|
+
const Blackboard = (props)=>{
|
|
94
|
+
const highlightElements = props.highlightElements || [];
|
|
95
|
+
const highlightIds = highlightElements.map((e)=>e.id);
|
|
96
|
+
const highlightRect = props.highlightRect;
|
|
97
|
+
const highlightPoints = props.highlightPoints;
|
|
98
|
+
const context = props.uiContext;
|
|
99
|
+
const { size, screenshotBase64 } = context;
|
|
100
|
+
const screenWidth = size.width;
|
|
101
|
+
const screenHeight = size.height;
|
|
102
|
+
const domRef = (0, external_react_namespaceObject.useRef)(null);
|
|
103
|
+
const app = (0, external_react_namespaceObject.useMemo)(()=>new external_pixi_js_namespaceObject.Application(), []);
|
|
104
|
+
const [appInitialed, setAppInitialed] = (0, external_react_namespaceObject.useState)(false);
|
|
105
|
+
const highlightContainer = (0, external_react_namespaceObject.useMemo)(()=>new external_pixi_js_namespaceObject.Container(), []);
|
|
106
|
+
const elementMarkContainer = (0, external_react_namespaceObject.useMemo)(()=>new external_pixi_js_namespaceObject.Container(), []);
|
|
107
|
+
const [hoverElement, setHoverElement] = (0, external_react_namespaceObject.useState)(null);
|
|
108
|
+
const pixiBgRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
109
|
+
const { backgroundVisible, setBackgroundVisible, elementsVisible, setElementsVisible } = (0, store_js_namespaceObject.useBlackboardPreference)();
|
|
110
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
111
|
+
Promise.resolve((async ()=>{
|
|
112
|
+
if (!domRef.current || !screenWidth) return;
|
|
113
|
+
await app.init({
|
|
114
|
+
width: screenWidth,
|
|
115
|
+
height: screenHeight,
|
|
116
|
+
background: 0xffffff
|
|
117
|
+
});
|
|
118
|
+
const canvasEl = domRef.current;
|
|
119
|
+
domRef.current.appendChild(app.canvas);
|
|
120
|
+
const { clientWidth } = domRef.current.parentElement;
|
|
121
|
+
const targetHeight = 0.6 * window.innerHeight;
|
|
122
|
+
const viewportRatio = clientWidth / targetHeight;
|
|
123
|
+
if (screenWidth / screenHeight <= viewportRatio) {
|
|
124
|
+
const ratio = targetHeight / screenHeight;
|
|
125
|
+
canvasEl.style.width = `${Math.floor(screenWidth * ratio)}px`;
|
|
126
|
+
canvasEl.style.height = `${Math.floor(screenHeight * ratio)}px`;
|
|
127
|
+
}
|
|
128
|
+
app.stage.addChild(highlightContainer);
|
|
129
|
+
app.stage.addChild(elementMarkContainer);
|
|
130
|
+
setAppInitialed(true);
|
|
131
|
+
})());
|
|
132
|
+
return ()=>{
|
|
133
|
+
console.log('will destroy');
|
|
134
|
+
try {
|
|
135
|
+
app.destroy(true, {
|
|
136
|
+
children: true,
|
|
137
|
+
texture: true
|
|
138
|
+
});
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.warn('destroy failed', e);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}, [
|
|
144
|
+
app,
|
|
145
|
+
screenWidth,
|
|
146
|
+
screenHeight
|
|
147
|
+
]);
|
|
148
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
149
|
+
if (!appInitialed) return;
|
|
150
|
+
app.stage.eventMode = 'static';
|
|
151
|
+
app.stage.hitArea = new external_pixi_js_namespaceObject.Rectangle(0, 0, screenWidth, screenHeight);
|
|
152
|
+
const clickHandler = (event)=>{
|
|
153
|
+
var _props_onCanvasClick;
|
|
154
|
+
console.log('pixi click', event);
|
|
155
|
+
const { x, y } = event.data.global;
|
|
156
|
+
null == (_props_onCanvasClick = props.onCanvasClick) || _props_onCanvasClick.call(props, [
|
|
157
|
+
Math.round(x),
|
|
158
|
+
Math.round(y)
|
|
159
|
+
]);
|
|
160
|
+
};
|
|
161
|
+
app.stage.on('click', clickHandler);
|
|
162
|
+
return ()=>{
|
|
163
|
+
var _app_stage;
|
|
164
|
+
null == app || null == (_app_stage = app.stage) || _app_stage.off('click');
|
|
165
|
+
};
|
|
166
|
+
}, [
|
|
167
|
+
appInitialed,
|
|
168
|
+
props.onCanvasClick,
|
|
169
|
+
screenWidth,
|
|
170
|
+
screenHeight
|
|
171
|
+
]);
|
|
172
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
173
|
+
if (!appInitialed) return;
|
|
174
|
+
const img = new Image();
|
|
175
|
+
img.onload = ()=>{
|
|
176
|
+
if (!app.stage) return;
|
|
177
|
+
const screenshotTexture = external_pixi_js_namespaceObject.Texture.from(img);
|
|
178
|
+
const backgroundSprite = new external_pixi_js_namespaceObject.Sprite(screenshotTexture);
|
|
179
|
+
backgroundSprite.x = 0;
|
|
180
|
+
backgroundSprite.y = 0;
|
|
181
|
+
backgroundSprite.width = screenWidth;
|
|
182
|
+
backgroundSprite.height = screenHeight;
|
|
183
|
+
backgroundSprite.eventMode = 'passive';
|
|
184
|
+
app.stage.addChildAt(backgroundSprite, 0);
|
|
185
|
+
pixiBgRef.current = backgroundSprite;
|
|
186
|
+
backgroundSprite.visible = backgroundVisible;
|
|
187
|
+
};
|
|
188
|
+
img.onerror = (e)=>{
|
|
189
|
+
console.error('load screenshot failed', e);
|
|
190
|
+
};
|
|
191
|
+
img.src = screenshotBase64;
|
|
192
|
+
}, [
|
|
193
|
+
app.stage,
|
|
194
|
+
appInitialed,
|
|
195
|
+
screenWidth,
|
|
196
|
+
screenHeight
|
|
197
|
+
]);
|
|
198
|
+
const { highlightElementRects } = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
199
|
+
const highlightElementRects = [];
|
|
200
|
+
highlightContainer.removeChildren();
|
|
201
|
+
elementMarkContainer.removeChildren();
|
|
202
|
+
highlightContainer.eventMode = 'passive';
|
|
203
|
+
elementMarkContainer.eventMode = 'passive';
|
|
204
|
+
if (highlightRect) {
|
|
205
|
+
const [graphics] = rectMarkForItem(highlightRect, 'Search Area', 'searchArea');
|
|
206
|
+
highlightContainer.addChild(graphics);
|
|
207
|
+
}
|
|
208
|
+
if (highlightElements.length) highlightElements.forEach((element)=>{
|
|
209
|
+
const { rect, content, id } = element;
|
|
210
|
+
const [graphics] = rectMarkForItem(rect, content, 'highlight');
|
|
211
|
+
highlightContainer.addChild(graphics);
|
|
212
|
+
});
|
|
213
|
+
if (null == highlightPoints ? void 0 : highlightPoints.length) highlightPoints.forEach((point)=>{
|
|
214
|
+
const graphics = pointMarkForItem(point, 'highlightPoint');
|
|
215
|
+
highlightContainer.addChild(graphics);
|
|
216
|
+
});
|
|
217
|
+
const elements = (0, extractor_namespaceObject.treeToList)(context.tree);
|
|
218
|
+
elements.forEach((element)=>{
|
|
219
|
+
const { rect, content, id } = element;
|
|
220
|
+
const ifHighlight = highlightIds.includes(id) || (null == hoverElement ? void 0 : hoverElement.id) === id;
|
|
221
|
+
if (ifHighlight) return;
|
|
222
|
+
const [graphics] = rectMarkForItem(rect, content, 'element');
|
|
223
|
+
elementMarkContainer.addChild(graphics);
|
|
224
|
+
});
|
|
225
|
+
elementMarkContainer.visible = elementsVisible;
|
|
226
|
+
return {
|
|
227
|
+
highlightElementRects
|
|
228
|
+
};
|
|
229
|
+
}, [
|
|
230
|
+
app,
|
|
231
|
+
appInitialed,
|
|
232
|
+
highlightElements,
|
|
233
|
+
context.tree,
|
|
234
|
+
hoverElement,
|
|
235
|
+
highlightRect,
|
|
236
|
+
highlightPoints
|
|
237
|
+
]);
|
|
238
|
+
const onSetBackgroundVisible = (e)=>{
|
|
239
|
+
setBackgroundVisible(e.target.checked);
|
|
240
|
+
if (pixiBgRef.current) pixiBgRef.current.visible = e.target.checked;
|
|
241
|
+
};
|
|
242
|
+
const onSetElementsVisible = (e)=>{
|
|
243
|
+
setElementsVisible(e.target.checked);
|
|
244
|
+
elementMarkContainer.visible = e.target.checked;
|
|
245
|
+
};
|
|
246
|
+
let bottomTipA = null;
|
|
247
|
+
if (1 === highlightElementRects.length) bottomTipA = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
248
|
+
className: "bottom-tip",
|
|
249
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
250
|
+
className: "bottom-tip-item",
|
|
251
|
+
children: [
|
|
252
|
+
"Element: ",
|
|
253
|
+
JSON.stringify(highlightElementRects[0])
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
else if (highlightElementRects.length > 1) bottomTipA = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
258
|
+
className: "bottom-tip",
|
|
259
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
260
|
+
className: "bottom-tip-item",
|
|
261
|
+
children: [
|
|
262
|
+
"Element: ",
|
|
263
|
+
JSON.stringify(highlightElementRects)
|
|
264
|
+
]
|
|
265
|
+
})
|
|
266
|
+
});
|
|
267
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
268
|
+
className: "blackboard",
|
|
269
|
+
children: [
|
|
270
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
271
|
+
className: "blackboard-main-content",
|
|
272
|
+
style: {
|
|
273
|
+
width: '100%'
|
|
274
|
+
},
|
|
275
|
+
ref: domRef
|
|
276
|
+
}),
|
|
277
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
278
|
+
className: "blackboard-filter",
|
|
279
|
+
style: {
|
|
280
|
+
display: props.hideController ? 'none' : 'block'
|
|
281
|
+
},
|
|
282
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
283
|
+
className: "overlay-control",
|
|
284
|
+
children: [
|
|
285
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Checkbox, {
|
|
286
|
+
checked: backgroundVisible,
|
|
287
|
+
onChange: onSetBackgroundVisible,
|
|
288
|
+
children: "Background"
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Checkbox, {
|
|
291
|
+
checked: elementsVisible,
|
|
292
|
+
onChange: onSetElementsVisible,
|
|
293
|
+
children: "Elements"
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
})
|
|
297
|
+
}),
|
|
298
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
299
|
+
className: "bottom-tip",
|
|
300
|
+
style: {
|
|
301
|
+
display: props.hideController ? 'none' : 'block'
|
|
302
|
+
},
|
|
303
|
+
children: bottomTipA
|
|
304
|
+
})
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
const blackboard = Blackboard;
|
|
309
|
+
exports.Blackboard = __webpack_exports__.Blackboard;
|
|
310
|
+
exports["default"] = __webpack_exports__["default"];
|
|
311
|
+
exports.pointMarkForItem = __webpack_exports__.pointMarkForItem;
|
|
312
|
+
exports.rectMarkForItem = __webpack_exports__.rectMarkForItem;
|
|
313
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
314
|
+
"Blackboard",
|
|
315
|
+
"default",
|
|
316
|
+
"pointMarkForItem",
|
|
317
|
+
"rectMarkForItem"
|
|
318
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
319
|
+
Object.defineProperty(exports, '__esModule', {
|
|
320
|
+
value: true
|
|
321
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
ConfigSelector: ()=>ConfigSelector
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const external_antd_namespaceObject = require("antd");
|
|
40
|
+
const setting_js_namespaceObject = require("../../icons/setting.js");
|
|
41
|
+
var setting_js_default = /*#__PURE__*/ __webpack_require__.n(setting_js_namespaceObject);
|
|
42
|
+
const store_js_namespaceObject = require("../../store/store.js");
|
|
43
|
+
const constants_js_namespaceObject = require("../../utils/constants.js");
|
|
44
|
+
const ConfigSelector = (param)=>{
|
|
45
|
+
let { showDeepThinkOption = false, enableTracking = false, showDataExtractionOptions = false, hideDomAndScreenshotOptions = false } = param;
|
|
46
|
+
const forceSameTabNavigation = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.forceSameTabNavigation);
|
|
47
|
+
const setForceSameTabNavigation = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.setForceSameTabNavigation);
|
|
48
|
+
const deepThink = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.deepThink);
|
|
49
|
+
const setDeepThink = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.setDeepThink);
|
|
50
|
+
const screenshotIncluded = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.screenshotIncluded);
|
|
51
|
+
const setScreenshotIncluded = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.setScreenshotIncluded);
|
|
52
|
+
const domIncluded = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.domIncluded);
|
|
53
|
+
const setDomIncluded = (0, store_js_namespaceObject.useEnvConfig)((state)=>state.setDomIncluded);
|
|
54
|
+
if (!enableTracking && !showDeepThinkOption && !showDataExtractionOptions) return null;
|
|
55
|
+
const configItems = buildConfigItems();
|
|
56
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
57
|
+
className: "selector-trigger",
|
|
58
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Dropdown, {
|
|
59
|
+
menu: {
|
|
60
|
+
items: configItems
|
|
61
|
+
},
|
|
62
|
+
trigger: [
|
|
63
|
+
'click'
|
|
64
|
+
],
|
|
65
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(setting_js_default(), {
|
|
66
|
+
width: 24,
|
|
67
|
+
height: 24
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
function buildConfigItems() {
|
|
72
|
+
const items = [];
|
|
73
|
+
if (enableTracking) items.push({
|
|
74
|
+
label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Checkbox, {
|
|
75
|
+
onChange: (e)=>setForceSameTabNavigation(e.target.checked),
|
|
76
|
+
checked: forceSameTabNavigation,
|
|
77
|
+
children: constants_js_namespaceObject.trackingTip
|
|
78
|
+
}),
|
|
79
|
+
key: 'track-config'
|
|
80
|
+
});
|
|
81
|
+
if (showDeepThinkOption) items.push({
|
|
82
|
+
label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Checkbox, {
|
|
83
|
+
onChange: (e)=>{
|
|
84
|
+
setDeepThink(e.target.checked);
|
|
85
|
+
},
|
|
86
|
+
checked: deepThink,
|
|
87
|
+
children: constants_js_namespaceObject.deepThinkTip
|
|
88
|
+
}),
|
|
89
|
+
key: 'deep-think-config'
|
|
90
|
+
});
|
|
91
|
+
if (showDataExtractionOptions && !hideDomAndScreenshotOptions) {
|
|
92
|
+
items.push({
|
|
93
|
+
label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Checkbox, {
|
|
94
|
+
onChange: (e)=>{
|
|
95
|
+
setScreenshotIncluded(e.target.checked);
|
|
96
|
+
},
|
|
97
|
+
checked: screenshotIncluded,
|
|
98
|
+
children: constants_js_namespaceObject.screenshotIncludedTip
|
|
99
|
+
}),
|
|
100
|
+
key: 'screenshot-included-config'
|
|
101
|
+
});
|
|
102
|
+
items.push({
|
|
103
|
+
label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
104
|
+
style: {
|
|
105
|
+
padding: '4px 0'
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
109
|
+
style: {
|
|
110
|
+
marginBottom: '4px',
|
|
111
|
+
fontSize: '14px'
|
|
112
|
+
},
|
|
113
|
+
children: constants_js_namespaceObject.domIncludedTip
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Radio.Group, {
|
|
116
|
+
size: "small",
|
|
117
|
+
value: domIncluded,
|
|
118
|
+
onChange: (e)=>setDomIncluded(e.target.value),
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio, {
|
|
121
|
+
value: false,
|
|
122
|
+
children: "Off"
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio, {
|
|
125
|
+
value: true,
|
|
126
|
+
children: "All"
|
|
127
|
+
}),
|
|
128
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio, {
|
|
129
|
+
value: 'visible-only',
|
|
130
|
+
children: "Visible only"
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
}),
|
|
136
|
+
key: 'dom-included-config'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return items;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.ConfigSelector = __webpack_exports__.ConfigSelector;
|
|
143
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
144
|
+
"ConfigSelector"
|
|
145
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
146
|
+
Object.defineProperty(exports, '__esModule', {
|
|
147
|
+
value: true
|
|
148
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
ContextPreview: ()=>ContextPreview
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const external_antd_namespaceObject = require("antd");
|
|
40
|
+
const index_js_namespaceObject = require("../blackboard/index.js");
|
|
41
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
42
|
+
const external_misc_index_js_namespaceObject = require("../misc/index.js");
|
|
43
|
+
const playground_demo_ui_context_json_namespaceObject = require("../playground/playground-demo-ui-context.json");
|
|
44
|
+
var playground_demo_ui_context_json_default = /*#__PURE__*/ __webpack_require__.n(playground_demo_ui_context_json_namespaceObject);
|
|
45
|
+
const ContextPreview = (param)=>{
|
|
46
|
+
let { uiContextPreview, setUiContextPreview, showContextPreview } = param;
|
|
47
|
+
if (!showContextPreview) return null;
|
|
48
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
49
|
+
className: "form-part context-panel",
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h3", {
|
|
52
|
+
children: "UI Context"
|
|
53
|
+
}),
|
|
54
|
+
uiContextPreview ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_default(), {
|
|
55
|
+
uiContext: uiContextPreview,
|
|
56
|
+
hideController: true
|
|
57
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
58
|
+
children: [
|
|
59
|
+
(0, external_misc_index_js_namespaceObject.iconForStatus)('failed'),
|
|
60
|
+
" No UI context",
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
62
|
+
type: "link",
|
|
63
|
+
onClick: (e)=>{
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
setUiContextPreview(playground_demo_ui_context_json_default());
|
|
66
|
+
},
|
|
67
|
+
children: "Load Demo"
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
70
|
+
children: "To load the UI context, you can either use the demo data above, or click the 'Send to Playground' in the report page."
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
exports.ContextPreview = __webpack_exports__.ContextPreview;
|
|
78
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
79
|
+
"ContextPreview"
|
|
80
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
81
|
+
Object.defineProperty(exports, '__esModule', {
|
|
82
|
+
value: true
|
|
83
|
+
});
|