superdoc 2.0.0-next.30 → 2.0.0-next.32

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.
@@ -3608,9 +3608,8 @@ function createSuperDocUI(options) {
3608
3608
  };
3609
3609
  const computeFonts = () => {
3610
3610
  const fontsApi = superdoc?.fonts;
3611
- const documentOptions = safeCall(fontsApi?.getDocumentFontOptions ? () => fontsApi.getDocumentFontOptions() : void 0, []);
3612
3611
  return {
3613
- options: composeFontFamilyOptions(Array.isArray(documentOptions) ? documentOptions : []),
3612
+ options: composeFontFamilyOptions(normalizeDocumentFontOptions(safeCall(fontsApi?.getDocumentFontOptions ? () => fontsApi.getDocumentFontOptions() : void 0, [])), normalizePickerFontOptions(safeCall(fontsApi?.getFontFamilyOptions ? () => fontsApi.getFontFamilyOptions() : void 0, []))),
3614
3613
  sizeOptions: DEFAULT_FONT_SIZE_OPTIONS
3615
3614
  };
3616
3615
  };
@@ -8097,7 +8096,52 @@ var DEFAULT_FONT_FAMILY_OPTIONS = [
8097
8096
  previewFamily: "Verdana, sans-serif"
8098
8097
  }
8099
8098
  ];
