wendang-react 0.6.3 → 0.6.4
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/NOTICE.md +1 -1
- package/README.md +105 -0
- package/dist/bindings/yjs.js +1 -5
- package/dist/chunks/AnchoredPanel-C7jMoPze.js +1 -0
- package/dist/chunks/DocumentExportMenu-CUMsgq3w.js +2 -0
- package/dist/chunks/Dropdown-D98tXfe0.js +3 -0
- package/dist/chunks/MindMapCanvas-CVXQXNOg.js +163 -0
- package/dist/chunks/MindMapViewer-BI8zbQM1.js +13 -0
- package/dist/chunks/SpreadsheetViewer-CoQ4VIgj.js +23 -0
- package/dist/chunks/code-highlight-BmaqTe1m.js +1 -30
- package/dist/chunks/code-highlight-engine-BFDzDPzy.js +1 -40
- package/dist/chunks/comment-hint-BhUxKjKK.js +14 -0
- package/dist/chunks/composition-state-Bl-U1R_2.js +1 -40
- package/dist/chunks/extensions-C1fCBnEs.js +14 -0
- package/dist/chunks/fuzzy-match-DYQR-4w2.js +1 -89
- package/dist/chunks/hooks-C53Dp0pr.js +1 -35
- package/dist/chunks/i18n-B0kCsIjc.js +2 -0
- package/dist/chunks/index-COeA2QcQ.js +15 -0
- package/dist/chunks/katex-WjrodtTU.js +1 -71
- package/dist/chunks/locale-DWpIJ_9X.js +1 -0
- package/dist/chunks/mind-map-controller-Ce76mETT.js +1 -0
- package/dist/chunks/mind-map-delete-CVsxdXfs.js +1 -31
- package/dist/chunks/mind-map-input-CEWRz_t6.js +1 -43
- package/dist/chunks/mind-topic-text-Bn1waxff.js +31 -0
- package/dist/chunks/popover-placement-D3xVYdkt.js +1 -47
- package/dist/chunks/worksheet-engine-c84sdD4N.js +1 -0
- package/dist/chunks/worksheet-preview-DsDVWxIM.js +1 -129
- package/dist/document/viewer.js +30 -289
- package/dist/document.js +120 -3811
- package/dist/export/json.js +1 -5
- package/dist/export/markdown.js +1 -2
- package/dist/export/mindmap.js +1 -2
- package/dist/export/pdf.js +1 -6
- package/dist/export/word.js +1 -2
- package/dist/export.js +1 -2
- package/dist/i18n.js +1 -0
- package/dist/index.js +1 -8
- package/dist/locales/en-US.js +1 -0
- package/dist/locales/es-ES.js +1 -0
- package/dist/locales/ja-JP.js +1 -0
- package/dist/locales/ko-KR.js +1 -0
- package/dist/locales/zh-CN.js +1 -0
- package/dist/locales/zh-TW.js +1 -0
- package/dist/mindmap/viewer.js +1 -6
- package/dist/mindmap.js +3 -123
- package/dist/shared.js +1 -52
- package/dist/spreadsheet/viewer.js +1 -5
- package/dist/spreadsheet/xlsx.js +1 -299
- package/dist/spreadsheet.js +2 -120
- package/dist/styles/callout.css +1 -34
- package/dist/styles/code-block.css +1 -58
- package/dist/styles/content-style.css +1 -619
- package/dist/styles/content-tokens.css +1 -29
- package/dist/styles/editor-interaction.css +1 -621
- package/dist/styles/file-video.css +1 -12
- package/dist/styles/image-preview.css +1 -103
- package/dist/styles/mind-map-block.css +1 -14
- package/dist/styles/mind-map-canvas.css +1 -80
- package/dist/styles/mind-map-comments.css +1 -93
- package/dist/styles/mind-map-details.css +1 -7
- package/dist/styles/mind-map-preview.css +1 -7
- package/dist/styles/mind-map-topic.css +1 -112
- package/dist/styles/page-picker.css +1 -47
- package/dist/styles/renderer.css +1 -45
- package/dist/styles/spreadsheet-editor.css +1 -3
- package/dist/styles/tokens.css +1 -142
- package/dist/styles/video-dialog.css +1 -41
- package/dist/styles/video-embed.css +1 -35
- package/dist/styles.css +1 -2655
- package/dist/types/editor/BlockAffordance.d.ts +5 -2
- package/dist/types/editor/CalloutView.d.ts +2 -1
- package/dist/types/editor/ImagePreview.d.ts +1 -1
- package/dist/types/editor/PagePicker.d.ts +1 -1
- package/dist/types/editor/extensions.d.ts +4 -1
- package/dist/types/engine/editor/block-commands.d.ts +1 -1
- package/dist/types/engine/editor/block-menu-hover.d.ts +16 -0
- package/dist/types/engine/editor/extensions/locale.d.ts +3 -0
- package/dist/types/engine/editor/nodes/image-nodeview.d.ts +1 -1
- package/dist/types/engine/host.d.ts +60 -2
- package/dist/types/engine/renderer/attachments.d.ts +3 -3
- package/dist/types/engine/shared/video-feedback.d.ts +1 -1
- package/dist/types/engine/worksheets/worksheet-engine.d.ts +1 -0
- package/dist/types/engine/worksheets/worksheet-xlsx.d.ts +6 -1
- package/dist/types/host-types.d.ts +2 -60
- package/dist/types/host.d.ts +8 -1
- package/dist/types/i18n.d.ts +3 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locales/en-US.d.ts +1 -0
- package/dist/types/locales/es-ES.d.ts +1 -0
- package/dist/types/locales/ja-JP.d.ts +1 -0
- package/dist/types/locales/ko-KR.d.ts +1 -0
- package/dist/types/locales/zh-CN.d.ts +1 -0
- package/dist/types/locales/zh-TW.d.ts +1 -0
- package/dist/types/spreadsheet/xlsx.d.ts +1 -1
- package/dist/types/wui/Dropdown.d.ts +2 -1
- package/dist/types/wui/index.d.ts +2 -1
- package/integrity.json +3135 -0
- package/package.json +15 -5
- package/verify-integrity.mjs +138 -0
- package/dist/chunks/AnchoredPanel-Cv4RURwF.js +0 -68
- package/dist/chunks/DocumentExportMenu-BrGipZ59.js +0 -75
- package/dist/chunks/MindMapCanvas-tkFBBs4g.js +0 -2090
- package/dist/chunks/MindMapViewer-DJrryb2Y.js +0 -180
- package/dist/chunks/SpreadsheetViewer-DxCxIUx_.js +0 -163
- package/dist/chunks/comment-hint-B9qcrqvn.js +0 -296
- package/dist/chunks/extensions-ByORRoRa.js +0 -4210
- package/dist/chunks/host-C-V688Rq.js +0 -197
- package/dist/chunks/index-DdfMnva8.js +0 -726
- package/dist/chunks/mind-map-controller-B6SxK3GZ.js +0 -479
- package/dist/chunks/mind-topic-text-DSyb95vL.js +0 -446
- package/dist/chunks/nodes-iKqTGr_N.js +0 -291
- package/dist/chunks/worksheet-engine-TJ54m0KC.js +0 -125
- package/third-party-notices/wendang-export@0.6.0-NOTICE.md.txt +0 -51
- package/third-party-notices/wendang-export@0.6.1-LICENSE.txt +0 -21
- package/third-party-notices/wendang-export@0.6.2-LICENSE.txt +0 -21
- package/third-party-notices/wendang-export@0.6.2-NOTICE.md.txt +0 -70
- /package/third-party-notices/{wendang-export@0.6.0-LICENSE.txt → wendang-export@0.6.3-LICENSE.txt} +0 -0
- /package/third-party-notices/{wendang-export@0.6.1-NOTICE.md.txt → wendang-export@0.6.3-NOTICE.md.txt} +0 -0
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Node, mergeAttributes, Mark } from "@tiptap/core";
|
|
3
|
-
import { documentColorAttributes, paletteColor, TEXT_COLORS, HIGHLIGHT_COLORS } from "wendang/internal/document-colors";
|
|
4
|
-
import { Slice, Fragment } from "@tiptap/pm/model";
|
|
5
|
-
import { Plugin } from "@tiptap/pm/state";
|
|
6
|
-
import { MIND_MAP_VERSION, mindMapId } from "wendang/internal/mind-map";
|
|
7
|
-
import { normalizeVideoEmbed, videoSourceUrl } from "wendang/internal/video-embed";
|
|
8
|
-
import { effectiveCallout, calloutDOMAttributes, validCalloutAttrs, CALLOUT_TONES } from "wendang/shared";
|
|
9
|
-
const MindMapTopic = Node.create({
|
|
10
|
-
name: "mindMapTopic",
|
|
11
|
-
content: "text* mindMapDescription? mindMapNote?",
|
|
12
|
-
marks: "bold italic strike textStyle highlight link",
|
|
13
|
-
defining: true,
|
|
14
|
-
addAttributes() {
|
|
15
|
-
return {
|
|
16
|
-
id: { default: "", parseHTML: (el) => el.getAttribute("data-topic-id") },
|
|
17
|
-
parentId: { default: "", parseHTML: (el) => el.getAttribute("data-parent-id") },
|
|
18
|
-
order: { default: 0, parseHTML: (el) => Number(el.getAttribute("data-order")) || 0 },
|
|
19
|
-
...Object.fromEntries(["shape", "color", "background", "fontSize", "align", "icon", "done", "attachmentId", "side"].map((key) => [key, { default: null, parseHTML: (el) => {
|
|
20
|
-
try {
|
|
21
|
-
return JSON.parse(el.getAttribute("data-topic-meta") || "{}")[key] ?? null;
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
} }]))
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
parseHTML() {
|
|
29
|
-
return [{ tag: "div[data-mind-topic]" }];
|
|
30
|
-
},
|
|
31
|
-
renderHTML({ node }) {
|
|
32
|
-
return ["div", {
|
|
33
|
-
"data-mind-topic": "",
|
|
34
|
-
"data-topic-id": node.attrs.id,
|
|
35
|
-
"data-parent-id": node.attrs.parentId,
|
|
36
|
-
"data-order": node.attrs.order,
|
|
37
|
-
"data-topic-meta": JSON.stringify(node.attrs)
|
|
38
|
-
}, 0];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const MindMap$1 = Node.create({
|
|
42
|
-
name: "mindMap",
|
|
43
|
-
group: "block",
|
|
44
|
-
content: "mindMapTopic+ mindMapRelation*",
|
|
45
|
-
atom: true,
|
|
46
|
-
isolating: true,
|
|
47
|
-
defining: true,
|
|
48
|
-
addStorage() {
|
|
49
|
-
return { composing: 0 };
|
|
50
|
-
},
|
|
51
|
-
addAttributes() {
|
|
52
|
-
return {
|
|
53
|
-
id: { default: "", parseHTML: (el) => el.getAttribute("data-map-id") },
|
|
54
|
-
rootId: { default: "", parseHTML: (el) => el.getAttribute("data-root-id") },
|
|
55
|
-
formatVersion: { default: MIND_MAP_VERSION, parseHTML: (el) => Number(el.getAttribute("data-format-version")) || 1 },
|
|
56
|
-
branchStyle: { default: "curve", parseHTML: (el) => el.getAttribute("data-branch-style") || "curve" },
|
|
57
|
-
layout: { default: "right", parseHTML: (el) => el.getAttribute("data-layout") || "right" },
|
|
58
|
-
theme: { default: "blue", parseHTML: (el) => el.getAttribute("data-theme") || "blue" },
|
|
59
|
-
height: { default: 380, parseHTML: (el) => Number(el.getAttribute("data-height")) || 380 }
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
parseHTML() {
|
|
63
|
-
return [{ tag: "div[data-mind-map]" }];
|
|
64
|
-
},
|
|
65
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
66
|
-
return ["div", mergeAttributes(HTMLAttributes, {
|
|
67
|
-
// 与 nodeView 保持同一份"自带视觉身份"声明(见 addNodeView 的说明)
|
|
68
|
-
"data-block-chrome": "",
|
|
69
|
-
"data-mind-map": "",
|
|
70
|
-
"data-map-id": node.attrs.id,
|
|
71
|
-
"data-root-id": node.attrs.rootId,
|
|
72
|
-
"data-format-version": node.attrs.formatVersion,
|
|
73
|
-
"data-layout": node.attrs.layout,
|
|
74
|
-
"data-theme": node.attrs.theme,
|
|
75
|
-
"data-height": node.attrs.height,
|
|
76
|
-
"data-branch-style": node.attrs.branchStyle
|
|
77
|
-
}), 0];
|
|
78
|
-
},
|
|
79
|
-
addProseMirrorPlugins() {
|
|
80
|
-
return [new Plugin({
|
|
81
|
-
props: {
|
|
82
|
-
transformPasted(slice) {
|
|
83
|
-
const clone = (fragment) => {
|
|
84
|
-
const nodes = [];
|
|
85
|
-
fragment.forEach((n) => {
|
|
86
|
-
if (n.type.name === "mindMap") {
|
|
87
|
-
const ids = /* @__PURE__ */ new Map();
|
|
88
|
-
n.forEach((t) => {
|
|
89
|
-
if (t.type.name === "mindMapTopic") ids.set(t.attrs.id, mindMapId());
|
|
90
|
-
});
|
|
91
|
-
const topics = [];
|
|
92
|
-
n.forEach((t) => topics.push(t.type.create({
|
|
93
|
-
...t.attrs,
|
|
94
|
-
id: ids.get(t.attrs.id) ?? mindMapId(),
|
|
95
|
-
...t.type.name === "mindMapRelation" ? { source: ids.get(t.attrs.source), target: ids.get(t.attrs.target) } : { parentId: ids.get(t.attrs.parentId) ?? "" }
|
|
96
|
-
}, t.content)));
|
|
97
|
-
nodes.push(n.type.create({ ...n.attrs, id: mindMapId(), rootId: ids.get(n.attrs.rootId) }, topics));
|
|
98
|
-
} else nodes.push(n.copy(clone(n.content)));
|
|
99
|
-
});
|
|
100
|
-
return Fragment.from(nodes);
|
|
101
|
-
};
|
|
102
|
-
return new Slice(clone(slice.content), slice.openStart, slice.openEnd);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
})];
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const MindMapDescription = Node.create({
|
|
109
|
-
name: "mindMapDescription",
|
|
110
|
-
inline: true,
|
|
111
|
-
content: "text*",
|
|
112
|
-
marks: "",
|
|
113
|
-
selectable: false,
|
|
114
|
-
parseHTML() {
|
|
115
|
-
return [{ tag: "span[data-mind-description]" }];
|
|
116
|
-
},
|
|
117
|
-
renderHTML() {
|
|
118
|
-
return ["span", { "data-mind-description": "" }, 0];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const MindMapNote = MindMapDescription.extend({
|
|
122
|
-
name: "mindMapNote",
|
|
123
|
-
parseHTML() {
|
|
124
|
-
return [{ tag: "span[data-mind-note]" }];
|
|
125
|
-
},
|
|
126
|
-
renderHTML() {
|
|
127
|
-
return ["span", { "data-mind-note": "" }, 0];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
const MindMapRelation = Node.create({
|
|
131
|
-
name: "mindMapRelation",
|
|
132
|
-
atom: true,
|
|
133
|
-
addAttributes() {
|
|
134
|
-
return Object.fromEntries(["id", "source", "target", "kind", "label"].map((key) => [key, { default: "", parseHTML: (el) => el.getAttribute(`data-${key}`) || "" }]));
|
|
135
|
-
},
|
|
136
|
-
parseHTML() {
|
|
137
|
-
return [{ tag: "span[data-mind-relation]" }];
|
|
138
|
-
},
|
|
139
|
-
renderHTML({ node }) {
|
|
140
|
-
return ["span", { "data-mind-relation": "", ...Object.fromEntries(Object.entries(node.attrs).map(([k, v]) => [`data-${k}`, v])) }];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
const VideoEmbed$1 = Node.create({
|
|
144
|
-
name: "videoEmbed",
|
|
145
|
-
group: "block",
|
|
146
|
-
atom: true,
|
|
147
|
-
selectable: true,
|
|
148
|
-
draggable: false,
|
|
149
|
-
addAttributes() {
|
|
150
|
-
return {
|
|
151
|
-
provider: { default: null, parseHTML: (el) => el.getAttribute("data-provider") },
|
|
152
|
-
videoId: { default: "", parseHTML: (el) => el.getAttribute("data-video-id") },
|
|
153
|
-
page: { default: 1, parseHTML: (el) => Number(el.getAttribute("data-page") ?? 1) },
|
|
154
|
-
startSeconds: { default: 0, parseHTML: (el) => Number(el.getAttribute("data-start-seconds") ?? 0) }
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
parseHTML() {
|
|
158
|
-
return [{ tag: "div[data-video-embed]" }];
|
|
159
|
-
},
|
|
160
|
-
renderHTML({ node }) {
|
|
161
|
-
const data = normalizeVideoEmbed(node.attrs);
|
|
162
|
-
return [
|
|
163
|
-
"div",
|
|
164
|
-
mergeAttributes({
|
|
165
|
-
"data-video-embed": "true",
|
|
166
|
-
// 视频卡片自带边框与播放器外观:块选中只加外圈
|
|
167
|
-
"data-block-chrome": "",
|
|
168
|
-
"data-provider": data == null ? void 0 : data.provider,
|
|
169
|
-
"data-video-id": data == null ? void 0 : data.videoId,
|
|
170
|
-
"data-page": data == null ? void 0 : data.page,
|
|
171
|
-
"data-start-seconds": data == null ? void 0 : data.startSeconds
|
|
172
|
-
}),
|
|
173
|
-
data ? videoSourceUrl(data) : "视频地址无效"
|
|
174
|
-
];
|
|
175
|
-
},
|
|
176
|
-
renderText({ node }) {
|
|
177
|
-
const data = normalizeVideoEmbed(node.attrs);
|
|
178
|
-
return data ? videoSourceUrl(data) : "视频地址无效";
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
const TextStyle = Mark.create({
|
|
182
|
-
name: "textStyle",
|
|
183
|
-
// 颜色是"附加样式",不应与其它标记互斥
|
|
184
|
-
inclusive: true,
|
|
185
|
-
addAttributes() {
|
|
186
|
-
return {
|
|
187
|
-
color: {
|
|
188
|
-
default: null,
|
|
189
|
-
parseHTML: (el) => {
|
|
190
|
-
const v = el.getAttribute("data-color") ?? el.style.color;
|
|
191
|
-
return paletteColor(v, TEXT_COLORS);
|
|
192
|
-
},
|
|
193
|
-
renderHTML: (attrs) => documentColorAttributes("text", attrs.color)
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
parseHTML() {
|
|
198
|
-
return [{ tag: "span[data-text-color]" }];
|
|
199
|
-
},
|
|
200
|
-
renderHTML({ HTMLAttributes }) {
|
|
201
|
-
return [
|
|
202
|
-
"span",
|
|
203
|
-
mergeAttributes(HTMLAttributes, { "data-text-color": "true" }),
|
|
204
|
-
0
|
|
205
|
-
];
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
const Highlight = Mark.create({
|
|
209
|
-
name: "highlight",
|
|
210
|
-
inclusive: true,
|
|
211
|
-
addAttributes() {
|
|
212
|
-
return {
|
|
213
|
-
color: {
|
|
214
|
-
default: null,
|
|
215
|
-
parseHTML: (el) => {
|
|
216
|
-
const v = el.getAttribute("data-color") ?? el.style.backgroundColor;
|
|
217
|
-
return paletteColor(v, HIGHLIGHT_COLORS);
|
|
218
|
-
},
|
|
219
|
-
renderHTML: (attrs) => documentColorAttributes("highlight", attrs.color)
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
},
|
|
223
|
-
parseHTML() {
|
|
224
|
-
return [{ tag: "mark[data-highlight]" }];
|
|
225
|
-
},
|
|
226
|
-
renderHTML({ HTMLAttributes }) {
|
|
227
|
-
return [
|
|
228
|
-
"mark",
|
|
229
|
-
mergeAttributes(HTMLAttributes, { "data-highlight": "true" }),
|
|
230
|
-
0
|
|
231
|
-
];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
const Callout = Node.create({
|
|
235
|
-
name: "callout",
|
|
236
|
-
group: "block",
|
|
237
|
-
content: "block+",
|
|
238
|
-
defining: true,
|
|
239
|
-
addOptions: () => ({ renderer: void 0 }),
|
|
240
|
-
addAttributes() {
|
|
241
|
-
return {
|
|
242
|
-
tone: { default: "info", parseHTML: (el) => {
|
|
243
|
-
const tone = el.getAttribute("data-tone");
|
|
244
|
-
return CALLOUT_TONES.includes(tone) ? tone : "info";
|
|
245
|
-
} },
|
|
246
|
-
...Object.fromEntries(["icon", "textColor", "borderColor", "backgroundColor"].map((key) => [key, {
|
|
247
|
-
default: null,
|
|
248
|
-
parseHTML: (el) => {
|
|
249
|
-
const value = el.getAttribute(`data-callout-${key.toLowerCase()}`);
|
|
250
|
-
return value !== null && validCalloutAttrs({ [key]: value }) ? value : null;
|
|
251
|
-
}
|
|
252
|
-
}]))
|
|
253
|
-
};
|
|
254
|
-
},
|
|
255
|
-
parseHTML: () => [{ tag: "div[data-callout]", contentElement: (el) => el.querySelector("[data-callout-content]") ?? el }],
|
|
256
|
-
renderHTML: ({ node }) => {
|
|
257
|
-
const { icon } = effectiveCallout(node.attrs);
|
|
258
|
-
return [
|
|
259
|
-
"div",
|
|
260
|
-
{ ...calloutDOMAttributes(node.attrs), class: "doc-callout" },
|
|
261
|
-
...icon ? [["span", { class: "callout-icon", contenteditable: "false", "data-callout-decoration": "true" }, icon]] : [],
|
|
262
|
-
["div", { class: "doc-callout-content", "data-callout-content": "true" }, 0]
|
|
263
|
-
];
|
|
264
|
-
},
|
|
265
|
-
addNodeView() {
|
|
266
|
-
return this.options.renderer ?? null;
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
const MindMap = MindMap$1.extend({
|
|
270
|
-
addOptions: () => ({ renderer: void 0 }),
|
|
271
|
-
addNodeView() {
|
|
272
|
-
return this.options.renderer ?? null;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
const VideoEmbed = VideoEmbed$1.extend({
|
|
276
|
-
addOptions: () => ({ renderer: void 0 }),
|
|
277
|
-
addNodeView() {
|
|
278
|
-
return this.options.renderer ?? null;
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
export {
|
|
282
|
-
Callout as C,
|
|
283
|
-
Highlight as H,
|
|
284
|
-
MindMap as M,
|
|
285
|
-
TextStyle as T,
|
|
286
|
-
VideoEmbed as V,
|
|
287
|
-
MindMapTopic as a,
|
|
288
|
-
MindMapDescription as b,
|
|
289
|
-
MindMapNote as c,
|
|
290
|
-
MindMapRelation as d
|
|
291
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createUniver, LocaleType, mergeLocales, CommandType } from "@univerjs/presets";
|
|
3
|
-
import { UniverSheetsCorePreset } from "@univerjs/preset-sheets-core";
|
|
4
|
-
import coreZhCN from "@univerjs/preset-sheets-core/locales/zh-CN";
|
|
5
|
-
import { UniverSheetsFilterPreset } from "@univerjs/preset-sheets-filter";
|
|
6
|
-
import filterZhCN from "@univerjs/preset-sheets-filter/locales/zh-CN";
|
|
7
|
-
import { UniverSheetsSortPreset } from "@univerjs/preset-sheets-sort";
|
|
8
|
-
import sortZhCN from "@univerjs/preset-sheets-sort/locales/zh-CN";
|
|
9
|
-
import "@univerjs/preset-sheets-core/lib/index.css";
|
|
10
|
-
import "@univerjs/preset-sheets-filter/lib/index.css";
|
|
11
|
-
import "@univerjs/preset-sheets-sort/lib/index.css";
|
|
12
|
-
import { sanitizeNonFiniteNumbers } from "wendang/internal/workbook";
|
|
13
|
-
function snapshotWorkbook(saved) {
|
|
14
|
-
const { value, dropped } = sanitizeNonFiniteNumbers(saved);
|
|
15
|
-
if (dropped.length) {
|
|
16
|
-
const contentLoss = dropped.filter((path) => path.includes(".cellData."));
|
|
17
|
-
console.warn(
|
|
18
|
-
`[wendang] 工作表快照含 ${dropped.length} 处非有限数值,已清洗(内容字段 ${contentLoss.length} 处)`,
|
|
19
|
-
dropped.slice(0, 10)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
function editKey(doc) {
|
|
25
|
-
return JSON.stringify(doc, (key, value) => {
|
|
26
|
-
if (key === "cellData") {
|
|
27
|
-
return Object.fromEntries(Object.entries(value ?? {}).map(([r, row]) => [
|
|
28
|
-
r,
|
|
29
|
-
Object.fromEntries(Object.entries(row).map(([c, raw]) => {
|
|
30
|
-
const cell = raw;
|
|
31
|
-
if (!(cell == null ? void 0 : cell.f)) return [c, cell];
|
|
32
|
-
const { v: _v, t: _t, ...input } = cell;
|
|
33
|
-
return [c, input];
|
|
34
|
-
}))
|
|
35
|
-
]));
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function createWorksheetEngine(container, initial, onChange, options = {}) {
|
|
41
|
-
const { univer, univerAPI } = createUniver({
|
|
42
|
-
locale: LocaleType.ZH_CN,
|
|
43
|
-
darkMode: options.theme === "dark",
|
|
44
|
-
locales: { [LocaleType.ZH_CN]: mergeLocales(coreZhCN, filterZhCN, sortZhCN) },
|
|
45
|
-
presets: [UniverSheetsCorePreset({
|
|
46
|
-
container,
|
|
47
|
-
header: true,
|
|
48
|
-
ribbonType: "collapsed",
|
|
49
|
-
footer: { statisticBar: false, zoomSlider: false }
|
|
50
|
-
}), UniverSheetsFilterPreset(), UniverSheetsSortPreset()]
|
|
51
|
-
});
|
|
52
|
-
let book;
|
|
53
|
-
try {
|
|
54
|
-
book = univerAPI.createWorkbook(initial.workbook);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
univer.dispose();
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
let cached = null;
|
|
60
|
-
const snapshot = () => cached ?? (cached = {
|
|
61
|
-
type: "workbook",
|
|
62
|
-
formatVersion: 1,
|
|
63
|
-
workbook: snapshotWorkbook(book.save())
|
|
64
|
-
});
|
|
65
|
-
let lastKey = editKey(snapshot());
|
|
66
|
-
let replacing = false;
|
|
67
|
-
let editing = false;
|
|
68
|
-
const startEdit = univerAPI.addEvent(univerAPI.Event.SheetEditStarted, () => {
|
|
69
|
-
editing = true;
|
|
70
|
-
});
|
|
71
|
-
const endEdit = univerAPI.addEvent(univerAPI.Event.SheetEditEnded, () => {
|
|
72
|
-
editing = false;
|
|
73
|
-
});
|
|
74
|
-
const subscription = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
|
|
75
|
-
if (event.type !== CommandType.MUTATION) return;
|
|
76
|
-
cached = null;
|
|
77
|
-
if (replacing || event.id.startsWith("formula.")) return;
|
|
78
|
-
const nextKey = editKey(snapshot());
|
|
79
|
-
if (nextKey !== lastKey) {
|
|
80
|
-
lastKey = nextKey;
|
|
81
|
-
onChange();
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
snapshot,
|
|
86
|
-
setEditable: (editable) => book.setEditable(editable),
|
|
87
|
-
setTheme: (theme) => univerAPI.toggleDarkMode(theme === "dark"),
|
|
88
|
-
isEditing: () => editing,
|
|
89
|
-
async finishEditing() {
|
|
90
|
-
await book.endEditingAsync(true);
|
|
91
|
-
await univerAPI.getFormula().onCalculationResultApplied(15e3);
|
|
92
|
-
cached = null;
|
|
93
|
-
},
|
|
94
|
-
async settleCalculation() {
|
|
95
|
-
await univerAPI.getFormula().onCalculationResultApplied(15e3);
|
|
96
|
-
cached = null;
|
|
97
|
-
},
|
|
98
|
-
replace(doc) {
|
|
99
|
-
replacing = true;
|
|
100
|
-
const previous = snapshot();
|
|
101
|
-
try {
|
|
102
|
-
univerAPI.disposeUnit(book.getId());
|
|
103
|
-
book = univerAPI.createWorkbook(doc.workbook);
|
|
104
|
-
cached = null;
|
|
105
|
-
lastKey = editKey(snapshot());
|
|
106
|
-
} catch (error) {
|
|
107
|
-
book = univerAPI.createWorkbook(previous.workbook);
|
|
108
|
-
cached = null;
|
|
109
|
-
lastKey = editKey(snapshot());
|
|
110
|
-
throw error;
|
|
111
|
-
} finally {
|
|
112
|
-
replacing = false;
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
dispose() {
|
|
116
|
-
subscription.dispose();
|
|
117
|
-
startEdit.dispose();
|
|
118
|
-
endEdit.dispose();
|
|
119
|
-
univer.dispose();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export {
|
|
124
|
-
createWorksheetEngine
|
|
125
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Third-party notices
|
|
2
|
-
|
|
3
|
-
Generated from the installed runtime dependency graph; package licenses remain unchanged.
|
|
4
|
-
Wendang is licensed under the MIT License; see LICENSE. Third-party components retain their own licenses.
|
|
5
|
-
|
|
6
|
-
| Package | Version | Declared license | Included upstream notice |
|
|
7
|
-
| --- | --- | --- | --- |
|
|
8
|
-
| @noble/ciphers | 1.3.0 | MIT | LICENSE |
|
|
9
|
-
| @noble/hashes | 1.8.0 | MIT | LICENSE |
|
|
10
|
-
| @pdf-lib/standard-fonts | 1.0.0 | MIT | LICENSE.md |
|
|
11
|
-
| @pdf-lib/upng | 1.0.1 | MIT | LICENSE |
|
|
12
|
-
| @swc/helpers | 0.5.23 | Apache-2.0 | LICENSE |
|
|
13
|
-
| @types/node | 26.6.2 | MIT | LICENSE |
|
|
14
|
-
| base64-js | 0.0.8 | MIT | LICENSE.MIT |
|
|
15
|
-
| base64-js | 1.5.1 | MIT | LICENSE |
|
|
16
|
-
| brotli | 1.3.3 | MIT | Inspect upstream package |
|
|
17
|
-
| clone | 2.1.2 | MIT | LICENSE |
|
|
18
|
-
| core-util-is | 1.0.3 | MIT | LICENSE |
|
|
19
|
-
| dfa | 1.2.0 | MIT | Inspect upstream package |
|
|
20
|
-
| docx | 9.15.0 | MIT | LICENSE |
|
|
21
|
-
| fast-deep-equal | 3.1.3 | MIT | LICENSE |
|
|
22
|
-
| fflate | 0.8.3 | MIT | LICENSE |
|
|
23
|
-
| fontkit | 2.0.4 | MIT | Inspect upstream package |
|
|
24
|
-
| immediate | 3.0.6 | MIT | LICENSE.txt |
|
|
25
|
-
| inherits | 2.0.4 | ISC | LICENSE |
|
|
26
|
-
| isarray | 1.0.0 | MIT | Inspect upstream package |
|
|
27
|
-
| jszip | 3.10.2 | (MIT OR GPL-3.0-or-later) | LICENSE.markdown |
|
|
28
|
-
| lie | 3.3.0 | MIT | license.md |
|
|
29
|
-
| linebreak | 1.1.0 | MIT | LICENSE |
|
|
30
|
-
| nanoid | 6.0.2 | MIT | LICENSE |
|
|
31
|
-
| pako | 0.2.9 | MIT | LICENSE |
|
|
32
|
-
| pako | 1.0.11 | (MIT AND Zlib) | LICENSE |
|
|
33
|
-
| pdf-lib | 1.17.1 | MIT | LICENSE.md |
|
|
34
|
-
| pdfkit | 0.20.2 | MIT | LICENSE |
|
|
35
|
-
| pdfmake | 0.3.13 | MIT | LICENSE |
|
|
36
|
-
| png-js | 2.0.0 | See package license | LICENSE |
|
|
37
|
-
| process-nextick-args | 2.0.1 | MIT | license.md |
|
|
38
|
-
| readable-stream | 2.3.8 | MIT | LICENSE |
|
|
39
|
-
| restructure | 3.0.2 | MIT | LICENSE |
|
|
40
|
-
| safe-buffer | 5.1.2 | MIT | LICENSE |
|
|
41
|
-
| sax | 1.6.1 | BlueOak-1.0.0 | LICENSE.md |
|
|
42
|
-
| setimmediate | 1.0.5 | MIT | LICENSE.txt |
|
|
43
|
-
| string_decoder | 1.1.1 | MIT | LICENSE |
|
|
44
|
-
| tiny-inflate | 1.0.3 | MIT | LICENSE |
|
|
45
|
-
| tslib | 1.14.1 | 0BSD | LICENSE.txt |
|
|
46
|
-
| tslib | 2.8.1 | 0BSD | LICENSE.txt |
|
|
47
|
-
| undici-types | 8.9.0 | MIT | LICENSE |
|
|
48
|
-
| unicode-properties | 1.4.1 | MIT | LICENSE |
|
|
49
|
-
| unicode-trie | 2.0.0 | MIT | LICENSE |
|
|
50
|
-
| util-deprecate | 1.0.2 | MIT | LICENSE |
|
|
51
|
-
| xmldoc | 2.0.3 | MIT | LICENSE |
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 ztes
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 ztes
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Third-party notices
|
|
2
|
-
|
|
3
|
-
Generated from the installed runtime dependency graph; package licenses remain unchanged.
|
|
4
|
-
Wendang is licensed under the MIT License; see LICENSE. Third-party components retain their own licenses.
|
|
5
|
-
|
|
6
|
-
| Package | Version | Declared license | Included upstream notice |
|
|
7
|
-
| --- | --- | --- | --- |
|
|
8
|
-
| @mathjax/mathjax-newcm-font | 4.1.3 | Apache-2.0 | Inspect upstream package |
|
|
9
|
-
| @mathjax/mathjax-tex-font | 4.1.3 | Apache-2.0 | Inspect upstream package |
|
|
10
|
-
| @mathjax/src | 4.1.3 | Apache-2.0 | LICENSE |
|
|
11
|
-
| @noble/ciphers | 1.3.0 | MIT | LICENSE |
|
|
12
|
-
| @noble/hashes | 1.8.0 | MIT | LICENSE |
|
|
13
|
-
| @pdf-lib/fontkit | 1.1.1 | MIT | Inspect upstream package |
|
|
14
|
-
| @pdf-lib/standard-fonts | 1.0.0 | MIT | LICENSE.md |
|
|
15
|
-
| @pdf-lib/upng | 1.0.1 | MIT | LICENSE |
|
|
16
|
-
| @swc/helpers | 0.5.23 | Apache-2.0 | LICENSE |
|
|
17
|
-
| @types/node | 26.6.2 | MIT | LICENSE |
|
|
18
|
-
| @xmldom/xmldom | 0.9.12 | MIT | LICENSE |
|
|
19
|
-
| balanced-match | 4.0.4 | MIT | LICENSE.md |
|
|
20
|
-
| base64-js | 0.0.8 | MIT | LICENSE.MIT |
|
|
21
|
-
| base64-js | 1.5.1 | MIT | LICENSE |
|
|
22
|
-
| brace-expansion | 5.0.12 | MIT | LICENSE |
|
|
23
|
-
| brotli | 1.3.3 | MIT | Inspect upstream package |
|
|
24
|
-
| clone | 2.1.2 | MIT | LICENSE |
|
|
25
|
-
| commander | 14.0.3 | MIT | LICENSE |
|
|
26
|
-
| core-util-is | 1.0.3 | MIT | LICENSE |
|
|
27
|
-
| dfa | 1.2.0 | MIT | Inspect upstream package |
|
|
28
|
-
| docx | 9.15.0 | MIT | LICENSE |
|
|
29
|
-
| fast-deep-equal | 3.1.3 | MIT | LICENSE |
|
|
30
|
-
| fflate | 0.8.3 | MIT | LICENSE |
|
|
31
|
-
| fontkit | 2.0.4 | MIT | Inspect upstream package |
|
|
32
|
-
| glob | 13.0.6 | BlueOak-1.0.0 | LICENSE.md |
|
|
33
|
-
| immediate | 3.0.6 | MIT | LICENSE.txt |
|
|
34
|
-
| inherits | 2.0.4 | ISC | LICENSE |
|
|
35
|
-
| isarray | 1.0.0 | MIT | Inspect upstream package |
|
|
36
|
-
| jszip | 3.10.2 | (MIT OR GPL-3.0-or-later) | LICENSE.markdown |
|
|
37
|
-
| lie | 3.3.0 | MIT | license.md |
|
|
38
|
-
| linebreak | 1.1.0 | MIT | LICENSE |
|
|
39
|
-
| lru-cache | 11.5.3 | BlueOak-1.0.0 | LICENSE.md |
|
|
40
|
-
| mhchemparser | 4.2.1 | Apache-2.0 | LICENSE.txt |
|
|
41
|
-
| minimatch | 10.2.6 | BlueOak-1.0.0 | LICENSE.md |
|
|
42
|
-
| minipass | 7.1.3 | BlueOak-1.0.0 | LICENSE.md |
|
|
43
|
-
| mj-context-menu | 1.0.0 | Apache-2.0 | LICENSE |
|
|
44
|
-
| nanoid | 6.0.2 | MIT | LICENSE |
|
|
45
|
-
| package-json-from-dist | 1.0.1 | BlueOak-1.0.0 | LICENSE.md |
|
|
46
|
-
| pako | 0.2.9 | MIT | LICENSE |
|
|
47
|
-
| pako | 1.0.11 | (MIT AND Zlib) | LICENSE |
|
|
48
|
-
| path-scurry | 2.0.2 | BlueOak-1.0.0 | LICENSE.md |
|
|
49
|
-
| pdf-lib | 1.17.1 | MIT | LICENSE.md |
|
|
50
|
-
| pdfkit | 0.20.2 | MIT | LICENSE |
|
|
51
|
-
| pdfmake | 0.3.13 | MIT | LICENSE |
|
|
52
|
-
| png-js | 2.0.0 | See package license | LICENSE |
|
|
53
|
-
| process-nextick-args | 2.0.1 | MIT | license.md |
|
|
54
|
-
| readable-stream | 2.3.8 | MIT | LICENSE |
|
|
55
|
-
| restructure | 3.0.2 | MIT | LICENSE |
|
|
56
|
-
| rimraf | 6.1.3 | BlueOak-1.0.0 | LICENSE.md |
|
|
57
|
-
| safe-buffer | 5.1.2 | MIT | LICENSE |
|
|
58
|
-
| sax | 1.6.1 | BlueOak-1.0.0 | LICENSE.md |
|
|
59
|
-
| setimmediate | 1.0.5 | MIT | LICENSE.txt |
|
|
60
|
-
| speech-rule-engine | 5.0.0-rc.4 | Apache-2.0 | LICENSE |
|
|
61
|
-
| string_decoder | 1.1.1 | MIT | LICENSE |
|
|
62
|
-
| tiny-inflate | 1.0.3 | MIT | LICENSE |
|
|
63
|
-
| tslib | 1.14.1 | 0BSD | LICENSE.txt |
|
|
64
|
-
| tslib | 2.8.1 | 0BSD | LICENSE.txt |
|
|
65
|
-
| undici-types | 8.9.0 | MIT | LICENSE |
|
|
66
|
-
| unicode-properties | 1.4.1 | MIT | LICENSE |
|
|
67
|
-
| unicode-trie | 2.0.0 | MIT | LICENSE |
|
|
68
|
-
| util-deprecate | 1.0.2 | MIT | LICENSE |
|
|
69
|
-
| wicked-good-xpath | 1.3.0 | MIT | LICENSE |
|
|
70
|
-
| xmldoc | 2.0.3 | MIT | LICENSE |
|
/package/third-party-notices/{wendang-export@0.6.0-LICENSE.txt → wendang-export@0.6.3-LICENSE.txt}
RENAMED
|
File without changes
|
|
File without changes
|