@eworkbase/sdk 0.3.4 → 0.3.6
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/index.d.ts +1 -1
- package/dist/style.css +2278 -0
- package/dist/{types--jTA_mHn.d.ts → types-Cl1kerLO.d.ts} +1 -0
- package/dist/ui/index.d.ts +1 -1
- 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 +23 -0
- package/dist/ui/markdown-editor.js +330 -0
- package/dist/ui/theme.d.ts +11 -1
- package/dist/ui/theme.js +4 -1
- package/package.json +27 -9
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
window.VditorI18n = {
|
|
2
|
+
'alignCenter': '居中',
|
|
3
|
+
'alignLeft': '居左',
|
|
4
|
+
'alignRight': '居右',
|
|
5
|
+
'alternateText': '替代文本',
|
|
6
|
+
'bold': '粗体',
|
|
7
|
+
'both': '编辑 & 预览',
|
|
8
|
+
'cancelUpload': '取消上传',
|
|
9
|
+
'check': '任务列表',
|
|
10
|
+
'close': '关闭',
|
|
11
|
+
'code': '代码块',
|
|
12
|
+
'code-theme': '代码块主题预览',
|
|
13
|
+
'column': '列',
|
|
14
|
+
'comment': '评论',
|
|
15
|
+
'confirm': '确定',
|
|
16
|
+
'content-theme': '内容主题预览',
|
|
17
|
+
'copied': '已复制',
|
|
18
|
+
'copy': '复制',
|
|
19
|
+
'delete-column': '删除列',
|
|
20
|
+
'delete-row': '删除行',
|
|
21
|
+
'devtools': '开发者工具',
|
|
22
|
+
'down': '下',
|
|
23
|
+
'downloadTip': '该浏览器不支持下载功能',
|
|
24
|
+
'edit': '编辑',
|
|
25
|
+
'edit-mode': '切换编辑模式',
|
|
26
|
+
'emoji': '表情',
|
|
27
|
+
'export': '导出',
|
|
28
|
+
'fileTypeError': '文件类型不允许上传,请压缩后再试',
|
|
29
|
+
'footnoteRef': '脚注标识',
|
|
30
|
+
'fullscreen': '全屏切换',
|
|
31
|
+
'generate': '生成中',
|
|
32
|
+
'headings': '标题',
|
|
33
|
+
'heading1': '一级标题',
|
|
34
|
+
'heading2': '二级标题',
|
|
35
|
+
'heading3': '三级标题',
|
|
36
|
+
'heading4': '四级标题',
|
|
37
|
+
'heading5': '五级标题',
|
|
38
|
+
'heading6': '六级标题',
|
|
39
|
+
'help': '帮助',
|
|
40
|
+
'imageURL': '图片地址',
|
|
41
|
+
'indent': '列表缩进',
|
|
42
|
+
'info': '关于',
|
|
43
|
+
'inline-code': '行内代码',
|
|
44
|
+
'insert-after': '末尾插入行',
|
|
45
|
+
'insert-before': '起始插入行',
|
|
46
|
+
'insertColumnLeft': '在左边插入一列',
|
|
47
|
+
'insertColumnRight': '在右边插入一列',
|
|
48
|
+
'insertRowAbove': '在上方插入一行',
|
|
49
|
+
'insertRowBelow': '在下方插入一行',
|
|
50
|
+
'instantRendering': '即时渲染',
|
|
51
|
+
'italic': '斜体',
|
|
52
|
+
'language': '语言',
|
|
53
|
+
'line': '分隔线',
|
|
54
|
+
'link': '链接',
|
|
55
|
+
'linkRef': '引用标识',
|
|
56
|
+
'list': '无序列表',
|
|
57
|
+
'more': '更多',
|
|
58
|
+
'nameEmpty': '文件名不能为空',
|
|
59
|
+
'ordered-list': '有序列表',
|
|
60
|
+
'outdent': '列表反向缩进',
|
|
61
|
+
'outline': '大纲',
|
|
62
|
+
'over': '超过',
|
|
63
|
+
'performanceTip': '实时预览需 ${x}ms,可点击编辑 & 预览按钮进行关闭',
|
|
64
|
+
'preview': '预览',
|
|
65
|
+
'quote': '引用',
|
|
66
|
+
'record': '开始录音/结束录音',
|
|
67
|
+
'record-tip': '该设备不支持录音功能',
|
|
68
|
+
'recording': '录音中...',
|
|
69
|
+
'redo': '重做',
|
|
70
|
+
'remove': '删除',
|
|
71
|
+
'row': '行',
|
|
72
|
+
'spin': '旋转',
|
|
73
|
+
'splitView': '分屏预览',
|
|
74
|
+
'strike': '删除线',
|
|
75
|
+
'table': '表格',
|
|
76
|
+
'textIsNotEmpty': '文本(不能为空)',
|
|
77
|
+
'title': '标题',
|
|
78
|
+
'tooltipText': '提示文本',
|
|
79
|
+
'undo': '撤销',
|
|
80
|
+
'up': '上',
|
|
81
|
+
'update': '更新',
|
|
82
|
+
'upload': '上传图片或文件',
|
|
83
|
+
'uploadError': '上传错误',
|
|
84
|
+
'uploading': '上传中...',
|
|
85
|
+
'wysiwyg': '所见即所得',
|
|
86
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ui/MarkdownEditor.dto.d.ts
|
|
2
|
+
/** Shared Markdown field contracts; no host transport or plugin business types. */
|
|
3
|
+
interface MarkdownCompletion {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly description?: string;
|
|
6
|
+
}
|
|
7
|
+
interface MarkdownEditorProps {
|
|
8
|
+
readonly value: string;
|
|
9
|
+
readonly onChange: (value: string) => void;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly name?: string;
|
|
12
|
+
readonly placeholder?: string;
|
|
13
|
+
readonly isReadOnly?: boolean;
|
|
14
|
+
readonly isDisabled?: boolean;
|
|
15
|
+
readonly required?: boolean;
|
|
16
|
+
readonly maxLength?: number;
|
|
17
|
+
readonly completions?: readonly MarkdownCompletion[];
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/ui/MarkdownEditor.d.ts
|
|
21
|
+
export declare const MarkdownEditor: import("react").NamedExoticComponent<MarkdownEditorProps>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export type { MarkdownCompletion, MarkdownEditorProps };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/ui/MarkdownEditor.tsx
|
|
4
|
+
/** Local Vditor field with three editing modes, draft-safe updates and native form submission. */
|
|
5
|
+
const ASSET_DIRECTORY = "./markdown-editor-assets/";
|
|
6
|
+
const MINIMUM_EDITOR_HEIGHT = 360;
|
|
7
|
+
const MAXIMUM_HINTS = 12;
|
|
8
|
+
const TOOLBAR = [
|
|
9
|
+
"bold",
|
|
10
|
+
"list",
|
|
11
|
+
"check",
|
|
12
|
+
"|",
|
|
13
|
+
"edit-mode",
|
|
14
|
+
"preview",
|
|
15
|
+
{
|
|
16
|
+
name: "more",
|
|
17
|
+
toolbar: [
|
|
18
|
+
"headings",
|
|
19
|
+
"italic",
|
|
20
|
+
"strike",
|
|
21
|
+
"ordered-list",
|
|
22
|
+
"quote",
|
|
23
|
+
"code",
|
|
24
|
+
"table",
|
|
25
|
+
"|",
|
|
26
|
+
"undo",
|
|
27
|
+
"redo",
|
|
28
|
+
"both"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const LOCAL_SCRIPTS = [
|
|
33
|
+
{
|
|
34
|
+
file: "zh_CN.js",
|
|
35
|
+
id: "vditorI18nScriptzh_CN"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
file: "ant.js",
|
|
39
|
+
id: "vditorIconScript"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
file: "lute.min.js",
|
|
43
|
+
id: "vditorLuteScript"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
const MarkdownEditor = memo(function MarkdownEditor({ value, onChange, label, name, placeholder = "输入 Markdown…", isReadOnly = false, isDisabled = false, required, maxLength, completions = [] }) {
|
|
47
|
+
const container = useRef(null);
|
|
48
|
+
const formValue = useRef(null);
|
|
49
|
+
const editor = useRef(null);
|
|
50
|
+
const latest = useRef({
|
|
51
|
+
value,
|
|
52
|
+
onChange,
|
|
53
|
+
isReadOnly,
|
|
54
|
+
isDisabled,
|
|
55
|
+
completions
|
|
56
|
+
});
|
|
57
|
+
const rendered = useRef(null);
|
|
58
|
+
const source = useRef(value);
|
|
59
|
+
const isUpdating = useRef(false);
|
|
60
|
+
const labelId = useId();
|
|
61
|
+
const [attempt, setAttempt] = useState(0);
|
|
62
|
+
const [isReady, setIsReady] = useState(false);
|
|
63
|
+
const [error, setError] = useState(null);
|
|
64
|
+
const [validationError, setValidationError] = useState(null);
|
|
65
|
+
latest.current = {
|
|
66
|
+
value,
|
|
67
|
+
onChange,
|
|
68
|
+
isReadOnly,
|
|
69
|
+
isDisabled,
|
|
70
|
+
completions
|
|
71
|
+
};
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const element = container.current;
|
|
74
|
+
let stopped = false;
|
|
75
|
+
let instance = null;
|
|
76
|
+
let initialized = false;
|
|
77
|
+
if (!element) return;
|
|
78
|
+
const updateContent = (content) => {
|
|
79
|
+
if (stopped || isUpdating.current || !initialized || content === rendered.current) return;
|
|
80
|
+
rendered.current = content;
|
|
81
|
+
source.current = content;
|
|
82
|
+
latest.current.onChange(content);
|
|
83
|
+
};
|
|
84
|
+
const initialize = async () => {
|
|
85
|
+
setIsReady(false);
|
|
86
|
+
setError(null);
|
|
87
|
+
try {
|
|
88
|
+
await Promise.all(LOCAL_SCRIPTS.map(loadLocalScript));
|
|
89
|
+
const { default: Editor } = await import("vditor");
|
|
90
|
+
if (stopped) return;
|
|
91
|
+
instance = new Editor(element, {
|
|
92
|
+
value: latest.current.value,
|
|
93
|
+
placeholder,
|
|
94
|
+
lang: "zh_CN",
|
|
95
|
+
mode: "ir",
|
|
96
|
+
cdn: new URL(ASSET_DIRECTORY, document.baseURI).href,
|
|
97
|
+
cache: { enable: false },
|
|
98
|
+
minHeight: MINIMUM_EDITOR_HEIGHT,
|
|
99
|
+
toolbar: [...TOOLBAR],
|
|
100
|
+
toolbarConfig: { pin: false },
|
|
101
|
+
counter: {
|
|
102
|
+
enable: Boolean(maxLength),
|
|
103
|
+
max: maxLength,
|
|
104
|
+
type: "markdown"
|
|
105
|
+
},
|
|
106
|
+
link: { isOpen: false },
|
|
107
|
+
image: { isPreview: false },
|
|
108
|
+
preview: {
|
|
109
|
+
actions: [],
|
|
110
|
+
hljs: { enable: false },
|
|
111
|
+
theme: {
|
|
112
|
+
current: "",
|
|
113
|
+
path: ""
|
|
114
|
+
},
|
|
115
|
+
markdown: {
|
|
116
|
+
sanitize: true,
|
|
117
|
+
autoSpace: false,
|
|
118
|
+
fixTermTypo: false,
|
|
119
|
+
codeBlockPreview: false,
|
|
120
|
+
mathBlockPreview: false,
|
|
121
|
+
inlineMath: false
|
|
122
|
+
},
|
|
123
|
+
render: { media: { enable: false } },
|
|
124
|
+
transform: plainCodePreview
|
|
125
|
+
},
|
|
126
|
+
hint: {
|
|
127
|
+
emoji: {},
|
|
128
|
+
parse: false,
|
|
129
|
+
extend: ["@", "/"].map((key) => ({
|
|
130
|
+
key,
|
|
131
|
+
hint: (query) => latest.current.completions.filter(({ value: token }) => token.startsWith(key) && token.slice(key.length).toLowerCase().includes(query.toLowerCase())).slice(0, MAXIMUM_HINTS).map(({ value: token, description }) => ({
|
|
132
|
+
value: token,
|
|
133
|
+
html: escapeText(description ? token + " · " + description : token)
|
|
134
|
+
}))
|
|
135
|
+
}))
|
|
136
|
+
},
|
|
137
|
+
input: updateContent,
|
|
138
|
+
blur: updateContent,
|
|
139
|
+
focus: () => labelEditorFields(element, labelId),
|
|
140
|
+
after: () => {
|
|
141
|
+
if (!instance) return;
|
|
142
|
+
initialized = true;
|
|
143
|
+
if (stopped) {
|
|
144
|
+
instance.destroy();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
editor.current = instance;
|
|
148
|
+
isUpdating.current = true;
|
|
149
|
+
instance.setValue(latest.current.value, true);
|
|
150
|
+
source.current = latest.current.value;
|
|
151
|
+
rendered.current = instance.getValue();
|
|
152
|
+
isUpdating.current = false;
|
|
153
|
+
setEditorReadOnly(instance, latest.current.isDisabled || latest.current.isReadOnly);
|
|
154
|
+
labelEditorFields(element, labelId);
|
|
155
|
+
setIsReady(true);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
} catch (failure) {
|
|
159
|
+
if (!stopped) setError(failure instanceof Error ? failure.message : "编辑器初始化失败。");
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
initialize();
|
|
163
|
+
return () => {
|
|
164
|
+
stopped = true;
|
|
165
|
+
editor.current = null;
|
|
166
|
+
if (initialized) instance?.destroy();
|
|
167
|
+
};
|
|
168
|
+
}, [
|
|
169
|
+
attempt,
|
|
170
|
+
labelId,
|
|
171
|
+
maxLength,
|
|
172
|
+
placeholder
|
|
173
|
+
]);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
const instance = editor.current;
|
|
176
|
+
if (!instance || !isReady) return;
|
|
177
|
+
if (value === source.current) return;
|
|
178
|
+
isUpdating.current = true;
|
|
179
|
+
instance.setValue(value, true);
|
|
180
|
+
source.current = value;
|
|
181
|
+
rendered.current = instance.getValue();
|
|
182
|
+
isUpdating.current = false;
|
|
183
|
+
}, [isReady, value]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (editor.current && isReady) setEditorReadOnly(editor.current, isDisabled || isReadOnly);
|
|
186
|
+
}, [
|
|
187
|
+
isDisabled,
|
|
188
|
+
isReadOnly,
|
|
189
|
+
isReady
|
|
190
|
+
]);
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
formValue.current?.setCustomValidity(maxLength && value.length > maxLength ? "内容不能超过 " + maxLength + " 个字符。" : "");
|
|
193
|
+
setValidationError(null);
|
|
194
|
+
}, [maxLength, value]);
|
|
195
|
+
const handleFallbackChange = useCallback((event) => onChange(event.currentTarget.value), [onChange]);
|
|
196
|
+
const handleRetry = useCallback(() => setAttempt((current) => current + 1), []);
|
|
197
|
+
const handleInvalid = useCallback((event) => {
|
|
198
|
+
if (editor.current) {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
setValidationError(event.currentTarget.validationMessage);
|
|
201
|
+
editor.current.focus();
|
|
202
|
+
}
|
|
203
|
+
}, []);
|
|
204
|
+
const handleInsert = useCallback((event) => {
|
|
205
|
+
const token = event.currentTarget.value;
|
|
206
|
+
if (token && editor.current) {
|
|
207
|
+
editor.current.insertValue(token + " ");
|
|
208
|
+
editor.current.focus();
|
|
209
|
+
}
|
|
210
|
+
}, []);
|
|
211
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
212
|
+
className: "workbase-markdown-editor",
|
|
213
|
+
"data-readonly": isReadOnly,
|
|
214
|
+
"data-disabled": isDisabled,
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ jsx("span", {
|
|
217
|
+
className: "markdown-field-label",
|
|
218
|
+
id: labelId,
|
|
219
|
+
children: label
|
|
220
|
+
}),
|
|
221
|
+
completions.length && !isReadOnly ? /* @__PURE__ */ jsxs("select", {
|
|
222
|
+
"aria-label": "插入资源引用",
|
|
223
|
+
value: "",
|
|
224
|
+
onChange: handleInsert,
|
|
225
|
+
disabled: !isReady || isDisabled,
|
|
226
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
227
|
+
value: "",
|
|
228
|
+
children: "插入资源引用…"
|
|
229
|
+
}), completions.map(({ value: token, description }) => /* @__PURE__ */ jsxs("option", {
|
|
230
|
+
value: token,
|
|
231
|
+
children: [token, description ? " · " + description : ""]
|
|
232
|
+
}, token))]
|
|
233
|
+
}) : null,
|
|
234
|
+
error ? /* @__PURE__ */ jsxs("p", {
|
|
235
|
+
role: "alert",
|
|
236
|
+
className: "markdown-editor-error",
|
|
237
|
+
children: ["编辑器加载失败,可继续编辑源码。", /* @__PURE__ */ jsx("button", {
|
|
238
|
+
type: "button",
|
|
239
|
+
onClick: handleRetry,
|
|
240
|
+
children: "重试"
|
|
241
|
+
})]
|
|
242
|
+
}) : null,
|
|
243
|
+
validationError ? /* @__PURE__ */ jsx("p", {
|
|
244
|
+
role: "alert",
|
|
245
|
+
className: "markdown-editor-error",
|
|
246
|
+
children: validationError
|
|
247
|
+
}) : null,
|
|
248
|
+
!isReady && !error ? /* @__PURE__ */ jsx("p", {
|
|
249
|
+
role: "status",
|
|
250
|
+
className: "markdown-editor-loading",
|
|
251
|
+
children: "正在加载编辑器…"
|
|
252
|
+
}) : null,
|
|
253
|
+
/* @__PURE__ */ jsx("div", {
|
|
254
|
+
ref: container,
|
|
255
|
+
className: "markdown-editor-surface",
|
|
256
|
+
hidden: !isReady
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
259
|
+
ref: formValue,
|
|
260
|
+
className: error ? "markdown-editor-fallback" : "markdown-editor-form-value",
|
|
261
|
+
"aria-label": label,
|
|
262
|
+
"aria-hidden": !error,
|
|
263
|
+
tabIndex: error ? 0 : -1,
|
|
264
|
+
name,
|
|
265
|
+
value,
|
|
266
|
+
onChange: handleFallbackChange,
|
|
267
|
+
required,
|
|
268
|
+
maxLength,
|
|
269
|
+
onInvalid: handleInvalid,
|
|
270
|
+
readOnly: isReadOnly,
|
|
271
|
+
disabled: isDisabled,
|
|
272
|
+
spellCheck: false,
|
|
273
|
+
autoCapitalize: "none"
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
async function loadLocalScript({ file, id }) {
|
|
279
|
+
const previous = document.getElementById(id);
|
|
280
|
+
if (previous?.dataset.loaded === "true") return;
|
|
281
|
+
await new Promise((resolve, reject) => {
|
|
282
|
+
const script = previous ?? document.createElement("script");
|
|
283
|
+
const finish = () => {
|
|
284
|
+
script.dataset.loaded = "true";
|
|
285
|
+
const icons = document.getElementById("vditor-icon-bold")?.closest("svg");
|
|
286
|
+
icons?.classList.add("workbase-markdown-icons");
|
|
287
|
+
icons?.setAttribute("aria-hidden", "true");
|
|
288
|
+
cleanup();
|
|
289
|
+
resolve();
|
|
290
|
+
};
|
|
291
|
+
const fail = () => {
|
|
292
|
+
cleanup();
|
|
293
|
+
script.remove();
|
|
294
|
+
reject(/* @__PURE__ */ new Error("无法加载编辑器资源:" + file));
|
|
295
|
+
};
|
|
296
|
+
const cleanup = () => {
|
|
297
|
+
script.removeEventListener("load", finish);
|
|
298
|
+
script.removeEventListener("error", fail);
|
|
299
|
+
};
|
|
300
|
+
script.addEventListener("load", finish, { once: true });
|
|
301
|
+
script.addEventListener("error", fail, { once: true });
|
|
302
|
+
if (!previous) {
|
|
303
|
+
script.id = id;
|
|
304
|
+
script.src = new URL(ASSET_DIRECTORY + file, document.baseURI).href;
|
|
305
|
+
document.head.append(script);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function setEditorReadOnly(editor, isReadOnly) {
|
|
310
|
+
if (isReadOnly) editor.disabled();
|
|
311
|
+
else editor.enable();
|
|
312
|
+
}
|
|
313
|
+
function labelEditorFields(element, labelId) {
|
|
314
|
+
element.querySelectorAll("[contenteditable], textarea").forEach((field) => {
|
|
315
|
+
field.setAttribute("role", "textbox");
|
|
316
|
+
field.setAttribute("aria-labelledby", labelId);
|
|
317
|
+
field.setAttribute("aria-multiline", "true");
|
|
318
|
+
field.setAttribute("autocapitalize", "none");
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function escapeText(text) {
|
|
322
|
+
const span = document.createElement("span");
|
|
323
|
+
span.textContent = text;
|
|
324
|
+
return span.innerHTML;
|
|
325
|
+
}
|
|
326
|
+
function plainCodePreview(html) {
|
|
327
|
+
return html.replace(/class="language-[^"]*"/g, "class=\"language-text\"");
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
export { MarkdownEditor };
|
package/dist/ui/theme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/ui/theme.d.ts
|
|
2
2
|
/** Shared Mantine tokens for Workbase and its React plugin views; no runtime bridge dependencies. */
|
|
3
|
-
/**
|
|
3
|
+
/** Initializes shared document defaults and style authorization before mounting React. */
|
|
4
4
|
export declare function initializeWorkbaseUiStyles(): void;
|
|
5
5
|
/** Reads the per-document style authorization issued by the plugin asset protocol. */
|
|
6
6
|
export declare function getWorkbaseStyleNonce(): string;
|
|
@@ -34,6 +34,16 @@ export declare const workbaseUiTheme: {
|
|
|
34
34
|
readonly blue: readonly ["#f0f7ff", "#ebf3fc", "#a6ccfa", "#599be9", "#0969da", "#085ec2", "#0752aa", "#06458e", "#053974", "#042b59"];
|
|
35
35
|
};
|
|
36
36
|
readonly components: {
|
|
37
|
+
readonly Input: {
|
|
38
|
+
readonly defaultProps: {
|
|
39
|
+
readonly autoCapitalize: "none";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly Textarea: {
|
|
43
|
+
readonly defaultProps: {
|
|
44
|
+
readonly autoCapitalize: "none";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
37
47
|
readonly Badge: {
|
|
38
48
|
readonly defaultProps: {
|
|
39
49
|
readonly radius: "md";
|
package/dist/ui/theme.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//#region src/ui/theme.ts
|
|
2
2
|
/** Shared Mantine tokens for Workbase and its React plugin views; no runtime bridge dependencies. */
|
|
3
|
-
/**
|
|
3
|
+
/** Initializes shared document defaults and style authorization before mounting React. */
|
|
4
4
|
function initializeWorkbaseUiStyles() {
|
|
5
|
+
document.documentElement.setAttribute("autocapitalize", "none");
|
|
5
6
|
Object.assign(window, { __webpack_nonce__: getWorkbaseStyleNonce() });
|
|
6
7
|
}
|
|
7
8
|
/** Reads the per-document style authorization issued by the plugin asset protocol. */
|
|
@@ -104,6 +105,8 @@ const workbaseUiTheme = {
|
|
|
104
105
|
]
|
|
105
106
|
},
|
|
106
107
|
components: {
|
|
108
|
+
Input: { defaultProps: { autoCapitalize: "none" } },
|
|
109
|
+
Textarea: { defaultProps: { autoCapitalize: "none" } },
|
|
107
110
|
Badge: {
|
|
108
111
|
defaultProps: { radius: "md" },
|
|
109
112
|
classNames: badgeClassNames
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eworkbase/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -23,19 +23,21 @@
|
|
|
23
23
|
"types": "./dist/ui/theme.d.ts",
|
|
24
24
|
"import": "./dist/ui/theme.js"
|
|
25
25
|
},
|
|
26
|
-
"./ui/theme.css": "./dist/ui/theme.css"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
26
|
+
"./ui/theme.css": "./dist/ui/theme.css",
|
|
27
|
+
"./ui/markdown-editor": {
|
|
28
|
+
"types": "./dist/ui/markdown-editor.d.ts",
|
|
29
|
+
"import": "./dist/ui/markdown-editor.js"
|
|
30
|
+
},
|
|
31
|
+
"./ui/markdown-editor.css": "./dist/style.css",
|
|
32
|
+
"./ui/markdown-editor-assets": "./dist/ui/markdown-editor-assets/lute.min.js"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|
|
34
35
|
"node": ">=22"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"penpal": "^7.0.0",
|
|
38
|
-
"zod": "^4.6.5"
|
|
39
|
+
"zod": "^4.6.5",
|
|
40
|
+
"vditor": "^4.0.1"
|
|
39
41
|
},
|
|
40
42
|
"publishConfig": {
|
|
41
43
|
"access": "public"
|
|
@@ -44,8 +46,24 @@
|
|
|
44
46
|
"dist"
|
|
45
47
|
],
|
|
46
48
|
"devDependencies": {
|
|
49
|
+
"@tsdown/css": "0.23.0",
|
|
47
50
|
"@types/node": "^24.0.3",
|
|
51
|
+
"@types/react": "^19.2.17",
|
|
52
|
+
"react": "^19.2.7",
|
|
48
53
|
"tsdown": "0.23.0",
|
|
49
54
|
"typescript": "^5.8.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"react": "^19.1.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsdown",
|
|
66
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
67
|
+
"pack:local": "pnpm build && pnpm pack"
|
|
50
68
|
}
|
|
51
|
-
}
|
|
69
|
+
}
|