superdoc 2.20.0-next.9 → 2.20.1-next.1
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/README.md +26 -0
- package/dist/chunks/{create-super-doc-ui-B8olYVBF.es.js → create-super-doc-ui-B4_V1haj.es.js} +160 -10
- package/dist/chunks/{create-super-doc-ui-Dc2QEczb.cjs → create-super-doc-ui-DFCfYEpW.cjs} +160 -10
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
- package/dist/layout-engine/contracts/src/index.d.ts +1 -0
- package/dist/layout-engine/layout-bridge/src/index.d.ts +0 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +87 -86
- package/dist/style.layered.css +87 -86
- package/dist/superdoc/src/core/types/index.d.ts +4 -2
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +1 -1
- package/dist/superdoc/src/public/ui/types.d.ts +21 -2
- package/dist/superdoc/src/public/ui.d.cts +4 -0
- package/dist/superdoc/src/public/ui.d.ts +1 -1
- package/dist/superdoc.cjs +73 -19
- package/dist/superdoc.es.js +73 -19
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +38 -38
- package/package.json +2 -2
- package/dist/layout-engine/layout-bridge/src/hydrateTableTextboxMeasures.d.ts +0 -9
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
|
|
3
3
|
const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
|
|
4
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
4
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DFCfYEpW.cjs");
|
|
5
5
|
const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
|
|
6
6
|
const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
|
|
7
7
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CYxINHh_.cjs");
|
|
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
|
|
|
316
316
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
317
317
|
function getSuperdocVersion() {
|
|
318
318
|
try {
|
|
319
|
-
return "2.20.
|
|
319
|
+
return "2.20.1-next.1";
|
|
320
320
|
} catch {
|
|
321
321
|
return "unknown";
|
|
322
322
|
}
|
|
@@ -14327,7 +14327,7 @@ var _sfc_main$34 = {
|
|
|
14327
14327
|
};
|
|
14328
14328
|
}
|
|
14329
14329
|
};
|
|
14330
|
-
var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$34, [["__scopeId", "data-v-
|
|
14330
|
+
var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$34, [["__scopeId", "data-v-bc46ac97"]]);
|
|
14331
14331
|
//#endregion
|
|
14332
14332
|
//#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
|
|
14333
14333
|
var _hoisted_1$26 = [
|
|
@@ -22176,6 +22176,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22176
22176
|
if (!documentId) return;
|
|
22177
22177
|
clearV2CommandShortcutBinding(documentId);
|
|
22178
22178
|
if (typeof bindEditShortcuts !== "function") return;
|
|
22179
|
+
getSuperDocUI();
|
|
22179
22180
|
const openLinkWorkflow = resolveV2LinkWorkflowOpener();
|
|
22180
22181
|
const unbind = bindEditShortcuts({
|
|
22181
22182
|
commandRoute: {
|
|
@@ -24520,7 +24521,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
24520
24521
|
], 38);
|
|
24521
24522
|
};
|
|
24522
24523
|
}
|
|
24523
|
-
}, [["__scopeId", "data-v-
|
|
24524
|
+
}, [["__scopeId", "data-v-e476c448"]]);
|
|
24524
24525
|
//#endregion
|
|
24525
24526
|
//#region src/core/create-app.js
|
|
24526
24527
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -43548,6 +43549,35 @@ var getToolbarItemWidth = (item, controlSizes) => {
|
|
|
43548
43549
|
if (item.type === "separator") return controlSizes.get("separator");
|
|
43549
43550
|
return controlSizes.get(item.name.value) || controlSizes.get("default");
|
|
43550
43551
|
};
|
|
43552
|
+
var collapseSeparatorRun = (items) => {
|
|
43553
|
+
const result = [];
|
|
43554
|
+
for (const item of items) {
|
|
43555
|
+
if (item.type === "separator") {
|
|
43556
|
+
const previous = result[result.length - 1];
|
|
43557
|
+
if (!previous || previous.type === "separator") continue;
|
|
43558
|
+
}
|
|
43559
|
+
result.push(item);
|
|
43560
|
+
}
|
|
43561
|
+
while (result.length && result[result.length - 1].type === "separator") result.pop();
|
|
43562
|
+
return result;
|
|
43563
|
+
};
|
|
43564
|
+
var normalizeSeparators = (items) => {
|
|
43565
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
43566
|
+
for (const item of items) {
|
|
43567
|
+
const group = item.group?.value || "center";
|
|
43568
|
+
if (!byGroup.has(group)) byGroup.set(group, []);
|
|
43569
|
+
byGroup.get(group).push(item);
|
|
43570
|
+
}
|
|
43571
|
+
const kept = /* @__PURE__ */ new Set();
|
|
43572
|
+
for (const groupItems of byGroup.values()) for (const item of collapseSeparatorRun(groupItems)) kept.add(item);
|
|
43573
|
+
return items.filter((item) => kept.has(item));
|
|
43574
|
+
};
|
|
43575
|
+
var normalizeSeparatorsIgnoringOverflow = (items) => {
|
|
43576
|
+
const overflowTrigger = items.find((item) => item.type === "overflow");
|
|
43577
|
+
const withoutOverflow = items.filter((item) => item !== overflowTrigger);
|
|
43578
|
+
const kept = new Set(normalizeSeparators(withoutOverflow));
|
|
43579
|
+
return items.filter((item) => item === overflowTrigger || kept.has(item));
|
|
43580
|
+
};
|
|
43551
43581
|
/**
|
|
43552
43582
|
* Set or clear the link item's `href` without disturbing the rest of its
|
|
43553
43583
|
* attributes. The static configuration (`ariaLabel`, and anything added later)
|
|
@@ -43602,7 +43632,7 @@ function hasAiModule(superToolbar) {
|
|
|
43602
43632
|
function aiModuleConfig(superToolbar) {
|
|
43603
43633
|
return superToolbar.config?.superdoc?.config?.modules?.ai ?? superToolbar.superdoc?.config?.modules?.ai ?? {};
|
|
43604
43634
|
}
|
|
43605
|
-
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43635
|
+
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, configuredItemOrder, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43606
43636
|
const bold = useToolbarItem({
|
|
43607
43637
|
type: "button",
|
|
43608
43638
|
name: "bold",
|
|
@@ -43746,7 +43776,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
43746
43776
|
else fontSize.selectedValue.value = "";
|
|
43747
43777
|
}
|
|
43748
43778
|
});
|
|
43749
|
-
const
|
|
43779
|
+
const createSeparator = () => useToolbarItem({
|
|
43750
43780
|
type: "separator",
|
|
43751
43781
|
name: "separator",
|
|
43752
43782
|
isNarrow: true
|
|
@@ -44656,16 +44686,16 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44656
44686
|
search,
|
|
44657
44687
|
zoom,
|
|
44658
44688
|
fontButton,
|
|
44659
|
-
|
|
44689
|
+
createSeparator(),
|
|
44660
44690
|
fontSize,
|
|
44661
|
-
|
|
44691
|
+
createSeparator(),
|
|
44662
44692
|
bold,
|
|
44663
44693
|
italic,
|
|
44664
44694
|
underline,
|
|
44665
44695
|
strikethrough,
|
|
44666
44696
|
colorButton,
|
|
44667
44697
|
highlight,
|
|
44668
|
-
|
|
44698
|
+
createSeparator(),
|
|
44669
44699
|
link,
|
|
44670
44700
|
image,
|
|
44671
44701
|
...shouldIncludeTableOfContents ? [tableOfContents] : [],
|
|
@@ -44673,16 +44703,16 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44673
44703
|
...superToolbar.config?.showPageNumberButton || configuredItemNames?.has("pageNumber") ? [pageNumber] : [],
|
|
44674
44704
|
tableItem,
|
|
44675
44705
|
tableActionsItem,
|
|
44676
|
-
|
|
44706
|
+
createSeparator(),
|
|
44677
44707
|
alignment,
|
|
44678
44708
|
bulletedList,
|
|
44679
44709
|
numberedList,
|
|
44680
44710
|
indentLeft,
|
|
44681
44711
|
indentRight,
|
|
44682
44712
|
lineHeight,
|
|
44683
|
-
|
|
44713
|
+
createSeparator(),
|
|
44684
44714
|
linkedStyles,
|
|
44685
|
-
|
|
44715
|
+
createSeparator(),
|
|
44686
44716
|
ruler,
|
|
44687
44717
|
measurementUnit,
|
|
44688
44718
|
...shouldIncludeFormattingMarks ? [formattingMarks] : [],
|
|
@@ -44712,9 +44742,15 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44712
44742
|
}
|
|
44713
44743
|
if (configuredItemNames) toolbarItems = toolbarItems.filter((item) => item.name.value === "overflow" || item.isCustomToolbarItem || configuredItemNames.has(item.name.value));
|
|
44714
44744
|
if (excludedItemNames?.size) toolbarItems = toolbarItems.filter((item) => !excludedItemNames.has(item.name.value));
|
|
44745
|
+
toolbarItems = normalizeSeparatorsIgnoringOverflow(toolbarItems);
|
|
44715
44746
|
const isStickyItem = (item) => stickyItemNames.includes(item.name.value);
|
|
44716
44747
|
const overflowTrigger = toolbarItems.find((item) => item.name.value === "overflow");
|
|
44717
44748
|
const layoutItems = toolbarItems.filter((item) => item !== overflowTrigger);
|
|
44749
|
+
if (configuredItemOrder) {
|
|
44750
|
+
const orderIndex = new Map(configuredItemOrder.map((name, index) => [name, index]));
|
|
44751
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
44752
|
+
layoutItems.sort((a, b) => rank(a) - rank(b));
|
|
44753
|
+
}
|
|
44718
44754
|
const partitionItems = (reserveOverflowTrigger) => {
|
|
44719
44755
|
const overflowItems = [];
|
|
44720
44756
|
const visibleItems = [];
|
|
@@ -44756,6 +44792,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44756
44792
|
if (insertAt === -1) visibleItems.push(overflowTrigger);
|
|
44757
44793
|
else visibleItems.splice(insertAt, 0, overflowTrigger);
|
|
44758
44794
|
}
|
|
44795
|
+
visibleItems = normalizeSeparators(visibleItems);
|
|
44759
44796
|
return {
|
|
44760
44797
|
defaultItems: visibleItems,
|
|
44761
44798
|
overflowItems: overflowItems.filter((item) => item.type !== "separator")
|
|
@@ -45162,6 +45199,12 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45162
45199
|
}).filter(Boolean);
|
|
45163
45200
|
const configuredGroups = hasExplicitGroupComposition ? new Set(Object.keys(this.config.groups)) : null;
|
|
45164
45201
|
const layoutCustomItems = configuredGroups ? customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")) : customToolbarItems;
|
|
45202
|
+
let allConfigItems = null;
|
|
45203
|
+
if (hasExplicitGroupComposition) {
|
|
45204
|
+
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45205
|
+
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45206
|
+
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45207
|
+
}
|
|
45165
45208
|
const { defaultItems, overflowItems } = makeDefaultItems({
|
|
45166
45209
|
superToolbar: this,
|
|
45167
45210
|
toolbarIcons: this.config.icons,
|
|
@@ -45172,18 +45215,29 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45172
45215
|
role: this.role,
|
|
45173
45216
|
isDev: this.isDev,
|
|
45174
45217
|
configuredItemNames,
|
|
45218
|
+
configuredItemOrder: allConfigItems,
|
|
45175
45219
|
excludedItemNames,
|
|
45176
45220
|
additionalItems: layoutCustomItems
|
|
45177
45221
|
});
|
|
45178
|
-
|
|
45179
|
-
if (hasExplicitGroupComposition) {
|
|
45180
|
-
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45181
|
-
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45182
|
-
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45183
|
-
}
|
|
45222
|
+
if (!hasExplicitGroupComposition) allConfigItems = [...defaultItems.map((item) => item.name.value), ...overflowItems.map((item) => item.name.value)];
|
|
45184
45223
|
const configuredOverflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value) && !excludedItemNames.has(item.name.value));
|
|
45185
45224
|
const visibleItemNames = configuredOverflowItems.length ? [...allConfigItems, "overflow"] : allConfigItems;
|
|
45186
45225
|
const filteredItems = defaultItems.filter((item) => visibleItemNames.includes(item.name.value)).filter((item) => !excludedItemNames.has(item.name.value));
|
|
45226
|
+
if (hasExplicitGroupComposition) {
|
|
45227
|
+
const orderIndex = new Map(allConfigItems.map((name, index) => [name, index]));
|
|
45228
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
45229
|
+
const overflowTrigger = filteredItems.find((item) => item.name.value === "overflow");
|
|
45230
|
+
const originalIndex = new Map(filteredItems.map((item, index) => [item, index]));
|
|
45231
|
+
const reordered = filteredItems.filter((item) => item !== overflowTrigger);
|
|
45232
|
+
reordered.sort((a, b) => rank(a) - rank(b));
|
|
45233
|
+
if (overflowTrigger) {
|
|
45234
|
+
const triggerOriginalIndex = originalIndex.get(overflowTrigger);
|
|
45235
|
+
const insertAt = reordered.findIndex((item) => originalIndex.get(item) > triggerOriginalIndex);
|
|
45236
|
+
insertAt === -1 ? reordered.push(overflowTrigger) : reordered.splice(insertAt, 0, overflowTrigger);
|
|
45237
|
+
}
|
|
45238
|
+
filteredItems.splice(0, filteredItems.length, ...reordered);
|
|
45239
|
+
configuredOverflowItems.sort((a, b) => rank(a) - rank(b));
|
|
45240
|
+
}
|
|
45187
45241
|
if (hasExplicitGroupComposition) {
|
|
45188
45242
|
for (const [group, names] of Object.entries(this.config.groups)) for (const item of filteredItems) if (names.includes(item.name.value)) item.group.value = group;
|
|
45189
45243
|
}
|
|
@@ -46283,7 +46337,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46283
46337
|
this.config.colors = shuffleArray(this.config.colors);
|
|
46284
46338
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46285
46339
|
this.colorIndex = 0;
|
|
46286
|
-
this.version = "2.20.
|
|
46340
|
+
this.version = "2.20.1-next.1";
|
|
46287
46341
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46288
46342
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
46289
46343
|
this.colors = this.config.colors ?? [];
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
|
|
2
2
|
import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
|
|
3
|
-
import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as recordInteraction, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-
|
|
3
|
+
import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as recordInteraction, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-B4_V1haj.es.js";
|
|
4
4
|
import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
|
|
5
5
|
import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
|
|
6
6
|
import { $ as watch$1, A as onActivated, B as resolveDirective, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRef, H as shallowRef$1, I as reactive, J as useAttrs, K as toRefs, L as ref, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelText, R as renderList, S as isReactive$1, T as mergeProps, U as toDisplayString, V as resolveDynamicComponent, W as toRaw$2, X as vModelCheckbox, Y as useSlots, Z as vModelSelect, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as withCtx, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withKeys, o as createApp, p as createVNode, q as unref, r as Teleport, rt as withModifiers, s as createBlock, t as _plugin_vue_export_helper_default, tt as withDirectives, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderSlot } from "./chunks/_plugin-vue_export-helper-DHiJKCsy.es.js";
|
|
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
|
|
|
314
314
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
315
315
|
function getSuperdocVersion() {
|
|
316
316
|
try {
|
|
317
|
-
return "2.20.
|
|
317
|
+
return "2.20.1-next.1";
|
|
318
318
|
} catch {
|
|
319
319
|
return "unknown";
|
|
320
320
|
}
|
|
@@ -14319,7 +14319,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
14319
14319
|
], 64))], 14, _hoisted_1$27)), [[_directive_click_outside, handleClickOutside]]);
|
|
14320
14320
|
};
|
|
14321
14321
|
}
|
|
14322
|
-
}, [["__scopeId", "data-v-
|
|
14322
|
+
}, [["__scopeId", "data-v-bc46ac97"]]);
|
|
14323
14323
|
//#endregion
|
|
14324
14324
|
//#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
|
|
14325
14325
|
var _hoisted_1$26 = [
|
|
@@ -22135,6 +22135,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22135
22135
|
if (!documentId) return;
|
|
22136
22136
|
clearV2CommandShortcutBinding(documentId);
|
|
22137
22137
|
if (typeof bindEditShortcuts !== "function") return;
|
|
22138
|
+
getSuperDocUI();
|
|
22138
22139
|
const openLinkWorkflow = resolveV2LinkWorkflowOpener();
|
|
22139
22140
|
const unbind = bindEditShortcuts({
|
|
22140
22141
|
commandRoute: {
|
|
@@ -24479,7 +24480,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
24479
24480
|
], 38);
|
|
24480
24481
|
};
|
|
24481
24482
|
}
|
|
24482
|
-
}, [["__scopeId", "data-v-
|
|
24483
|
+
}, [["__scopeId", "data-v-e476c448"]]);
|
|
24483
24484
|
//#endregion
|
|
24484
24485
|
//#region src/core/create-app.js
|
|
24485
24486
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -43477,6 +43478,35 @@ var getToolbarItemWidth = (item, controlSizes) => {
|
|
|
43477
43478
|
if (item.type === "separator") return controlSizes.get("separator");
|
|
43478
43479
|
return controlSizes.get(item.name.value) || controlSizes.get("default");
|
|
43479
43480
|
};
|
|
43481
|
+
var collapseSeparatorRun = (items) => {
|
|
43482
|
+
const result = [];
|
|
43483
|
+
for (const item of items) {
|
|
43484
|
+
if (item.type === "separator") {
|
|
43485
|
+
const previous = result[result.length - 1];
|
|
43486
|
+
if (!previous || previous.type === "separator") continue;
|
|
43487
|
+
}
|
|
43488
|
+
result.push(item);
|
|
43489
|
+
}
|
|
43490
|
+
while (result.length && result[result.length - 1].type === "separator") result.pop();
|
|
43491
|
+
return result;
|
|
43492
|
+
};
|
|
43493
|
+
var normalizeSeparators = (items) => {
|
|
43494
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
43495
|
+
for (const item of items) {
|
|
43496
|
+
const group = item.group?.value || "center";
|
|
43497
|
+
if (!byGroup.has(group)) byGroup.set(group, []);
|
|
43498
|
+
byGroup.get(group).push(item);
|
|
43499
|
+
}
|
|
43500
|
+
const kept = /* @__PURE__ */ new Set();
|
|
43501
|
+
for (const groupItems of byGroup.values()) for (const item of collapseSeparatorRun(groupItems)) kept.add(item);
|
|
43502
|
+
return items.filter((item) => kept.has(item));
|
|
43503
|
+
};
|
|
43504
|
+
var normalizeSeparatorsIgnoringOverflow = (items) => {
|
|
43505
|
+
const overflowTrigger = items.find((item) => item.type === "overflow");
|
|
43506
|
+
const withoutOverflow = items.filter((item) => item !== overflowTrigger);
|
|
43507
|
+
const kept = new Set(normalizeSeparators(withoutOverflow));
|
|
43508
|
+
return items.filter((item) => item === overflowTrigger || kept.has(item));
|
|
43509
|
+
};
|
|
43480
43510
|
/**
|
|
43481
43511
|
* Set or clear the link item's `href` without disturbing the rest of its
|
|
43482
43512
|
* attributes. The static configuration (`ariaLabel`, and anything added later)
|
|
@@ -43531,7 +43561,7 @@ function hasAiModule(superToolbar) {
|
|
|
43531
43561
|
function aiModuleConfig(superToolbar) {
|
|
43532
43562
|
return superToolbar.config?.superdoc?.config?.modules?.ai ?? superToolbar.superdoc?.config?.modules?.ai ?? {};
|
|
43533
43563
|
}
|
|
43534
|
-
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43564
|
+
var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev = false, configuredItemNames, configuredItemOrder, excludedItemNames, additionalItems = [] } = {}) => {
|
|
43535
43565
|
const bold = useToolbarItem({
|
|
43536
43566
|
type: "button",
|
|
43537
43567
|
name: "bold",
|
|
@@ -43675,7 +43705,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
43675
43705
|
else fontSize.selectedValue.value = "";
|
|
43676
43706
|
}
|
|
43677
43707
|
});
|
|
43678
|
-
const
|
|
43708
|
+
const createSeparator = () => useToolbarItem({
|
|
43679
43709
|
type: "separator",
|
|
43680
43710
|
name: "separator",
|
|
43681
43711
|
isNarrow: true
|
|
@@ -44585,16 +44615,16 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44585
44615
|
search,
|
|
44586
44616
|
zoom,
|
|
44587
44617
|
fontButton,
|
|
44588
|
-
|
|
44618
|
+
createSeparator(),
|
|
44589
44619
|
fontSize,
|
|
44590
|
-
|
|
44620
|
+
createSeparator(),
|
|
44591
44621
|
bold,
|
|
44592
44622
|
italic,
|
|
44593
44623
|
underline,
|
|
44594
44624
|
strikethrough,
|
|
44595
44625
|
colorButton,
|
|
44596
44626
|
highlight,
|
|
44597
|
-
|
|
44627
|
+
createSeparator(),
|
|
44598
44628
|
link,
|
|
44599
44629
|
image,
|
|
44600
44630
|
...shouldIncludeTableOfContents ? [tableOfContents] : [],
|
|
@@ -44602,16 +44632,16 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44602
44632
|
...superToolbar.config?.showPageNumberButton || configuredItemNames?.has("pageNumber") ? [pageNumber] : [],
|
|
44603
44633
|
tableItem,
|
|
44604
44634
|
tableActionsItem,
|
|
44605
|
-
|
|
44635
|
+
createSeparator(),
|
|
44606
44636
|
alignment,
|
|
44607
44637
|
bulletedList,
|
|
44608
44638
|
numberedList,
|
|
44609
44639
|
indentLeft,
|
|
44610
44640
|
indentRight,
|
|
44611
44641
|
lineHeight,
|
|
44612
|
-
|
|
44642
|
+
createSeparator(),
|
|
44613
44643
|
linkedStyles,
|
|
44614
|
-
|
|
44644
|
+
createSeparator(),
|
|
44615
44645
|
ruler,
|
|
44616
44646
|
measurementUnit,
|
|
44617
44647
|
...shouldIncludeFormattingMarks ? [formattingMarks] : [],
|
|
@@ -44641,9 +44671,15 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44641
44671
|
}
|
|
44642
44672
|
if (configuredItemNames) toolbarItems = toolbarItems.filter((item) => item.name.value === "overflow" || item.isCustomToolbarItem || configuredItemNames.has(item.name.value));
|
|
44643
44673
|
if (excludedItemNames?.size) toolbarItems = toolbarItems.filter((item) => !excludedItemNames.has(item.name.value));
|
|
44674
|
+
toolbarItems = normalizeSeparatorsIgnoringOverflow(toolbarItems);
|
|
44644
44675
|
const isStickyItem = (item) => stickyItemNames.includes(item.name.value);
|
|
44645
44676
|
const overflowTrigger = toolbarItems.find((item) => item.name.value === "overflow");
|
|
44646
44677
|
const layoutItems = toolbarItems.filter((item) => item !== overflowTrigger);
|
|
44678
|
+
if (configuredItemOrder) {
|
|
44679
|
+
const orderIndex = new Map(configuredItemOrder.map((name, index) => [name, index]));
|
|
44680
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
44681
|
+
layoutItems.sort((a, b) => rank(a) - rank(b));
|
|
44682
|
+
}
|
|
44647
44683
|
const partitionItems = (reserveOverflowTrigger) => {
|
|
44648
44684
|
const overflowItems = [];
|
|
44649
44685
|
const visibleItems = [];
|
|
@@ -44685,6 +44721,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
44685
44721
|
if (insertAt === -1) visibleItems.push(overflowTrigger);
|
|
44686
44722
|
else visibleItems.splice(insertAt, 0, overflowTrigger);
|
|
44687
44723
|
}
|
|
44724
|
+
visibleItems = normalizeSeparators(visibleItems);
|
|
44688
44725
|
return {
|
|
44689
44726
|
defaultItems: visibleItems,
|
|
44690
44727
|
overflowItems: overflowItems.filter((item) => item.type !== "separator")
|
|
@@ -45091,6 +45128,12 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
45091
45128
|
}).filter(Boolean);
|
|
45092
45129
|
const configuredGroups = hasExplicitGroupComposition ? new Set(Object.keys(this.config.groups)) : null;
|
|
45093
45130
|
const layoutCustomItems = configuredGroups ? customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")) : customToolbarItems;
|
|
45131
|
+
let allConfigItems = null;
|
|
45132
|
+
if (hasExplicitGroupComposition) {
|
|
45133
|
+
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45134
|
+
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45135
|
+
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45136
|
+
}
|
|
45094
45137
|
const { defaultItems, overflowItems } = makeDefaultItems({
|
|
45095
45138
|
superToolbar: this,
|
|
45096
45139
|
toolbarIcons: this.config.icons,
|
|
@@ -45101,18 +45144,29 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
45101
45144
|
role: this.role,
|
|
45102
45145
|
isDev: this.isDev,
|
|
45103
45146
|
configuredItemNames,
|
|
45147
|
+
configuredItemOrder: allConfigItems,
|
|
45104
45148
|
excludedItemNames,
|
|
45105
45149
|
additionalItems: layoutCustomItems
|
|
45106
45150
|
});
|
|
45107
|
-
|
|
45108
|
-
if (hasExplicitGroupComposition) {
|
|
45109
|
-
const groupedItems = Object.values(this.config.groups).flatMap((item) => item);
|
|
45110
|
-
const groupedCustomItems = customToolbarItems.filter((item) => configuredGroups.has(item.group?.value || "center")).map((item) => item.name.value);
|
|
45111
|
-
allConfigItems = [.../* @__PURE__ */ new Set([...groupedItems, ...groupedCustomItems])];
|
|
45112
|
-
}
|
|
45151
|
+
if (!hasExplicitGroupComposition) allConfigItems = [...defaultItems.map((item) => item.name.value), ...overflowItems.map((item) => item.name.value)];
|
|
45113
45152
|
const configuredOverflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value) && !excludedItemNames.has(item.name.value));
|
|
45114
45153
|
const visibleItemNames = configuredOverflowItems.length ? [...allConfigItems, "overflow"] : allConfigItems;
|
|
45115
45154
|
const filteredItems = defaultItems.filter((item) => visibleItemNames.includes(item.name.value)).filter((item) => !excludedItemNames.has(item.name.value));
|
|
45155
|
+
if (hasExplicitGroupComposition) {
|
|
45156
|
+
const orderIndex = new Map(allConfigItems.map((name, index) => [name, index]));
|
|
45157
|
+
const rank = (item) => orderIndex.get(item.name.value) ?? Number.MAX_SAFE_INTEGER;
|
|
45158
|
+
const overflowTrigger = filteredItems.find((item) => item.name.value === "overflow");
|
|
45159
|
+
const originalIndex = new Map(filteredItems.map((item, index) => [item, index]));
|
|
45160
|
+
const reordered = filteredItems.filter((item) => item !== overflowTrigger);
|
|
45161
|
+
reordered.sort((a, b) => rank(a) - rank(b));
|
|
45162
|
+
if (overflowTrigger) {
|
|
45163
|
+
const triggerOriginalIndex = originalIndex.get(overflowTrigger);
|
|
45164
|
+
const insertAt = reordered.findIndex((item) => originalIndex.get(item) > triggerOriginalIndex);
|
|
45165
|
+
insertAt === -1 ? reordered.push(overflowTrigger) : reordered.splice(insertAt, 0, overflowTrigger);
|
|
45166
|
+
}
|
|
45167
|
+
filteredItems.splice(0, filteredItems.length, ...reordered);
|
|
45168
|
+
configuredOverflowItems.sort((a, b) => rank(a) - rank(b));
|
|
45169
|
+
}
|
|
45116
45170
|
if (hasExplicitGroupComposition) {
|
|
45117
45171
|
for (const [group, names] of Object.entries(this.config.groups)) for (const item of filteredItems) if (names.includes(item.name.value)) item.group.value = group;
|
|
45118
45172
|
}
|
|
@@ -46212,7 +46266,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46212
46266
|
this.config.colors = shuffleArray(this.config.colors);
|
|
46213
46267
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46214
46268
|
this.colorIndex = 0;
|
|
46215
|
-
this.version = "2.20.
|
|
46269
|
+
this.version = "2.20.1-next.1";
|
|
46216
46270
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46217
46271
|
this.superdocId = config.superdocId || v4();
|
|
46218
46272
|
this.colors = this.config.colors ?? [];
|