8100
- function composeFontFamilyOptions(documentOptions) {
8099
+ function canonicalFontFamilyName(family) {
8100
+ const trimmed = family.trim();
8101
+ const quote = trimmed[0];
8102
+ if (quote === "\"" || quote === "'") {
8103
+ const close = trimmed.indexOf(quote, 1);
8104
+ if (close > 0) return trimmed.slice(1, close).trim();
8105
+ }
8106
+ const comma = trimmed.indexOf(",");
8107
+ return (comma === -1 ? trimmed : trimmed.slice(0, comma)).trim().replace(/^["']|["']$/g, "");
8108
+ }
8109
+ function normalizeDocumentFontOptions(raw) {
8110
+ if (!Array.isArray(raw)) return [];
8111
+ const out = [];
8112
+ for (const option of raw) {
8113
+ if (!option || typeof option !== "object") continue;
8114
+ const rec = option;
8115
+ const logical = typeof rec.logicalFamily === "string" ? canonicalFontFamilyName(rec.logicalFamily) : "";
8116
+ if (!logical) continue;
8117
+ const previewFamily = typeof rec.previewFamily === "string" && rec.previewFamily.trim() ? rec.previewFamily.trim() : logical;
8118
+ out.push({
8119
+ value: logical,
8120
+ label: logical,
8121
+ previewFamily
8122
+ });
8123
+ }
8124
+ return out;
8125
+ }
8126
+ function normalizePickerFontOptions(raw) {
8127
+ if (!Array.isArray(raw)) return [];
8128
+ const out = [];
8129
+ for (const option of raw) {
8130
+ if (!option || typeof option !== "object") continue;
8131
+ const rec = option;
8132
+ const value = typeof rec.value === "string" ? rec.value.trim() : "";
8133
+ if (!value) continue;
8134
+ const label = typeof rec.label === "string" && rec.label.trim() ? rec.label.trim() : value;
8135
+ const previewFamily = typeof rec.previewFamily === "string" && rec.previewFamily.trim() ? rec.previewFamily.trim() : value;
8136
+ out.push({
8137
+ value,
8138
+ label,
8139
+ previewFamily
8140
+ });
8141
+ }
8142
+ return out;
8143
+ }
8144
+ function composeFontFamilyOptions(documentOptions, pickerOptions = []) {
8101
8145
  const out = [];
8102
8146
  const seen = /* @__PURE__ */ new Set();
8103
8147
  const push = (option) => {
@@ -8106,8 +8150,9 @@ function composeFontFamilyOptions(documentOptions) {
8106
8150
  seen.add(key);
8107
8151
  out.push(option);
8108
8152
  };
8109
- for (const option of documentOptions) if (option && typeof option.value === "string") push(option);
8110
- for (const option of DEFAULT_FONT_FAMILY_OPTIONS) push(option);
8153
+ for (const option of documentOptions) push(option);
8154
+ const defaults = pickerOptions.length ? pickerOptions : DEFAULT_FONT_FAMILY_OPTIONS;
8155
+ for (const option of defaults) push(option);
8111
8156
  return out;
8112
8157
  }
8113
8158
  var DEFAULT_FONT_SIZE_OPTIONS = [
@@ -3608,9 +3608,8 @@ function createSuperDocUI(options) {
3608
3608
  };
3609
3609
  const computeFonts = () => {
3610
3610
  const fontsApi = superdoc?.fonts;
3611
- const documentOptions = safeCall(fontsApi?.getDocumentFontOptions ? () => fontsApi.getDocumentFontOptions() : void 0, []);
3612
3611
  return {
3613
- options: composeFontFamilyOptions(Array.isArray(documentOptions) ? documentOptions : []),
3612
+ options: composeFontFamilyOptions(normalizeDocumentFontOptions(safeCall(fontsApi?.getDocumentFontOptions ? () => fontsApi.getDocumentFontOptions() : void 0, [])), normalizePickerFontOptions(safeCall(fontsApi?.getFontFamilyOptions ? () => fontsApi.getFontFamilyOptions() : void 0, []))),
3614
3613
  sizeOptions: DEFAULT_FONT_SIZE_OPTIONS
3615
3614
  };
3616
3615
  };
@@ -8097,7 +8096,52 @@ var DEFAULT_FONT_FAMILY_OPTIONS = [
8097
8096
  previewFamily: "Verdana, sans-serif"
8098
8097
  }
8099
8098
  ];
8100
- function composeFontFamilyOptions(documentOptions) {
8099
+ function canonicalFontFamilyName(family) {
8100
+ const trimmed = family.trim();
8101
+ const quote = trimmed[0];
8102
+ if (quote === "\"" || quote === "'") {
8103
+ const close = trimmed.indexOf(quote, 1);
8104
+ if (close > 0) return trimmed.slice(1, close).trim();
8105
+ }
8106
+ const comma = trimmed.indexOf(",");
8107
+ return (comma === -1 ? trimmed : trimmed.slice(0, comma)).trim().replace(/^["']|["']$/g, "");
8108
+ }
8109
+ function normalizeDocumentFontOptions(raw) {
8110
+ if (!Array.isArray(raw)) return [];
8111
+ const out = [];
8112
+ for (const option of raw) {
8113
+ if (!option || typeof option !== "object") continue;
8114
+ const rec = option;
8115
+ const logical = typeof rec.logicalFamily === "string" ? canonicalFontFamilyName(rec.logicalFamily) : "";
8116
+ if (!logical) continue;
8117
+ const previewFamily = typeof rec.previewFamily === "string" && rec.previewFamily.trim() ? rec.previewFamily.trim() : logical;
8118
+ out.push({
8119
+ value: logical,
8120
+ label: logical,
8121
+ previewFamily
8122
+ });
8123
+ }
8124
+ return out;
8125
+ }
8126
+ function normalizePickerFontOptions(raw) {
8127
+ if (!Array.isArray(raw)) return [];
8128
+ const out = [];
8129
+ for (const option of raw) {
8130
+ if (!option || typeof option !== "object") continue;
8131
+ const rec = option;
8132
+ const value = typeof rec.value === "string" ? rec.value.trim() : "";
8133
+ if (!value) continue;
8134
+ const label = typeof rec.label === "string" && rec.label.trim() ? rec.label.trim() : value;
8135
+ const previewFamily = typeof rec.previewFamily === "string" && rec.previewFamily.trim() ? rec.previewFamily.trim() : value;
8136
+ out.push({
8137
+ value,
8138
+ label,
8139
+ previewFamily
8140
+ });
8141
+ }
8142
+ return out;
8143
+ }
8144
+ function composeFontFamilyOptions(documentOptions, pickerOptions = []) {
8101
8145
  const out = [];
8102
8146
  const seen = /* @__PURE__ */ new Set();
8103
8147
  const push = (option) => {
@@ -8106,8 +8150,9 @@ function composeFontFamilyOptions(documentOptions) {
8106
8150
  seen.add(key);
8107
8151
  out.push(option);
8108
8152
  };
8109
- for (const option of documentOptions) if (option && typeof option.value === "string") push(option);
8110
- for (const option of DEFAULT_FONT_FAMILY_OPTIONS) push(option);
8153
+ for (const option of documentOptions) push(option);
8154
+ const defaults = pickerOptions.length ? pickerOptions : DEFAULT_FONT_FAMILY_OPTIONS;
8155
+ for (const option of defaults) push(option);
8111
8156
  return out;
8112
8157
  }
8113
8158
  var DEFAULT_FONT_SIZE_OPTIONS = [
@@ -7,7 +7,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
7
7
  var PRIVATE_ENGINE_INFO = (0, __superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
8
8
  var ENGINE_INFO = Object.freeze({
9
9
  ...PRIVATE_ENGINE_INFO,
10
- superdocVersion: "2.0.0-next.30",
10
+ superdocVersion: "2.0.0-next.32",
11
11
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
12
12
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
13
13
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -6,7 +6,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
6
6
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
7
7
  var ENGINE_INFO = Object.freeze({
8
8
  ...PRIVATE_ENGINE_INFO,
9
- superdocVersion: "2.0.0-next.30",
9
+ superdocVersion: "2.0.0-next.32",
10
10
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
11
11
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
12
12
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../chunks/rolldown-runtime-_dR15c8t.cjs");
3
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-BXehf3i3.cjs");
3
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C0ZJE05U.cjs");
4
4
  let react = require("react");
5
5
  var SuperDocUIContext = (0, react.createContext)(null);
6
6
  function SuperDocUIProvider(props) {
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BKVf2uCM.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-C01vcKRO.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  var SuperDocUIContext = createContext(null);
4
4
  function SuperDocUIProvider(props) {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-BXehf3i3.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C0ZJE05U.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as BUILT_IN_COMMAND_IDS, r as shallowEqual, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BKVf2uCM.es.js";
1
+ import { n as BUILT_IN_COMMAND_IDS, r as shallowEqual, t as createSuperDocUI } from "../chunks/create-super-doc-ui-C01vcKRO.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
package/dist/superdoc.cjs CHANGED
@@ -6,7 +6,7 @@ const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
6
6
  const require_jszip = require("./chunks/jszip-BdUBlUeG.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BTwbGDKw.cjs");
8
8
  const require_constants = require("./chunks/constants-sbCZ2O_A.cjs");
9
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-BXehf3i3.cjs");
9
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-C0ZJE05U.cjs");
10
10
  let vue = require("vue");
11
11
  vue = require_rolldown_runtime.__toESM(vue);
12
12
  require("y-websocket");
@@ -34935,7 +34935,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
34935
34935
  this.config.colors = shuffleArray(this.config.colors);
34936
34936
  this.userColorMap = /* @__PURE__ */ new Map();
34937
34937
  this.colorIndex = 0;
34938
- this.version = "2.0.0-next.30";
34938
+ this.version = "2.0.0-next.32";
34939
34939
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34940
34940
  this.superdocId = config.superdocId || require_uuid.v4_default();
34941
34941
  this.colors = this.config.colors ?? [];
@@ -5,7 +5,7 @@ import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
5
5
  import { a as init_dist, i as global, n as init_dist$1, r as process$1, t as require_jszip_min } from "./chunks/jszip-DzmwAHr3.es.js";
6
6
  import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-CInC0bKI.es.js";
7
7
  import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-CY3R3_kF.es.js";
8
- import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BKVf2uCM.es.js";
8
+ import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-C01vcKRO.es.js";
9
9
  import * as Vue from "vue";
10
10
  import { Fragment, Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, h, inject, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, openBlock, reactive, ref, renderList, renderSlot, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, unref, useAttrs, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
11
11
  import "y-websocket";
@@ -34653,7 +34653,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34653
34653
  this.config.colors = shuffleArray(this.config.colors);
34654
34654
  this.userColorMap = /* @__PURE__ */ new Map();
34655
34655
  this.colorIndex = 0;
34656
- this.version = "2.0.0-next.30";
34656
+ this.version = "2.0.0-next.32";
34657
34657
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34658
34658
  this.superdocId = config.superdocId || v4_default();
34659
34659
  this.colors = this.config.colors ?? [];