@seastudio/sdk 3.0.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.
Files changed (77) hide show
  1. package/README.md +108 -0
  2. package/bin/seastudio.js +3 -0
  3. package/dist/chunk-4ITOR5QE.js +901 -0
  4. package/dist/chunk-5QAINQWV.js +94 -0
  5. package/dist/chunk-6USQFZRH.js +291 -0
  6. package/dist/chunk-AGBZJGTY.cjs +1311 -0
  7. package/dist/chunk-ANWOL7SM.js +566 -0
  8. package/dist/chunk-BWG45ZWF.cjs +305 -0
  9. package/dist/chunk-CVF4QHS6.cjs +436 -0
  10. package/dist/chunk-DDVRUPMZ.js +1293 -0
  11. package/dist/chunk-DSOSHJH2.js +643 -0
  12. package/dist/chunk-FLATZQA2.js +174 -0
  13. package/dist/chunk-HJJTBVKQ.cjs +909 -0
  14. package/dist/chunk-ISI2OLPI.cjs +179 -0
  15. package/dist/chunk-MYURVLGP.cjs +165 -0
  16. package/dist/chunk-N33Y5NY7.cjs +105 -0
  17. package/dist/chunk-QD4KISXM.js +160 -0
  18. package/dist/chunk-SNGU4SHO.cjs +654 -0
  19. package/dist/chunk-TFOJLA2F.cjs +588 -0
  20. package/dist/chunk-Z7LV7DCO.js +429 -0
  21. package/dist/develop-tool/cli/index.cjs +1138 -0
  22. package/dist/develop-tool/cli/index.d.cts +1 -0
  23. package/dist/develop-tool/cli/index.d.ts +1 -0
  24. package/dist/develop-tool/cli/index.js +1127 -0
  25. package/dist/index.cjs +370 -0
  26. package/dist/index.d.cts +11 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.js +9 -0
  29. package/dist/mcp/core/index.cjs +90 -0
  30. package/dist/mcp/core/index.d.cts +124 -0
  31. package/dist/mcp/core/index.d.ts +124 -0
  32. package/dist/mcp/core/index.js +1 -0
  33. package/dist/mcp/index.cjs +317 -0
  34. package/dist/mcp/index.d.cts +123 -0
  35. package/dist/mcp/index.d.ts +123 -0
  36. package/dist/mcp/index.js +8 -0
  37. package/dist/mcp/plugin-editor/index.cjs +47 -0
  38. package/dist/mcp/plugin-editor/index.d.cts +98 -0
  39. package/dist/mcp/plugin-editor/index.d.ts +98 -0
  40. package/dist/mcp/plugin-editor/index.js +2 -0
  41. package/dist/mcp/plugin-excel/index.cjs +31 -0
  42. package/dist/mcp/plugin-excel/index.d.cts +86 -0
  43. package/dist/mcp/plugin-excel/index.d.ts +86 -0
  44. package/dist/mcp/plugin-excel/index.js +2 -0
  45. package/dist/mcp/plugin-preview/index.cjs +23 -0
  46. package/dist/mcp/plugin-preview/index.d.cts +109 -0
  47. package/dist/mcp/plugin-preview/index.d.ts +109 -0
  48. package/dist/mcp/plugin-preview/index.js +2 -0
  49. package/dist/mcp/plugin-seaflow/index.cjs +35 -0
  50. package/dist/mcp/plugin-seaflow/index.d.cts +318 -0
  51. package/dist/mcp/plugin-seaflow/index.d.ts +318 -0
  52. package/dist/mcp/plugin-seaflow/index.js +2 -0
  53. package/dist/mcp/seastudio/index.cjs +75 -0
  54. package/dist/mcp/seastudio/index.d.cts +341 -0
  55. package/dist/mcp/seastudio/index.d.ts +341 -0
  56. package/dist/mcp/seastudio/index.js +2 -0
  57. package/dist/tools-LMW67LIY.js +2 -0
  58. package/dist/tools-TU7PBMDO.cjs +23 -0
  59. package/dist/types-Clgf5gBf.d.cts +107 -0
  60. package/dist/types-Clgf5gBf.d.ts +107 -0
  61. package/dist/ui/index.cjs +58 -0
  62. package/dist/ui/index.d.cts +142 -0
  63. package/dist/ui/index.d.ts +142 -0
  64. package/dist/ui/index.js +1 -0
  65. package/package.json +115 -0
  66. package/src/develop-tool/templates/plugin/README.md.tmpl +36 -0
  67. package/src/develop-tool/templates/plugin/frontend/index.html.tmpl +12 -0
  68. package/src/develop-tool/templates/plugin/frontend/package.json.tmpl +30 -0
  69. package/src/develop-tool/templates/plugin/frontend/postcss.config.js +6 -0
  70. package/src/develop-tool/templates/plugin/frontend/src/App.css +43 -0
  71. package/src/develop-tool/templates/plugin/frontend/src/App.tsx.tmpl +43 -0
  72. package/src/develop-tool/templates/plugin/frontend/src/main.tsx +10 -0
  73. package/src/develop-tool/templates/plugin/frontend/src/vite-env.d.ts +1 -0
  74. package/src/develop-tool/templates/plugin/frontend/tsconfig.json +20 -0
  75. package/src/develop-tool/templates/plugin/frontend/vite.config.ts +12 -0
  76. package/src/develop-tool/templates/plugin/seastudio.config.json.tmpl +14 -0
  77. package/src/ui/cosmos.css +407 -0
