@beyondwork/docx-react-component 1.0.132 → 1.0.133

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.
Files changed (94) hide show
  1. package/dist/api/public-types.cjs +158 -67
  2. package/dist/api/public-types.d.cts +1 -1
  3. package/dist/api/public-types.d.ts +1 -1
  4. package/dist/api/public-types.js +3 -3
  5. package/dist/api/v3.cjs +9326 -7478
  6. package/dist/api/v3.d.cts +2 -2
  7. package/dist/api/v3.d.ts +2 -2
  8. package/dist/api/v3.js +10 -10
  9. package/dist/{chunk-XYTWOJII.js → chunk-224TSMEB.js} +635 -89
  10. package/dist/{chunk-43JAPM2F.js → chunk-3JEE5RJU.js} +92 -131
  11. package/dist/{chunk-UP2KDOYE.js → chunk-57HTKX3P.js} +6 -2
  12. package/dist/{chunk-RYMMKOFI.js → chunk-5KTJKTNE.js} +32 -0
  13. package/dist/{chunk-LPLJZJT2.js → chunk-CVSD3UNK.js} +128 -69
  14. package/dist/{chunk-JVTDBX67.js → chunk-EFEW7BTT.js} +2 -2
  15. package/dist/{chunk-UFPBYJMA.js → chunk-INLRCC4N.js} +2 -2
  16. package/dist/{chunk-6736GA6J.js → chunk-KL4TZSZV.js} +1 -1
  17. package/dist/{chunk-N5FTU4HZ.js → chunk-MQ5GAJ54.js} +68 -39
  18. package/dist/{chunk-W2I47J2Q.js → chunk-NJFKPDNG.js} +216 -2
  19. package/dist/{chunk-YUHNDEV5.js → chunk-OTRVGNZQ.js} +2934 -1815
  20. package/dist/{chunk-4HGFJ6Z2.js → chunk-PZIEOEJZ.js} +1 -1
  21. package/dist/{chunk-C5LXKR54.js → chunk-QTRJLKR2.js} +1 -1
  22. package/dist/{chunk-SZ6BJA4Q.js → chunk-REFHJ2FN.js} +3 -3
  23. package/dist/{chunk-ZDYGRO2Z.js → chunk-RP76USJE.js} +1 -1
  24. package/dist/{chunk-QUTVR72L.js → chunk-S3PEKX6H.js} +246 -43
  25. package/dist/{chunk-RBWJHRNP.js → chunk-T66OS7MN.js} +8 -3
  26. package/dist/{chunk-ALWXYGXP.js → chunk-V2JF42SI.js} +2 -2
  27. package/dist/{chunk-6TLZ6CMP.js → chunk-WDDFU2N2.js} +2 -2
  28. package/dist/{chunk-U3UMKA7B.js → chunk-XBQFDBXE.js} +1 -1
  29. package/dist/{chunk-CDEZGLQ3.js → chunk-ZFCZ7XXH.js} +1 -1
  30. package/dist/core/commands/formatting-commands.d.cts +1 -1
  31. package/dist/core/commands/formatting-commands.d.ts +1 -1
  32. package/dist/core/commands/image-commands.cjs +32 -0
  33. package/dist/core/commands/image-commands.d.cts +1 -1
  34. package/dist/core/commands/image-commands.d.ts +1 -1
  35. package/dist/core/commands/image-commands.js +5 -5
  36. package/dist/core/commands/section-layout-commands.d.cts +1 -1
  37. package/dist/core/commands/section-layout-commands.d.ts +1 -1
  38. package/dist/core/commands/style-commands.d.cts +1 -1
  39. package/dist/core/commands/style-commands.d.ts +1 -1
  40. package/dist/core/commands/table-structure-commands.cjs +32 -0
  41. package/dist/core/commands/table-structure-commands.d.cts +1 -1
  42. package/dist/core/commands/table-structure-commands.d.ts +1 -1
  43. package/dist/core/commands/table-structure-commands.js +4 -4
  44. package/dist/core/commands/text-commands.cjs +99 -38
  45. package/dist/core/commands/text-commands.d.cts +12 -1
  46. package/dist/core/commands/text-commands.d.ts +12 -1
  47. package/dist/core/commands/text-commands.js +5 -5
  48. package/dist/core/selection/mapping.d.cts +1 -1
  49. package/dist/core/selection/mapping.d.ts +1 -1
  50. package/dist/core/state/editor-state.d.cts +1 -1
  51. package/dist/core/state/editor-state.d.ts +1 -1
  52. package/dist/index.cjs +4827 -2434
  53. package/dist/index.d.cts +4 -4
  54. package/dist/index.d.ts +4 -4
  55. package/dist/index.js +292 -53
  56. package/dist/io/docx-session.cjs +7 -2
  57. package/dist/io/docx-session.d.cts +3 -3
  58. package/dist/io/docx-session.d.ts +3 -3
  59. package/dist/io/docx-session.js +4 -4
  60. package/dist/legal.js +3 -3
  61. package/dist/{loader-MAa8VpzW.d.cts → loader-B2H99237.d.cts} +2 -2
  62. package/dist/{loader-CfpeEPAa.d.ts → loader-DfTjqVwn.d.ts} +2 -2
  63. package/dist/{public-types-Cjs8glST.d.ts → public-types-B5lOUIrP.d.ts} +689 -232
  64. package/dist/{public-types-KBS6JnOs.d.cts → public-types-S8gTYwKo.d.cts} +689 -232
  65. package/dist/public-types.cjs +158 -67
  66. package/dist/public-types.d.cts +1 -1
  67. package/dist/public-types.d.ts +1 -1
  68. package/dist/public-types.js +3 -3
  69. package/dist/runtime/collab.d.cts +2 -2
  70. package/dist/runtime/collab.d.ts +2 -2
  71. package/dist/runtime/document-runtime.cjs +1032 -416
  72. package/dist/runtime/document-runtime.d.cts +1 -1
  73. package/dist/runtime/document-runtime.d.ts +1 -1
  74. package/dist/runtime/document-runtime.js +14 -14
  75. package/dist/{session-CkoH8FoY.d.ts → session-CBDIOYXA.d.ts} +2 -2
  76. package/dist/{session-wwe0Gib-.d.cts → session-CR2A1hGZ.d.cts} +2 -2
  77. package/dist/session.cjs +7 -2
  78. package/dist/session.d.cts +4 -4
  79. package/dist/session.d.ts +4 -4
  80. package/dist/session.js +5 -5
  81. package/dist/tailwind.cjs +398 -105
  82. package/dist/tailwind.d.cts +1 -1
  83. package/dist/tailwind.d.ts +1 -1
  84. package/dist/tailwind.js +7 -7
  85. package/dist/{types-CH7NWqVL.d.ts → types-B-90ywjU.d.ts} +1 -1
  86. package/dist/{types-B3SGRW0w.d.cts → types-yty2K-hk.d.cts} +1 -1
  87. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +2 -2
  88. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +2 -2
  89. package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
  90. package/dist/ui-tailwind.cjs +398 -105
  91. package/dist/ui-tailwind.d.cts +3 -2
  92. package/dist/ui-tailwind.d.ts +3 -2
  93. package/dist/ui-tailwind.js +7 -7
  94. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  collectEditableTargetRefs
