@midscene/visualizer 0.27.5-beta-20250828012323.0 → 0.27.5-beta-20250828025824.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/dist/es/component/playground/FormField.mjs +12 -10
- package/dist/es/component/playground/PromptInput.mjs +169 -32
- package/dist/es/component/playground/index.css +7 -0
- package/dist/es/component/playground/playground-execution.mjs +114 -0
- package/dist/es/component/playground/playground-utils.mjs +46 -8
- package/dist/es/component/playground/types.mjs +22 -3
- package/dist/es/index.mjs +3 -3
- package/dist/lib/component/playground/FormField.js +12 -10
- package/dist/lib/component/playground/PromptInput.js +169 -32
- package/dist/lib/component/playground/index.css +7 -0
- package/dist/lib/component/playground/playground-execution.js +154 -0
- package/dist/lib/component/playground/playground-utils.js +47 -6
- package/dist/lib/component/playground/types.js +22 -3
- package/dist/lib/index.js +11 -5
- package/dist/types/component/playground/FormField.d.ts +1 -0
- package/dist/types/component/playground/PromptInput.d.ts +1 -1
- package/dist/types/component/playground/playground-execution.d.ts +7 -0
- package/dist/types/component/playground/playground-utils.d.ts +3 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +4 -4
- package/dist/es/component/playground/useStaticPageAgent.mjs +0 -12
- package/dist/lib/component/playground/useStaticPageAgent.js +0 -49
- package/dist/types/component/playground/useStaticPageAgent.d.ts +0 -5
|
@@ -34,6 +34,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
requestPlaygroundServer: ()=>requestPlaygroundServer,
|
|
35
35
|
staticAgentFromContext: ()=>staticAgentFromContext,
|
|
36
36
|
checkServerStatus: ()=>checkServerStatus,
|
|
37
|
+
getActionSpace: ()=>getActionSpace,
|
|
37
38
|
overrideServerConfig: ()=>overrideServerConfig,
|
|
38
39
|
getTaskProgress: ()=>getTaskProgress
|
|
39
40
|
});
|
|
@@ -50,7 +51,7 @@ const checkServerStatus = async ()=>{
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
const requestPlaygroundServer = async function(context, type, prompt) {
|
|
53
|
-
let { requestId, deepThink, screenshotIncluded, domIncluded } = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
|
|
54
|
+
let { requestId, deepThink, params, screenshotIncluded, domIncluded } = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
|
|
54
55
|
const payload = {
|
|
55
56
|
context,
|
|
56
57
|
type,
|
|
@@ -60,6 +61,7 @@ const requestPlaygroundServer = async function(context, type, prompt) {
|
|
|
60
61
|
if (deepThink) payload.deepThink = deepThink;
|
|
61
62
|
if (void 0 !== screenshotIncluded) payload.screenshotIncluded = screenshotIncluded;
|
|
62
63
|
if (void 0 !== domIncluded) payload.domIncluded = domIncluded;
|
|
64
|
+
if (params) payload.params = params;
|
|
63
65
|
const res = await fetch(`${serverBase}/execute`, {
|
|
64
66
|
method: 'POST',
|
|
65
67
|
headers: {
|
|
@@ -100,9 +102,31 @@ const getTaskProgress = async (requestId)=>{
|
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
};
|
|
105
|
+
const getActionSpace = async (context)=>{
|
|
106
|
+
try {
|
|
107
|
+
if (!context) return [];
|
|
108
|
+
const response = await fetch(`${serverBase}/action-space`, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'application/json'
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify({
|
|
114
|
+
context
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
if (response.ok) return await response.json();
|
|
118
|
+
return [];
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error('Failed to get action space:', error);
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
};
|
|
103
124
|
const actionNameForType = (type)=>{
|
|
104
125
|
const typeWithoutAi = type.startsWith('ai') ? type.slice(2) : type;
|
|
105
|
-
|
|
126
|
+
const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
|
|
127
|
+
const words = fullName.split(' ');
|
|
128
|
+
if (words.length > 3) return words.slice(-3).join(' ');
|
|
129
|
+
return fullName;
|
|
106
130
|
};
|
|
107
131
|
const staticAgentFromContext = (context)=>{
|
|
108
132
|
const page = new playground_namespaceObject.StaticPage(context);
|
|
@@ -111,8 +135,7 @@ const staticAgentFromContext = (context)=>{
|
|
|
111
135
|
const formatErrorMessage = (e)=>{
|
|
112
136
|
const errorMessage = (null == e ? void 0 : e.message) || '';
|
|
113
137
|
if (errorMessage.includes('of different extension')) return 'Conflicting extension detected. Please disable the suspicious plugins and refresh the page. Guide: https://midscenejs.com/quick-experience.html#faq';
|
|
114
|
-
|
|
115
|
-
return 'Unknown error';
|
|
138
|
+
return errorMessage || 'Unknown error';
|
|
116
139
|
};
|
|
117
140
|
const getPlaceholderForType = (type)=>{
|
|
118
141
|
if ('aiQuery' === type) return 'What do you want to query?';
|
|
@@ -139,13 +162,29 @@ const blankResult = {
|
|
|
139
162
|
};
|
|
140
163
|
const isRunButtonEnabled = (runButtonEnabled, needsStructuredParams, params, actionSpace, selectedType, promptValue)=>{
|
|
141
164
|
if (!runButtonEnabled) return false;
|
|
165
|
+
const needsAnyInput = (()=>{
|
|
166
|
+
if (actionSpace) {
|
|
167
|
+
const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
168
|
+
if (action) {
|
|
169
|
+
if (!action.paramSchema) return false;
|
|
170
|
+
if ('object' == typeof action.paramSchema && 'shape' in action.paramSchema) {
|
|
171
|
+
const shape = action.paramSchema.shape || {};
|
|
172
|
+
const shapeKeys = Object.keys(shape);
|
|
173
|
+
return shapeKeys.length > 0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
})();
|
|
179
|
+
if (!needsAnyInput) return true;
|
|
142
180
|
if (needsStructuredParams) {
|
|
143
181
|
const currentParams = params || {};
|
|
144
182
|
const action = null == actionSpace ? void 0 : actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
|
|
145
183
|
if ((null == action ? void 0 : action.paramSchema) && (0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) {
|
|
146
184
|
const schema = action.paramSchema;
|
|
147
|
-
|
|
148
|
-
|
|
185
|
+
const shape = schema.shape || {};
|
|
186
|
+
return Object.keys(shape).every((key)=>{
|
|
187
|
+
const field = shape[key];
|
|
149
188
|
const { isOptional } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
|
|
150
189
|
const value = currentParams[key];
|
|
151
190
|
return isOptional || void 0 !== value && '' !== value && null !== value;
|
|
@@ -160,6 +199,7 @@ exports.blankResult = __webpack_exports__.blankResult;
|
|
|
160
199
|
exports.cancelTask = __webpack_exports__.cancelTask;
|
|
161
200
|
exports.checkServerStatus = __webpack_exports__.checkServerStatus;
|
|
162
201
|
exports.formatErrorMessage = __webpack_exports__.formatErrorMessage;
|
|
202
|
+
exports.getActionSpace = __webpack_exports__.getActionSpace;
|
|
163
203
|
exports.getPlaceholderForType = __webpack_exports__.getPlaceholderForType;
|
|
164
204
|
exports.getTaskProgress = __webpack_exports__.getTaskProgress;
|
|
165
205
|
exports.isRunButtonEnabled = __webpack_exports__.isRunButtonEnabled;
|
|
@@ -173,6 +213,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
173
213
|
"cancelTask",
|
|
174
214
|
"checkServerStatus",
|
|
175
215
|
"formatErrorMessage",
|
|
216
|
+
"getActionSpace",
|
|
176
217
|
"getPlaceholderForType",
|
|
177
218
|
"getTaskProgress",
|
|
178
219
|
"isRunButtonEnabled",
|
|
@@ -49,10 +49,29 @@ const VALIDATION_CONSTANTS = {
|
|
|
49
49
|
CHECK_INTERVAL_MS: 3000
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
const isZodObjectSchema = (schema)=>'object' == typeof schema && null !== schema && 'shape' in schema
|
|
52
|
+
const isZodObjectSchema = (schema)=>'object' == typeof schema && null !== schema && ('shape' in schema || 'ZodObject' === schema.type);
|
|
53
53
|
const isLocateField = (field)=>{
|
|
54
|
-
var _field__def
|
|
55
|
-
|
|
54
|
+
var _field__def;
|
|
55
|
+
const fieldAsAny = field;
|
|
56
|
+
if ((null == (_field__def = field._def) ? void 0 : _field__def.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OBJECT) {
|
|
57
|
+
var _field__def1;
|
|
58
|
+
let shape;
|
|
59
|
+
if (field._def.shape) shape = 'function' == typeof field._def.shape ? field._def.shape() : field._def.shape;
|
|
60
|
+
if (!shape && fieldAsAny.shape) shape = fieldAsAny.shape;
|
|
61
|
+
if (shape && VALIDATION_CONSTANTS.FIELD_FLAGS.LOCATION in shape) return true;
|
|
62
|
+
const description = (null == (_field__def1 = field._def) ? void 0 : _field__def1.description) || fieldAsAny.description || '';
|
|
63
|
+
if ('string' == typeof description && description.toLowerCase().includes('input field')) return true;
|
|
64
|
+
}
|
|
65
|
+
if ('object' == typeof field && null !== field) {
|
|
66
|
+
var _fieldAsAny__def;
|
|
67
|
+
const description = fieldAsAny.description || (null == (_fieldAsAny__def = fieldAsAny._def) ? void 0 : _fieldAsAny__def.description) || '';
|
|
68
|
+
if ('string' == typeof description) {
|
|
69
|
+
const desc = description.toLowerCase();
|
|
70
|
+
if (desc.includes('input field') || desc.includes('element') || desc.includes('locate')) return true;
|
|
71
|
+
}
|
|
72
|
+
if ('ZodObject' === fieldAsAny.typeName || 'ZodObject' === fieldAsAny.type) return 'string' == typeof description && description.toLowerCase().includes('input field');
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
56
75
|
};
|
|
57
76
|
const unwrapZodType = (field)=>{
|
|
58
77
|
var _actualField__def, _actualField__def1, _actualField__def2;
|
package/dist/lib/index.js
CHANGED
|
@@ -43,22 +43,24 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
43
43
|
generateAnimationScripts: ()=>replay_scripts_js_namespaceObject.generateAnimationScripts,
|
|
44
44
|
getPlaceholderForType: ()=>playground_utils_js_namespaceObject.getPlaceholderForType,
|
|
45
45
|
ShinyText: ()=>shiny_text_js_default(),
|
|
46
|
+
getActionSpace: ()=>playground_utils_js_namespaceObject.getActionSpace,
|
|
46
47
|
staticAgentFromContext: ()=>playground_utils_js_namespaceObject.staticAgentFromContext,
|
|
47
|
-
useStaticPageAgent: ()=>useStaticPageAgent_js_namespaceObject.useStaticPageAgent,
|
|
48
48
|
useServerValid: ()=>useServerValid_js_namespaceObject.useServerValid,
|
|
49
49
|
ServiceModeControl: ()=>ServiceModeControl_js_namespaceObject.ServiceModeControl,
|
|
50
50
|
colorForName: ()=>color_js_namespaceObject.colorForName,
|
|
51
|
+
validateStructuredParams: ()=>playground_execution_js_namespaceObject.validateStructuredParams,
|
|
51
52
|
GithubStar: ()=>github_star_js_namespaceObject.GithubStar,
|
|
52
53
|
Logo: ()=>logo_js_namespaceObject.Logo,
|
|
53
54
|
checkServerStatus: ()=>playground_utils_js_namespaceObject.checkServerStatus,
|
|
54
55
|
blankResult: ()=>playground_utils_js_namespaceObject.blankResult,
|
|
55
56
|
useEnvConfig: ()=>store_js_namespaceObject.useEnvConfig,
|
|
57
|
+
executeAction: ()=>playground_execution_js_namespaceObject.executeAction,
|
|
56
58
|
PromptInput: ()=>PromptInput_js_namespaceObject.PromptInput,
|
|
57
59
|
ContextPreview: ()=>ContextPreview_js_namespaceObject.ContextPreview,
|
|
58
60
|
requestPlaygroundServer: ()=>playground_utils_js_namespaceObject.requestPlaygroundServer,
|
|
59
61
|
Blackboard: ()=>blackboard_js_namespaceObject.Blackboard,
|
|
60
62
|
overrideServerConfig: ()=>playground_utils_js_namespaceObject.overrideServerConfig,
|
|
61
|
-
formatErrorMessage: ()=>
|
|
63
|
+
formatErrorMessage: ()=>playground_execution_js_namespaceObject.formatErrorMessage,
|
|
62
64
|
Player: ()=>player_js_namespaceObject.Player,
|
|
63
65
|
filterBase64Value: ()=>external_utils_js_namespaceObject.filterBase64Value,
|
|
64
66
|
highlightColorForType: ()=>color_js_namespaceObject.highlightColorForType,
|
|
@@ -66,7 +68,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
66
68
|
globalThemeConfig: ()=>color_js_namespaceObject.globalThemeConfig,
|
|
67
69
|
getTaskProgress: ()=>playground_utils_js_namespaceObject.getTaskProgress
|
|
68
70
|
});
|
|
69
|
-
const useStaticPageAgent_js_namespaceObject = require("./component/playground/useStaticPageAgent.js");
|
|
70
71
|
require("./component/playground/index.css");
|
|
71
72
|
const replay_scripts_js_namespaceObject = require("./component/replay-scripts.js");
|
|
72
73
|
const store_js_namespaceObject = require("./component/store/store.js");
|
|
@@ -83,6 +84,7 @@ const player_js_namespaceObject = require("./component/player.js");
|
|
|
83
84
|
const blackboard_js_namespaceObject = require("./component/blackboard.js");
|
|
84
85
|
const github_star_js_namespaceObject = require("./component/github-star.js");
|
|
85
86
|
const playground_utils_js_namespaceObject = require("./component/playground/playground-utils.js");
|
|
87
|
+
const playground_execution_js_namespaceObject = require("./component/playground/playground-execution.js");
|
|
86
88
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
87
89
|
const shiny_text_js_namespaceObject = require("./component/shiny-text.js");
|
|
88
90
|
var shiny_text_js_default = /*#__PURE__*/ __webpack_require__.n(shiny_text_js_namespaceObject);
|
|
@@ -102,9 +104,11 @@ exports.blankResult = __webpack_exports__.blankResult;
|
|
|
102
104
|
exports.cancelTask = __webpack_exports__.cancelTask;
|
|
103
105
|
exports.checkServerStatus = __webpack_exports__.checkServerStatus;
|
|
104
106
|
exports.colorForName = __webpack_exports__.colorForName;
|
|
107
|
+
exports.executeAction = __webpack_exports__.executeAction;
|
|
105
108
|
exports.filterBase64Value = __webpack_exports__.filterBase64Value;
|
|
106
109
|
exports.formatErrorMessage = __webpack_exports__.formatErrorMessage;
|
|
107
110
|
exports.generateAnimationScripts = __webpack_exports__.generateAnimationScripts;
|
|
111
|
+
exports.getActionSpace = __webpack_exports__.getActionSpace;
|
|
108
112
|
exports.getPlaceholderForType = __webpack_exports__.getPlaceholderForType;
|
|
109
113
|
exports.getTaskProgress = __webpack_exports__.getTaskProgress;
|
|
110
114
|
exports.globalThemeConfig = __webpack_exports__.globalThemeConfig;
|
|
@@ -117,7 +121,7 @@ exports.timeCostStrElement = __webpack_exports__.timeCostStrElement;
|
|
|
117
121
|
exports.timeStr = __webpack_exports__.timeStr;
|
|
118
122
|
exports.useEnvConfig = __webpack_exports__.useEnvConfig;
|
|
119
123
|
exports.useServerValid = __webpack_exports__.useServerValid;
|
|
120
|
-
exports.
|
|
124
|
+
exports.validateStructuredParams = __webpack_exports__.validateStructuredParams;
|
|
121
125
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
122
126
|
"Blackboard",
|
|
123
127
|
"ContextPreview",
|
|
@@ -135,9 +139,11 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
135
139
|
"cancelTask",
|
|
136
140
|
"checkServerStatus",
|
|
137
141
|
"colorForName",
|
|
142
|
+
"executeAction",
|
|
138
143
|
"filterBase64Value",
|
|
139
144
|
"formatErrorMessage",
|
|
140
145
|
"generateAnimationScripts",
|
|
146
|
+
"getActionSpace",
|
|
141
147
|
"getPlaceholderForType",
|
|
142
148
|
"getTaskProgress",
|
|
143
149
|
"globalThemeConfig",
|
|
@@ -150,7 +156,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
150
156
|
"timeStr",
|
|
151
157
|
"useEnvConfig",
|
|
152
158
|
"useServerValid",
|
|
153
|
-
"
|
|
159
|
+
"validateStructuredParams"
|
|
154
160
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
155
161
|
Object.defineProperty(exports, '__esModule', {
|
|
156
162
|
value: true
|
|
@@ -7,6 +7,7 @@ interface FormFieldProps {
|
|
|
7
7
|
isRequired: boolean;
|
|
8
8
|
isLocateField: boolean;
|
|
9
9
|
marginBottom: number;
|
|
10
|
+
placeholder?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const TextField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
12
13
|
export declare const LocateField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
@@ -14,8 +14,8 @@ interface PromptInputProps {
|
|
|
14
14
|
onRun: () => void;
|
|
15
15
|
onStop: () => void;
|
|
16
16
|
clearPromptAfterRun?: boolean;
|
|
17
|
-
actionSpace?: DeviceAction<any>[];
|
|
18
17
|
hideDomAndScreenshotOptions?: boolean;
|
|
18
|
+
actionSpace: DeviceAction<any>[];
|
|
19
19
|
}
|
|
20
20
|
export declare const PromptInput: React.FC<PromptInputProps>;
|
|
21
21
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DeviceAction } from '@midscene/core';
|
|
2
|
+
export declare const formatErrorMessage: (e: any) => string;
|
|
3
|
+
export declare function validateStructuredParams(value: any, action: DeviceAction<any> | undefined): {
|
|
4
|
+
valid: boolean;
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function executeAction(activeAgent: any, actionType: string, actionSpace: DeviceAction<any>[], value: any, deepThink: boolean): Promise<any>;
|
|
@@ -3,15 +3,17 @@ import type { WebUIContext } from '@midscene/web';
|
|
|
3
3
|
import { StaticPageAgent } from '@midscene/web/playground';
|
|
4
4
|
export declare const serverBase = "http://localhost:5800";
|
|
5
5
|
export declare const checkServerStatus: () => Promise<boolean>;
|
|
6
|
-
export declare const requestPlaygroundServer: (context: UIContext | string, type: string, prompt: string, { requestId, deepThink, screenshotIncluded, domIncluded, }?: {
|
|
6
|
+
export declare const requestPlaygroundServer: (context: UIContext | string, type: string, prompt: string, { requestId, deepThink, params, screenshotIncluded, domIncluded, }?: {
|
|
7
7
|
requestId?: string;
|
|
8
8
|
deepThink?: boolean;
|
|
9
|
+
params?: any;
|
|
9
10
|
screenshotIncluded?: boolean;
|
|
10
11
|
domIncluded?: boolean | "visible-only";
|
|
11
12
|
}) => Promise<any>;
|
|
12
13
|
export declare const overrideServerConfig: (aiConfig: any) => Promise<Response>;
|
|
13
14
|
export declare const cancelTask: (requestId: string) => Promise<any>;
|
|
14
15
|
export declare const getTaskProgress: (requestId: string) => Promise<any>;
|
|
16
|
+
export declare const getActionSpace: (context?: string) => Promise<any>;
|
|
15
17
|
export declare const actionNameForType: (type: string) => string;
|
|
16
18
|
export declare const staticAgentFromContext: (context: WebUIContext) => StaticPageAgent;
|
|
17
19
|
export declare const formatErrorMessage: (e: any) => string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { useStaticPageAgent } from './component/playground/useStaticPageAgent';
|
|
2
1
|
import './component/playground/index.less';
|
|
3
2
|
export { type AnimationScript, type ReplayScriptsInfo, allScriptsFromDump, generateAnimationScripts, } from './component/replay-scripts';
|
|
4
3
|
export { useEnvConfig } from './component/store/store';
|
|
@@ -15,6 +14,7 @@ export { PromptInput } from './component/playground/PromptInput';
|
|
|
15
14
|
export { Player } from './component/player';
|
|
16
15
|
export { Blackboard } from './component/blackboard';
|
|
17
16
|
export { GithubStar } from './component/github-star';
|
|
18
|
-
export { requestPlaygroundServer, cancelTask, overrideServerConfig, getTaskProgress, checkServerStatus, actionNameForType, staticAgentFromContext,
|
|
17
|
+
export { requestPlaygroundServer, cancelTask, overrideServerConfig, getTaskProgress, getActionSpace, checkServerStatus, actionNameForType, staticAgentFromContext, getPlaceholderForType, blankResult, } from './component/playground/playground-utils';
|
|
18
|
+
export { executeAction, validateStructuredParams, formatErrorMessage, } from './component/playground/playground-execution';
|
|
19
19
|
export { timeStr, filterBase64Value } from './utils';
|
|
20
20
|
export { default as ShinyText } from './component/shiny-text';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/visualizer",
|
|
3
|
-
"version": "0.27.5-beta-
|
|
3
|
+
"version": "0.27.5-beta-20250828025824.0",
|
|
4
4
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
5
5
|
"homepage": "https://midscenejs.com/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"antd": "^5.21.6",
|
|
71
71
|
"buffer": "6.0.3",
|
|
72
72
|
"dayjs": "^1.11.11",
|
|
73
|
-
"@midscene/
|
|
74
|
-
"@midscene/
|
|
75
|
-
"@midscene/
|
|
73
|
+
"@midscene/shared": "0.27.5-beta-20250828025824.0",
|
|
74
|
+
"@midscene/web": "0.27.5-beta-20250828025824.0",
|
|
75
|
+
"@midscene/core": "0.27.5-beta-20250828025824.0"
|
|
76
76
|
},
|
|
77
77
|
"license": "MIT",
|
|
78
78
|
"scripts": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { staticAgentFromContext } from "./playground-utils.mjs";
|
|
3
|
-
const useStaticPageAgent = (context)=>{
|
|
4
|
-
const agent = useMemo(()=>{
|
|
5
|
-
if (!context) return null;
|
|
6
|
-
return staticAgentFromContext(context);
|
|
7
|
-
}, [
|
|
8
|
-
context
|
|
9
|
-
]);
|
|
10
|
-
return agent;
|
|
11
|
-
};
|
|
12
|
-
export { staticAgentFromContext, useStaticPageAgent };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
useStaticPageAgent: ()=>useStaticPageAgent,
|
|
28
|
-
staticAgentFromContext: ()=>external_playground_utils_js_namespaceObject.staticAgentFromContext
|
|
29
|
-
});
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
|
-
const external_playground_utils_js_namespaceObject = require("./playground-utils.js");
|
|
32
|
-
const useStaticPageAgent = (context)=>{
|
|
33
|
-
const agent = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
34
|
-
if (!context) return null;
|
|
35
|
-
return (0, external_playground_utils_js_namespaceObject.staticAgentFromContext)(context);
|
|
36
|
-
}, [
|
|
37
|
-
context
|
|
38
|
-
]);
|
|
39
|
-
return agent;
|
|
40
|
-
};
|
|
41
|
-
exports.staticAgentFromContext = __webpack_exports__.staticAgentFromContext;
|
|
42
|
-
exports.useStaticPageAgent = __webpack_exports__.useStaticPageAgent;
|
|
43
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
44
|
-
"staticAgentFromContext",
|
|
45
|
-
"useStaticPageAgent"
|
|
46
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
47
|
-
Object.defineProperty(exports, '__esModule', {
|
|
48
|
-
value: true
|
|
49
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { WebUIContext } from '@midscene/web';
|
|
2
|
-
import type { StaticPageAgent } from '@midscene/web/playground';
|
|
3
|
-
import { staticAgentFromContext } from './playground-utils';
|
|
4
|
-
export { staticAgentFromContext };
|
|
5
|
-
export declare const useStaticPageAgent: (context: WebUIContext | undefined | null) => StaticPageAgent | null;
|