@harbour-enterprises/superdoc 0.28.0 → 0.28.2
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/chunks/{PdfViewer-COOBTu0Z.es.js → PdfViewer-DpWYWlWj.es.js} +1 -1
- package/dist/chunks/{PdfViewer-D-d9sxeo.cjs → PdfViewer-lAbA0-lT.cjs} +1 -1
- package/dist/chunks/default-BS6z0SoE-BS6z0SoE.es.js +5 -0
- package/dist/chunks/default-BS6z0SoE-Gl4f7Y7J.cjs +4 -0
- package/dist/chunks/{index-lzF76amP.cjs → index-ByVhw_G0.cjs} +3 -3
- package/dist/chunks/index-CHAKf7mX-C5aFF6Zl.es.js +2213 -0
- package/dist/chunks/index-CHAKf7mX-Dx-DOGGJ.cjs +2213 -0
- package/dist/chunks/index-CSaZZzfe-BzemjgYL.cjs +264 -0
- package/dist/chunks/index-CSaZZzfe-CSaZZzfe.es.js +265 -0
- package/dist/chunks/index-C_x_N6Uh-DJn8hIEt.es.js +2200 -0
- package/dist/chunks/index-C_x_N6Uh-Db3CUJMX.cjs +2200 -0
- package/dist/chunks/index-Cd3D_8gF-CFhMnajQ.es.js +862 -0
- package/dist/chunks/index-Cd3D_8gF-DKJ_wTu_.cjs +861 -0
- package/dist/chunks/index-CvBqQJbG-CvBqQJbG.es.js +878 -0
- package/dist/chunks/index-CvBqQJbG-Dwm0THD7.cjs +877 -0
- package/dist/chunks/index-DRCvimau-Cw339678.es.js +9876 -0
- package/dist/chunks/index-DRCvimau-H4Ck3S9a.cjs +9876 -0
- package/dist/chunks/index-D_sWOSiG-BtDZzJ6I.cjs +588 -0
- package/dist/chunks/index-D_sWOSiG-DE96TaT5.es.js +588 -0
- package/dist/chunks/{index-CeV3gm4O.es.js → index-Dw2T2UIP.es.js} +3 -3
- package/dist/chunks/index-Dz5_CDAf-B9kc0ArX.es.js +845 -0
- package/dist/chunks/index-Dz5_CDAf-C5D7BTD6.cjs +845 -0
- package/dist/chunks/{super-editor.es-CsOCPht5.cjs → super-editor.es-7iRvcDFc.cjs} +7812 -24984
- package/dist/chunks/{super-editor.es-CBBT9MkW.es.js → super-editor.es-DnZ5Ru-q.es.js} +7903 -25075
- package/dist/core/types/index.d.ts +6 -6
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-3mtRTJOI.js → converter-C5g1OhUM.js} +702 -692
- package/dist/super-editor/chunks/default-BS6z0SoE.js +5 -0
- package/dist/super-editor/chunks/{docx-zipper-DIkBRy6i.js → docx-zipper-D9LLIDXC.js} +1 -1
- package/dist/super-editor/chunks/{editor-DakKNLen.js → editor-CD7hiFDo.js} +4186 -21369
- package/dist/super-editor/chunks/index-CHAKf7mX.js +2213 -0
- package/dist/super-editor/chunks/index-CSaZZzfe.js +265 -0
- package/dist/super-editor/chunks/index-C_x_N6Uh.js +2200 -0
- package/dist/super-editor/chunks/index-Cd3D_8gF.js +862 -0
- package/dist/super-editor/chunks/index-CvBqQJbG.js +878 -0
- package/dist/super-editor/chunks/index-DRCvimau.js +9876 -0
- package/dist/super-editor/chunks/index-D_sWOSiG.js +588 -0
- package/dist/super-editor/chunks/index-Dz5_CDAf.js +845 -0
- package/dist/super-editor/chunks/{toolbar-D4J4zzEp.js → toolbar-BC_z_xMq.js} +2 -2
- package/dist/super-editor/converter.es.js +2 -2
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +2 -2
- package/dist/super-editor/super-editor/src/core/helpers/rangeUtils.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/field-annotation/FieldAnnotationPlugin.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/imagePositionPlugin.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +5 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts +11 -2
- package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +6 -6
- package/dist/super-editor/super-editor.es.js +15 -15
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +75068 -74546
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/images/altText_add.svg +0 -3
- package/dist/images/altText_disclaimer.svg +0 -3
- package/dist/images/altText_done.svg +0 -3
- package/dist/images/altText_spinner.svg +0 -30
- package/dist/images/altText_warning.svg +0 -3
- package/dist/images/annotation-check.svg +0 -11
- package/dist/images/annotation-comment.svg +0 -16
- package/dist/images/annotation-help.svg +0 -26
- package/dist/images/annotation-insert.svg +0 -10
- package/dist/images/annotation-key.svg +0 -11
- package/dist/images/annotation-newparagraph.svg +0 -11
- package/dist/images/annotation-noicon.svg +0 -7
- package/dist/images/annotation-note.svg +0 -42
- package/dist/images/annotation-paperclip.svg +0 -6
- package/dist/images/annotation-paragraph.svg +0 -16
- package/dist/images/annotation-pushpin.svg +0 -7
- package/dist/images/cursor-editorFreeHighlight.svg +0 -6
- package/dist/images/cursor-editorFreeText.svg +0 -3
- package/dist/images/cursor-editorInk.svg +0 -4
- package/dist/images/cursor-editorTextHighlight.svg +0 -8
- package/dist/images/editor-toolbar-delete.svg +0 -5
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/messageBar_closingButton.svg +0 -3
- package/dist/images/messageBar_warning.svg +0 -3
- package/dist/images/toolbarButton-editorHighlight.svg +0 -6
- package/dist/images/toolbarButton-menuArrow.svg +0 -3
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
const convert = (
|
|
2
|
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
3
|
+
/**
|
|
4
|
+
* @type {(
|
|
5
|
+
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
|
6
|
+
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
|
7
|
+
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
|
8
|
+
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
|
9
|
+
* ((test?: Test) => Check)
|
|
10
|
+
* )}
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @param {Test} [test]
|
|
14
|
+
* @returns {Check}
|
|
15
|
+
*/
|
|
16
|
+
(function(test) {
|
|
17
|
+
if (test === null || test === void 0) {
|
|
18
|
+
return ok;
|
|
19
|
+
}
|
|
20
|
+
if (typeof test === "function") {
|
|
21
|
+
return castFactory(test);
|
|
22
|
+
}
|
|
23
|
+
if (typeof test === "object") {
|
|
24
|
+
return Array.isArray(test) ? anyFactory(test) : (
|
|
25
|
+
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
26
|
+
// narrows to `Array`.
|
|
27
|
+
propertiesFactory(
|
|
28
|
+
/** @type {Props} */
|
|
29
|
+
test
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
if (typeof test === "string") {
|
|
34
|
+
return typeFactory(test);
|
|
35
|
+
}
|
|
36
|
+
throw new Error("Expected function, string, or object as test");
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
function anyFactory(tests) {
|
|
40
|
+
const checks = [];
|
|
41
|
+
let index = -1;
|
|
42
|
+
while (++index < tests.length) {
|
|
43
|
+
checks[index] = convert(tests[index]);
|
|
44
|
+
}
|
|
45
|
+
return castFactory(any);
|
|
46
|
+
function any(...parameters) {
|
|
47
|
+
let index2 = -1;
|
|
48
|
+
while (++index2 < checks.length) {
|
|
49
|
+
if (checks[index2].apply(this, parameters)) return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function propertiesFactory(check) {
|
|
55
|
+
const checkAsRecord = (
|
|
56
|
+
/** @type {Record<string, unknown>} */
|
|
57
|
+
check
|
|
58
|
+
);
|
|
59
|
+
return castFactory(all2);
|
|
60
|
+
function all2(node2) {
|
|
61
|
+
const nodeAsRecord = (
|
|
62
|
+
/** @type {Record<string, unknown>} */
|
|
63
|
+
/** @type {unknown} */
|
|
64
|
+
node2
|
|
65
|
+
);
|
|
66
|
+
let key;
|
|
67
|
+
for (key in check) {
|
|
68
|
+
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function typeFactory(check) {
|
|
74
|
+
return castFactory(type);
|
|
75
|
+
function type(node2) {
|
|
76
|
+
return node2 && node2.type === check;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function castFactory(testFunction) {
|
|
80
|
+
return check;
|
|
81
|
+
function check(value, index, parent) {
|
|
82
|
+
return Boolean(
|
|
83
|
+
looksLikeANode(value) && testFunction.call(
|
|
84
|
+
this,
|
|
85
|
+
value,
|
|
86
|
+
typeof index === "number" ? index : void 0,
|
|
87
|
+
parent || void 0
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function ok() {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
function looksLikeANode(value) {
|
|
96
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
97
|
+
}
|
|
98
|
+
function color(d) {
|
|
99
|
+
return d;
|
|
100
|
+
}
|
|
101
|
+
const empty = [];
|
|
102
|
+
const CONTINUE = true;
|
|
103
|
+
const EXIT = false;
|
|
104
|
+
const SKIP = "skip";
|
|
105
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
106
|
+
let check;
|
|
107
|
+
if (typeof test === "function" && typeof visitor !== "function") {
|
|
108
|
+
reverse = visitor;
|
|
109
|
+
visitor = test;
|
|
110
|
+
} else {
|
|
111
|
+
check = test;
|
|
112
|
+
}
|
|
113
|
+
const is = convert(check);
|
|
114
|
+
const step = reverse ? -1 : 1;
|
|
115
|
+
factory(tree, void 0, [])();
|
|
116
|
+
function factory(node2, index, parents) {
|
|
117
|
+
const value = (
|
|
118
|
+
/** @type {Record<string, unknown>} */
|
|
119
|
+
node2 && typeof node2 === "object" ? node2 : {}
|
|
120
|
+
);
|
|
121
|
+
if (typeof value.type === "string") {
|
|
122
|
+
const name = (
|
|
123
|
+
// `hast`
|
|
124
|
+
typeof value.tagName === "string" ? value.tagName : (
|
|
125
|
+
// `xast`
|
|
126
|
+
typeof value.name === "string" ? value.name : void 0
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
Object.defineProperty(visit2, "name", {
|
|
130
|
+
value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return visit2;
|
|
134
|
+
function visit2() {
|
|
135
|
+
let result = empty;
|
|
136
|
+
let subresult;
|
|
137
|
+
let offset;
|
|
138
|
+
let grandparents;
|
|
139
|
+
if (!test || is(node2, index, parents[parents.length - 1] || void 0)) {
|
|
140
|
+
result = toResult(visitor(node2, parents));
|
|
141
|
+
if (result[0] === EXIT) {
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if ("children" in node2 && node2.children) {
|
|
146
|
+
const nodeAsParent = (
|
|
147
|
+
/** @type {UnistParent} */
|
|
148
|
+
node2
|
|
149
|
+
);
|
|
150
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
151
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
152
|
+
grandparents = parents.concat(nodeAsParent);
|
|
153
|
+
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
154
|
+
const child = nodeAsParent.children[offset];
|
|
155
|
+
subresult = factory(child, offset, grandparents)();
|
|
156
|
+
if (subresult[0] === EXIT) {
|
|
157
|
+
return subresult;
|
|
158
|
+
}
|
|
159
|
+
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function toResult(value) {
|
|
168
|
+
if (Array.isArray(value)) {
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
if (typeof value === "number") {
|
|
172
|
+
return [CONTINUE, value];
|
|
173
|
+
}
|
|
174
|
+
return value === null || value === void 0 ? empty : [value];
|
|
175
|
+
}
|
|
176
|
+
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
177
|
+
let reverse;
|
|
178
|
+
let test;
|
|
179
|
+
let visitor;
|
|
180
|
+
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
181
|
+
test = void 0;
|
|
182
|
+
visitor = testOrVisitor;
|
|
183
|
+
reverse = visitorOrReverse;
|
|
184
|
+
} else {
|
|
185
|
+
test = testOrVisitor;
|
|
186
|
+
visitor = visitorOrReverse;
|
|
187
|
+
reverse = maybeReverse;
|
|
188
|
+
}
|
|
189
|
+
visitParents(tree, test, overload, reverse);
|
|
190
|
+
function overload(node2, parents) {
|
|
191
|
+
const parent = parents[parents.length - 1];
|
|
192
|
+
const index = parent ? parent.children.indexOf(node2) : void 0;
|
|
193
|
+
return visitor(node2, index, parent);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const emptyOptions = {};
|
|
197
|
+
function toString(value, options) {
|
|
198
|
+
const settings = emptyOptions;
|
|
199
|
+
const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
|
|
200
|
+
const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
|
|
201
|
+
return one(value, includeImageAlt, includeHtml);
|
|
202
|
+
}
|
|
203
|
+
function one(value, includeImageAlt, includeHtml) {
|
|
204
|
+
if (node(value)) {
|
|
205
|
+
if ("value" in value) {
|
|
206
|
+
return value.type === "html" && !includeHtml ? "" : value.value;
|
|
207
|
+
}
|
|
208
|
+
if (includeImageAlt && "alt" in value && value.alt) {
|
|
209
|
+
return value.alt;
|
|
210
|
+
}
|
|
211
|
+
if ("children" in value) {
|
|
212
|
+
return all(value.children, includeImageAlt, includeHtml);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (Array.isArray(value)) {
|
|
216
|
+
return all(value, includeImageAlt, includeHtml);
|
|
217
|
+
}
|
|
218
|
+
return "";
|
|
219
|
+
}
|
|
220
|
+
function all(values, includeImageAlt, includeHtml) {
|
|
221
|
+
const result = [];
|
|
222
|
+
let index = -1;
|
|
223
|
+
while (++index < values.length) {
|
|
224
|
+
result[index] = one(values[index], includeImageAlt, includeHtml);
|
|
225
|
+
}
|
|
226
|
+
return result.join("");
|
|
227
|
+
}
|
|
228
|
+
function node(value) {
|
|
229
|
+
return Boolean(value && typeof value === "object");
|
|
230
|
+
}
|
|
231
|
+
const phrasing = (
|
|
232
|
+
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
233
|
+
convert([
|
|
234
|
+
"break",
|
|
235
|
+
"delete",
|
|
236
|
+
"emphasis",
|
|
237
|
+
// To do: next major: removed since footnotes were added to GFM.
|
|
238
|
+
"footnote",
|
|
239
|
+
"footnoteReference",
|
|
240
|
+
"image",
|
|
241
|
+
"imageReference",
|
|
242
|
+
"inlineCode",
|
|
243
|
+
// Enabled by `mdast-util-math`:
|
|
244
|
+
"inlineMath",
|
|
245
|
+
"link",
|
|
246
|
+
"linkReference",
|
|
247
|
+
// Enabled by `mdast-util-mdx`:
|
|
248
|
+
"mdxJsxTextElement",
|
|
249
|
+
// Enabled by `mdast-util-mdx`:
|
|
250
|
+
"mdxTextExpression",
|
|
251
|
+
"strong",
|
|
252
|
+
"text",
|
|
253
|
+
// Enabled by `mdast-util-directive`:
|
|
254
|
+
"textDirective"
|
|
255
|
+
])
|
|
256
|
+
);
|
|
257
|
+
export {
|
|
258
|
+
EXIT as E,
|
|
259
|
+
SKIP as S,
|
|
260
|
+
visitParents as a,
|
|
261
|
+
convert as c,
|
|
262
|
+
phrasing as p,
|
|
263
|
+
toString as t,
|
|
264
|
+
visit as v
|
|
265
|
+
};
|