3
- } from "./chunk-RYMMKOFI.js";
3
+ } from "./chunk-5KTJKTNE.js";
4
4
 
5
5
  // src/api/v3/_ux-response.ts
6
6
  function emitUxResponse(runtime, res) {
@@ -2110,6 +2110,218 @@ function createScopeFamily(ctx) {
2110
2110
  };
2111
2111
  }
2112
2112
 
2113
+ // src/api/v3/ui/lists.ts
2114
+ var SUPPORTED_COMMANDS = [
2115
+ "toggle-numbered",
2116
+ "toggle-bulleted",
2117
+ "indent",
2118
+ "outdent",
2119
+ "restart-numbering",
2120
+ "continue-numbering"
2121
+ ];
2122
+ var UNSUPPORTED_COMMANDS = [
2123
+ "create",
2124
+ "attach",
2125
+ "detach",
2126
+ "join",
2127
+ "separate",
2128
+ "split",
2129
+ "set-value",
2130
+ "apply-template",
2131
+ "capture-template",
2132
+ "apply-preset",
2133
+ "set-level-numbering",
2134
+ "set-level-bullet",
2135
+ "set-level-picture-bullet",
2136
+ "set-level-alignment",
2137
+ "set-level-indents",
2138
+ "set-level-trailing-character",
2139
+ "set-level-marker-font",
2140
+ "set-level-text",
2141
+ "set-level-start",
2142
+ "set-level-layout",
2143
+ "convert-to-text",
2144
+ "paste-fragment",
2145
+ "drop-fragment"
2146
+ ];
2147
+ function createListsFamily(ctx) {
2148
+ return {
2149
+ list(filter) {
2150
+ const rows = collectListReadbacks(ctx);
2151
+ const filtered = filter?.storyKey === void 0 ? rows : rows.filter((row) => row.storyKey === filter.storyKey);
2152
+ if (typeof filter?.limit === "number") {
2153
+ return filtered.slice(0, Math.max(0, filter.limit));
2154
+ }
2155
+ return filtered;
2156
+ },
2157
+ get(target) {
2158
+ return findReadback(collectListReadbacks(ctx), target);
2159
+ },
2160
+ previewCommand(target) {
2161
+ const row = findReadback(collectListReadbacks(ctx), target);
2162
+ if (!row) {
2163
+ return {
2164
+ command: target.command,
2165
+ supported: false,
2166
+ blockers: [
2167
+ {
2168
+ command: target.command,
2169
+ enabled: false,
2170
+ reason: "list-target-not-found",
2171
+ ownerLayer: "L10"
2172
+ }
2173
+ ]
2174
+ };
2175
+ }
2176
+ const command = row.commandSupport.find((candidate) => candidate.command === target.command);
2177
+ const blocker = command && !command.enabled ? [command] : [];
2178
+ return {
2179
+ command: target.command,
2180
+ supported: Boolean(command?.enabled),
2181
+ target: row,
2182
+ blockers: blocker,
2183
+ canJoin: row.canJoin,
2184
+ canContinuePrevious: row.canContinuePrevious
2185
+ };
2186
+ }
2187
+ };
2188
+ }
2189
+ function collectListReadbacks(ctx) {
2190
+ const surface = ctx.handle.getRenderSnapshot().surface;
2191
+ if (!surface) return [];
2192
+ const paragraphs = [];
2193
+ collectParagraphs(surface.blocks, paragraphs);
2194
+ for (const secondary of surface.secondaryStories) {
2195
+ collectParagraphs(secondary.blocks, paragraphs);
2196
+ }
2197
+ const rows = [];
2198
+ for (let index = 0; index < paragraphs.length; index += 1) {
2199
+ const entry = paragraphs[index];
2200
+ if (!entry) continue;
2201
+ const row = rowForParagraph(entry.block, paragraphs, index);
2202
+ if (row) rows.push(row);
2203
+ }
2204
+ return rows;
2205
+ }
2206
+ function collectParagraphs(blocks, out) {
2207
+ for (const block of blocks) {
2208
+ switch (block.kind) {
2209
+ case "paragraph":
2210
+ out.push({ block });
2211
+ break;
2212
+ case "table":
2213
+ for (const row of block.rows) {
2214
+ for (const cell of row.cells) {
2215
+ collectParagraphs(cell.content, out);
2216
+ }
2217
+ }
2218
+ break;
2219
+ case "sdt_block":
2220
+ collectParagraphs(block.children, out);
2221
+ break;
2222
+ default:
2223
+ break;
2224
+ }
2225
+ }
2226
+ }
2227
+ function rowForParagraph(block, paragraphs, paragraphIndex) {
2228
+ const target = block.editableTarget;
2229
+ const listAddress = target?.listAddress;
2230
+ const numbering = block.numbering;
2231
+ if (!target || !listAddress || !numbering || !block.resolvedNumbering) return null;
2232
+ const listKind = inferListKind(block.resolvedNumbering);
2233
+ const previousParagraph = paragraphs[paragraphIndex - 1]?.block;
2234
+ const canJoin = Boolean(
2235
+ previousParagraph?.numbering && previousParagraph.numbering.numberingInstanceId !== numbering.numberingInstanceId && inferListKind(previousParagraph.resolvedNumbering) === listKind
2236
+ );
2237
+ const canContinuePrevious = paragraphs.slice(0, paragraphIndex).some(
2238
+ ({ block: previous }) => Boolean(
2239
+ previous.numbering && previous.numbering.numberingInstanceId !== numbering.numberingInstanceId && inferListKind(previous.resolvedNumbering) === listKind
2240
+ )
2241
+ );
2242
+ const actionHandle = `list-action:${listAddress.addressKey}`;
2243
+ const blockers = target.posture.blockers;
2244
+ const commandSupport = commandAvailability({
2245
+ actionHandle,
2246
+ blockers,
2247
+ canContinuePrevious
2248
+ });
2249
+ return {
2250
+ source: "surface-render-snapshot",
2251
+ targetKey: target.targetKey,
2252
+ actionHandle,
2253
+ kind: target.kind,
2254
+ storyKey: target.storyKey,
2255
+ blockPath: target.blockPath,
2256
+ leafPath: target.leafPath,
2257
+ addressKey: listAddress.addressKey,
2258
+ hierarchyPath: [numbering.level],
2259
+ numberingInstanceId: numbering.numberingInstanceId,
2260
+ level: numbering.level,
2261
+ listKind,
2262
+ ...block.resolvedNumbering.text !== void 0 ? { markerText: block.resolvedNumbering.text } : {},
2263
+ ...block.resolvedNumbering.suffix !== void 0 ? { suffix: block.resolvedNumbering.suffix } : {},
2264
+ requestedFormat: block.resolvedNumbering.formatPosture?.requestedFormat ?? block.resolvedNumbering.format,
2265
+ renderedFormat: block.resolvedNumbering.formatPosture?.renderedFormat ?? block.resolvedNumbering.format,
2266
+ ...block.resolvedNumbering.formatPosture ? { formatPosture: block.resolvedNumbering.formatPosture } : {},
2267
+ ...block.resolvedNumbering.markerTextPosture ? { markerTextPosture: block.resolvedNumbering.markerTextPosture } : {},
2268
+ ...block.resolvedNumbering.pictureBulletPosture ? { pictureBulletPosture: block.resolvedNumbering.pictureBulletPosture } : {},
2269
+ authoredTextRange: { from: block.from, to: block.to },
2270
+ editability: target.editability,
2271
+ blockers,
2272
+ supportedCommands: SUPPORTED_COMMANDS,
2273
+ unsupportedCommands: UNSUPPORTED_COMMANDS,
2274
+ commandSupport,
2275
+ canJoin,
2276
+ canContinuePrevious,
2277
+ staleDiscriminators: {
2278
+ paragraphTextHash: target.staleCheck.paragraphTextHash,
2279
+ paragraphTextLength: target.staleCheck.paragraphTextLength,
2280
+ inlineCount: target.staleCheck.inlineCount,
2281
+ listAddressStaleHash: listAddress.resolver?.staleHash
2282
+ },
2283
+ geometry: block.resolvedNumbering.geometry,
2284
+ ...!block.resolvedNumbering.geometry.markerLane ? { geometryUnavailableReason: "marker-geometry-unavailable" } : {}
2285
+ };
2286
+ }
2287
+ function commandAvailability(input) {
2288
+ const out = [];
2289
+ for (const command of SUPPORTED_COMMANDS) {
2290
+ const blockedReason = input.blockers[0];
2291
+ const continueBlocked = command === "continue-numbering" && !input.canContinuePrevious;
2292
+ out.push({
2293
+ command,
2294
+ enabled: !blockedReason && !continueBlocked,
2295
+ ...!blockedReason && !continueBlocked ? { actionHandle: input.actionHandle } : {},
2296
+ ...blockedReason ? { reason: blockedReason, ownerLayer: "L07" } : {},
2297
+ ...continueBlocked ? { reason: "list-continue-target-missing", ownerLayer: "L07" } : {}
2298
+ });
2299
+ }
2300
+ for (const command of UNSUPPORTED_COMMANDS) {
2301
+ out.push({
2302
+ command,
2303
+ enabled: false,
2304
+ reason: "list-command-unsupported",
2305
+ ownerLayer: "L07"
2306
+ });
2307
+ }
2308
+ return out;
2309
+ }
2310
+ function findReadback(rows, target) {
2311
+ const addressKey = target.addressKey ?? addressKeyFromActionHandle(target.actionHandle);
2312
+ return rows.find(
2313
+ (row) => target.targetKey !== void 0 && row.targetKey === target.targetKey || addressKey !== void 0 && row.addressKey === addressKey || target.actionHandle !== void 0 && row.actionHandle === target.actionHandle
2314
+ ) ?? null;
2315
+ }
2316
+ function addressKeyFromActionHandle(actionHandle) {
2317
+ const prefix = "list-action:";
2318
+ return actionHandle?.startsWith(prefix) ? actionHandle.slice(prefix.length) : void 0;
2319
+ }
2320
+ function inferListKind(resolved) {
2321
+ if (!resolved) return "numbered";
2322
+ return resolved.format === "bullet" || resolved.picBulletId !== void 0 || resolved.pictureBulletPosture !== void 0 ? "bulleted" : "numbered";
2323
+ }
2324
+
2113
2325
  // src/api/v3/ui/_create.ts
2114
2326
  function createUiApi(handle, factory) {
2115
2327
  const ctx = createUiApiContext(handle);
@@ -2124,7 +2336,8 @@ function createUiApi(handle, factory) {
2124
2336
  overlays: createOverlaysFamily(ctx),
2125
2337
  chrome: createChromeFamily(ctx),
2126
2338
  debug: createDebugFamily(ctx),
2127
- scope: createScopeFamily(ctx)
2339
+ scope: createScopeFamily(ctx),
2340
+ lists: createListsFamily(ctx)
2128
2341
  };
2129
2342
  Object.freeze(api.session);
2130
2343
  Object.freeze(api.surface);
@@ -2133,6 +2346,7 @@ function createUiApi(handle, factory) {
2133
2346
  Object.freeze(api.chrome);
2134
2347
  Object.freeze(api.debug);
2135
2348
  Object.freeze(api.scope);
2349
+ Object.freeze(api.lists);
2136
2350
  return Object.freeze(api);
2137
2351
  }
2138
2352