@@ -0,0 +1,305 @@
1
+ 'use strict';
2
+
3
+ var lucideReact = require('lucide-react');
4
+ var clsx = require('clsx');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ // src/ui/Tab.tsx
9
+ function cn(...inputs) {
10
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
11
+ }
12
+ function Tab({
13
+ isActive,
14
+ onClick,
15
+ onClose,
16
+ icon,
17
+ title,
18
+ className,
19
+ disabled = false
20
+ }) {
21
+ return /* @__PURE__ */ jsxRuntime.jsxs(
22
+ "div",
23
+ {
24
+ onClick: () => {
25
+ if (!disabled) {
26
+ onClick();
27
+ }
28
+ },
29
+ className: cn(
30
+ "group flex items-center gap-2 px-3 h-7",
31
+ "transition-colors duration-150",
32
+ disabled ? isActive ? "text-muted-foreground bg-transparent border-b-2 border-muted-foreground/50 cursor-not-allowed" : "text-muted-foreground/50 bg-transparent border-b-2 border-transparent cursor-not-allowed" : isActive ? "text-foreground bg-muted border-b-2 border-primary cursor-pointer" : "text-muted-foreground hover:text-foreground hover:bg-muted/50 border-b-2 border-transparent cursor-pointer",
33
+ className
34
+ ),
35
+ children: [
36
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: icon }),
37
+ title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm truncate max-w-[120px]", children: title }),
38
+ onClose && /* @__PURE__ */ jsxRuntime.jsx(
39
+ "button",
40
+ {
41
+ onClick: (e) => {
42
+ e.stopPropagation();
43
+ if (!disabled) {
44
+ onClose();
45
+ }
46
+ },
47
+ disabled,
48
+ className: cn(
49
+ "p-0.5 transition-all flex-shrink-0",
50
+ "opacity-0 group-hover:opacity-100",
51
+ isActive && "opacity-60",
52
+ !disabled && "hover:bg-foreground/10",
53
+ disabled && "cursor-not-allowed opacity-0"
54
+ ),
55
+ title: "\u5173\u95ED",
56
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3 h-3 text-muted-foreground/70" })
57
+ }
58
+ )
59
+ ]
60
+ }
61
+ );
62
+ }
63
+ function MenuContainer({
64
+ children,
65
+ className
66
+ }) {
67
+ return /* @__PURE__ */ jsxRuntime.jsx(
68
+ "div",
69
+ {
70
+ className: cn(
71
+ "bg-popover border border-border rounded-md shadow-lg py-1 min-w-[140px]",
72
+ className
73
+ ),
74
+ children
75
+ }
76
+ );
77
+ }
78
+ function MenuItem({
79
+ label,
80
+ icon,
81
+ shortcut,
82
+ disabled,
83
+ danger,
84
+ onClick,
85
+ className
86
+ }) {
87
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-1", children: /* @__PURE__ */ jsxRuntime.jsxs(
88
+ "button",
89
+ {
90
+ onClick: () => {
91
+ if (!disabled) {
92
+ onClick();
93
+ }
94
+ },
95
+ disabled,
96
+ className: cn(
97
+ "w-full flex items-center gap-2 px-2 py-1.5 text-xs text-left transition-colors rounded-md",
98
+ disabled ? "text-muted-foreground/50 cursor-not-allowed" : "hover:bg-muted",
99
+ danger && !disabled && "text-red-500",
100
+ className
101
+ ),
102
+ children: [
103
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 w-3.5 h-3.5", children: icon }),
104
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 whitespace-nowrap", children: label }),
105
+ shortcut && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto text-muted-foreground text-[10px] whitespace-nowrap", children: shortcut })
106
+ ]
107
+ }
108
+ ) });
109
+ }
110
+ function MenuSeparator({
111
+ className
112
+ }) {
113
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("border-t border-border my-1", className) });
114
+ }
115
+ function MenuEmpty({
116
+ children,
117
+ className
118
+ }) {
119
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-xs text-muted-foreground", className), children });
120
+ }
121
+
122
+ // src/ui/context-menu.ts
123
+ var CONTEXT_MENU_TIMEOUT_MS = 3e4;
124
+ function canUseHostBridge() {
125
+ if (typeof window === "undefined") return false;
126
+ return !!window.parent && window.parent !== window;
127
+ }
128
+ function createRequestId() {
129
+ return `sdk-cm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
130
+ }
131
+ function isContextMenuResultMessage(data) {
132
+ return typeof data === "object" && data !== null && data.type === "context_menu_result" && typeof data.id === "string";
133
+ }
134
+ async function showHostContextMenu(x, y, items) {
135
+ if (!canUseHostBridge()) {
136
+ return { supported: false, selectedId: null };
137
+ }
138
+ const requestId = createRequestId();
139
+ return new Promise((resolve) => {
140
+ let settled = false;
141
+ const timeoutId = setTimeout(() => {
142
+ if (settled) return;
143
+ settled = true;
144
+ window.removeEventListener("message", onMessage);
145
+ resolve({ supported: true, selectedId: null });
146
+ }, CONTEXT_MENU_TIMEOUT_MS);
147
+ const onMessage = (event) => {
148
+ if (event.source !== window.parent) return;
149
+ if (!isContextMenuResultMessage(event.data)) return;
150
+ if (event.data.id !== requestId) return;
151
+ if (settled) return;
152
+ settled = true;
153
+ clearTimeout(timeoutId);
154
+ window.removeEventListener("message", onMessage);
155
+ resolve({ supported: true, selectedId: event.data.itemId ?? null });
156
+ };
157
+ window.addEventListener("message", onMessage);
158
+ const message = {
159
+ type: "context_menu_show",
160
+ id: requestId,
161
+ x,
162
+ y,
163
+ items
164
+ };
165
+ window.parent.postMessage(message, "*");
166
+ });
167
+ }
168
+ function DialogOverlay({
169
+ children,
170
+ onClose,
171
+ className
172
+ }) {
173
+ return /* @__PURE__ */ jsxRuntime.jsxs(
174
+ "div",
175
+ {
176
+ className: cn(
177
+ "fixed inset-0 z-[100] flex items-center justify-center",
178
+ className
179
+ ),
180
+ children: [
181
+ /* @__PURE__ */ jsxRuntime.jsx(
182
+ "div",
183
+ {
184
+ className: "absolute inset-0 bg-black/50",
185
+ onClick: onClose
186
+ }
187
+ ),
188
+ children
189
+ ]
190
+ }
191
+ );
192
+ }
193
+ function DialogContainer({
194
+ children,
195
+ width = "md",
196
+ className
197
+ }) {
198
+ const widthClass = typeof width === "number" ? void 0 : {
199
+ sm: "w-[320px]",
200
+ md: "w-[400px]",
201
+ lg: "w-[520px]"
202
+ }[width];
203
+ const widthStyle = typeof width === "number" ? { width } : void 0;
204
+ return /* @__PURE__ */ jsxRuntime.jsx(
205
+ "div",
206
+ {
207
+ className: cn(
208
+ "relative bg-popover border border-border rounded-lg shadow-xl max-w-[90vw]",
209
+ widthClass,
210
+ className
211
+ ),
212
+ style: widthStyle,
213
+ onClick: (e) => e.stopPropagation(),
214
+ children
215
+ }
216
+ );
217
+ }
218
+ function DialogHeader({
219
+ title,
220
+ onClose,
221
+ className
222
+ }) {
223
+ return /* @__PURE__ */ jsxRuntime.jsxs(
224
+ "div",
225
+ {
226
+ className: cn(
227
+ "flex items-center justify-between h-12 px-4 border-b border-border",
228
+ className
229
+ ),
230
+ children: [
231
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: title }),
232
+ onClose && /* @__PURE__ */ jsxRuntime.jsx(
233
+ "button",
234
+ {
235
+ onClick: onClose,
236
+ className: "p-1 hover:bg-muted rounded transition-colors",
237
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4 text-muted-foreground" })
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ );
243
+ }
244
+ function DialogBody({
245
+ children,
246
+ className
247
+ }) {
248
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-4", className), children });
249
+ }
250
+ function DialogFooter({
251
+ children,
252
+ className
253
+ }) {
254
+ return /* @__PURE__ */ jsxRuntime.jsx(
255
+ "div",
256
+ {
257
+ className: cn(
258
+ "flex items-center justify-end gap-2 h-14 px-4 border-t border-border",
259
+ className
260
+ ),
261
+ children
262
+ }
263
+ );
264
+ }
265
+ function DialogButton({
266
+ children,
267
+ variant = "secondary",
268
+ disabled,
269
+ onClick,
270
+ className
271
+ }) {
272
+ const variantClasses = {
273
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
274
+ secondary: "text-muted-foreground hover:text-foreground hover:bg-muted",
275
+ danger: "bg-red-500 text-white hover:bg-red-600"
276
+ };
277
+ return /* @__PURE__ */ jsxRuntime.jsx(
278
+ "button",
279
+ {
280
+ onClick,
281
+ disabled,
282
+ className: cn(
283
+ "h-8 px-4 text-sm rounded transition-colors",
284
+ variantClasses[variant],
285
+ disabled && "opacity-50 cursor-not-allowed",
286
+ className
287
+ ),
288
+ children
289
+ }
290
+ );
291
+ }
292
+
293
+ exports.DialogBody = DialogBody;
294
+ exports.DialogButton = DialogButton;
295
+ exports.DialogContainer = DialogContainer;
296
+ exports.DialogFooter = DialogFooter;
297
+ exports.DialogHeader = DialogHeader;
298
+ exports.DialogOverlay = DialogOverlay;
299
+ exports.MenuContainer = MenuContainer;
300
+ exports.MenuEmpty = MenuEmpty;
301
+ exports.MenuItem = MenuItem;
302
+ exports.MenuSeparator = MenuSeparator;
303
+ exports.Tab = Tab;
304
+ exports.cn = cn;
305
+ exports.showHostContextMenu = showHostContextMenu;