@beyondwork/docx-react-component 1.0.128 → 1.0.129
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/api/public-types.cjs +215 -61
- package/dist/api/public-types.d.cts +2 -2
- package/dist/api/public-types.d.ts +2 -2
- package/dist/api/public-types.js +2 -2
- package/dist/api/v3.cjs +896 -71
- package/dist/api/v3.d.cts +3 -3
- package/dist/api/v3.d.ts +3 -3
- package/dist/api/v3.js +8 -8
- package/dist/{canonical-document-CXCFCbAz.d.cts → canonical-document-BMtONpgf.d.cts} +6 -0
- package/dist/{canonical-document-CXCFCbAz.d.ts → canonical-document-BMtONpgf.d.ts} +6 -0
- package/dist/{chunk-KV435YXO.js → chunk-5DSHUYSY.js} +1 -1
- package/dist/{chunk-TQDQU2E3.js → chunk-63FYIGCT.js} +2 -2
- package/dist/{chunk-ZDOAUP3V.js → chunk-DDN2AIGE.js} +1 -1
- package/dist/{chunk-6F5QW44A.js → chunk-DJU2W4E4.js} +2 -2
- package/dist/{chunk-4EENH4FG.js → chunk-EZKJXIPH.js} +1 -1
- package/dist/{chunk-CXSYRB37.js → chunk-HUIHBBAQ.js} +166 -49
- package/dist/{chunk-ESJ2MES5.js → chunk-JJGVE5J7.js} +1 -1
- package/dist/{chunk-LZVBNDGU.js → chunk-LJH64PV3.js} +3 -3
- package/dist/{chunk-MWSBGJQO.js → chunk-OTQIW2TC.js} +2 -2
- package/dist/{chunk-2QL5DAKF.js → chunk-PGKUJZXV.js} +3 -3
- package/dist/{chunk-6EROGFUF.js → chunk-PRAZBHNF.js} +441 -128
- package/dist/{chunk-4YJVRIUB.js → chunk-Q3QYGKFE.js} +51 -8
- package/dist/{chunk-YHZHPXDB.js → chunk-RMRTQGW3.js} +50 -13
- package/dist/{chunk-XRACP43Q.js → chunk-SKPTKQHF.js} +351 -13
- package/dist/{chunk-D5HYZQTG.js → chunk-VNLDQJ47.js} +1 -1
- package/dist/{chunk-BYSRJ4FE.js → chunk-W34X3KBR.js} +1 -1
- package/dist/{chunk-V6XVZFFH.js → chunk-XMHSGPLN.js} +2 -2
- package/dist/{chunk-LCYYR57Q.js → chunk-XQCAMKIQ.js} +421 -6
- package/dist/{chunk-YD2JE54B.js → chunk-YZDZ4FGR.js} +1 -1
- package/dist/compare.d.cts +1 -1
- package/dist/compare.d.ts +1 -1
- package/dist/core/commands/formatting-commands.d.cts +2 -2
- package/dist/core/commands/formatting-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.cjs +166 -49
- package/dist/core/commands/image-commands.d.cts +2 -2
- package/dist/core/commands/image-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.js +4 -4
- package/dist/core/commands/section-layout-commands.d.cts +2 -2
- package/dist/core/commands/section-layout-commands.d.ts +2 -2
- package/dist/core/commands/style-commands.d.cts +2 -2
- package/dist/core/commands/style-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.cjs +166 -49
- package/dist/core/commands/table-structure-commands.d.cts +2 -2
- package/dist/core/commands/table-structure-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.js +3 -3
- package/dist/core/commands/text-commands.cjs +166 -49
- package/dist/core/commands/text-commands.d.cts +2 -2
- package/dist/core/commands/text-commands.d.ts +2 -2
- package/dist/core/commands/text-commands.js +4 -4
- package/dist/core/selection/mapping.d.cts +2 -2
- package/dist/core/selection/mapping.d.ts +2 -2
- package/dist/core/state/editor-state.d.cts +2 -2
- package/dist/core/state/editor-state.d.ts +2 -2
- package/dist/index.cjs +1486 -211
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +46 -22
- package/dist/io/docx-session.cjs +51 -8
- package/dist/io/docx-session.d.cts +4 -4
- package/dist/io/docx-session.d.ts +4 -4
- package/dist/io/docx-session.js +3 -3
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +2 -2
- package/dist/{loader-19ct2Be0.d.ts → loader-4qsw4eIU.d.ts} +3 -3
- package/dist/{loader-CoXQ2wGd.d.cts → loader-B8TKhmQi.d.cts} +3 -3
- package/dist/{public-types-B-CskQen.d.cts → public-types-B5CRoR6f.d.cts} +128 -1
- package/dist/{public-types-7KZsNGE2.d.ts → public-types-p9b8rfy8.d.ts} +128 -1
- package/dist/public-types.cjs +215 -61
- package/dist/public-types.d.cts +2 -2
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.js +2 -2
- package/dist/runtime/collab.d.cts +3 -3
- package/dist/runtime/collab.d.ts +3 -3
- package/dist/runtime/document-runtime.cjs +980 -185
- package/dist/runtime/document-runtime.d.cts +2 -2
- package/dist/runtime/document-runtime.d.ts +2 -2
- package/dist/runtime/document-runtime.js +13 -13
- package/dist/{session-B5015J4v.d.cts → session-BnGIjaex.d.cts} +3 -3
- package/dist/{session-C2i8-d6v.d.ts → session-vEYKf-w3.d.ts} +3 -3
- package/dist/session.cjs +51 -8
- package/dist/session.d.cts +5 -5
- package/dist/session.d.ts +5 -5
- package/dist/session.js +4 -4
- package/dist/tailwind.cjs +215 -61
- package/dist/tailwind.d.cts +2 -2
- package/dist/tailwind.d.ts +2 -2
- package/dist/tailwind.js +5 -5
- package/dist/{types-DNhN0WeN.d.cts → types-BLuvZ6cQ.d.cts} +2 -2
- package/dist/{types-yvrQuGX9.d.ts → types-Dutlyj0T.d.ts} +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.js +3 -3
- package/dist/ui-tailwind.cjs +215 -61
- package/dist/ui-tailwind.d.cts +3 -3
- package/dist/ui-tailwind.d.ts +3 -3
- package/dist/ui-tailwind.js +5 -5
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
enumerateScopes,
|
|
10
10
|
findParagraphByBlockId,
|
|
11
11
|
getAIActionPolicy,
|
|
12
|
+
getListKind,
|
|
12
13
|
parseCanonicalFragmentFromWordML,
|
|
13
14
|
resolveDirectRunFormattingAtSegment,
|
|
14
15
|
resolveEditableTableStructureTarget,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
resolveScopeRange,
|
|
18
19
|
scopeSpecificity,
|
|
19
20
|
searchDocument
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SKPTKQHF.js";
|
|
21
22
|
import {
|
|
22
23
|
BROADCAST_COMMAND_TYPES,
|
|
23
24
|
COMMAND_EVENT_SCHEMA_VERSION,
|
|
@@ -36,23 +37,24 @@ import {
|
|
|
36
37
|
LAYCACHE_SCHEMA_VERSION,
|
|
37
38
|
LAYOUT_ENGINE_VERSION,
|
|
38
39
|
createScopeTagRegistry
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-RMRTQGW3.js";
|
|
40
41
|
import {
|
|
41
42
|
chartModelStore,
|
|
42
43
|
createFormattingContext
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-HUIHBBAQ.js";
|
|
44
45
|
import {
|
|
46
|
+
createSelectionSnapshot,
|
|
45
47
|
deriveDocumentStats
|
|
46
48
|
} from "./chunk-OYGMRRR7.js";
|
|
47
49
|
import {
|
|
48
50
|
DocxSession
|
|
49
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-63FYIGCT.js";
|
|
50
52
|
import {
|
|
51
53
|
WORKFLOW_PAYLOAD_PART_PATH,
|
|
52
54
|
buildEditorStateXml,
|
|
53
55
|
parseEditorStateXml,
|
|
54
56
|
parseWorkflowPayloadEnvelopeFromPackage
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-XMHSGPLN.js";
|
|
56
58
|
import {
|
|
57
59
|
EMU_PER_PX,
|
|
58
60
|
GRADIENT_STOP_UNITS,
|
|
@@ -864,6 +866,10 @@ function extractNLHaystack(entry) {
|
|
|
864
866
|
}
|
|
865
867
|
return out.slice(0, 200).toLowerCase();
|
|
866
868
|
}
|
|
869
|
+
case "image": {
|
|
870
|
+
const text = entry.image.type === "image" ? entry.image.altText ?? "" : entry.image.anchor.docPr?.descr ?? entry.image.anchor.docPr?.name ?? "";
|
|
871
|
+
return text.slice(0, 200).toLowerCase();
|
|
872
|
+
}
|
|
867
873
|
case "table":
|
|
868
874
|
case "table-row":
|
|
869
875
|
case "table-cell":
|
|
@@ -3993,6 +3999,391 @@ function createViewportFamily(runtime) {
|
|
|
3993
3999
|
};
|
|
3994
4000
|
}
|
|
3995
4001
|
|
|
4002
|
+
// src/api/v3/runtime/lists.ts
|
|
4003
|
+
var SUPPORTED_COMMANDS = [
|
|
4004
|
+
"toggle-numbered",
|
|
4005
|
+
"toggle-bulleted",
|
|
4006
|
+
"indent",
|
|
4007
|
+
"outdent",
|
|
4008
|
+
"restart-numbering",
|
|
4009
|
+
"continue-numbering"
|
|
4010
|
+
];
|
|
4011
|
+
var UNSUPPORTED_COMMANDS = [
|
|
4012
|
+
"create",
|
|
4013
|
+
"attach",
|
|
4014
|
+
"detach",
|
|
4015
|
+
"join",
|
|
4016
|
+
"separate",
|
|
4017
|
+
"split",
|
|
4018
|
+
"set-value",
|
|
4019
|
+
"apply-template",
|
|
4020
|
+
"capture-template",
|
|
4021
|
+
"apply-preset",
|
|
4022
|
+
"set-level-numbering",
|
|
4023
|
+
"set-level-bullet",
|
|
4024
|
+
"set-level-picture-bullet",
|
|
4025
|
+
"set-level-alignment",
|
|
4026
|
+
"set-level-indents",
|
|
4027
|
+
"set-level-trailing-character",
|
|
4028
|
+
"set-level-marker-font",
|
|
4029
|
+
"set-level-text",
|
|
4030
|
+
"set-level-start",
|
|
4031
|
+
"set-level-layout",
|
|
4032
|
+
"convert-to-text",
|
|
4033
|
+
"paste-fragment",
|
|
4034
|
+
"drop-fragment"
|
|
4035
|
+
];
|
|
4036
|
+
var applyCommandMetadata = {
|
|
4037
|
+
name: "runtime.lists.applyCommand",
|
|
4038
|
+
status: "live-with-adapter",
|
|
4039
|
+
sourceLayer: "runtime-core",
|
|
4040
|
+
liveEvidence: {
|
|
4041
|
+
runnerTest: "test/api/v3/runtime/lists.test.ts",
|
|
4042
|
+
commit: "refactor-07-runtime-lists-namespace"
|
|
4043
|
+
},
|
|
4044
|
+
uxIntent: {
|
|
4045
|
+
uiVisible: true,
|
|
4046
|
+
expectsUxResponse: "surface-refresh",
|
|
4047
|
+
expectedDelta: "list structure changes through the L07 list command surface"
|
|
4048
|
+
},
|
|
4049
|
+
agentMetadata: { readOrMutate: "mutate", boundedScope: "scope", auditCategory: "list-command" },
|
|
4050
|
+
stateClass: "A-canonical",
|
|
4051
|
+
persistsTo: "canonical",
|
|
4052
|
+
broadcastsVia: "crdt",
|
|
4053
|
+
rwdReference: "\xA7Runtime API \xA7 runtime.lists.applyCommand. Dispatches only proven L07 list commands through opaque list targets; future commands return owner-routed blockers until command/export/readback support lands."
|
|
4054
|
+
};
|
|
4055
|
+
function createListsFamily(runtime) {
|
|
4056
|
+
return {
|
|
4057
|
+
list(input = {}) {
|
|
4058
|
+
const document = runtime.getCanonicalDocument();
|
|
4059
|
+
const rows = currentListTargets(document).filter((entry) => input.storyKey === void 0 || entry.target.storyKey === input.storyKey).map((entry) => toReadback(document, entry.target, entry.paragraph));
|
|
4060
|
+
return input.limit === void 0 ? rows : rows.slice(0, Math.max(0, input.limit));
|
|
4061
|
+
},
|
|
4062
|
+
get(input) {
|
|
4063
|
+
const resolved = resolveCurrentListTarget(runtime.getCanonicalDocument(), input);
|
|
4064
|
+
return resolved.kind === "resolved" ? toReadback(runtime.getCanonicalDocument(), resolved.target, resolved.paragraph) : null;
|
|
4065
|
+
},
|
|
4066
|
+
previewCommand(input) {
|
|
4067
|
+
return previewListCommand(runtime.getCanonicalDocument(), input);
|
|
4068
|
+
},
|
|
4069
|
+
applyCommand(input) {
|
|
4070
|
+
const preview = previewListCommand(runtime.getCanonicalDocument(), input);
|
|
4071
|
+
if (!preview.supported || !preview.target) {
|
|
4072
|
+
return {
|
|
4073
|
+
applied: false,
|
|
4074
|
+
command: input.command,
|
|
4075
|
+
before: preview.target,
|
|
4076
|
+
blockers: preview.blockers
|
|
4077
|
+
};
|
|
4078
|
+
}
|
|
4079
|
+
const resolved = resolveCurrentListTarget(runtime.getCanonicalDocument(), {
|
|
4080
|
+
addressKey: preview.target.addressKey
|
|
4081
|
+
});
|
|
4082
|
+
if (resolved.kind !== "resolved") {
|
|
4083
|
+
return {
|
|
4084
|
+
applied: false,
|
|
4085
|
+
command: input.command,
|
|
4086
|
+
before: preview.target,
|
|
4087
|
+
blockers: [resolved.blocker]
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
const command = editorCommandForListCommand(
|
|
4091
|
+
input.command,
|
|
4092
|
+
resolved.target,
|
|
4093
|
+
runtime.now(),
|
|
4094
|
+
input.startAt
|
|
4095
|
+
);
|
|
4096
|
+
if (!command) {
|
|
4097
|
+
return {
|
|
4098
|
+
applied: false,
|
|
4099
|
+
command: input.command,
|
|
4100
|
+
before: preview.target,
|
|
4101
|
+
blockers: [
|
|
4102
|
+
unsupportedCommandBlocker(input.command, {
|
|
4103
|
+
targetKey: preview.target.targetKey,
|
|
4104
|
+
addressKey: preview.target.addressKey
|
|
4105
|
+
})
|
|
4106
|
+
]
|
|
4107
|
+
};
|
|
4108
|
+
}
|
|
4109
|
+
const beforeDocument = runtime.getCanonicalDocument();
|
|
4110
|
+
runtime.dispatch(command);
|
|
4111
|
+
const afterDocument = runtime.getCanonicalDocument();
|
|
4112
|
+
const after = resolveCurrentListTarget(afterDocument, { targetKey: preview.target.targetKey });
|
|
4113
|
+
emitUxResponse(runtime, {
|
|
4114
|
+
apiFn: applyCommandMetadata.name,
|
|
4115
|
+
intent: applyCommandMetadata.uxIntent.expectedDelta ?? "",
|
|
4116
|
+
mockOrLive: "live",
|
|
4117
|
+
uiVisible: true,
|
|
4118
|
+
expectedDelta: applyCommandMetadata.uxIntent.expectedDelta
|
|
4119
|
+
});
|
|
4120
|
+
return {
|
|
4121
|
+
applied: beforeDocument !== afterDocument,
|
|
4122
|
+
command: input.command,
|
|
4123
|
+
before: preview.target,
|
|
4124
|
+
...after.kind === "resolved" ? { after: toReadback(afterDocument, after.target, after.paragraph) } : {},
|
|
4125
|
+
blockers: []
|
|
4126
|
+
};
|
|
4127
|
+
}
|
|
4128
|
+
};
|
|
4129
|
+
}
|
|
4130
|
+
function previewListCommand(document, input) {
|
|
4131
|
+
const resolved = resolveCurrentListTarget(document, input);
|
|
4132
|
+
if (resolved.kind !== "resolved") {
|
|
4133
|
+
return {
|
|
4134
|
+
command: input.command,
|
|
4135
|
+
supported: false,
|
|
4136
|
+
affectedTargets: [],
|
|
4137
|
+
blockers: [resolved.blocker]
|
|
4138
|
+
};
|
|
4139
|
+
}
|
|
4140
|
+
const target = toReadback(document, resolved.target, resolved.paragraph);
|
|
4141
|
+
const targetRef = { targetKey: target.targetKey, addressKey: target.addressKey };
|
|
4142
|
+
if (!SUPPORTED_COMMANDS.includes(input.command)) {
|
|
4143
|
+
return {
|
|
4144
|
+
command: input.command,
|
|
4145
|
+
supported: false,
|
|
4146
|
+
target,
|
|
4147
|
+
affectedTargets: [target],
|
|
4148
|
+
blockers: [unsupportedCommandBlocker(input.command, targetRef)]
|
|
4149
|
+
};
|
|
4150
|
+
}
|
|
4151
|
+
const canContinuePrevious = canContinuePreviousSequence(document, resolved.paragraphIndex);
|
|
4152
|
+
const canJoin = canJoinPreviousSequence(document, resolved.paragraphIndex);
|
|
4153
|
+
const blockers = [];
|
|
4154
|
+
if (input.command === "continue-numbering" && !canContinuePrevious) {
|
|
4155
|
+
blockers.push({
|
|
4156
|
+
code: "list-continue-target-missing",
|
|
4157
|
+
ownerLayer: "L07",
|
|
4158
|
+
message: "No previous compatible list sequence is available for continue-numbering.",
|
|
4159
|
+
...targetRef
|
|
4160
|
+
});
|
|
4161
|
+
}
|
|
4162
|
+
return {
|
|
4163
|
+
command: input.command,
|
|
4164
|
+
supported: blockers.length === 0,
|
|
4165
|
+
target,
|
|
4166
|
+
affectedTargets: [target],
|
|
4167
|
+
blockers,
|
|
4168
|
+
canJoin,
|
|
4169
|
+
canContinuePrevious
|
|
4170
|
+
};
|
|
4171
|
+
}
|
|
4172
|
+
function editorCommandForListCommand(command, editableTarget, timestamp, startAt) {
|
|
4173
|
+
const origin = { source: "api", timestamp };
|
|
4174
|
+
switch (command) {
|
|
4175
|
+
case "toggle-numbered":
|
|
4176
|
+
return { type: "list.toggle", kind: "numbered", editableTargets: [editableTarget], origin };
|
|
4177
|
+
case "toggle-bulleted":
|
|
4178
|
+
return { type: "list.toggle", kind: "bulleted", editableTargets: [editableTarget], origin };
|
|
4179
|
+
case "indent":
|
|
4180
|
+
return { type: "list.indent", editableTargets: [editableTarget], origin };
|
|
4181
|
+
case "outdent":
|
|
4182
|
+
return { type: "list.outdent", editableTargets: [editableTarget], origin };
|
|
4183
|
+
case "restart-numbering":
|
|
4184
|
+
return {
|
|
4185
|
+
type: "list.restart-numbering",
|
|
4186
|
+
editableTarget,
|
|
4187
|
+
...startAt !== void 0 ? { startAt } : {},
|
|
4188
|
+
origin
|
|
4189
|
+
};
|
|
4190
|
+
case "continue-numbering":
|
|
4191
|
+
return { type: "list.continue-numbering", editableTarget, origin };
|
|
4192
|
+
default:
|
|
4193
|
+
return void 0;
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
function resolveCurrentListTarget(document, input) {
|
|
4197
|
+
if (input.editableTarget) {
|
|
4198
|
+
const shapeIssues = validateEditableTargetRef(input.editableTarget);
|
|
4199
|
+
if (shapeIssues.length > 0) {
|
|
4200
|
+
return {
|
|
4201
|
+
kind: "blocked",
|
|
4202
|
+
blocker: {
|
|
4203
|
+
code: "list-target-malformed",
|
|
4204
|
+
ownerLayer: "L07",
|
|
4205
|
+
message: `List target is malformed: ${shapeIssues[0]?.path ?? "$"}.`,
|
|
4206
|
+
targetKey: input.editableTarget.targetKey,
|
|
4207
|
+
addressKey: input.editableTarget.listAddress?.addressKey
|
|
4208
|
+
}
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
const requestedTargetKey = input.editableTarget?.targetKey ?? input.targetKey;
|
|
4213
|
+
const requestedAddressKey = input.editableTarget?.listAddress?.addressKey ?? input.addressKey;
|
|
4214
|
+
if (!requestedTargetKey && !requestedAddressKey) {
|
|
4215
|
+
return {
|
|
4216
|
+
kind: "blocked",
|
|
4217
|
+
blocker: {
|
|
4218
|
+
code: "list-target-required",
|
|
4219
|
+
ownerLayer: "L07",
|
|
4220
|
+
message: "runtime.lists requires a targetKey, addressKey, or editableTarget."
|
|
4221
|
+
}
|
|
4222
|
+
};
|
|
4223
|
+
}
|
|
4224
|
+
const currentTargets = currentListTargets(document);
|
|
4225
|
+
const resolved = currentTargets.find(
|
|
4226
|
+
({ target }) => requestedTargetKey !== void 0 && target.targetKey === requestedTargetKey || requestedAddressKey !== void 0 && target.listAddress?.addressKey === requestedAddressKey
|
|
4227
|
+
);
|
|
4228
|
+
if (!resolved) {
|
|
4229
|
+
return {
|
|
4230
|
+
kind: "blocked",
|
|
4231
|
+
blocker: {
|
|
4232
|
+
code: "list-target-not-found",
|
|
4233
|
+
ownerLayer: "L07",
|
|
4234
|
+
message: "List target no longer resolves in the current canonical document.",
|
|
4235
|
+
...requestedTargetKey !== void 0 ? { targetKey: requestedTargetKey } : {},
|
|
4236
|
+
...requestedAddressKey !== void 0 ? { addressKey: requestedAddressKey } : {}
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
}
|
|
4240
|
+
if (input.editableTarget && !sameTargetStaleHash(input.editableTarget, resolved.target)) {
|
|
4241
|
+
return {
|
|
4242
|
+
kind: "blocked",
|
|
4243
|
+
blocker: {
|
|
4244
|
+
code: "list-target-stale",
|
|
4245
|
+
ownerLayer: "L07",
|
|
4246
|
+
message: "List target resolved by identity but stale discriminators changed.",
|
|
4247
|
+
targetKey: input.editableTarget.targetKey,
|
|
4248
|
+
addressKey: input.editableTarget.listAddress?.addressKey
|
|
4249
|
+
}
|
|
4250
|
+
};
|
|
4251
|
+
}
|
|
4252
|
+
if (resolved.target.editability !== "editable" || resolved.target.posture.blockers.length > 0) {
|
|
4253
|
+
return {
|
|
4254
|
+
kind: "blocked",
|
|
4255
|
+
blocker: {
|
|
4256
|
+
code: "list-target-non-editable",
|
|
4257
|
+
ownerLayer: "L07",
|
|
4258
|
+
message: resolved.target.posture.blockers.length > 0 ? `List target is not editable: ${resolved.target.posture.blockers.join(", ")}.` : "List target is not editable.",
|
|
4259
|
+
targetKey: resolved.target.targetKey,
|
|
4260
|
+
addressKey: resolved.target.listAddress?.addressKey
|
|
4261
|
+
}
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
return { kind: "resolved", ...resolved };
|
|
4265
|
+
}
|
|
4266
|
+
function currentListTargets(document) {
|
|
4267
|
+
const paragraphs = collectParagraphEntries(document.content.children, "main");
|
|
4268
|
+
const targets = collectEditableTargetRefs(document).filter(isListTextTarget);
|
|
4269
|
+
const byBlockPath = /* @__PURE__ */ new Map();
|
|
4270
|
+
for (const target of targets) byBlockPath.set(target.blockPath, target);
|
|
4271
|
+
const out = [];
|
|
4272
|
+
for (let paragraphIndex = 0; paragraphIndex < paragraphs.length; paragraphIndex += 1) {
|
|
4273
|
+
const entry = paragraphs[paragraphIndex];
|
|
4274
|
+
if (!entry?.paragraph.numbering) continue;
|
|
4275
|
+
const target = byBlockPath.get(entry.blockPath);
|
|
4276
|
+
if (!target) continue;
|
|
4277
|
+
out.push({ target, paragraph: entry.paragraph, paragraphIndex });
|
|
4278
|
+
}
|
|
4279
|
+
return out;
|
|
4280
|
+
}
|
|
4281
|
+
function collectParagraphEntries(blocks, basePath) {
|
|
4282
|
+
const out = [];
|
|
4283
|
+
collectParagraphEntriesInto(blocks, basePath, out);
|
|
4284
|
+
return out;
|
|
4285
|
+
}
|
|
4286
|
+
function collectParagraphEntriesInto(blocks, basePath, out) {
|
|
4287
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
4288
|
+
const block = blocks[blockIndex];
|
|
4289
|
+
if (!block) continue;
|
|
4290
|
+
const blockPath = `${basePath}/block[${blockIndex}]`;
|
|
4291
|
+
switch (block.type) {
|
|
4292
|
+
case "paragraph":
|
|
4293
|
+
out.push({ paragraph: block, blockPath });
|
|
4294
|
+
break;
|
|
4295
|
+
case "table":
|
|
4296
|
+
for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {
|
|
4297
|
+
const row = block.rows[rowIndex];
|
|
4298
|
+
if (!row) continue;
|
|
4299
|
+
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
4300
|
+
const cell = row.cells[cellIndex];
|
|
4301
|
+
if (!cell) continue;
|
|
4302
|
+
collectParagraphEntriesInto(
|
|
4303
|
+
cell.children,
|
|
4304
|
+
`${blockPath}/row[${rowIndex}]/cell[${cellIndex}]`,
|
|
4305
|
+
out
|
|
4306
|
+
);
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
break;
|
|
4310
|
+
case "sdt":
|
|
4311
|
+
collectParagraphEntriesInto(block.children, blockPath, out);
|
|
4312
|
+
break;
|
|
4313
|
+
case "custom_xml":
|
|
4314
|
+
break;
|
|
4315
|
+
default:
|
|
4316
|
+
break;
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
function isListTextTarget(target) {
|
|
4321
|
+
return target.commandFamily === "text-leaf" && target.listAddress?.operationScope === "list-text" && target.listAddress.addressKind === "list-item-text";
|
|
4322
|
+
}
|
|
4323
|
+
function sameTargetStaleHash(left, right) {
|
|
4324
|
+
return left.targetKey === right.targetKey && left.listAddress?.addressKey === right.listAddress?.addressKey && left.listAddress?.resolver?.staleHash === right.listAddress?.resolver?.staleHash && left.staleCheck.paragraphTextHash === right.staleCheck.paragraphTextHash && left.staleCheck.paragraphTextLength === right.staleCheck.paragraphTextLength && left.staleCheck.inlineCount === right.staleCheck.inlineCount;
|
|
4325
|
+
}
|
|
4326
|
+
function toReadback(document, target, paragraph) {
|
|
4327
|
+
const numbering = paragraph.numbering;
|
|
4328
|
+
const instance = document.numbering.instances[numbering.numberingInstanceId];
|
|
4329
|
+
const listKind = instance ? getListKind(document.numbering, numbering.numberingInstanceId) : void 0;
|
|
4330
|
+
return {
|
|
4331
|
+
targetKey: target.targetKey,
|
|
4332
|
+
actionHandle: `list-action:${target.listAddress.addressKey}`,
|
|
4333
|
+
kind: target.kind,
|
|
4334
|
+
storyKey: target.storyKey,
|
|
4335
|
+
blockPath: target.blockPath,
|
|
4336
|
+
leafPath: target.leafPath,
|
|
4337
|
+
addressKey: target.listAddress.addressKey,
|
|
4338
|
+
numberingInstanceId: numbering.numberingInstanceId,
|
|
4339
|
+
...instance?.abstractNumberingId ? { abstractNumberingId: instance.abstractNumberingId } : {},
|
|
4340
|
+
level: numbering.level,
|
|
4341
|
+
...listKind ? { listKind } : {},
|
|
4342
|
+
editability: target.editability,
|
|
4343
|
+
blockers: target.posture.blockers,
|
|
4344
|
+
supportedCommands: SUPPORTED_COMMANDS,
|
|
4345
|
+
unsupportedCommands: UNSUPPORTED_COMMANDS,
|
|
4346
|
+
staleDiscriminators: {
|
|
4347
|
+
paragraphTextHash: target.staleCheck.paragraphTextHash,
|
|
4348
|
+
paragraphTextLength: target.staleCheck.paragraphTextLength,
|
|
4349
|
+
inlineCount: target.staleCheck.inlineCount,
|
|
4350
|
+
listAddressStaleHash: target.listAddress?.resolver?.staleHash
|
|
4351
|
+
}
|
|
4352
|
+
};
|
|
4353
|
+
}
|
|
4354
|
+
function canContinuePreviousSequence(document, paragraphIndex) {
|
|
4355
|
+
const paragraphs = collectParagraphEntries(document.content.children, "main");
|
|
4356
|
+
const current = paragraphs[paragraphIndex]?.paragraph;
|
|
4357
|
+
if (!current?.numbering) return false;
|
|
4358
|
+
const currentKind = getListKind(document.numbering, current.numbering.numberingInstanceId);
|
|
4359
|
+
if (!currentKind) return false;
|
|
4360
|
+
for (let index = paragraphIndex - 1; index >= 0; index -= 1) {
|
|
4361
|
+
const previous = paragraphs[index]?.paragraph;
|
|
4362
|
+
if (!previous?.numbering) continue;
|
|
4363
|
+
const previousKind = getListKind(document.numbering, previous.numbering.numberingInstanceId);
|
|
4364
|
+
return previousKind === currentKind && previous.numbering.numberingInstanceId !== current.numbering.numberingInstanceId;
|
|
4365
|
+
}
|
|
4366
|
+
return false;
|
|
4367
|
+
}
|
|
4368
|
+
function canJoinPreviousSequence(document, paragraphIndex) {
|
|
4369
|
+
const paragraphs = collectParagraphEntries(document.content.children, "main");
|
|
4370
|
+
const current = paragraphs[paragraphIndex]?.paragraph;
|
|
4371
|
+
const previous = paragraphs[paragraphIndex - 1]?.paragraph;
|
|
4372
|
+
if (!current?.numbering || !previous?.numbering) return false;
|
|
4373
|
+
const currentKind = getListKind(document.numbering, current.numbering.numberingInstanceId);
|
|
4374
|
+
const previousKind = getListKind(document.numbering, previous.numbering.numberingInstanceId);
|
|
4375
|
+
return Boolean(currentKind) && currentKind === previousKind && current.numbering.numberingInstanceId !== previous.numbering.numberingInstanceId;
|
|
4376
|
+
}
|
|
4377
|
+
function unsupportedCommandBlocker(command, target) {
|
|
4378
|
+
return {
|
|
4379
|
+
code: "list-command-unsupported",
|
|
4380
|
+
ownerLayer: "L07",
|
|
4381
|
+
message: `runtime.lists.${command} is reserved but not implemented by the L07 command surface yet.`,
|
|
4382
|
+
...target.targetKey !== void 0 ? { targetKey: target.targetKey } : {},
|
|
4383
|
+
...target.addressKey !== void 0 ? { addressKey: target.addressKey } : {}
|
|
4384
|
+
};
|
|
4385
|
+
}
|
|
4386
|
+
|
|
3996
4387
|
// src/api/v3/ai/_pe2-evidence.ts
|
|
3997
4388
|
function copyCoverage(coverage) {
|
|
3998
4389
|
return {
|
|
@@ -5720,6 +6111,17 @@ function createTableActionFamily(runtime) {
|
|
|
5720
6111
|
operationScope: target.table?.operationScope
|
|
5721
6112
|
});
|
|
5722
6113
|
}
|
|
6114
|
+
if (fragmentContent && fragmentContent.blocks.length === 0) {
|
|
6115
|
+
return blockedResult(input, proposalId, {
|
|
6116
|
+
code: `table-action-structured-fragment-empty:${input.operation.kind}`,
|
|
6117
|
+
category: "unsupported-operation",
|
|
6118
|
+
message: "Structured table text actions require a canonical document fragment with at least one block.",
|
|
6119
|
+
nextStep: 'Retry with operation.content.kind="structured" and a CanonicalDocumentFragment whose blocks array contains the paragraph or table content to paste/drop.',
|
|
6120
|
+
actionHandle: input.actionHandle,
|
|
6121
|
+
operation: input.operation.kind,
|
|
6122
|
+
operationScope: target.table?.operationScope
|
|
6123
|
+
});
|
|
6124
|
+
}
|
|
5723
6125
|
const resolution2 = resolveEditableTextTarget({
|
|
5724
6126
|
document: runtime.getCanonicalDocument(),
|
|
5725
6127
|
surface: runtime.getRenderSnapshot().surface?.blocks ?? [],
|
|
@@ -5742,6 +6144,7 @@ function createTableActionFamily(runtime) {
|
|
|
5742
6144
|
runtime.dispatch({
|
|
5743
6145
|
type: "fragment.insert",
|
|
5744
6146
|
fragment: fragmentContent,
|
|
6147
|
+
selection: createSelectionSnapshot(resolution2.range.to, resolution2.range.to),
|
|
5745
6148
|
editableTarget: target,
|
|
5746
6149
|
origin: { source: "api", timestamp: nowUtc }
|
|
5747
6150
|
});
|
|
@@ -5754,6 +6157,17 @@ function createTableActionFamily(runtime) {
|
|
|
5754
6157
|
});
|
|
5755
6158
|
}
|
|
5756
6159
|
const changed2 = runtime.getCanonicalDocument() !== before2;
|
|
6160
|
+
if (!changed2) {
|
|
6161
|
+
return blockedResult(input, proposalId, {
|
|
6162
|
+
code: `table-action-noop:${input.operation.kind}:${input.actionHandle}`,
|
|
6163
|
+
category: "runtime-noop",
|
|
6164
|
+
message: "The runtime accepted the table text target but the operation produced no document change.",
|
|
6165
|
+
nextStep: "Refresh the table action list and verify the target is still editable, the payload is non-empty when required, and structured fragments are dispatched through a command-safe table text action.",
|
|
6166
|
+
actionHandle: input.actionHandle,
|
|
6167
|
+
operation: input.operation.kind,
|
|
6168
|
+
operationScope: target.table?.operationScope
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
5757
6171
|
const afterReadback = tableTextReadback(readEditableTargetText(runtime.getCanonicalDocument(), target));
|
|
5758
6172
|
return {
|
|
5759
6173
|
proposalId,
|
|
@@ -8856,7 +9270,8 @@ function createApiV3(handle, opts) {
|
|
|
8856
9270
|
chart: createChartFamily(handle),
|
|
8857
9271
|
search: createSearchFamily(handle),
|
|
8858
9272
|
table: createTableFamily(handle),
|
|
8859
|
-
viewport: createViewportFamily(handle)
|
|
9273
|
+
viewport: createViewportFamily(handle),
|
|
9274
|
+
lists: createListsFamily(handle)
|
|
8860
9275
|
};
|
|
8861
9276
|
const ui = opts?.ui ? createUiApi(handle, opts.ui) : void 0;
|
|
8862
9277
|
const api = ui ? { runtime, ai, ui } : { runtime, ai };
|
package/dist/compare.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-
|
|
1
|
+
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-BMtONpgf.cjs';
|
|
2
2
|
|
|
3
3
|
type OpcCompressionMethod = "store" | "deflate";
|
|
4
4
|
type OpcSurfaceKind = "content" | "relationships" | "content-types";
|
package/dist/compare.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-
|
|
1
|
+
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-BMtONpgf.js';
|
|
2
2
|
|
|
3
3
|
type OpcCompressionMethod = "store" | "deflate";
|
|
4
4
|
type OpcSurfaceKind = "content" | "relationships" | "content-types";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'prosemirror-state';
|
|
2
2
|
import 'prosemirror-model';
|
|
3
|
-
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-
|
|
4
|
-
import '../../canonical-document-
|
|
3
|
+
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-B5CRoR6f.cjs';
|
|
4
|
+
import '../../canonical-document-BMtONpgf.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'prosemirror-state';
|
|
2
2
|
import 'prosemirror-model';
|
|
3
|
-
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-
|
|
4
|
-
import '../../canonical-document-
|
|
3
|
+
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-p9b8rfy8.js';
|
|
4
|
+
import '../../canonical-document-BMtONpgf.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|