@godscene/visualizer 1.7.11

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 (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/es/component/blackboard/highlights.mjs +47 -0
  4. package/dist/es/component/blackboard/index.css +118 -0
  5. package/dist/es/component/blackboard/index.mjs +122 -0
  6. package/dist/es/component/config-selector/index.mjs +251 -0
  7. package/dist/es/component/context-preview/index.mjs +37 -0
  8. package/dist/es/component/env-config/index.mjs +237 -0
  9. package/dist/es/component/env-config-reminder/index.css +30 -0
  10. package/dist/es/component/env-config-reminder/index.mjs +27 -0
  11. package/dist/es/component/form-field/index.mjs +158 -0
  12. package/dist/es/component/history-selector/index.css +237 -0
  13. package/dist/es/component/history-selector/index.mjs +197 -0
  14. package/dist/es/component/index.mjs +1 -0
  15. package/dist/es/component/logo/index.css +19 -0
  16. package/dist/es/component/logo/index.mjs +20 -0
  17. package/dist/es/component/logo/logo.mjs +2 -0
  18. package/dist/es/component/misc/index.mjs +96 -0
  19. package/dist/es/component/nav-actions/index.mjs +14 -0
  20. package/dist/es/component/nav-actions/style.css +35 -0
  21. package/dist/es/component/player/index.css +296 -0
  22. package/dist/es/component/player/index.mjs +702 -0
  23. package/dist/es/component/player/playback-controls.mjs +4 -0
  24. package/dist/es/component/player/report-download.mjs +61 -0
  25. package/dist/es/component/player/scenes/StepScene.mjs +194 -0
  26. package/dist/es/component/player/scenes/derive-frame-state.mjs +229 -0
  27. package/dist/es/component/player/scenes/export-branded-video.mjs +360 -0
  28. package/dist/es/component/player/scenes/frame-calculator.mjs +149 -0
  29. package/dist/es/component/player/scenes/playback-frame.mjs +6 -0
  30. package/dist/es/component/player/scenes/playback-layout.mjs +12 -0
  31. package/dist/es/component/player/scenes/pointer-layout.mjs +36 -0
  32. package/dist/es/component/player/use-frame-player.mjs +87 -0
  33. package/dist/es/component/playground/index.css +930 -0
  34. package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
  35. package/dist/es/component/playground-result/index.css +92 -0
  36. package/dist/es/component/playground-result/index.mjs +232 -0
  37. package/dist/es/component/prompt-input/index.css +832 -0
  38. package/dist/es/component/prompt-input/index.mjs +959 -0
  39. package/dist/es/component/screenshot-viewer/index.css +237 -0
  40. package/dist/es/component/screenshot-viewer/index.mjs +319 -0
  41. package/dist/es/component/service-mode-control/index.mjs +107 -0
  42. package/dist/es/component/shiny-text/index.css +107 -0
  43. package/dist/es/component/shiny-text/index.mjs +15 -0
  44. package/dist/es/component/universal-playground/empty-state.mjs +5 -0
  45. package/dist/es/component/universal-playground/index.css +619 -0
  46. package/dist/es/component/universal-playground/index.mjs +558 -0
  47. package/dist/es/component/universal-playground/providers/context-provider.mjs +90 -0
  48. package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +280 -0
  49. package/dist/es/component/universal-playground/providers/storage-provider.mjs +279 -0
  50. package/dist/es/component/universal-playground/universal-playground-electron.mjs +668 -0
  51. package/dist/es/hooks/useMinimalTypeGate.mjs +47 -0
  52. package/dist/es/hooks/usePlaygroundExecution.mjs +435 -0
  53. package/dist/es/hooks/usePlaygroundState.mjs +278 -0
  54. package/dist/es/hooks/useSafeOverrideAIConfig.mjs +20 -0
  55. package/dist/es/hooks/useServerValid.mjs +55 -0
  56. package/dist/es/hooks/useTheme.mjs +25 -0
  57. package/dist/es/icons/action-chevron.mjs +61 -0
  58. package/dist/es/icons/avatar.mjs +70 -0
  59. package/dist/es/icons/close.mjs +61 -0
  60. package/dist/es/icons/global-perspective.mjs +58 -0
  61. package/dist/es/icons/history.mjs +72 -0
  62. package/dist/es/icons/magnifying-glass.mjs +81 -0
  63. package/dist/es/icons/player-setting.mjs +68 -0
  64. package/dist/es/icons/prompt-history.mjs +70 -0
  65. package/dist/es/icons/setting.mjs +62 -0
  66. package/dist/es/icons/show-marker.mjs +58 -0
  67. package/dist/es/index.mjs +26 -0
  68. package/dist/es/static/image/logo.png +0 -0
  69. package/dist/es/store/history.mjs +128 -0
  70. package/dist/es/store/store.mjs +277 -0
  71. package/dist/es/types.mjs +73 -0
  72. package/dist/es/utils/action-label.mjs +15 -0
  73. package/dist/es/utils/color.mjs +35 -0
  74. package/dist/es/utils/constants.mjs +99 -0
  75. package/dist/es/utils/device-capabilities.mjs +13 -0
  76. package/dist/es/utils/empty-state-scroll.mjs +8 -0
  77. package/dist/es/utils/highlight-element.mjs +62 -0
  78. package/dist/es/utils/index.mjs +13 -0
  79. package/dist/es/utils/playground-utils.mjs +43 -0
  80. package/dist/es/utils/progress-action-icon.mjs +30 -0
  81. package/dist/es/utils/prompt-input-utils.mjs +49 -0
  82. package/dist/es/utils/prompt-placeholder.mjs +19 -0
  83. package/dist/es/utils/replay-scripts.mjs +428 -0
  84. package/dist/lib/component/blackboard/highlights.js +84 -0
  85. package/dist/lib/component/blackboard/index.css +118 -0
  86. package/dist/lib/component/blackboard/index.js +169 -0
  87. package/dist/lib/component/config-selector/index.js +295 -0
  88. package/dist/lib/component/context-preview/index.js +82 -0
  89. package/dist/lib/component/env-config/index.js +271 -0
  90. package/dist/lib/component/env-config-reminder/index.css +30 -0
  91. package/dist/lib/component/env-config-reminder/index.js +61 -0
  92. package/dist/lib/component/form-field/index.js +204 -0
  93. package/dist/lib/component/history-selector/index.css +237 -0
  94. package/dist/lib/component/history-selector/index.js +243 -0
  95. package/dist/lib/component/index.js +58 -0
  96. package/dist/lib/component/logo/index.css +19 -0
  97. package/dist/lib/component/logo/index.js +67 -0
  98. package/dist/lib/component/logo/logo.js +24 -0
  99. package/dist/lib/component/misc/index.js +152 -0
  100. package/dist/lib/component/nav-actions/index.js +48 -0
  101. package/dist/lib/component/nav-actions/style.css +35 -0
  102. package/dist/lib/component/player/index.css +296 -0
  103. package/dist/lib/component/player/index.js +747 -0
  104. package/dist/lib/component/player/playback-controls.js +38 -0
  105. package/dist/lib/component/player/report-download.js +98 -0
  106. package/dist/lib/component/player/scenes/StepScene.js +228 -0
  107. package/dist/lib/component/player/scenes/derive-frame-state.js +266 -0
  108. package/dist/lib/component/player/scenes/export-branded-video.js +403 -0
  109. package/dist/lib/component/player/scenes/frame-calculator.js +186 -0
  110. package/dist/lib/component/player/scenes/playback-frame.js +40 -0
  111. package/dist/lib/component/player/scenes/playback-layout.js +46 -0
  112. package/dist/lib/component/player/scenes/pointer-layout.js +88 -0
  113. package/dist/lib/component/player/use-frame-player.js +121 -0
  114. package/dist/lib/component/playground/index.css +930 -0
  115. package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
  116. package/dist/lib/component/playground-result/index.css +92 -0
  117. package/dist/lib/component/playground-result/index.js +276 -0
  118. package/dist/lib/component/prompt-input/index.css +832 -0
  119. package/dist/lib/component/prompt-input/index.js +1005 -0
  120. package/dist/lib/component/screenshot-viewer/index.css +237 -0
  121. package/dist/lib/component/screenshot-viewer/index.js +353 -0
  122. package/dist/lib/component/service-mode-control/index.js +141 -0
  123. package/dist/lib/component/shiny-text/index.css +107 -0
  124. package/dist/lib/component/shiny-text/index.js +49 -0
  125. package/dist/lib/component/universal-playground/empty-state.js +39 -0
  126. package/dist/lib/component/universal-playground/index.css +619 -0
  127. package/dist/lib/component/universal-playground/index.js +607 -0
  128. package/dist/lib/component/universal-playground/providers/context-provider.js +133 -0
  129. package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +320 -0
  130. package/dist/lib/component/universal-playground/providers/storage-provider.js +337 -0
  131. package/dist/lib/component/universal-playground/universal-playground-electron.js +717 -0
  132. package/dist/lib/hooks/useMinimalTypeGate.js +81 -0
  133. package/dist/lib/hooks/usePlaygroundExecution.js +478 -0
  134. package/dist/lib/hooks/usePlaygroundState.js +312 -0
  135. package/dist/lib/hooks/useSafeOverrideAIConfig.js +57 -0
  136. package/dist/lib/hooks/useServerValid.js +89 -0
  137. package/dist/lib/hooks/useTheme.js +59 -0
  138. package/dist/lib/icons/action-chevron.js +95 -0
  139. package/dist/lib/icons/avatar.js +104 -0
  140. package/dist/lib/icons/close.js +95 -0
  141. package/dist/lib/icons/global-perspective.js +92 -0
  142. package/dist/lib/icons/history.js +106 -0
  143. package/dist/lib/icons/magnifying-glass.js +115 -0
  144. package/dist/lib/icons/player-setting.js +102 -0
  145. package/dist/lib/icons/prompt-history.js +104 -0
  146. package/dist/lib/icons/setting.js +96 -0
  147. package/dist/lib/icons/show-marker.js +92 -0
  148. package/dist/lib/index.js +204 -0
  149. package/dist/lib/static/image/logo.png +0 -0
  150. package/dist/lib/store/history.js +135 -0
  151. package/dist/lib/store/store.js +287 -0
  152. package/dist/lib/types.js +119 -0
  153. package/dist/lib/utils/action-label.js +52 -0
  154. package/dist/lib/utils/color.js +75 -0
  155. package/dist/lib/utils/constants.js +172 -0
  156. package/dist/lib/utils/device-capabilities.js +50 -0
  157. package/dist/lib/utils/empty-state-scroll.js +42 -0
  158. package/dist/lib/utils/highlight-element.js +99 -0
  159. package/dist/lib/utils/index.js +69 -0
  160. package/dist/lib/utils/playground-utils.js +86 -0
  161. package/dist/lib/utils/progress-action-icon.js +67 -0
  162. package/dist/lib/utils/prompt-input-utils.js +89 -0
  163. package/dist/lib/utils/prompt-placeholder.js +53 -0
  164. package/dist/lib/utils/replay-scripts.js +474 -0
  165. package/dist/types/component/blackboard/highlights.d.ts +11 -0
  166. package/dist/types/component/blackboard/index.d.ts +10 -0
  167. package/dist/types/component/config-selector/index.d.ts +15 -0
  168. package/dist/types/component/context-preview/index.d.ts +9 -0
  169. package/dist/types/component/env-config/index.d.ts +8 -0
  170. package/dist/types/component/env-config-reminder/index.d.ts +6 -0
  171. package/dist/types/component/form-field/index.d.ts +17 -0
  172. package/dist/types/component/history-selector/index.d.ts +13 -0
  173. package/dist/types/component/index.d.ts +1 -0
  174. package/dist/types/component/logo/index.d.ts +5 -0
  175. package/dist/types/component/misc/index.d.ts +6 -0
  176. package/dist/types/component/nav-actions/index.d.ts +12 -0
  177. package/dist/types/component/player/index.d.ts +15 -0
  178. package/dist/types/component/player/playback-controls.d.ts +1 -0
  179. package/dist/types/component/player/report-download.d.ts +32 -0
  180. package/dist/types/component/player/scenes/StepScene.d.ts +9 -0
  181. package/dist/types/component/player/scenes/derive-frame-state.d.ts +40 -0
  182. package/dist/types/component/player/scenes/export-branded-video.d.ts +33 -0
  183. package/dist/types/component/player/scenes/frame-calculator.d.ts +40 -0
  184. package/dist/types/component/player/scenes/playback-frame.d.ts +3 -0
  185. package/dist/types/component/player/scenes/playback-layout.d.ts +7 -0
  186. package/dist/types/component/player/scenes/pointer-layout.d.ts +20 -0
  187. package/dist/types/component/player/use-frame-player.d.ts +17 -0
  188. package/dist/types/component/playground-result/index.d.ts +22 -0
  189. package/dist/types/component/prompt-input/index.d.ts +23 -0
  190. package/dist/types/component/screenshot-viewer/index.d.ts +23 -0
  191. package/dist/types/component/service-mode-control/index.d.ts +6 -0
  192. package/dist/types/component/shiny-text/index.d.ts +12 -0
  193. package/dist/types/component/universal-playground/empty-state.d.ts +3 -0
  194. package/dist/types/component/universal-playground/index.d.ts +4 -0
  195. package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
  196. package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
  197. package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
  198. package/dist/types/component/universal-playground/universal-playground-electron.d.ts +4 -0
  199. package/dist/types/hooks/useMinimalTypeGate.d.ts +72 -0
  200. package/dist/types/hooks/usePlaygroundExecution.d.ts +40 -0
  201. package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
  202. package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
  203. package/dist/types/hooks/useServerValid.d.ts +1 -0
  204. package/dist/types/hooks/useTheme.d.ts +7 -0
  205. package/dist/types/index.d.ts +29 -0
  206. package/dist/types/store/history.d.ts +16 -0
  207. package/dist/types/store/store.d.ts +57 -0
  208. package/dist/types/types.d.ts +278 -0
  209. package/dist/types/utils/action-label.d.ts +11 -0
  210. package/dist/types/utils/color.d.ts +4 -0
  211. package/dist/types/utils/constants.d.ts +80 -0
  212. package/dist/types/utils/device-capabilities.d.ts +9 -0
  213. package/dist/types/utils/empty-state-scroll.d.ts +11 -0
  214. package/dist/types/utils/highlight-element.d.ts +3 -0
  215. package/dist/types/utils/index.d.ts +5 -0
  216. package/dist/types/utils/playground-utils.d.ts +11 -0
  217. package/dist/types/utils/progress-action-icon.d.ts +12 -0
  218. package/dist/types/utils/prompt-input-utils.d.ts +24 -0
  219. package/dist/types/utils/prompt-placeholder.d.ts +1 -0
  220. package/dist/types/utils/replay-scripts.d.ts +50 -0
  221. package/package.json +82 -0
@@ -0,0 +1,197 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Input, Typography } from "antd";
3
+ import { useEffect, useMemo, useRef, useState } from "react";
4
+ import { createPortal } from "react-dom";
5
+ import icons_close from "../../icons/close.mjs";
6
+ import icons_history from "../../icons/history.mjs";
7
+ import magnifying_glass from "../../icons/magnifying-glass.mjs";
8
+ import { useHistoryStore } from "../../store/history.mjs";
9
+ import "./index.css";
10
+ const { Text } = Typography;
11
+ const HISTORY_MODAL_WIDTH = 320;
12
+ const HISTORY_MODAL_HEIGHT = 400;
13
+ const HISTORY_MODAL_GUTTER = 16;
14
+ const HISTORY_MODAL_OFFSET = 8;
15
+ const HistorySelector = ({ onSelect, history, currentType, trigger, popupPlacement = 'bottom' })=>{
16
+ const [isModalOpen, setIsModalOpen] = useState(false);
17
+ const [searchText, setSearchText] = useState('');
18
+ const clearHistory = useHistoryStore((state)=>state.clearHistory);
19
+ const modalRef = useRef(null);
20
+ const triggerRef = useRef(null);
21
+ const [overlayPosition, setOverlayPosition] = useState(null);
22
+ const groupedHistory = useMemo(()=>{
23
+ const now = Date.now();
24
+ const sevenDaysAgo = now - 604800000;
25
+ const oneYearAgo = now - 31536000000;
26
+ const filteredHistory = history.filter((item)=>item.prompt.toLowerCase().includes(searchText.toLowerCase()));
27
+ const groups = {
28
+ recent7Days: filteredHistory.filter((item)=>item.timestamp >= sevenDaysAgo),
29
+ recent1Year: filteredHistory.filter((item)=>item.timestamp < sevenDaysAgo && item.timestamp >= oneYearAgo),
30
+ older: filteredHistory.filter((item)=>item.timestamp < oneYearAgo)
31
+ };
32
+ return groups;
33
+ }, [
34
+ history,
35
+ searchText
36
+ ]);
37
+ const handleHistoryClick = (item)=>{
38
+ onSelect(item);
39
+ setIsModalOpen(false);
40
+ };
41
+ const handleClearHistory = ()=>{
42
+ clearHistory(currentType);
43
+ setSearchText('');
44
+ setIsModalOpen(false);
45
+ };
46
+ useEffect(()=>{
47
+ if (!isModalOpen) return;
48
+ const updateOverlayPosition = ()=>{
49
+ if (!triggerRef.current) return;
50
+ const triggerRect = triggerRef.current.getBoundingClientRect();
51
+ const maxLeft = Math.max(HISTORY_MODAL_GUTTER, window.innerWidth - HISTORY_MODAL_WIDTH - HISTORY_MODAL_GUTTER);
52
+ const maxTop = Math.max(HISTORY_MODAL_GUTTER, window.innerHeight - HISTORY_MODAL_HEIGHT - HISTORY_MODAL_GUTTER);
53
+ const left = Math.min(Math.max(HISTORY_MODAL_GUTTER, triggerRect.right - HISTORY_MODAL_WIDTH), maxLeft);
54
+ const preferredTop = 'top' === popupPlacement ? triggerRect.top - HISTORY_MODAL_HEIGHT - HISTORY_MODAL_OFFSET : triggerRect.bottom + HISTORY_MODAL_OFFSET;
55
+ const top = Math.min(Math.max(HISTORY_MODAL_GUTTER, preferredTop), maxTop);
56
+ setOverlayPosition({
57
+ left,
58
+ top
59
+ });
60
+ };
61
+ const handleClickOutside = (event)=>{
62
+ if (modalRef.current && !modalRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) setIsModalOpen(false);
63
+ };
64
+ updateOverlayPosition();
65
+ const timer = setTimeout(()=>{
66
+ document.addEventListener('click', handleClickOutside);
67
+ }, 100);
68
+ window.addEventListener('resize', updateOverlayPosition);
69
+ window.addEventListener('scroll', updateOverlayPosition, true);
70
+ return ()=>{
71
+ clearTimeout(timer);
72
+ document.removeEventListener('click', handleClickOutside);
73
+ window.removeEventListener('resize', updateOverlayPosition);
74
+ window.removeEventListener('scroll', updateOverlayPosition, true);
75
+ };
76
+ }, [
77
+ isModalOpen,
78
+ popupPlacement
79
+ ]);
80
+ const renderHistoryGroup = (title, items)=>{
81
+ if (0 === items.length) return null;
82
+ return /*#__PURE__*/ jsxs("div", {
83
+ className: "history-group",
84
+ children: [
85
+ /*#__PURE__*/ jsx("div", {
86
+ className: "history-group-title",
87
+ children: title
88
+ }),
89
+ items.map((item, index)=>/*#__PURE__*/ jsx("div", {
90
+ className: "history-item",
91
+ onClick: ()=>handleHistoryClick(item),
92
+ children: item.prompt
93
+ }, `${item.timestamp}-${index}`))
94
+ ]
95
+ }, title);
96
+ };
97
+ return /*#__PURE__*/ jsxs("div", {
98
+ className: "history-selector-wrapper",
99
+ children: [
100
+ /*#__PURE__*/ jsx("div", {
101
+ className: "selector-trigger",
102
+ onClick: ()=>setIsModalOpen(true),
103
+ ref: triggerRef,
104
+ children: null != trigger ? trigger : /*#__PURE__*/ jsx(icons_history, {
105
+ width: 24,
106
+ height: 24
107
+ })
108
+ }),
109
+ isModalOpen && overlayPosition && /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
110
+ className: "history-modal-overlay",
111
+ ref: modalRef,
112
+ style: overlayPosition,
113
+ children: /*#__PURE__*/ jsxs("div", {
114
+ className: "history-modal-container",
115
+ children: [
116
+ /*#__PURE__*/ jsxs("div", {
117
+ className: "history-modal-header",
118
+ children: [
119
+ /*#__PURE__*/ jsxs(Text, {
120
+ strong: true,
121
+ style: {
122
+ fontSize: '16px'
123
+ },
124
+ children: [
125
+ "History (",
126
+ history.length,
127
+ ")"
128
+ ]
129
+ }),
130
+ /*#__PURE__*/ jsx(Button, {
131
+ size: "small",
132
+ type: "text",
133
+ icon: /*#__PURE__*/ jsx(icons_close, {
134
+ width: 16,
135
+ height: 16
136
+ }),
137
+ onClick: ()=>setIsModalOpen(false),
138
+ className: "close-button"
139
+ })
140
+ ]
141
+ }),
142
+ /*#__PURE__*/ jsx("div", {
143
+ className: "history-search-section",
144
+ children: /*#__PURE__*/ jsxs("div", {
145
+ className: "search-input-wrapper",
146
+ children: [
147
+ /*#__PURE__*/ jsx(Input, {
148
+ placeholder: "Search",
149
+ value: searchText,
150
+ onChange: (e)=>setSearchText(e.target.value),
151
+ prefix: /*#__PURE__*/ jsx(magnifying_glass, {
152
+ width: 18,
153
+ height: 18
154
+ }),
155
+ className: "search-input",
156
+ allowClear: true
157
+ }),
158
+ /*#__PURE__*/ jsx(Button, {
159
+ type: "link",
160
+ onClick: handleClearHistory,
161
+ className: "clear-button",
162
+ disabled: 0 === history.length,
163
+ children: "Clear"
164
+ })
165
+ ]
166
+ })
167
+ }),
168
+ /*#__PURE__*/ jsx("div", {
169
+ className: "history-content",
170
+ children: 0 === history.length ? /*#__PURE__*/ jsx("div", {
171
+ className: "no-results",
172
+ children: /*#__PURE__*/ jsx(Text, {
173
+ type: "secondary",
174
+ children: "No history record"
175
+ })
176
+ }) : /*#__PURE__*/ jsxs(Fragment, {
177
+ children: [
178
+ renderHistoryGroup('Last 7 days', groupedHistory.recent7Days),
179
+ renderHistoryGroup('Last 1 year', groupedHistory.recent1Year),
180
+ renderHistoryGroup('Earlier', groupedHistory.older),
181
+ searchText && 0 === groupedHistory.recent7Days.length && 0 === groupedHistory.recent1Year.length && 0 === groupedHistory.older.length && /*#__PURE__*/ jsx("div", {
182
+ className: "no-results",
183
+ children: /*#__PURE__*/ jsx(Text, {
184
+ type: "secondary",
185
+ children: "No matching history record"
186
+ })
187
+ })
188
+ ]
189
+ })
190
+ })
191
+ ]
192
+ })
193
+ }), document.body)
194
+ ]
195
+ });
196
+ };
197
+ export { HistorySelector };
@@ -0,0 +1 @@
1
+ export * from "../types.mjs";
@@ -0,0 +1,19 @@
1
+ .logo img {
2
+ vertical-align: baseline;
3
+ height: 30px;
4
+ vertical-align: -webkit-baseline-middle;
5
+ line-height: 30px;
6
+ }
7
+
8
+ .logo {
9
+ align-items: center;
10
+ gap: 8px;
11
+ display: flex;
12
+ }
13
+
14
+ .logo-with-star-wrapper {
15
+ flex-direction: row;
16
+ justify-content: space-between;
17
+ display: flex;
18
+ }
19
+
@@ -0,0 +1,20 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "./index.css";
3
+ import logo from "./logo.mjs";
4
+ const LogoUrl = logo;
5
+ const Logo = ({ hideLogo = false })=>{
6
+ if (hideLogo) return null;
7
+ return /*#__PURE__*/ jsxs("div", {
8
+ className: "logo",
9
+ children: [
10
+ /*#__PURE__*/ jsx("img", {
11
+ alt: "Midscene_logo",
12
+ src: LogoUrl
13
+ }),
14
+ /*#__PURE__*/ jsx("span", {
15
+ children: "RPA智能助手"
16
+ })
17
+ ]
18
+ });
19
+ };
20
+ export { Logo, LogoUrl };
@@ -0,0 +1,2 @@
1
+ import logo_namespaceObject from "../../static/image/logo.png";
2
+ export { logo_namespaceObject as default };
@@ -0,0 +1,96 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ArrowRightOutlined, CheckOutlined, ClockCircleOutlined, CloseOutlined, LogoutOutlined, MinusOutlined, WarningOutlined } from "@ant-design/icons";
3
+ import { Alert } from "antd";
4
+ import shiny_text from "../shiny-text/index.mjs";
5
+ function timeCostStrElement(timeCost) {
6
+ let str;
7
+ str = 'number' != typeof timeCost ? '-' : `${(timeCost / 1000).toFixed(2)}s`;
8
+ return /*#__PURE__*/ jsx("span", {
9
+ style: {
10
+ fontVariantNumeric: 'tabular-nums',
11
+ fontFeatureSettings: 'tnum'
12
+ },
13
+ children: str
14
+ });
15
+ }
16
+ const iconForStatus = (status)=>{
17
+ switch(status){
18
+ case 'finished':
19
+ case 'passed':
20
+ case 'success':
21
+ case 'connected':
22
+ return /*#__PURE__*/ jsx("span", {
23
+ style: {
24
+ color: '#00AD4B'
25
+ },
26
+ children: /*#__PURE__*/ jsx(CheckOutlined, {})
27
+ });
28
+ case 'finishedWithWarning':
29
+ return /*#__PURE__*/ jsx("span", {
30
+ style: {
31
+ color: '#f7bb05'
32
+ },
33
+ children: /*#__PURE__*/ jsx(WarningOutlined, {})
34
+ });
35
+ case 'failed':
36
+ case 'closed':
37
+ case 'timedOut':
38
+ case 'interrupted':
39
+ return /*#__PURE__*/ jsx("span", {
40
+ style: {
41
+ color: '#FF0A0A'
42
+ },
43
+ children: /*#__PURE__*/ jsx(CloseOutlined, {})
44
+ });
45
+ case 'pending':
46
+ return /*#__PURE__*/ jsx(ClockCircleOutlined, {});
47
+ case 'cancelled':
48
+ case 'skipped':
49
+ return /*#__PURE__*/ jsx("span", {
50
+ style: {
51
+ color: '#8c8c8c'
52
+ },
53
+ children: /*#__PURE__*/ jsx(LogoutOutlined, {})
54
+ });
55
+ case 'running':
56
+ return /*#__PURE__*/ jsx(ArrowRightOutlined, {});
57
+ default:
58
+ return /*#__PURE__*/ jsx(MinusOutlined, {});
59
+ }
60
+ };
61
+ const errorMessageServerNotReady = /*#__PURE__*/ jsxs("span", {
62
+ children: [
63
+ "Don't worry, just one more step to launch the playground server.",
64
+ /*#__PURE__*/ jsx("br", {}),
65
+ "Please run one of the commands under the midscene project directory:",
66
+ /*#__PURE__*/ jsx("br", {}),
67
+ "a. ",
68
+ /*#__PURE__*/ jsx("strong", {
69
+ children: "npx midscene-playground"
70
+ }),
71
+ /*#__PURE__*/ jsx("br", {}),
72
+ "b. ",
73
+ /*#__PURE__*/ jsx("strong", {
74
+ children: "npx --yes @godscene/web"
75
+ })
76
+ ]
77
+ });
78
+ const serverLaunchTip = (notReadyMessage = errorMessageServerNotReady)=>/*#__PURE__*/ jsx("div", {
79
+ className: "server-tip",
80
+ children: /*#__PURE__*/ jsx(Alert, {
81
+ message: "Playground Server Not Ready",
82
+ description: notReadyMessage,
83
+ type: "warning"
84
+ })
85
+ });
86
+ const emptyResultTip = /*#__PURE__*/ jsx("div", {
87
+ className: "result-empty-tip",
88
+ style: {
89
+ textAlign: 'center'
90
+ },
91
+ children: /*#__PURE__*/ jsx(shiny_text, {
92
+ disabled: true,
93
+ text: "The result will be shown here"
94
+ })
95
+ });
96
+ export { emptyResultTip, errorMessageServerNotReady, iconForStatus, serverLaunchTip, timeCostStrElement };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { EnvConfig } from "../env-config/index.mjs";
3
+ import "./style.css";
4
+ function NavActions({ showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '', playgroundSDK }) {
5
+ return /*#__PURE__*/ jsx("div", {
6
+ className: `nav-actions ${className}`,
7
+ children: showEnvConfig && /*#__PURE__*/ jsx(EnvConfig, {
8
+ showTooltipWhenEmpty: showTooltipWhenEmpty,
9
+ showModelName: showModelName,
10
+ playgroundSDK: playgroundSDK
11
+ })
12
+ });
13
+ }
14
+ export { NavActions };
@@ -0,0 +1,35 @@
1
+ .nav-actions {
2
+ align-items: center;
3
+ gap: 8px;
4
+ display: flex;
5
+ }
6
+
7
+ .nav-actions .nav-icon {
8
+ color: rgba(0, 0, 0, .65);
9
+ cursor: pointer;
10
+ font-size: 16px;
11
+ transition: color .3s;
12
+ }
13
+
14
+ .nav-actions .nav-icon:hover {
15
+ color: #2b83ff;
16
+ }
17
+
18
+ .nav-actions a {
19
+ align-items: center;
20
+ text-decoration: none;
21
+ display: flex;
22
+ }
23
+
24
+ .nav-actions a:hover .nav-icon {
25
+ color: #2b83ff;
26
+ }
27
+
28
+ [data-theme="dark"] .nav-actions .nav-icon {
29
+ color: #f8fafd;
30
+ }
31
+
32
+ [data-theme="dark"] .nav-actions .nav-icon:hover {
33
+ color: #2b83ff;
34
+ }
35
+
@@ -0,0 +1,296 @@
1
+ .player-container {
2
+ box-sizing: border-box;
3
+ border: 1px solid #f2f4f7;
4
+ border-radius: 8px;
5
+ flex-direction: column;
6
+ width: 100%;
7
+ max-width: 100%;
8
+ height: 100%;
9
+ min-height: 300px;
10
+ max-height: 100%;
11
+ margin: 0 auto;
12
+ padding: 12px;
13
+ line-height: normal;
14
+ display: flex;
15
+ position: relative;
16
+ overflow: visible;
17
+ }
18
+
19
+ .player-container[data-fit-mode="height"] {
20
+ background: #fff;
21
+ }
22
+
23
+ .player-container[data-fit-mode="height"] .canvas-container {
24
+ background-color: #000;
25
+ }
26
+
27
+ .player-container .canvas-container {
28
+ background-color: #000;
29
+ border-radius: 4px;
30
+ outline: none;
31
+ flex: auto;
32
+ justify-content: center;
33
+ align-items: center;
34
+ width: 100%;
35
+ min-height: 200px;
36
+ display: flex;
37
+ position: relative;
38
+ overflow: hidden;
39
+ }
40
+
41
+ .player-container .canvas-container .player-wrapper {
42
+ width: 100%;
43
+ max-width: 100%;
44
+ max-height: 100%;
45
+ position: relative;
46
+ }
47
+
48
+ .player-container .canvas-container .player-wrapper[data-portrait] {
49
+ width: auto;
50
+ height: 100%;
51
+ }
52
+
53
+ .player-container .player-subtitle {
54
+ -webkit-backdrop-filter: blur(8px);
55
+ backdrop-filter: blur(8px);
56
+ z-index: 3;
57
+ pointer-events: none;
58
+ background: rgba(80, 80, 80, .75);
59
+ border-radius: 8px;
60
+ align-items: center;
61
+ gap: 8px;
62
+ max-width: calc(100% - 24px);
63
+ height: 32px;
64
+ padding: 0 14px;
65
+ display: inline-flex;
66
+ position: absolute;
67
+ bottom: 52px;
68
+ left: 50%;
69
+ transform: translateX(-50%);
70
+ }
71
+
72
+ .player-container .player-subtitle .player-subtitle-badge {
73
+ color: #fff;
74
+ background: #a34dff;
75
+ border-radius: 4px;
76
+ flex-shrink: 0;
77
+ justify-content: center;
78
+ align-items: center;
79
+ height: 22px;
80
+ padding: 0 6px;
81
+ font-size: 13px;
82
+ font-weight: 700;
83
+ display: inline-flex;
84
+ }
85
+
86
+ .player-container .player-subtitle .player-subtitle-text {
87
+ color: #fff;
88
+ white-space: nowrap;
89
+ text-overflow: ellipsis;
90
+ min-width: 0;
91
+ font-size: 14px;
92
+ font-weight: 500;
93
+ overflow: hidden;
94
+ }
95
+
96
+ .player-container .control-bar {
97
+ z-index: 2;
98
+ background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .6));
99
+ align-items: center;
100
+ gap: 8px;
101
+ padding: 8px 12px;
102
+ transition: opacity .3s;
103
+ display: flex;
104
+ position: absolute;
105
+ bottom: 0;
106
+ left: 0;
107
+ right: 0;
108
+ }
109
+
110
+ .player-container .control-bar.hidden {
111
+ opacity: 0;
112
+ pointer-events: none;
113
+ }
114
+
115
+ .player-container .time-display {
116
+ color: rgba(255, 255, 255, .8);
117
+ font-variant-numeric: tabular-nums;
118
+ white-space: nowrap;
119
+ flex-shrink: 0;
120
+ font-size: 14px;
121
+ }
122
+
123
+ .player-container .seek-bar-track {
124
+ cursor: pointer;
125
+ touch-action: none;
126
+ background: rgba(255, 255, 255, .3);
127
+ border-radius: 2.5px;
128
+ flex: 1;
129
+ height: 5px;
130
+ position: relative;
131
+ }
132
+
133
+ .player-container .seek-bar-track .seek-bar-fill {
134
+ pointer-events: none;
135
+ background: #2b83ff;
136
+ border-radius: 2.5px;
137
+ height: 100%;
138
+ position: absolute;
139
+ top: 0;
140
+ left: 0;
141
+ }
142
+
143
+ .player-container .seek-bar-track .seek-bar-knob {
144
+ pointer-events: none;
145
+ background: #fff;
146
+ border-radius: 10px;
147
+ width: 8px;
148
+ height: 16px;
149
+ position: absolute;
150
+ top: 50%;
151
+ transform: translate(-50%, -50%);
152
+ }
153
+
154
+ .player-container .seek-bar-track .chapter-marker {
155
+ pointer-events: auto;
156
+ cursor: pointer;
157
+ z-index: 1;
158
+ background: #fff;
159
+ width: 2px;
160
+ height: 100%;
161
+ position: absolute;
162
+ top: 0;
163
+ transform: translateX(-50%);
164
+ }
165
+
166
+ .player-container .seek-bar-track .chapter-marker:before {
167
+ content: "";
168
+ position: absolute;
169
+ top: -8px;
170
+ bottom: -8px;
171
+ left: -8px;
172
+ right: -8px;
173
+ }
174
+
175
+ .player-container .status-icon {
176
+ color: #fff;
177
+ cursor: pointer;
178
+ opacity: .7;
179
+ border-radius: 4px;
180
+ flex-shrink: 0;
181
+ justify-content: center;
182
+ align-items: center;
183
+ width: 28px;
184
+ height: 28px;
185
+ transition: all .2s;
186
+ display: flex;
187
+ }
188
+
189
+ .player-container .status-icon svg {
190
+ color: #fff;
191
+ font-size: 16px;
192
+ }
193
+
194
+ .player-container .status-icon:hover {
195
+ opacity: 1;
196
+ background: rgba(255, 255, 255, .15);
197
+ }
198
+
199
+ .player-container .player-custom-controls {
200
+ flex-direction: row;
201
+ justify-content: center;
202
+ align-items: center;
203
+ gap: 2px;
204
+ min-width: 58px;
205
+ margin-left: 4px;
206
+ display: flex;
207
+ }
208
+
209
+ .player-container .player-custom-controls .ant-spin {
210
+ color: #fff;
211
+ }
212
+
213
+ .player-container.player-container-empty {
214
+ justify-content: center;
215
+ align-items: center;
216
+ }
217
+
218
+ .player-container.player-container-empty .player-empty-state {
219
+ color: #6b7280;
220
+ flex-direction: column;
221
+ align-items: center;
222
+ gap: 12px;
223
+ display: flex;
224
+ }
225
+
226
+ .player-container.player-container-empty .player-empty-state .player-empty-text {
227
+ font-size: 14px;
228
+ }
229
+
230
+ .chapter-tooltip .ant-tooltip-inner {
231
+ -webkit-backdrop-filter: blur(8px);
232
+ backdrop-filter: blur(8px);
233
+ background: rgba(80, 80, 80, .85);
234
+ border-radius: 16px;
235
+ max-width: 360px;
236
+ padding: 6px 12px;
237
+ font-size: 12px;
238
+ }
239
+
240
+ .chapter-tooltip .ant-tooltip-arrow:before {
241
+ background: rgba(80, 80, 80, .85);
242
+ }
243
+
244
+ [data-theme="dark"] .player-container {
245
+ border-color: #292929;
246
+ }
247
+
248
+ [data-theme="dark"] .player-container[data-fit-mode="height"] {
249
+ background: #292929;
250
+ border-color: #292929;
251
+ }
252
+
253
+ [data-theme="dark"] .player-container[data-fit-mode="height"] .canvas-container, [data-theme="dark"] .player-container .canvas-container {
254
+ background-color: #000;
255
+ }
256
+
257
+ .player-settings-dropdown {
258
+ background-color: #fff;
259
+ border: 1px solid rgba(0, 0, 0, .08);
260
+ border-radius: 8px;
261
+ padding: 4px;
262
+ overflow: hidden;
263
+ box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
264
+ }
265
+
266
+ .player-settings-divider {
267
+ background: rgba(0, 0, 0, .06);
268
+ height: 1px;
269
+ margin: 4px 0;
270
+ }
271
+
272
+ .player-export-label {
273
+ font-variant-numeric: tabular-nums;
274
+ font-feature-settings: "tnum";
275
+ font-size: 14px;
276
+ }
277
+
278
+ .player-speed-option:hover, .player-settings-item:hover {
279
+ background: rgba(0, 0, 0, .04);
280
+ }
281
+
282
+ .player-speed-option.active {
283
+ color: #1677ff;
284
+ }
285
+
286
+ [data-theme="dark"] .player-settings-dropdown {
287
+ color: #f8fafd;
288
+ background-color: #1f1f1f;
289
+ border-color: rgba(255, 255, 255, .08);
290
+ box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
291
+ }
292
+
293
+ [data-theme="dark"] .player-settings-divider, [data-theme="dark"] .player-speed-option:hover, [data-theme="dark"] .player-settings-item:hover {
294
+ background: rgba(255, 255, 255, .08);
295
+ }
296
+