@eworkbase/sdk 0.3.5 → 0.4.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/ExecutionLog.dto-CI-HpxZa.d.ts +116 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +85 -1
- package/dist/markdown-link-C-qw7xuN.js +50 -0
- package/dist/markdown.d.ts +18 -0
- package/dist/markdown.js +112 -0
- package/dist/style.css +2376 -0
- package/dist/{types-Cl1kerLO.d.ts → types-Bv7aJizu.d.ts} +10 -0
- package/dist/types-C8byxPji.d.ts +154 -0
- package/dist/ui/error-panel.d.ts +15 -0
- package/dist/ui/error-panel.js +44 -0
- package/dist/ui/execution-log.d.ts +42 -0
- package/dist/ui/execution-log.js +446 -0
- package/dist/ui/index.css +16 -6
- package/dist/ui/index.d.ts +2 -151
- package/dist/ui/index.js +1 -0
- package/dist/ui/markdown-editor-assets/LICENSE +21 -0
- package/dist/ui/markdown-editor-assets/ant.js +174 -0
- package/dist/ui/markdown-editor-assets/dist/js/highlight.js/styles/github.min.css +10 -0
- package/dist/ui/markdown-editor-assets/lute.min.js +87 -0
- package/dist/ui/markdown-editor-assets/zh_CN.js +86 -0
- package/dist/ui/markdown-editor.d.ts +26 -0
- package/dist/ui/markdown-editor.js +361 -0
- package/dist/ui/markdown-links.d.ts +12 -0
- package/dist/ui/markdown-links.js +246 -0
- package/dist/ui/model.d.ts +2 -0
- package/dist/ui/model.js +5 -1
- package/dist/ui/theme.css +109 -0
- package/package.json +38 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { t as parseMarkdownLink } from "../markdown-link-C-qw7xuN.js";
|
|
2
|
+
import { renderMarkdownPreview } from "./markdown-editor.js";
|
|
3
|
+
import { memo, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/ui/MarkdownLinks.tsx
|
|
6
|
+
/** Keeps Markdown navigation inside its document context while preserving mounted editors. */
|
|
7
|
+
const MAXIMUM_CACHED_DOCUMENTS = 8;
|
|
8
|
+
const DOCUMENT_SOURCE_SELECTOR = "[data-markdown-source]";
|
|
9
|
+
const HEADING_SELECTOR = "h1,h2,h3,h4,h5,h6";
|
|
10
|
+
const INACTIVE_PREVIEW_ELEMENTS = "img,iframe,object,embed,audio,video,source,script,style,link,meta,base,form,button";
|
|
11
|
+
const MarkdownLinks = memo(function MarkdownLinks(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(MarkdownLinkBoundary, { ...props }, props.contextKey);
|
|
13
|
+
});
|
|
14
|
+
function MarkdownLinkBoundary({ host, children }) {
|
|
15
|
+
const container = useRef(null);
|
|
16
|
+
const previewPanel = useRef(null);
|
|
17
|
+
const returnFocus = useRef(null);
|
|
18
|
+
const cache = useRef(/* @__PURE__ */ new Map());
|
|
19
|
+
const pending = useRef(/* @__PURE__ */ new Map());
|
|
20
|
+
const version = useRef(0);
|
|
21
|
+
const [preview, setPreview] = useState(null);
|
|
22
|
+
const [request, setRequest] = useState(null);
|
|
23
|
+
const [error, setError] = useState("");
|
|
24
|
+
const [isLoading, setLoading] = useState(false);
|
|
25
|
+
const [isOpeningWebsite, setOpeningWebsite] = useState(false);
|
|
26
|
+
const labelId = useId();
|
|
27
|
+
const open = useCallback(async (options, origin) => {
|
|
28
|
+
const currentVersion = ++version.current;
|
|
29
|
+
setError("");
|
|
30
|
+
setRequest(options);
|
|
31
|
+
try {
|
|
32
|
+
const link = parseMarkdownLink(options.href);
|
|
33
|
+
if (link.kind === "anchor") {
|
|
34
|
+
scrollToAnchor(origin?.closest(DOCUMENT_SOURCE_SELECTOR) ?? container.current, link.fragment);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!host) throw new Error("当前工作区尚未就绪,请稍后重试。");
|
|
38
|
+
const key = JSON.stringify([options.sourcePath ?? "", options.href]);
|
|
39
|
+
const isDocument = link.kind === "document";
|
|
40
|
+
if (origin instanceof HTMLElement && !origin.closest(".markdown-document-preview")) returnFocus.current = origin.closest("a[href],[contenteditable=\"true\"],textarea,button,[tabindex]") ?? origin;
|
|
41
|
+
if (isDocument) {
|
|
42
|
+
previewPanel.current?.focus();
|
|
43
|
+
previewPanel.current?.scrollIntoView({ block: "nearest" });
|
|
44
|
+
}
|
|
45
|
+
setLoading(isDocument);
|
|
46
|
+
setOpeningWebsite(!isDocument);
|
|
47
|
+
const cached = cache.current.get(key);
|
|
48
|
+
if (cached) setPreview(cached);
|
|
49
|
+
let response = pending.current.get(key);
|
|
50
|
+
if (!response) {
|
|
51
|
+
response = host.view.call("openMarkdownLink", options);
|
|
52
|
+
pending.current.set(key, response);
|
|
53
|
+
}
|
|
54
|
+
let document;
|
|
55
|
+
try {
|
|
56
|
+
document = await response;
|
|
57
|
+
} finally {
|
|
58
|
+
if (pending.current.get(key) === response) pending.current.delete(key);
|
|
59
|
+
}
|
|
60
|
+
if (version.current !== currentVersion) return;
|
|
61
|
+
if (!document) return;
|
|
62
|
+
setError("");
|
|
63
|
+
cache.current.set(key, document);
|
|
64
|
+
if (cache.current.size > MAXIMUM_CACHED_DOCUMENTS) cache.current.delete(cache.current.keys().next().value);
|
|
65
|
+
setPreview(document);
|
|
66
|
+
} catch (failure) {
|
|
67
|
+
if (version.current === currentVersion) setError(readableError(failure));
|
|
68
|
+
} finally {
|
|
69
|
+
if (version.current === currentVersion) {
|
|
70
|
+
setLoading(false);
|
|
71
|
+
setOpeningWebsite(false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, [host]);
|
|
75
|
+
const handleClose = useCallback(() => {
|
|
76
|
+
version.current += 1;
|
|
77
|
+
setPreview(null);
|
|
78
|
+
setRequest(null);
|
|
79
|
+
setLoading(false);
|
|
80
|
+
setOpeningWebsite(false);
|
|
81
|
+
setError("");
|
|
82
|
+
if (returnFocus.current?.isConnected) returnFocus.current.focus();
|
|
83
|
+
}, []);
|
|
84
|
+
const handleRetry = useCallback(() => {
|
|
85
|
+
if (request) open(request);
|
|
86
|
+
}, [open, request]);
|
|
87
|
+
const handlePreviewError = useCallback((message) => setError(message), []);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const element = container.current;
|
|
90
|
+
if (!element) return;
|
|
91
|
+
const handleClick = (event) => {
|
|
92
|
+
if (event.button !== 0 && event.button !== 1) return;
|
|
93
|
+
const link = event.target.closest?.("a[href]");
|
|
94
|
+
if (!link) return;
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
const sourcePath = link.closest(DOCUMENT_SOURCE_SELECTOR)?.getAttribute("data-markdown-source") || void 0;
|
|
98
|
+
open({
|
|
99
|
+
href: link.getAttribute("href") ?? "",
|
|
100
|
+
sourcePath
|
|
101
|
+
}, link);
|
|
102
|
+
};
|
|
103
|
+
const handleEditorLink = (event) => {
|
|
104
|
+
const { detail } = event;
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
if (typeof detail !== "string") return;
|
|
108
|
+
const target = event.target;
|
|
109
|
+
const sourcePath = target.closest(DOCUMENT_SOURCE_SELECTOR)?.getAttribute("data-markdown-source") || void 0;
|
|
110
|
+
open({
|
|
111
|
+
href: detail,
|
|
112
|
+
sourcePath
|
|
113
|
+
}, target);
|
|
114
|
+
};
|
|
115
|
+
element.addEventListener("click", handleClick, true);
|
|
116
|
+
element.addEventListener("auxclick", handleClick, true);
|
|
117
|
+
element.addEventListener("workbase-markdown-link", handleEditorLink);
|
|
118
|
+
return () => {
|
|
119
|
+
version.current += 1;
|
|
120
|
+
element.removeEventListener("click", handleClick, true);
|
|
121
|
+
element.removeEventListener("auxclick", handleClick, true);
|
|
122
|
+
element.removeEventListener("workbase-markdown-link", handleEditorLink);
|
|
123
|
+
};
|
|
124
|
+
}, [open]);
|
|
125
|
+
const hasPreview = Boolean(preview || isLoading);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!hasPreview) return;
|
|
128
|
+
previewPanel.current?.focus();
|
|
129
|
+
previewPanel.current?.scrollIntoView({ block: "nearest" });
|
|
130
|
+
}, [hasPreview]);
|
|
131
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
132
|
+
ref: container,
|
|
133
|
+
className: "workbase-markdown-links",
|
|
134
|
+
children: [
|
|
135
|
+
error ? /* @__PURE__ */ jsxs("p", {
|
|
136
|
+
role: "alert",
|
|
137
|
+
className: "markdown-link-error",
|
|
138
|
+
children: [error, request ? /* @__PURE__ */ jsx("button", {
|
|
139
|
+
type: "button",
|
|
140
|
+
onClick: handleRetry,
|
|
141
|
+
children: "重试打开"
|
|
142
|
+
}) : null]
|
|
143
|
+
}) : null,
|
|
144
|
+
isOpeningWebsite ? /* @__PURE__ */ jsx("p", {
|
|
145
|
+
role: "status",
|
|
146
|
+
children: "正在等待打开网页的确认…"
|
|
147
|
+
}) : null,
|
|
148
|
+
hasPreview ? /* @__PURE__ */ jsxs("section", {
|
|
149
|
+
ref: previewPanel,
|
|
150
|
+
tabIndex: -1,
|
|
151
|
+
className: "markdown-document-preview",
|
|
152
|
+
"aria-labelledby": labelId,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsxs("div", {
|
|
155
|
+
className: "markdown-document-heading",
|
|
156
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
157
|
+
id: labelId,
|
|
158
|
+
children: "文档预览"
|
|
159
|
+
}), /* @__PURE__ */ jsx("p", { children: preview?.path ?? request?.href })] }), /* @__PURE__ */ jsx("button", {
|
|
160
|
+
type: "button",
|
|
161
|
+
onClick: handleClose,
|
|
162
|
+
children: "关闭预览"
|
|
163
|
+
})]
|
|
164
|
+
}),
|
|
165
|
+
isLoading ? /* @__PURE__ */ jsx("p", {
|
|
166
|
+
role: "status",
|
|
167
|
+
children: preview ? "正在读取最新文档,当前显示上次内容…" : "正在读取文档…"
|
|
168
|
+
}) : null,
|
|
169
|
+
preview ? /* @__PURE__ */ jsx(MarkdownPreview, {
|
|
170
|
+
document: preview,
|
|
171
|
+
onError: handlePreviewError
|
|
172
|
+
}, preview.path) : null
|
|
173
|
+
]
|
|
174
|
+
}) : null,
|
|
175
|
+
children
|
|
176
|
+
]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const MarkdownPreview = memo(function MarkdownPreview({ document: markdownDocument, onError }) {
|
|
180
|
+
const container = useRef(null);
|
|
181
|
+
const [isRendering, setRendering] = useState(true);
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
let stopped = false;
|
|
184
|
+
const render = async () => {
|
|
185
|
+
setRendering(true);
|
|
186
|
+
try {
|
|
187
|
+
const html = await renderMarkdownPreview(markdownDocument.content);
|
|
188
|
+
if (stopped || !container.current) return;
|
|
189
|
+
const template = document.createElement("template");
|
|
190
|
+
template.innerHTML = html;
|
|
191
|
+
template.content.querySelectorAll(INACTIVE_PREVIEW_ELEMENTS).forEach((element) => element.remove());
|
|
192
|
+
template.content.querySelectorAll("input[type=\"checkbox\"]").forEach((checkbox) => {
|
|
193
|
+
checkbox.disabled = true;
|
|
194
|
+
});
|
|
195
|
+
container.current.replaceChildren(template.content);
|
|
196
|
+
if (markdownDocument.fragment) scrollToAnchor(container.current, markdownDocument.fragment);
|
|
197
|
+
} catch (failure) {
|
|
198
|
+
if (!stopped) onError(readableError(failure));
|
|
199
|
+
} finally {
|
|
200
|
+
if (!stopped) setRendering(false);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
render();
|
|
204
|
+
return () => {
|
|
205
|
+
stopped = true;
|
|
206
|
+
};
|
|
207
|
+
}, [
|
|
208
|
+
markdownDocument.content,
|
|
209
|
+
markdownDocument.fragment,
|
|
210
|
+
markdownDocument.revision,
|
|
211
|
+
onError
|
|
212
|
+
]);
|
|
213
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
214
|
+
"data-markdown-source": markdownDocument.path,
|
|
215
|
+
children: [isRendering ? /* @__PURE__ */ jsx("p", {
|
|
216
|
+
role: "status",
|
|
217
|
+
children: "正在排版文档…"
|
|
218
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
219
|
+
ref: container,
|
|
220
|
+
className: "markdown-document-body vditor-reset"
|
|
221
|
+
})]
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
function scrollToAnchor(root, fragment) {
|
|
225
|
+
if (!root) return;
|
|
226
|
+
if (!fragment) {
|
|
227
|
+
root.scrollIntoView({ block: "start" });
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const identified = Array.from(root.querySelectorAll("[id]")).find(({ id }) => id === fragment);
|
|
231
|
+
const counts = /* @__PURE__ */ new Map();
|
|
232
|
+
const heading = Array.from(root.querySelectorAll(HEADING_SELECTOR)).find((element) => {
|
|
233
|
+
const slug = (element.textContent ?? "").trim().toLowerCase().replace(/[^\p{L}\p{N}_\s-]/gu, "").replace(/\s/g, "-");
|
|
234
|
+
const count = counts.get(slug) ?? 0;
|
|
235
|
+
counts.set(slug, count + 1);
|
|
236
|
+
return (count ? slug + "-" + count : slug) === fragment;
|
|
237
|
+
});
|
|
238
|
+
const target = identified ?? heading;
|
|
239
|
+
if (!target) throw new Error("文档中未找到标题:" + fragment);
|
|
240
|
+
target.scrollIntoView({ block: "start" });
|
|
241
|
+
}
|
|
242
|
+
function readableError(failure) {
|
|
243
|
+
return failure instanceof Error ? failure.message : "链接打开失败,请重试。";
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { MarkdownLinks };
|
package/dist/ui/model.d.ts
CHANGED
|
@@ -20,4 +20,6 @@ export declare function configurationSavedMessage(publication: {
|
|
|
20
20
|
export declare function formatActionOutput(title: string, result: unknown, logs: unknown): PluginActionOutput;
|
|
21
21
|
export declare function formatActionError(title: string, error: unknown): PluginActionOutput;
|
|
22
22
|
export declare function readableError(error: unknown, fallback: string): string;
|
|
23
|
+
/** Keeps the actual cause visible while leaving stack frames in technical details. */
|
|
24
|
+
export declare function errorSummary(message: string): string;
|
|
23
25
|
//#endregion
|
package/dist/ui/model.js
CHANGED
|
@@ -29,6 +29,10 @@ function formatActionError(title, error) {
|
|
|
29
29
|
function readableError(error, fallback) {
|
|
30
30
|
return error instanceof Error && error.message.trim().length > 0 ? error.message : fallback;
|
|
31
31
|
}
|
|
32
|
+
/** Keeps the actual cause visible while leaving stack frames in technical details. */
|
|
33
|
+
function errorSummary(message) {
|
|
34
|
+
return message.split(/\n\s+at\s/, 1)[0].trim();
|
|
35
|
+
}
|
|
32
36
|
function formatLogEntries(value) {
|
|
33
37
|
if (!Array.isArray(value)) return "";
|
|
34
38
|
return value.filter(isRecord).map((entry) => {
|
|
@@ -46,4 +50,4 @@ function isRecord(value) {
|
|
|
46
50
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
47
51
|
}
|
|
48
52
|
//#endregion
|
|
49
|
-
export { ConfigurationMode, TEAM_CONFIGURATION_NOTICE, configurationSavedMessage, formatActionError, formatActionOutput, readableError };
|
|
53
|
+
export { ConfigurationMode, TEAM_CONFIGURATION_NOTICE, configurationSavedMessage, errorSummary, formatActionError, formatActionOutput, readableError };
|
package/dist/ui/theme.css
CHANGED
|
@@ -188,6 +188,32 @@
|
|
|
188
188
|
|
|
189
189
|
.mantine-Alert-root { padding: 12px; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
|
|
190
190
|
.mantine-Alert-message { color: inherit; font-size: 14px; line-height: 1.5; }
|
|
191
|
+
.workbase-plugin-error {
|
|
192
|
+
min-width: 0;
|
|
193
|
+
max-height: 100%;
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
overflow-y: auto;
|
|
196
|
+
padding: 16px 20px;
|
|
197
|
+
border: 1px solid color-mix(in srgb, var(--color-danger) 24%, var(--color-border));
|
|
198
|
+
border-radius: 8px;
|
|
199
|
+
color: var(--color-foreground);
|
|
200
|
+
background: color-mix(in srgb, var(--color-danger) 5%, var(--color-surface));
|
|
201
|
+
text-align: left;
|
|
202
|
+
overflow-wrap: anywhere;
|
|
203
|
+
scrollbar-color: var(--color-border-strong) transparent;
|
|
204
|
+
scrollbar-width: thin;
|
|
205
|
+
}
|
|
206
|
+
.workbase-plugin-error:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
|
|
207
|
+
.workbase-plugin-error .workbase-error-title { margin: 0 0 8px; color: var(--color-danger); font-size: 14px; font-weight: 600; line-height: 1.5; }
|
|
208
|
+
.workbase-plugin-error .workbase-error-cause { margin: 0; color: var(--color-foreground); font-size: 14px; font-weight: 500; line-height: 1.65; white-space: pre-wrap; }
|
|
209
|
+
.workbase-plugin-error .workbase-error-context { margin: 8px 0 0; color: var(--color-foreground); font-size: 12px; font-weight: 400; line-height: 1.65; }
|
|
210
|
+
.workbase-error-context strong { margin-right: 8px; font-weight: 600; }
|
|
211
|
+
.workbase-error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
|
|
212
|
+
.workbase-error-details { margin-top: 12px; color: var(--color-foreground); font-size: 12px; font-weight: 400; }
|
|
213
|
+
.workbase-error-details summary { width: fit-content; cursor: pointer; text-underline-offset: 3px; }
|
|
214
|
+
.workbase-error-details summary:hover { text-decoration: underline; }
|
|
215
|
+
.workbase-error-details summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }
|
|
216
|
+
.workbase-error-details pre { max-width: 100%; max-height: 240px; margin: 8px 0 0; padding: 12px; overflow: auto; border-radius: 4px; color: var(--color-foreground); background: var(--color-surface); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: var(--color-border-strong) transparent; scrollbar-width: thin; }
|
|
191
217
|
.mantine-Notification-root { border: 1px solid var(--color-border); }
|
|
192
218
|
.mantine-Notification-title { color: var(--color-brand-deep); font-weight: 600; }
|
|
193
219
|
.mantine-Notification-description { color: var(--color-muted); }
|
|
@@ -200,3 +226,86 @@
|
|
|
200
226
|
outline-offset: 2px;
|
|
201
227
|
}
|
|
202
228
|
}
|
|
229
|
+
|
|
230
|
+
@layer components {
|
|
231
|
+
.workbase-execution-log { min-width: 0; font-size: 14px; line-height: 1.7; }
|
|
232
|
+
.workbase-execution-log[data-display="full"] { max-width: calc(75ch + 100px); }
|
|
233
|
+
.workbase-log-entries { list-style: none; margin: 0; padding: 0; }
|
|
234
|
+
.workbase-log-entry { position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 28px; padding: 0 0 20px; min-width: 0; scroll-margin-top: 24px; }
|
|
235
|
+
.workbase-log-entry:last-child { padding-bottom: 0; }
|
|
236
|
+
.workbase-log-entry::before { content: ""; position: absolute; left: 84px; top: 9px; width: 7px; height: 7px; border: 1px solid var(--color-border-strong); border-radius: 50%; background: var(--color-surface); }
|
|
237
|
+
.workbase-log-entry:not(:last-child)::after { content: ""; position: absolute; left: 87px; top: 20px; bottom: 2px; width: 1px; background: var(--color-border); }
|
|
238
|
+
.workbase-log-entry[data-status="failed"]::before { border-color: var(--color-danger); background: var(--color-danger); }
|
|
239
|
+
.workbase-log-entry[data-status="pending"]::before { border-color: var(--color-warning); background: var(--color-brand-weak); }
|
|
240
|
+
.workbase-log-entry:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
|
|
241
|
+
.workbase-log-time { grid-column: 1; grid-row: 1; padding-top: 2px; color: var(--color-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
|
|
242
|
+
.workbase-log-body { position: relative; grid-column: 2; grid-row: 1; min-width: 0; }
|
|
243
|
+
.workbase-log-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-height: 24px; margin-bottom: 8px; }
|
|
244
|
+
.workbase-log-heading strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
|
|
245
|
+
.workbase-log-kind, .workbase-log-status, .workbase-log-note { color: var(--color-muted); font-size: 12px; }
|
|
246
|
+
.workbase-log-status { margin-left: auto; white-space: nowrap; }
|
|
247
|
+
.workbase-execution-log[data-display="full"] .workbase-log-heading strong { flex: 0 1 auto; }
|
|
248
|
+
.workbase-execution-log[data-display="full"] .workbase-log-status { margin-left: 0; }
|
|
249
|
+
.workbase-log-status[data-status="failed"], .workbase-log-error { color: var(--color-danger); }
|
|
250
|
+
.workbase-log-status[data-status="completed"] { color: var(--color-success); }
|
|
251
|
+
.workbase-log-status:is([data-status="needs_action"], [data-status="warning"]) { color: var(--color-warning); }
|
|
252
|
+
.workbase-log-status:is([data-status="pending"], [data-status="invalid"]) { color: var(--color-warning); }
|
|
253
|
+
.workbase-log-content { max-width: 75ch; overflow-wrap: anywhere; }
|
|
254
|
+
.workbase-log-content > :first-child { margin-top: 0; }
|
|
255
|
+
.workbase-log-content > :last-child { margin-bottom: 0; }
|
|
256
|
+
.workbase-log-content :is(h1, h2, h3, h4) { margin-block: 20px 8px; font-size: 1em; line-height: 1.5; }
|
|
257
|
+
.workbase-log-content :is(p, ul, ol, pre, blockquote, table) { margin-block: 8px 12px; }
|
|
258
|
+
.workbase-log-content :is(ul, ol) { padding-left: 22px; }
|
|
259
|
+
.workbase-log-content ul { list-style: disc; }
|
|
260
|
+
.workbase-log-content ol { list-style: decimal; }
|
|
261
|
+
.workbase-log-content a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }
|
|
262
|
+
.workbase-log-content pre, .workbase-log-details pre, .workbase-log-raw { max-height: 360px; overflow: auto; max-width: 100%; padding: 12px; background: var(--color-surface-muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; scrollbar-color: var(--color-border-strong) transparent; scrollbar-width: thin; }
|
|
263
|
+
.workbase-log-content table { display: block; overflow-x: auto; }
|
|
264
|
+
.workbase-log-content :is(th, td) { padding: 6px 10px; border-bottom: 1px solid var(--color-border); text-align: left; }
|
|
265
|
+
.workbase-log-details { margin-top: 10px; }
|
|
266
|
+
.workbase-log-details summary { width: fit-content; cursor: pointer; color: var(--color-muted); font-size: 12px; }
|
|
267
|
+
.workbase-log-operation > summary { display: flex; align-items: center; gap: 12px; min-height: 28px; cursor: pointer; list-style: none; border-radius: 4px; }
|
|
268
|
+
.workbase-log-operation > summary::-webkit-details-marker { display: none; }
|
|
269
|
+
.workbase-log-operation .workbase-log-heading { flex: 1; margin: 0; }
|
|
270
|
+
.workbase-log-operation[open] > summary { margin-bottom: 12px; }
|
|
271
|
+
.workbase-log-chevron { width: 6px; height: 6px; margin-right: 4px; flex-shrink: 0; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; color: var(--color-muted); transform: rotate(-45deg); }
|
|
272
|
+
.workbase-log-operation[open] > summary .workbase-log-chevron { transform: rotate(45deg); }
|
|
273
|
+
.workbase-log-operation summary:hover { color: var(--color-brand); }
|
|
274
|
+
.workbase-execution-log summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
|
|
275
|
+
.workbase-execution-log ::selection { background: var(--color-brand-weak); color: var(--color-foreground); }
|
|
276
|
+
.workbase-log-anchor { position: absolute; top: 0; }
|
|
277
|
+
.workbase-log-calls { margin: 12px 0; padding: 0; list-style: none; }
|
|
278
|
+
.workbase-log-calls > li { display: grid; grid-template-columns: minmax(0, 1fr) max-content max-content; align-items: center; gap: 4px 16px; padding-block: 8px; font-size: 13px; }
|
|
279
|
+
.workbase-log-calls > li + li { border-top: 1px solid var(--color-border); }
|
|
280
|
+
.workbase-log-calls > li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|
|
281
|
+
.workbase-log-calls .workbase-log-note { white-space: nowrap; }
|
|
282
|
+
.workbase-log-link, .workbase-log-copy button { border: 0; min-height: 32px; padding: 4px 0; background: transparent; color: var(--color-brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
|
|
283
|
+
.workbase-log-calls .workbase-log-link { justify-self: end; white-space: nowrap; }
|
|
284
|
+
.workbase-log-copy { display: flex; align-items: center; gap: 12px; color: var(--color-muted); font-size: 12px; }
|
|
285
|
+
.workbase-log-follow { display: flex; justify-content: center; padding-top: 8px; }
|
|
286
|
+
.workbase-log-latest { min-height: 28px; border: 1px solid var(--color-border-strong); border-radius: 6px; padding: 3px 10px; background: var(--color-surface); color: var(--color-foreground); font: inherit; font-size: 12px; cursor: pointer; }
|
|
287
|
+
.workbase-log-latest[data-following="true"] { visibility: hidden; }
|
|
288
|
+
.workbase-execution-log button:focus-visible, .workbase-log-viewport:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
|
|
289
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-viewport { max-height: 280px; overflow: auto; padding: 2px 10px 2px 2px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
|
|
290
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 0 0 18px 22px; }
|
|
291
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry::before { left: 2px; top: 7px; }
|
|
292
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry::after { left: 5px; top: 18px; }
|
|
293
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry[data-status="completed"]::before { background: var(--color-success); border-color: var(--color-success); }
|
|
294
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-time { grid-column: 2; grid-row: 1; padding: 0; line-height: 20px; }
|
|
295
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-body { grid-column: 1; grid-row: 1; padding: 0; }
|
|
296
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-heading { margin: 0; min-height: 20px; }
|
|
297
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-heading strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 20px; font-weight: 500; }
|
|
298
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-status { flex-shrink: 0; font-size: 12px; white-space: nowrap; }
|
|
299
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-status:not([data-status="failed"], [data-status="needs_action"], [data-status="warning"], [data-status="interrupted"]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
|
|
300
|
+
@media (max-width: 600px) {
|
|
301
|
+
.workbase-execution-log[data-display="full"] .workbase-log-entry { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-left: 20px; }
|
|
302
|
+
.workbase-execution-log[data-display="full"] .workbase-log-time { grid-column: 1; grid-row: 1; text-align: left; }
|
|
303
|
+
.workbase-execution-log[data-display="full"] .workbase-log-body { grid-column: 1; grid-row: 2; }
|
|
304
|
+
.workbase-execution-log[data-display="full"] .workbase-log-entry::before { left: 0; top: 9px; }
|
|
305
|
+
.workbase-execution-log[data-display="full"] .workbase-log-entry:not(:last-child)::after { left: 3px; }
|
|
306
|
+
.workbase-log-calls > li { grid-template-columns: minmax(0, 1fr) auto; }
|
|
307
|
+
.workbase-log-calls > li > span:first-child { grid-column: 1 / -1; }
|
|
308
|
+
.workbase-log-calls .workbase-log-link { grid-column: 2; }
|
|
309
|
+
.workbase-log-kind { margin-left: 0; }
|
|
310
|
+
}
|
|
311
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eworkbase/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
|
+
"./markdown": {
|
|
7
|
+
"types": "./dist/markdown.d.ts",
|
|
8
|
+
"import": "./dist/markdown.js"
|
|
9
|
+
},
|
|
10
|
+
"./ui/markdown-links": {
|
|
11
|
+
"types": "./dist/ui/markdown-links.d.ts",
|
|
12
|
+
"import": "./dist/ui/markdown-links.js"
|
|
13
|
+
},
|
|
6
14
|
".": {
|
|
7
15
|
"types": "./dist/index.d.ts",
|
|
8
16
|
"import": "./dist/index.js"
|
|
@@ -19,17 +27,34 @@
|
|
|
19
27
|
"types": "./dist/ui/model.d.ts",
|
|
20
28
|
"import": "./dist/ui/model.js"
|
|
21
29
|
},
|
|
30
|
+
"./ui/error-panel": {
|
|
31
|
+
"types": "./dist/ui/error-panel.d.ts",
|
|
32
|
+
"import": "./dist/ui/error-panel.js"
|
|
33
|
+
},
|
|
22
34
|
"./ui/theme": {
|
|
23
35
|
"types": "./dist/ui/theme.d.ts",
|
|
24
36
|
"import": "./dist/ui/theme.js"
|
|
25
37
|
},
|
|
26
|
-
"./ui/theme.css": "./dist/ui/theme.css"
|
|
38
|
+
"./ui/theme.css": "./dist/ui/theme.css",
|
|
39
|
+
"./ui/markdown-editor": {
|
|
40
|
+
"types": "./dist/ui/markdown-editor.d.ts",
|
|
41
|
+
"import": "./dist/ui/markdown-editor.js"
|
|
42
|
+
},
|
|
43
|
+
"./ui/markdown-editor.css": "./dist/style.css",
|
|
44
|
+
"./ui/markdown-editor-assets": "./dist/ui/markdown-editor-assets/lute.min.js",
|
|
45
|
+
"./ui/execution-log": {
|
|
46
|
+
"types": "./dist/ui/execution-log.d.ts",
|
|
47
|
+
"import": "./dist/ui/execution-log.js"
|
|
48
|
+
}
|
|
27
49
|
},
|
|
28
50
|
"engines": {
|
|
29
51
|
"node": ">=22"
|
|
30
52
|
},
|
|
31
53
|
"dependencies": {
|
|
32
54
|
"penpal": "^7.0.0",
|
|
55
|
+
"react-markdown": "^10.1.0",
|
|
56
|
+
"remark-gfm": "^4.0.1",
|
|
57
|
+
"vditor": "^4.0.1",
|
|
33
58
|
"zod": "^4.6.5"
|
|
34
59
|
},
|
|
35
60
|
"publishConfig": {
|
|
@@ -39,10 +64,21 @@
|
|
|
39
64
|
"dist"
|
|
40
65
|
],
|
|
41
66
|
"devDependencies": {
|
|
67
|
+
"@tsdown/css": "0.23.0",
|
|
42
68
|
"@types/node": "^24.0.3",
|
|
69
|
+
"@types/react": "^19.2.17",
|
|
70
|
+
"react": "^19.2.7",
|
|
43
71
|
"tsdown": "0.23.0",
|
|
44
72
|
"typescript": "^5.8.3"
|
|
45
73
|
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"react": "^19.1.0"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"react": {
|
|
79
|
+
"optional": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
46
82
|
"scripts": {
|
|
47
83
|
"build": "tsdown",
|
|
48
84
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|