superdoc 2.0.0-next.40 → 2.0.0-next.42

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.
@@ -1449,6 +1449,260 @@ const decodeLayoutStoryDataset = (raw) => {
1449
1449
  };
1450
1450
  const SDT_BLOCK_WITH_ID_SELECTOR = `.${DOM_CLASS_NAMES.BLOCK_SDT}[${DATA_ATTRS.SDT_ID}]`;
1451
1451
  const DRAGGABLE_SELECTOR = `[${DATA_ATTRS.DRAGGABLE}="true"]`;
1452
+ var schemaBooleanOrNull = () => ({ oneOf: [{ type: "boolean" }, { type: "null" }] });
1453
+ var schemaStringOrNull = () => ({ oneOf: [{
1454
+ type: "string",
1455
+ minLength: 1
1456
+ }, { type: "null" }] });
1457
+ var schemaNumberOrNull = () => ({ oneOf: [{ type: "number" }, { type: "null" }] });
1458
+ var schemaObjectOrNull = (properties) => ({ oneOf: [{
1459
+ type: "object",
1460
+ properties,
1461
+ additionalProperties: false,
1462
+ minProperties: 1
1463
+ }, { type: "null" }] });
1464
+ var UNDERLINE_OBJECT_SCHEMA = {
1465
+ type: "object",
1466
+ properties: {
1467
+ style: { oneOf: [{
1468
+ type: "string",
1469
+ minLength: 1
1470
+ }, { type: "null" }] },
1471
+ color: { oneOf: [{
1472
+ type: "string",
1473
+ minLength: 1
1474
+ }, { type: "null" }] },
1475
+ themeColor: { oneOf: [{
1476
+ type: "string",
1477
+ minLength: 1
1478
+ }, { type: "null" }] }
1479
+ },
1480
+ additionalProperties: false,
1481
+ minProperties: 1
1482
+ };
1483
+ var STYLISTIC_SET_ITEM_SCHEMA = {
1484
+ type: "object",
1485
+ properties: {
1486
+ id: { type: "number" },
1487
+ val: { type: "boolean" }
1488
+ },
1489
+ required: ["id"],
1490
+ additionalProperties: false
1491
+ };
1492
+ var schemaUnderlinePatch = () => ({ oneOf: [
1493
+ { type: "boolean" },
1494
+ { type: "null" },
1495
+ UNDERLINE_OBJECT_SCHEMA
1496
+ ] });
1497
+ var schemaStylisticSets = () => ({ oneOf: [{
1498
+ type: "array",
1499
+ items: STYLISTIC_SET_ITEM_SCHEMA,
1500
+ minItems: 1
1501
+ }, { type: "null" }] });
1502
+ function markCarrier(markName, textStyleAttr) {
1503
+ return {
1504
+ storage: "mark",
1505
+ markName,
1506
+ textStyleAttr
1507
+ };
1508
+ }
1509
+ function runAttributeCarrier(runPropertyKey) {
1510
+ return {
1511
+ storage: "runAttribute",
1512
+ nodeName: "run",
1513
+ runPropertyKey
1514
+ };
1515
+ }
1516
+ var markBoolean = (key, ooxmlElement, markName) => ({
1517
+ key,
1518
+ type: "boolean",
1519
+ ooxmlElement,
1520
+ storage: "mark",
1521
+ tracked: true,
1522
+ carrier: markCarrier(markName),
1523
+ schema: schemaBooleanOrNull()
1524
+ });
1525
+ var markTextStyleValue = (key, type, ooxmlElement, schema, textStyleAttr) => ({
1526
+ key,
1527
+ type,
1528
+ ooxmlElement,
1529
+ storage: "mark",
1530
+ tracked: true,
1531
+ carrier: markCarrier("textStyle", textStyleAttr ?? key),
1532
+ schema
1533
+ });
1534
+ var runAttribute = (key, type, ooxmlElement, schema, runPropertyKey) => ({
1535
+ key,
1536
+ type,
1537
+ ooxmlElement,
1538
+ storage: "runAttribute",
1539
+ tracked: false,
1540
+ carrier: runAttributeCarrier(runPropertyKey ?? key),
1541
+ schema
1542
+ });
1543
+ const INLINE_PROPERTY_REGISTRY = [
1544
+ markBoolean("bold", "w:b", "bold"),
1545
+ markBoolean("italic", "w:i", "italic"),
1546
+ markBoolean("strike", "w:strike", "strike"),
1547
+ {
1548
+ key: "underline",
1549
+ type: "object",
1550
+ ooxmlElement: "w:u",
1551
+ storage: "mark",
1552
+ tracked: true,
1553
+ carrier: markCarrier("underline"),
1554
+ schema: schemaUnderlinePatch()
1555
+ },
1556
+ {
1557
+ key: "highlight",
1558
+ type: "string",
1559
+ ooxmlElement: "w:highlight",
1560
+ storage: "mark",
1561
+ tracked: true,
1562
+ carrier: markCarrier("highlight"),
1563
+ schema: schemaStringOrNull()
1564
+ },
1565
+ markTextStyleValue("color", "string", "w:color", schemaStringOrNull()),
1566
+ markTextStyleValue("fontSize", "number", "w:sz", schemaNumberOrNull()),
1567
+ markTextStyleValue("fontFamily", "string", "w:rFonts", schemaStringOrNull()),
1568
+ markTextStyleValue("letterSpacing", "number", "w:spacing", schemaNumberOrNull()),
1569
+ markTextStyleValue("vertAlign", "string", "w:vertAlign", { oneOf: [{ enum: [
1570
+ "superscript",
1571
+ "subscript",
1572
+ "baseline"
1573
+ ] }, { type: "null" }] }),
1574
+ markTextStyleValue("position", "number", "w:position", schemaNumberOrNull()),
1575
+ runAttribute("dstrike", "boolean", "w:dstrike", schemaBooleanOrNull()),
1576
+ runAttribute("smallCaps", "boolean", "w:smallCaps", schemaBooleanOrNull()),
1577
+ markTextStyleValue("caps", "boolean", "w:caps", schemaBooleanOrNull(), "textTransform"),
1578
+ runAttribute("shading", "object", "w:shd", schemaObjectOrNull({
1579
+ fill: { oneOf: [{
1580
+ type: "string",
1581
+ minLength: 1
1582
+ }, { type: "null" }] },
1583
+ color: { oneOf: [{
1584
+ type: "string",
1585
+ minLength: 1
1586
+ }, { type: "null" }] },
1587
+ val: { oneOf: [{
1588
+ type: "string",
1589
+ minLength: 1
1590
+ }, { type: "null" }] }
1591
+ })),
1592
+ runAttribute("border", "object", "w:bdr", schemaObjectOrNull({
1593
+ val: { oneOf: [{
1594
+ type: "string",
1595
+ minLength: 1
1596
+ }, { type: "null" }] },
1597
+ sz: { oneOf: [{ type: "number" }, { type: "null" }] },
1598
+ color: { oneOf: [{
1599
+ type: "string",
1600
+ minLength: 1
1601
+ }, { type: "null" }] },
1602
+ space: { oneOf: [{ type: "number" }, { type: "null" }] }
1603
+ }), "borders"),
1604
+ runAttribute("outline", "boolean", "w:outline", schemaBooleanOrNull()),
1605
+ runAttribute("shadow", "boolean", "w:shadow", schemaBooleanOrNull()),
1606
+ runAttribute("emboss", "boolean", "w:emboss", schemaBooleanOrNull()),
1607
+ runAttribute("imprint", "boolean", "w:imprint", schemaBooleanOrNull()),
1608
+ runAttribute("charScale", "number", "w:w", schemaNumberOrNull(), "w"),
1609
+ runAttribute("kerning", "number", "w:kern", schemaNumberOrNull(), "kern"),
1610
+ runAttribute("vanish", "boolean", "w:vanish", schemaBooleanOrNull()),
1611
+ runAttribute("webHidden", "boolean", "w:webHidden", schemaBooleanOrNull()),
1612
+ runAttribute("specVanish", "boolean", "w:specVanish", schemaBooleanOrNull()),
1613
+ runAttribute("rtl", "boolean", "w:rtl", schemaBooleanOrNull()),
1614
+ runAttribute("cs", "boolean", "w:cs", schemaBooleanOrNull()),
1615
+ runAttribute("bCs", "boolean", "w:bCs", schemaBooleanOrNull(), "boldCs"),
1616
+ runAttribute("iCs", "boolean", "w:iCs", schemaBooleanOrNull(), "italicCs"),
1617
+ runAttribute("eastAsianLayout", "object", "w:eastAsianLayout", schemaObjectOrNull({
1618
+ id: { oneOf: [{
1619
+ type: "string",
1620
+ minLength: 1
1621
+ }, { type: "null" }] },
1622
+ combine: { oneOf: [{ type: "boolean" }, { type: "null" }] },
1623
+ combineBrackets: { oneOf: [{
1624
+ type: "string",
1625
+ minLength: 1
1626
+ }, { type: "null" }] },
1627
+ vert: { oneOf: [{ type: "boolean" }, { type: "null" }] },
1628
+ vertCompress: { oneOf: [{ type: "boolean" }, { type: "null" }] }
1629
+ })),
1630
+ runAttribute("em", "string", "w:em", schemaStringOrNull()),
1631
+ runAttribute("fitText", "object", "w:fitText", schemaObjectOrNull({
1632
+ val: { oneOf: [{ type: "number" }, { type: "null" }] },
1633
+ id: { oneOf: [{
1634
+ type: "string",
1635
+ minLength: 1
1636
+ }, { type: "null" }] }
1637
+ })),
1638
+ runAttribute("snapToGrid", "boolean", "w:snapToGrid", schemaBooleanOrNull()),
1639
+ runAttribute("lang", "object", "w:lang", schemaObjectOrNull({
1640
+ val: { oneOf: [{
1641
+ type: "string",
1642
+ minLength: 1
1643
+ }, { type: "null" }] },
1644
+ eastAsia: { oneOf: [{
1645
+ type: "string",
1646
+ minLength: 1
1647
+ }, { type: "null" }] },
1648
+ bidi: { oneOf: [{
1649
+ type: "string",
1650
+ minLength: 1
1651
+ }, { type: "null" }] }
1652
+ })),
1653
+ runAttribute("oMath", "boolean", "w:oMath", schemaBooleanOrNull()),
1654
+ runAttribute("rStyle", "string", "w:rStyle", schemaStringOrNull(), "styleId"),
1655
+ runAttribute("rFonts", "object", "w:rFonts", schemaObjectOrNull({
1656
+ ascii: { oneOf: [{
1657
+ type: "string",
1658
+ minLength: 1
1659
+ }, { type: "null" }] },
1660
+ hAnsi: { oneOf: [{
1661
+ type: "string",
1662
+ minLength: 1
1663
+ }, { type: "null" }] },
1664
+ eastAsia: { oneOf: [{
1665
+ type: "string",
1666
+ minLength: 1
1667
+ }, { type: "null" }] },
1668
+ cs: { oneOf: [{
1669
+ type: "string",
1670
+ minLength: 1
1671
+ }, { type: "null" }] },
1672
+ asciiTheme: { oneOf: [{
1673
+ type: "string",
1674
+ minLength: 1
1675
+ }, { type: "null" }] },
1676
+ hAnsiTheme: { oneOf: [{
1677
+ type: "string",
1678
+ minLength: 1
1679
+ }, { type: "null" }] },
1680
+ eastAsiaTheme: { oneOf: [{
1681
+ type: "string",
1682
+ minLength: 1
1683
+ }, { type: "null" }] },
1684
+ csTheme: { oneOf: [{
1685
+ type: "string",
1686
+ minLength: 1
1687
+ }, { type: "null" }] },
1688
+ hint: { oneOf: [{
1689
+ type: "string",
1690
+ minLength: 1
1691
+ }, { type: "null" }] }
1692
+ }), "fontFamily"),
1693
+ runAttribute("fontSizeCs", "number", "w:szCs", schemaNumberOrNull()),
1694
+ runAttribute("ligatures", "string", "w14:ligatures", schemaStringOrNull()),
1695
+ runAttribute("numForm", "string", "w14:numForm", schemaStringOrNull()),
1696
+ runAttribute("numSpacing", "string", "w14:numSpacing", schemaStringOrNull()),
1697
+ runAttribute("stylisticSets", "array", "w14:stylisticSets", schemaStylisticSets()),
1698
+ runAttribute("contextualAlternates", "boolean", "w14:cntxtAlts", schemaBooleanOrNull())
1699
+ ];
1700
+ const INLINE_PROPERTY_KEY_SET = new Set(INLINE_PROPERTY_REGISTRY.map((entry) => entry.key));
1701
+ const INLINE_PROPERTY_BY_KEY = Object.fromEntries(INLINE_PROPERTY_REGISTRY.map((entry) => [entry.key, entry]));
1702
+ const INLINE_PROPERTY_KEYS_BY_STORAGE = {
1703
+ mark: INLINE_PROPERTY_REGISTRY.filter((entry) => entry.storage === "mark").map((entry) => entry.key),
1704
+ runAttribute: INLINE_PROPERTY_REGISTRY.filter((entry) => entry.storage === "runAttribute").map((entry) => entry.key)
1705
+ };
1452
1706
  var POST_DECISION_TRACKED_CHANGES_LIST_OPTIONS = Object.freeze({
1453
1707
  mode: "background-reconcile",
1454
1708
  refreshReason: "post-decision-background",
@@ -2091,6 +2345,12 @@ var MIRRORED_EDIT_COMMAND_IDS = {
2091
2345
  undo: "history.undo",
2092
2346
  redo: "history.redo"
2093
2347
  };
2348
+ var EFFECTIVE_MARK_KEYS = [
2349
+ "bold",
2350
+ "italic",
2351
+ "underline",
2352
+ "strikethrough"
2353
+ ];
2094
2354
  function isProjectedInlineSelectionValueKey(value) {
2095
2355
  return PROJECTED_INLINE_SELECTION_VALUE_KEYS.includes(value);
2096
2356
  }
@@ -2511,6 +2771,7 @@ var CLEAR_INLINE_PATCH = {
2511
2771
  letterSpacing: null,
2512
2772
  dstrike: null
2513
2773
  };
2774
+ var TRACKED_CLEAR_INLINE_PATCH = Object.fromEntries(Object.entries(CLEAR_INLINE_PATCH).filter(([key]) => INLINE_PROPERTY_BY_KEY[key]?.tracked === true));
2514
2775
  function buildInlineFormatInput(spec, target, payload, active) {
2515
2776
  switch (spec.kind) {
2516
2777
  case "toggle": {
@@ -4142,6 +4403,112 @@ function createSuperDocUI(options) {
4142
4403
  if (sizes.size === 1) projection.fontSize = [...sizes][0];
4143
4404
  return projection;
4144
4405
  };
4406
+ const resolveEffectiveMarkValuesFromLayout = (selection$1) => {
4407
+ const host = getHost();
4408
+ const blockIds = new Set(selectionBlockIds(selection$1));
4409
+ if (blockIds.size === 0) return {};
4410
+ const readByIds = host?.readMountedProjectionBlocksByIds;
4411
+ const readAll = host?.readMountedProjectionBlocks;
4412
+ if (typeof readByIds !== "function" && typeof readAll !== "function") return {};
4413
+ const blocks = safeCall(() => {
4414
+ if (typeof readByIds !== "function") return readAll.call(host);
4415
+ const story = selectionStoryLocator(selection$1);
4416
+ return story ? readByIds.call(host, [...blockIds], story) : readByIds.call(host, [...blockIds]);
4417
+ }, null);
4418
+ if (!Array.isArray(blocks)) return {};
4419
+ const flatBlocks = collectProjectionTextBlocks(blocks);
4420
+ const runMarkValues = (run) => ({
4421
+ bold: run.bold === true,
4422
+ italic: run.italic === true,
4423
+ underline: run.underline != null,
4424
+ strikethrough: run.strike === true
4425
+ });
4426
+ const collapseMarkSets = (sets) => {
4427
+ const out = {};
4428
+ for (const key of EFFECTIVE_MARK_KEYS) {
4429
+ const set = sets[key];
4430
+ if (set.size === 1) out[key] = [...set][0];
4431
+ }
4432
+ return out;
4433
+ };
4434
+ const caret = collapsedTextAddressFromSelection(selection$1);
4435
+ const caretOffset = caret && typeof caret.range?.start === "number" ? caret.range.start : null;
4436
+ if (caret && caretOffset !== null && blockIds.has(caret.blockId)) {
4437
+ const block = flatBlocks.find((b) => projectionBlockMatchesId(b, caret.blockId));
4438
+ const runs = block && Array.isArray(block.runs) ? block.runs : null;
4439
+ if (runs && runs.length > 0 && runs.every((r) => r?.kind === "text" || r?.kind === "tab")) {
4440
+ let acc = 0;
4441
+ let chosen = null;
4442
+ for (const run of runs) {
4443
+ const len = typeof run.text === "string" ? run.text.length : 0;
4444
+ if (caretOffset >= acc && caretOffset < acc + len) {
4445
+ chosen = run;
4446
+ break;
4447
+ }
4448
+ acc += len;
4449
+ }
4450
+ if (!chosen) {
4451
+ for (let i = runs.length - 1; i >= 0 && !chosen; i -= 1) if (runs[i]?.kind === "text") chosen = runs[i];
4452
+ chosen ??= runs[runs.length - 1] ?? null;
4453
+ }
4454
+ if (!chosen) return {};
4455
+ return runMarkValues(chosen);
4456
+ }
4457
+ }
4458
+ const segments = selectionTextSegments(selection$1);
4459
+ if (segments.length > 0) {
4460
+ const rangeSets = {
4461
+ bold: /* @__PURE__ */ new Set(),
4462
+ italic: /* @__PURE__ */ new Set(),
4463
+ underline: /* @__PURE__ */ new Set(),
4464
+ strikethrough: /* @__PURE__ */ new Set()
4465
+ };
4466
+ let rangeSawRun = false;
4467
+ let offsetSafe = true;
4468
+ for (const seg of segments) {
4469
+ const block = flatBlocks.find((b) => projectionBlockMatchesId(b, seg.blockId));
4470
+ if (!block) return {};
4471
+ const runs = Array.isArray(block.runs) ? block.runs : [];
4472
+ if (runs.length === 0) continue;
4473
+ if (!runs.every((r) => r?.kind === "text" || r?.kind === "tab")) {
4474
+ offsetSafe = false;
4475
+ break;
4476
+ }
4477
+ let acc = 0;
4478
+ for (const run of runs) {
4479
+ const len = typeof run.text === "string" ? run.text.length : 0;
4480
+ const runStart = acc;
4481
+ const runEnd = acc + len;
4482
+ if (runStart < seg.end && runEnd > seg.start) {
4483
+ rangeSawRun = true;
4484
+ const values = runMarkValues(run);
4485
+ for (const key of EFFECTIVE_MARK_KEYS) rangeSets[key].add(values[key]);
4486
+ }
4487
+ acc = runEnd;
4488
+ }
4489
+ }
4490
+ if (offsetSafe && rangeSawRun) return collapseMarkSets(rangeSets);
4491
+ }
4492
+ const wholeSets = {
4493
+ bold: /* @__PURE__ */ new Set(),
4494
+ italic: /* @__PURE__ */ new Set(),
4495
+ underline: /* @__PURE__ */ new Set(),
4496
+ strikethrough: /* @__PURE__ */ new Set()
4497
+ };
4498
+ let sawWholeRun = false;
4499
+ for (const block of flatBlocks) {
4500
+ if (![...blockIds].some((id) => projectionBlockMatchesId(block, id))) continue;
4501
+ const runs = Array.isArray(block.runs) ? block.runs : [];
4502
+ for (const run of runs) {
4503
+ if (run?.kind !== "text") continue;
4504
+ sawWholeRun = true;
4505
+ const values = runMarkValues(run);
4506
+ for (const key of EFFECTIVE_MARK_KEYS) wholeSets[key].add(values[key]);
4507
+ }
4508
+ }
4509
+ if (!sawWholeRun) return {};
4510
+ return collapseMarkSets(wholeSets);
4511
+ };
4145
4512
  const completeProjectedInlineValues = (selection$1, direct) => {
4146
4513
  if (direct.fontFamily !== void 0 && direct.fontSize !== void 0 && direct.color !== void 0 && direct.highlight !== void 0) return {
4147
4514
  values: direct,
@@ -4171,21 +4538,33 @@ function createSuperDocUI(options) {
4171
4538
  effectiveUniformityStatus: "ready"
4172
4539
  };
4173
4540
  };
4174
- const resolveEffectiveInlineUniformityValues = (selection$1) => {
4541
+ const EFFECTIVE_INLINE_UNIFORMITY_KEYS = [
4542
+ "fontFamily",
4543
+ "fontSize",
4544
+ "bold",
4545
+ "italic",
4546
+ "underline",
4547
+ "strikethrough"
4548
+ ];
4549
+ const readEffectiveInlineUniformityCached = (selection$1) => {
4175
4550
  const target = selection$1.selectionTarget;
4176
4551
  if (!target) return {
4177
- values: null,
4552
+ value: null,
4178
4553
  status: "ready"
4179
4554
  };
4180
4555
  const op = resolveDocOperation(getDoc(), "format.readEffectiveInlineUniformity");
4181
4556
  if (!op) return {
4182
- values: null,
4557
+ value: null,
4183
4558
  status: "ready"
4184
4559
  };
4185
- const { value, status } = readAsync(`effInline:${selectionEffectiveUniformitySignature(selection$1) ?? selectionSignature(selection$1)}`, contentToken(), () => op({
4560
+ return readAsync(`effInline:${selectionEffectiveUniformitySignature(selection$1) ?? selectionSignature(selection$1)}`, contentToken(), () => op({
4186
4561
  target,
4187
- offsetSpace: "selection"
4562
+ offsetSpace: "selection",
4563
+ keys: EFFECTIVE_INLINE_UNIFORMITY_KEYS
4188
4564
  }), (raw) => raw && typeof raw === "object" ? raw : null);
4565
+ };
4566
+ const resolveEffectiveInlineUniformityValues = (selection$1) => {
4567
+ const { value, status } = readEffectiveInlineUniformityCached(selection$1);
4189
4568
  if (!value || value.success !== true) return {
4190
4569
  values: null,
4191
4570
  status
@@ -4204,6 +4583,33 @@ function createSuperDocUI(options) {
4204
4583
  status
4205
4584
  };
4206
4585
  };
4586
+ const resolveEffectiveMarkUniformityValues = (selection$1) => {
4587
+ const { value, status } = readEffectiveInlineUniformityCached(selection$1);
4588
+ if (!value || value.success !== true) return {
4589
+ values: null,
4590
+ status
4591
+ };
4592
+ const states = value.values;
4593
+ const values = {};
4594
+ for (const key of EFFECTIVE_MARK_KEYS) {
4595
+ const entry = states?.[key];
4596
+ if (entry?.state === "uniform" && (entry.value === "true" || entry.value === "false")) values[key] = entry.value === "true";
4597
+ }
4598
+ return {
4599
+ values,
4600
+ status
4601
+ };
4602
+ };
4603
+ const effectiveMarkActiveState = (descriptor, selection$1) => {
4604
+ const mark = descriptor.activeMark;
4605
+ if (!mark || !EFFECTIVE_MARK_KEYS.includes(mark)) return null;
4606
+ const key = mark;
4607
+ const fromLayout = resolveEffectiveMarkValuesFromLayout(selection$1)[key];
4608
+ if (fromLayout !== void 0) return fromLayout;
4609
+ const { values } = resolveEffectiveMarkUniformityValues(selection$1);
4610
+ const fromWorker = values?.[key];
4611
+ return fromWorker !== void 0 ? fromWorker : null;
4612
+ };
4207
4613
  const readEffectiveInlineUniformityNow = async (selection$1) => {
4208
4614
  const target = selection$1.selectionTarget;
4209
4615
  if (!target) return null;
@@ -4572,6 +4978,8 @@ function createSuperDocUI(options) {
4572
4978
  const optimistic = optimisticInlineToggles.get(descriptor.id);
4573
4979
  const selectionSignature$1 = selectionInlineValueSignature(selection$1);
4574
4980
  if (selectionSignature$1 && optimistic?.selectionSignature === selectionSignature$1) return optimistic.active;
4981
+ const effective = effectiveMarkActiveState(descriptor, selection$1);
4982
+ if (effective !== null) return effective;
4575
4983
  return commandIsActive(descriptor, selection$1);
4576
4984
  };
4577
4985
  const routedCommandValue = (descriptor, doc, selection$1, projectedInlineValues) => {
@@ -5840,6 +6248,7 @@ function createSuperDocUI(options) {
5840
6248
  if (UNSUPPORTED_TRACKED_UI_MUTATION_ROUTES.has(route)) return unsupportedTrackedMutationReceipt(route);
5841
6249
  return { changeMode: "tracked" };
5842
6250
  };
6251
+ const clearInlinePatchForMode = () => readDocumentMode() === "suggesting" ? TRACKED_CLEAR_INLINE_PATCH : CLEAR_INLINE_PATCH;
5843
6252
  const callEditorMutation = (route, op, input) => {
5844
6253
  const options$1 = editorMutationOptionsForRoute(route);
5845
6254
  if (options$1 && options$1.success === false) return options$1;
@@ -6096,7 +6505,7 @@ function createSuperDocUI(options) {
6096
6505
  if (inlineOp) try {
6097
6506
  record(callInlineFormatMutation("format.apply", inlineOp, {
6098
6507
  target: rangeTarget,
6099
- inline: { ...CLEAR_INLINE_PATCH }
6508
+ inline: { ...clearInlinePatchForMode() }
6100
6509
  }));
6101
6510
  } catch {
6102
6511
  immediateResults.push(false);
@@ -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.40",
10
+ superdocVersion: "2.0.0-next.42",
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.40",
9
+ superdocVersion: "2.0.0-next.42",
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
@@ -55,7 +55,6 @@ export type TemplateScope = 'styles' | 'numbering' | 'settings' | 'theme' | 'fon
55
55
  export interface TemplatesApplyInput {
56
56
  source: TemplatesApplySource;
57
57
  bodyPolicy?: TemplateBodyPolicy;
58
- onUnsupportedContent?: 'narrow' | 'error';
59
58
  }
60
59
  export interface TemplatesApplyOptions {
61
60
  dryRun?: boolean;
@@ -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-kkZK7Tc-.cjs");
3
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-DYky1UEo.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-BDAxgGrE.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BFz0iim0.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-kkZK7Tc-.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-DYky1UEo.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-BDAxgGrE.es.js";
1
+ import { n as BUILT_IN_COMMAND_IDS, r as shallowEqual, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BFz0iim0.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
package/dist/style.css CHANGED
@@ -2674,11 +2674,11 @@ img[data-v-c95b2073] {
2674
2674
  opacity: 0.55;
2675
2675
  }
2676
2676
 
2677
- .sd-option-row[data-v-5f3db0a9] {
2677
+ .sd-option-row[data-v-05eb02fc] {
2678
2678
  display: flex;
2679
2679
  flex-direction: row;
2680
2680
  }
2681
- .sd-option[data-v-5f3db0a9] {
2681
+ .sd-option[data-v-05eb02fc] {
2682
2682
  border-radius: 50%;
2683
2683
  cursor: pointer;
2684
2684
  padding: 3px;
@@ -2688,15 +2688,15 @@ img[data-v-c95b2073] {
2688
2688
  position: relative;
2689
2689
  box-sizing: border-box;
2690
2690
  }
2691
- .sd-option[data-v-5f3db0a9]:hover {
2691
+ .sd-option[data-v-05eb02fc]:hover {
2692
2692
  background-color: var(--sd-ui-dropdown-hover-bg, #d8dee5);
2693
2693
  }
2694
- .sd-option__icon[data-v-5f3db0a9] {
2694
+ .sd-option__icon[data-v-05eb02fc] {
2695
2695
  width: 20px;
2696
2696
  height: 20px;
2697
2697
  flex-shrink: 0;
2698
2698
  }
2699
- .sd-option__check[data-v-5f3db0a9] {
2699
+ .sd-option__check[data-v-05eb02fc] {
2700
2700
  width: 14px;
2701
2701
  height: 14px;
2702
2702
  flex-shrink: 0;
@@ -2674,11 +2674,11 @@ img[data-v-c95b2073] {
2674
2674
  opacity: 0.55;
2675
2675
  }
2676
2676
 
2677
- .sd-option-row[data-v-5f3db0a9] {
2677
+ .sd-option-row[data-v-05eb02fc] {
2678
2678
  display: flex;
2679
2679
  flex-direction: row;
2680
2680
  }
2681
- .sd-option[data-v-5f3db0a9] {
2681
+ .sd-option[data-v-05eb02fc] {
2682
2682
  border-radius: 50%;
2683
2683
  cursor: pointer;
2684
2684
  padding: 3px;
@@ -2688,15 +2688,15 @@ img[data-v-c95b2073] {
2688
2688
  position: relative;
2689
2689
  box-sizing: border-box;
2690
2690
  }
2691
- .sd-option[data-v-5f3db0a9]:hover {
2691
+ .sd-option[data-v-05eb02fc]:hover {
2692
2692
  background-color: var(--sd-ui-dropdown-hover-bg, #d8dee5);
2693
2693
  }
2694
- .sd-option__icon[data-v-5f3db0a9] {
2694
+ .sd-option__icon[data-v-05eb02fc] {
2695
2695
  width: 20px;
2696
2696
  height: 20px;
2697
2697
  flex-shrink: 0;
2698
2698
  }
2699
- .sd-option__check[data-v-5f3db0a9] {
2699
+ .sd-option__check[data-v-05eb02fc] {
2700
2700
  width: 14px;
2701
2701
  height: 14px;
2702
2702
  flex-shrink: 0;
@@ -129,7 +129,10 @@ export interface Editor {
129
129
  state?: unknown;
130
130
  view?: unknown;
131
131
  exportDocx?: (options?: Record<string, unknown>) => Promise<Blob | File | null | undefined>;
132
- focus?: () => unknown;
132
+ focus?: (options?: {
133
+ preventScroll?: boolean;
134
+ restoreSelection?: boolean;
135
+ }) => unknown;
133
136
  setOptions?: (options: Record<string, unknown>) => unknown;
134
137
  setDocumentMode?: (mode: DocumentMode) => unknown;
135
138
  setHighContrastMode?: (isHighContrast: boolean) => unknown;