superdoc 2.28.0 → 2.29.0-next.13

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 (192) hide show
  1. package/dist/chunks/{FindReplaceSurface-Dm043CZP.es.js → FindReplaceSurface-BKVHzhQ4.es.js} +34 -26
  2. package/dist/chunks/{FindReplaceSurface-BRs3JrCq.cjs → FindReplaceSurface-BNDrJ6VS.cjs} +34 -26
  3. package/dist/chunks/{PasswordPromptSurface-DGjmN7A-.es.js → PasswordPromptSurface-6mF6Azda.es.js} +6 -4
  4. package/dist/chunks/{PasswordPromptSurface-BpqP4pUa.cjs → PasswordPromptSurface-BNkaztaP.cjs} +6 -4
  5. package/dist/chunks/{PdfViewer-Cg072l5d.cjs → PdfViewer-DmSkZehl.cjs} +72 -100
  6. package/dist/chunks/{PdfViewer-JHXZQZ9x.es.js → PdfViewer-aOWhUVI7.es.js} +69 -97
  7. package/dist/chunks/{constants-DpXuDx_g.cjs → constants-BeeNZoQp.cjs} +1 -1
  8. package/dist/chunks/{constants-B6VBlmKp.es.js → constants-BvNs_ybI.es.js} +1 -1
  9. package/dist/chunks/{create-super-doc-ui-BbjHD1ul.es.js → create-super-doc-ui-DdT4b29f.es.js} +200 -65
  10. package/dist/chunks/{create-super-doc-ui-BfgYblyI.cjs → create-super-doc-ui-_SbygYQ4.cjs} +227 -68
  11. package/dist/chunks/is-finite-number-BEXgTRgc.cjs +11 -0
  12. package/dist/chunks/is-finite-number-BpL4F38c.es.js +6 -0
  13. package/dist/collaboration-upgrade-engine.cjs +1 -1
  14. package/dist/collaboration-upgrade-engine.es.js +1 -1
  15. package/dist/document-api/src/capabilities/html-markdown-support.d.ts +4 -6
  16. package/dist/document-api/src/comments/comments.d.ts +2 -0
  17. package/dist/document-api/src/contract/metadata-types.d.ts +1 -1
  18. package/dist/document-api/src/contract/operation-definitions.d.ts +3 -3
  19. package/dist/document-api/src/contract/operation-registry.d.ts +10 -9
  20. package/dist/document-api/src/index.d.ts +8 -7
  21. package/dist/document-api/src/insert/insert.d.ts +2 -2
  22. package/dist/document-api/src/lists/lists.d.ts +79 -79
  23. package/dist/document-api/src/replace/replace.d.ts +3 -2
  24. package/dist/document-api/src/tables/tables.d.ts +2 -1
  25. package/dist/document-api/src/types/address.d.ts +3 -0
  26. package/dist/document-api/src/types/table-operations.types.d.ts +1 -0
  27. package/dist/document-api/src/types/temporary-mutation.d.ts +5 -1
  28. package/dist/document-api/src/write/write.d.ts +18 -11
  29. package/dist/layout-engine/contracts/src/index.d.ts +1 -1
  30. package/dist/layout-engine/contracts/src/paragraph-visible-text.d.ts +3 -1
  31. package/dist/layout-engine/painters/dom/src/page-content.d.ts +1 -1
  32. package/dist/layout-engine/painters/dom/src/persistent-page-surface.d.ts +2 -0
  33. package/dist/public/ui-react.cjs +1 -1
  34. package/dist/public/ui-react.es.js +1 -1
  35. package/dist/public/ui-vue.cjs +1 -1
  36. package/dist/public/ui-vue.es.js +1 -1
  37. package/dist/public/ui.cjs +1 -1
  38. package/dist/public/ui.es.js +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/style.layered.css +1 -1
  41. package/dist/superdoc/src/SuperDoc.vue.d.ts +137 -61
  42. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +533 -48
  43. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +107 -23
  44. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +74 -14
  45. package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +55 -20
  46. package/dist/superdoc/src/components/CommentsLayer/FloatingComments.vue.d.ts +21 -8
  47. package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +24 -8
  48. package/dist/superdoc/src/components/CommentsLayer/PdfCommentsLayer.vue.d.ts +5 -3
  49. package/dist/superdoc/src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue.d.ts +60 -12
  50. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +20 -6
  51. package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +24 -23
  52. package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +0 -1
  53. package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +29 -13
  54. package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +132 -45
  55. package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +62 -16
  56. package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +77 -17
  57. package/dist/superdoc/src/components/PdfViewer/pdf-viewer-types.d.ts +45 -0
  58. package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +81 -16
  59. package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +49 -13
  60. package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +30 -15
  61. package/dist/superdoc/src/components/Whiteboard/whiteboard-types.d.ts +11 -0
  62. package/dist/superdoc/src/components/general/Avatar.vue.d.ts +14 -0
  63. package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +58 -15
  64. package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +58 -15
  65. package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +27 -9
  66. package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +53 -16
  67. package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +14 -6
  68. package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +25 -15
  69. package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +1 -5
  70. package/dist/superdoc/src/components/surfaces/watermark-surface-runtime.d.ts +7 -7
  71. package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +16 -9
  72. package/dist/superdoc/src/composables/replace-continuation.d.ts +11 -15
  73. package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +11 -7
  74. package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +44 -18
  75. package/dist/superdoc/src/composables/use-document.d.ts +1210 -30
  76. package/dist/superdoc/src/composables/use-field.d.ts +88 -25
  77. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -3
  78. package/dist/superdoc/src/composables/use-password-prompt.d.ts +23 -24
  79. package/dist/superdoc/src/composables/use-superdoc-instance.d.ts +4 -1
  80. package/dist/superdoc/src/composables/use-viewport-fit.d.ts +40 -26
  81. package/dist/superdoc/src/composables/useUiFontFamily.d.ts +3 -11
  82. package/dist/superdoc/src/core/SuperDoc.d.ts +3 -8
  83. package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +9 -4
  84. package/dist/superdoc/src/core/collaboration/helpers.d.ts +20 -3
  85. package/dist/superdoc/src/core/collaboration/permissions.d.ts +15 -9
  86. package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +4 -3
  87. package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +2 -1
  88. package/dist/superdoc/src/core/config/merge-comments-config.d.ts +1 -5
  89. package/dist/superdoc/src/core/config/merge-defined.d.ts +3 -8
  90. package/dist/superdoc/src/core/config/normalize-hyperlinks-config.d.ts +7 -12
  91. package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +9 -12
  92. package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +1 -12
  93. package/dist/superdoc/src/core/create-app.d.ts +13 -24
  94. package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +2 -1
  95. package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +2 -1
  96. package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -1
  97. package/dist/superdoc/src/core/editor-runtime/types.d.ts +9 -1
  98. package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +2 -1
  99. package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +1 -1
  100. package/dist/superdoc/src/core/helpers/export.d.ts +3 -2
  101. package/dist/superdoc/src/core/helpers/file.d.ts +8 -45
  102. package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +6 -60
  103. package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -2
  104. package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -1
  105. package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -1
  106. package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -1
  107. package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +24 -61
  108. package/dist/superdoc/src/core/superdoc-ui-owner.d.ts +1 -1
  109. package/dist/superdoc/src/core/surface-manager.d.ts +21 -83
  110. package/dist/superdoc/src/core/types/index.d.ts +14 -23
  111. package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +10 -10
  112. package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +22 -208
  113. package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +163 -189
  114. package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +14 -1
  115. package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -1
  116. package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -1
  117. package/dist/superdoc/src/helpers/comment-focus.d.ts +21 -4
  118. package/dist/superdoc/src/helpers/deprecation.d.ts +5 -11
  119. package/dist/superdoc/src/helpers/interaction-trace.d.ts +7 -24
  120. package/dist/superdoc/src/helpers/is-finite-number.d.ts +1 -0
  121. package/dist/superdoc/src/helpers/mark-raw-component.d.ts +1 -0
  122. package/dist/superdoc/src/helpers/object-guards.d.ts +1 -5
  123. package/dist/superdoc/src/helpers/selection-source.d.ts +1 -1
  124. package/dist/superdoc/src/helpers/use-selection.d.ts +35 -15
  125. package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +8 -11
  126. package/dist/superdoc/src/helpers/v2-bulk-decision-event.d.ts +9 -7
  127. package/dist/superdoc/src/helpers/v2-keyboard-edit-rejection.d.ts +8 -7
  128. package/dist/superdoc/src/helpers/v2-mutation-exception.d.ts +12 -8
  129. package/dist/superdoc/src/helpers/v2-review-target.d.ts +11 -1
  130. package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +40 -14
  131. package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +14 -5
  132. package/dist/superdoc/src/icons.d.ts +11 -11
  133. package/dist/superdoc/src/internal/diagnostics/diagnostic-dedupe.d.ts +7 -16
  134. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +77 -16
  135. package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +5 -3
  136. package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +85 -5
  137. package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +20 -6
  138. package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +32 -8
  139. package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +32 -8
  140. package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +44 -12
  141. package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +32 -9
  142. package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +181 -36
  143. package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +39 -10
  144. package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +133 -22
  145. package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +62 -23
  146. package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +39 -10
  147. package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +24 -6
  148. package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +7 -3
  149. package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +9 -3
  150. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +101 -16
  151. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +31 -10
  152. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +80 -11
  153. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +113 -33
  154. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +16 -6
  155. package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +10 -20
  156. package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +12 -45
  157. package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +34 -17
  158. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
  159. package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +10 -2
  160. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +67 -0
  161. package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +61 -61
  162. package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +110 -49
  163. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +7 -27
  164. package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +4 -3
  165. package/dist/superdoc/src/internal/toolbar/toolbar-item-aliases.d.ts +1 -1
  166. package/dist/superdoc/src/public/browser-document-api.d.ts +5 -4
  167. package/dist/superdoc/src/public/index.d.cts +26 -0
  168. package/dist/superdoc/src/public/index.d.ts +13 -0
  169. package/dist/superdoc/src/public/ui/commands.d.ts +14 -13
  170. package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +1 -1
  171. package/dist/superdoc/src/public/ui/entity-at.d.ts +2 -1
  172. package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +2 -8
  173. package/dist/superdoc/src/public/ui/style-match-patch.d.ts +2 -2
  174. package/dist/superdoc/src/public/ui/types.d.ts +1 -1
  175. package/dist/superdoc/src/stores/comments-store.d.ts +372 -123
  176. package/dist/superdoc/src/stores/helpers/comment-draft-text.d.ts +1 -0
  177. package/dist/superdoc/src/stores/helpers/comment-grouping.d.ts +30 -0
  178. package/dist/superdoc/src/stores/helpers/comment-identity.d.ts +40 -0
  179. package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +48 -13
  180. package/dist/superdoc/src/stores/helpers/tracked-change-identity.d.ts +19 -0
  181. package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +21 -0
  182. package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +21 -24
  183. package/dist/superdoc/src/stores/superdoc-store.d.ts +1117 -370
  184. package/dist/superdoc.cjs +1923 -2838
  185. package/dist/superdoc.es.js +1863 -2783
  186. package/dist-cdn/style.layered.css +1 -1
  187. package/dist-cdn/superdoc.min.css +1 -1
  188. package/dist-cdn/superdoc.min.js +42 -42
  189. package/package.json +2 -2
  190. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +0 -104
  191. package/dist/superdoc/src/internal/toolbar/index.d.ts +0 -10
  192. package/dist/superdoc/src/main.d.ts +0 -1
@@ -1,4 +1,5 @@
1
1
  import { B as renderList, D as normalizeClass, E as nextTick, F as openBlock, G as toDisplayString, N as onMounted, W as shallowRef, Y as unref, a as computed, at as withModifiers, c as createCommentVNode, f as createTextVNode, h as defineComponent, j as onBeforeUnmount, l as createElementBlock, n as Fragment, t as _plugin_vue_export_helper_default, tt as watch, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-CsJQtMvr.es.js";
2
+ import { t as isFiniteNumber } from "./is-finite-number-BpL4F38c.es.js";
2
3
  //#region src/internal/diagnostics/workflow-recording.ts
3
4
  var fields$1 = /* @__PURE__ */ new Set([
4
5
  "documentId",
@@ -1078,6 +1079,11 @@ var decodeLayoutStoryDataset = (raw) => {
1078
1079
  `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
1079
1080
  `${DATA_ATTRS.DRAGGABLE}`;
1080
1081
  //#endregion
1082
+ //#region src/helpers/object-guards.ts
1083
+ function isPlainObject(value) {
1084
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1085
+ }
1086
+ //#endregion
1081
1087
  //#region src/helpers/tracked-change-comment-lane.ts
1082
1088
  var TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX = "tc-comment:";
1083
1089
  function isSyntheticTrackedChangeCommentLaneItem(item) {
@@ -1087,14 +1093,149 @@ function isSyntheticTrackedChangeCommentLaneItem(item) {
1087
1093
  return typeof itemId === "string" && itemId.startsWith(TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX);
1088
1094
  }
1089
1095
  //#endregion
1090
- //#region src/helpers/object-guards.js
1091
- /**
1092
- * @param {unknown} value
1093
- * @returns {value is Record<string, unknown>}
1094
- */
1095
- function isPlainObject(value) {
1096
- return typeof value === "object" && value !== null && !Array.isArray(value);
1097
- }
1096
+ //#region src/core/collaboration/permissions.ts
1097
+ var PERMISSIONS = Object.freeze({
1098
+ RESOLVE_OWN: "RESOLVE_OWN",
1099
+ RESOLVE_OTHER: "RESOLVE_OTHER",
1100
+ REJECT_OWN: "REJECT_OWN",
1101
+ REJECT_OTHER: "REJECT_OTHER",
1102
+ COMMENTS_OVERFLOW_OWN: "COMMENTS_OVERFLOW",
1103
+ COMMENTS_OVERFLOW_OTHER: "COMMENTS_OVERFLOW_OTHER",
1104
+ COMMENTS_DELETE_OWN: "COMMENTS_DELETE_OWN",
1105
+ COMMENTS_DELETE_OTHER: "COMMENTS_DELETE_OTHER",
1106
+ UPLOAD_VERSION: "UPLOAD_VERSION",
1107
+ VERSION_HISTORY: "VERSION_HISTORY"
1108
+ });
1109
+ var ROLES = Object.freeze({
1110
+ EDITOR: "editor",
1111
+ SUGGESTER: "suggester",
1112
+ VIEWER: "viewer"
1113
+ });
1114
+ var PERMISSION_MATRIX = Object.freeze({
1115
+ [PERMISSIONS.RESOLVE_OWN]: {
1116
+ internal: [ROLES.EDITOR],
1117
+ external: [ROLES.EDITOR]
1118
+ },
1119
+ [PERMISSIONS.RESOLVE_OTHER]: {
1120
+ internal: [ROLES.EDITOR],
1121
+ external: [ROLES.EDITOR]
1122
+ },
1123
+ [PERMISSIONS.REJECT_OWN]: {
1124
+ internal: [ROLES.EDITOR, ROLES.SUGGESTER],
1125
+ external: [ROLES.EDITOR, ROLES.SUGGESTER]
1126
+ },
1127
+ [PERMISSIONS.REJECT_OTHER]: {
1128
+ internal: [ROLES.EDITOR],
1129
+ external: [ROLES.EDITOR]
1130
+ },
1131
+ [PERMISSIONS.COMMENTS_OVERFLOW_OWN]: {
1132
+ internal: [ROLES.EDITOR, ROLES.SUGGESTER],
1133
+ external: [ROLES.EDITOR, ROLES.SUGGESTER]
1134
+ },
1135
+ [PERMISSIONS.COMMENTS_OVERFLOW_OTHER]: {
1136
+ internal: [ROLES.EDITOR],
1137
+ external: [ROLES.EDITOR]
1138
+ },
1139
+ [PERMISSIONS.COMMENTS_DELETE_OWN]: {
1140
+ internal: [ROLES.EDITOR, ROLES.SUGGESTER],
1141
+ external: [ROLES.EDITOR, ROLES.SUGGESTER]
1142
+ },
1143
+ [PERMISSIONS.COMMENTS_DELETE_OTHER]: {
1144
+ internal: [ROLES.EDITOR],
1145
+ external: [ROLES.EDITOR]
1146
+ },
1147
+ [PERMISSIONS.UPLOAD_VERSION]: {
1148
+ internal: [ROLES.EDITOR],
1149
+ external: []
1150
+ },
1151
+ [PERMISSIONS.VERSION_HISTORY]: {
1152
+ internal: [ROLES.EDITOR],
1153
+ external: []
1154
+ }
1155
+ });
1156
+ var pickResolver = (context = {}) => {
1157
+ if (typeof context.permissionResolver === "function") return context.permissionResolver;
1158
+ if (typeof context.superdoc?.config?.permissionResolver === "function") return context.superdoc.config.permissionResolver;
1159
+ const comments = context.superdoc?.config?.modules?.comments;
1160
+ const deprecatedResolver = comments ? comments.permissionResolver : void 0;
1161
+ if (typeof deprecatedResolver === "function") return deprecatedResolver;
1162
+ return null;
1163
+ };
1164
+ var BUILT_IN_PERMISSION_METHOD = Symbol.for("superdoc.internal.permission-method.builtin");
1165
+ var BUILT_IN_PERMISSION_RESOLVER = Symbol.for("superdoc.internal.permission-resolver.builtin");
1166
+ var hasBuiltInPermissionMethodBrand = (method) => (typeof method === "object" && method !== null || typeof method === "function") && Reflect.get(method, BUILT_IN_PERMISSION_METHOD) === true;
1167
+ var createTrackedChangePermissionResolver = (superdoc) => {
1168
+ const isBuiltInPolicy = () => hasBuiltInPermissionMethodBrand(superdoc.canPerformPermission) && pickResolver({ superdoc }) === null;
1169
+ const resolver = (payload = {}) => isBuiltInPolicy() ? defaultDecisionFor(payload.permission, superdoc.config.role, superdoc.config.isInternal) : superdoc.canPerformPermission({
1170
+ ...payload,
1171
+ role: superdoc.config.role,
1172
+ isInternal: superdoc.config.isInternal
1173
+ });
1174
+ Object.defineProperty(resolver, BUILT_IN_PERMISSION_RESOLVER, { value: isBuiltInPolicy });
1175
+ return resolver;
1176
+ };
1177
+ var defaultDecisionFor = (permission, role, isInternal) => {
1178
+ if (permission === void 0 || typeof role !== "string") return false;
1179
+ const internalExternal = isInternal ? "internal" : "external";
1180
+ return PERMISSION_MATRIX[permission]?.[internalExternal]?.includes(role) ?? false;
1181
+ };
1182
+ var NON_DATA_PERMISSION_PROPERTY = Symbol();
1183
+ var readPermissionDataProperty = (source, key) => {
1184
+ if (source == null) return void 0;
1185
+ if (typeof source !== "object" && typeof source !== "function") return NON_DATA_PERMISSION_PROPERTY;
1186
+ for (let owner = source; owner !== null; owner = Object.getPrototypeOf(owner)) {
1187
+ const descriptor = Object.getOwnPropertyDescriptor(owner, key);
1188
+ if (descriptor) return "value" in descriptor ? descriptor.value : NON_DATA_PERMISSION_PROPERTY;
1189
+ }
1190
+ };
1191
+ var readBuiltInTrackedChangePermissionDecision = (superdoc, canPerform, permission, trackedChange) => {
1192
+ try {
1193
+ if (readPermissionDataProperty(superdoc, "canPerformPermission") !== canPerform || readPermissionDataProperty(canPerform, BUILT_IN_PERMISSION_METHOD) !== true) return null;
1194
+ const config = readPermissionDataProperty(superdoc, "config");
1195
+ if (!config || typeof config !== "object") return null;
1196
+ const role = readPermissionDataProperty(config, "role");
1197
+ const isInternal = readPermissionDataProperty(config, "isInternal");
1198
+ const user = readPermissionDataProperty(config, "user");
1199
+ const resolver = readPermissionDataProperty(config, "permissionResolver");
1200
+ const modules = readPermissionDataProperty(config, "modules");
1201
+ const comments = readPermissionDataProperty(modules, "comments");
1202
+ const deprecatedResolver = readPermissionDataProperty(comments, "permissionResolver");
1203
+ const commentsStore = readPermissionDataProperty(superdoc, "commentsStore");
1204
+ if ([
1205
+ role,
1206
+ isInternal,
1207
+ user,
1208
+ resolver,
1209
+ modules,
1210
+ comments,
1211
+ deprecatedResolver,
1212
+ commentsStore,
1213
+ readPermissionDataProperty(commentsStore, "getComment"),
1214
+ readPermissionDataProperty(trackedChange, "comment"),
1215
+ readPermissionDataProperty(trackedChange, "commentId"),
1216
+ readPermissionDataProperty(trackedChange, "id")
1217
+ ].includes(NON_DATA_PERMISSION_PROPERTY) || typeof resolver === "function" || typeof deprecatedResolver === "function") return null;
1218
+ return defaultDecisionFor(permission, role, isInternal);
1219
+ } catch {
1220
+ return null;
1221
+ }
1222
+ };
1223
+ var isAllowed = (permission, role, isInternal, context = {}) => {
1224
+ const defaultDecision = defaultDecisionFor(permission, role, isInternal);
1225
+ const resolver = pickResolver(context);
1226
+ if (typeof resolver !== "function") return defaultDecision;
1227
+ const decision = resolver({
1228
+ permission,
1229
+ role,
1230
+ isInternal,
1231
+ defaultDecision,
1232
+ comment: context.comment ?? null,
1233
+ currentUser: context.currentUser ?? context.superdoc?.config?.user ?? null,
1234
+ superdoc: context.superdoc ?? null,
1235
+ trackedChange: context.trackedChange ?? null
1236
+ });
1237
+ return typeof decision === "boolean" ? decision : defaultDecision;
1238
+ };
1098
1239
  //#endregion
1099
1240
  //#region src/public/ui/viewport-batch.ts
1100
1241
  /** No rendering or scrolling: read only geometry already acknowledged by the host. */
@@ -1865,13 +2006,9 @@ var WatermarkSurface_default = /* @__PURE__ */ _plugin_vue_export_helper_default
1865
2006
  }
1866
2007
  }), [["__scopeId", "data-v-df56c82c"]]);
1867
2008
  //#endregion
1868
- //#region src/components/surfaces/watermark-surface-runtime.js
1869
- /**
1870
- * Keeps Vue rendering and post-dismissal announcements outside the public type graph.
1871
- * @param {(() => HTMLElement | null) | undefined} getContainer
1872
- */
2009
+ //#region src/components/surfaces/watermark-surface-runtime.ts
2010
+ /** Keeps Vue rendering and post-dismissal announcements outside the public type graph. */
1873
2011
  function createWatermarkSurfaceRuntime(getContainer) {
1874
- /** @type {HTMLDivElement | null} */
1875
2012
  let status = null;
1876
2013
  let disposed = false;
1877
2014
  return {
@@ -1882,7 +2019,6 @@ function createWatermarkSurfaceRuntime(getContainer) {
1882
2019
  const item = opener?.closest("[data-sd-part=\"toolbar-item\"]") ?? opener?.querySelector("[data-sd-part=\"toolbar-item\"]");
1883
2020
  const container = (item?.closest("[data-sd-part=\"toolbar\"]"))?.parentElement;
1884
2021
  const isWatermarkEntry = item?.querySelector("[data-item=\"btn-watermark\"], [data-item=\"btn-overflow\"]");
1885
- /** @param {() => boolean} isCurrent */
1886
2022
  return async (isCurrent) => {
1887
2023
  await nextTick();
1888
2024
  if (disposed || !isCurrent() || !isWatermarkEntry || opener?.isConnected || !container?.isConnected) return;
@@ -1914,7 +2050,6 @@ function createWatermarkSurfaceRuntime(getContainer) {
1914
2050
  });
1915
2051
  container.appendChild(status);
1916
2052
  },
1917
- /** @param {string} message */
1918
2053
  announce(message) {
1919
2054
  if (!disposed && status) status.textContent = message;
1920
2055
  },
@@ -2495,7 +2630,7 @@ function toStyleValue(key, value) {
2495
2630
  case "italic": return value === true;
2496
2631
  case "underline": return underlineValue(value);
2497
2632
  case "color": return typeof value === "string" && value.length > 0 ? { val: value.replace(/^#/, "") } : null;
2498
- case "fontSize": return typeof value === "number" && Number.isFinite(value) ? Math.round(value * 2) : null;
2633
+ case "fontSize": return isFiniteNumber(value) ? Math.round(value * 2) : null;
2499
2634
  case "rFonts": return fontsValue(value);
2500
2635
  default: return null;
2501
2636
  }
@@ -2530,34 +2665,33 @@ function fontsValue(value) {
2530
2665
  return Object.keys(result).length > 0 ? result : null;
2531
2666
  }
2532
2667
  //#endregion
2533
- //#region src/public/ui/format-painter-helpers.js
2668
+ //#region src/public/ui/format-painter-helpers.ts
2534
2669
  /**
2535
2670
  * Maps SDRunProps field names to InlineRunPatch field names.
2536
2671
  * SDRunProps (read-side) and InlineRunPatch (write-side) use different keys
2537
2672
  * for the same properties; direct assignment between them is forbidden.
2538
- *
2539
- * @param {Record<string, unknown>} props - SDRunProps object from doc.getNodeById
2540
- * @returns {Record<string, unknown>} InlineRunPatch ready for doc.format.apply
2541
2673
  */
2542
2674
  function sdRunPropsToInlineRunPatch(props) {
2543
2675
  if (!props || typeof props !== "object") return {};
2544
2676
  const patch = {};
2545
- if (props.fonts) patch.rFonts = {
2546
- ascii: props.fonts.ascii,
2547
- hAnsi: props.fonts.hAnsi,
2548
- eastAsia: props.fonts.eastAsia,
2549
- cs: props.fonts.cs,
2550
- asciiTheme: props.fonts.asciiTheme,
2551
- hAnsiTheme: props.fonts.hAnsiTheme,
2552
- eastAsiaTheme: props.fonts.eastAsiaTheme,
2553
- csTheme: props.fonts.csTheme,
2554
- hint: props.fonts.hint
2677
+ const fonts = props.fonts;
2678
+ if (isPlainObject(fonts)) patch.rFonts = {
2679
+ ascii: fonts.ascii,
2680
+ hAnsi: fonts.hAnsi,
2681
+ eastAsia: fonts.eastAsia,
2682
+ cs: fonts.cs,
2683
+ asciiTheme: fonts.asciiTheme,
2684
+ hAnsiTheme: fonts.hAnsiTheme,
2685
+ eastAsiaTheme: fonts.eastAsiaTheme,
2686
+ csTheme: fonts.csTheme,
2687
+ hint: fonts.hint
2555
2688
  };
2556
2689
  if (props.fontFamily != null) patch.fontFamily = props.fontFamily;
2557
- if (props.lang) patch.lang = {
2558
- val: props.lang.val,
2559
- eastAsia: props.lang.eastAsia,
2560
- bidi: props.lang.bidi
2690
+ const lang = props.lang;
2691
+ if (isPlainObject(lang)) patch.lang = {
2692
+ val: lang.val,
2693
+ eastAsia: lang.eastAsia,
2694
+ bidi: lang.bidi
2561
2695
  };
2562
2696
  if (props.fontSize != null) patch.fontSize = props.fontSize;
2563
2697
  if (props.fontSizeCs != null) patch.fontSizeCs = props.fontSizeCs;
@@ -2598,19 +2732,24 @@ function sdRunPropsToInlineRunPatch(props) {
2598
2732
  function projectColorRefToInlineColor(color) {
2599
2733
  if (!color) return void 0;
2600
2734
  if (typeof color === "string") return color;
2735
+ if (!isPlainObject(color)) return void 0;
2601
2736
  if (color.model === "rgb") return color.value;
2602
2737
  if (color.model === "auto") return "auto";
2603
2738
  }
2604
2739
  function projectUnderlineToInlinePatch(underline) {
2605
2740
  if (underline == null) return void 0;
2741
+ if (!isPlainObject(underline)) return true;
2606
2742
  const patch = {};
2607
2743
  if (underline.style != null) patch.style = underline.style;
2608
- if (underline.color?.model === "rgb") patch.color = underline.color.value;
2609
- if (underline.color?.model === "theme") patch.themeColor = underline.color.theme;
2744
+ const color = underline.color;
2745
+ if (isPlainObject(color)) {
2746
+ if (color.model === "rgb") patch.color = color.value;
2747
+ else if (color.model === "theme") patch.themeColor = color.theme;
2748
+ }
2610
2749
  return Object.keys(patch).length > 0 ? patch : true;
2611
2750
  }
2612
2751
  function projectShadingToInlinePatch(shading) {
2613
- if (!shading) return void 0;
2752
+ if (!isPlainObject(shading)) return void 0;
2614
2753
  const patch = {};
2615
2754
  const fill = projectColorRefToInlineColor(shading.fill);
2616
2755
  if (fill != null) patch.fill = fill;
@@ -2620,7 +2759,7 @@ function projectShadingToInlinePatch(shading) {
2620
2759
  return Object.keys(patch).length > 0 ? patch : void 0;
2621
2760
  }
2622
2761
  function projectBorderToInlinePatch(border) {
2623
- if (!border) return void 0;
2762
+ if (!isPlainObject(border)) return void 0;
2624
2763
  const patch = {};
2625
2764
  if (border.style != null) patch.val = border.style;
2626
2765
  if (border.width != null) patch.sz = border.width;
@@ -2635,9 +2774,6 @@ function projectBorderToInlinePatch(border) {
2635
2774
  *
2636
2775
  * Falls back to the plain text target when the host has not populated an
2637
2776
  * explicit `selectionTarget` yet.
2638
- *
2639
- * @param {{ selectionTarget?: unknown; target?: unknown } | null | undefined} selection
2640
- * @returns {string}
2641
2777
  */
2642
2778
  function selectionKey(selection) {
2643
2779
  const target = selection?.selectionTarget ?? selection?.target;
@@ -2746,7 +2882,7 @@ function readAllResolvedFact(event, receipt) {
2746
2882
  return fact;
2747
2883
  }
2748
2884
  //#endregion
2749
- //#region src/helpers/v2-typing-mutation-event.js
2885
+ //#region src/helpers/v2-typing-mutation-event.ts
2750
2886
  /**
2751
2887
  * Command kinds whose committed mutations belong to the sustained typing
2752
2888
  * cadence class (insert / replace / plain paste / Backspace / Delete).
@@ -2787,9 +2923,6 @@ var V2_TYPING_COMMAND_KINDS = /* @__PURE__ */ new Set([
2787
2923
  * Events without a forwarded `editableCommandKind` (programmatic Document API
2788
2924
  * mutations, history commits, unclassified structural commands) return false
2789
2925
  * so they keep hydrating immediately.
2790
- *
2791
- * @param {{ type?: string, origin?: string, editableCommandKind?: string } | null | undefined} event
2792
- * @returns {boolean}
2793
2926
  */
2794
2927
  var isV2EditableTextMutationEvent = (event) => {
2795
2928
  if (event?.type !== "mutation:committed" || event.origin !== "command") return false;
@@ -2987,7 +3120,7 @@ function normalizeZoomPayload(payload) {
2987
3120
  if (!Number.isFinite(parsed)) return payload;
2988
3121
  return normalizeNumber(parsed, isPercent);
2989
3122
  }
2990
- if (typeof payload === "number" && Number.isFinite(payload)) return normalizeNumber(payload, false);
3123
+ if (isFiniteNumber(payload)) return normalizeNumber(payload, false);
2991
3124
  return payload;
2992
3125
  }
2993
3126
  /**
@@ -5357,9 +5490,6 @@ var PARAGRAPH_INDENT_STEP_TWIPS = 720;
5357
5490
  function pointsToTwips(value) {
5358
5491
  return Math.round(value * 20);
5359
5492
  }
5360
- function isFiniteNumber(value) {
5361
- return typeof value === "number" && Number.isFinite(value);
5362
- }
5363
5493
  function readParagraphIndentationFromResult(result) {
5364
5494
  if (!result || typeof result !== "object") return null;
5365
5495
  const node = result.node;
@@ -5663,7 +5793,7 @@ function normalizeLayoutFontFamily(value) {
5663
5793
  }
5664
5794
  /** Convert a resolved run font size in CSS px to the toolbar's point value (SD-3652). */
5665
5795
  function normalizeLayoutFontSizePt(value) {
5666
- if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return void 0;
5796
+ if (!isFiniteNumber(value) || value <= 0) return void 0;
5667
5797
  const pt = Math.round(value * .75 * 2) / 2;
5668
5798
  if (pt <= 0) return void 0;
5669
5799
  return String(pt);
@@ -6401,7 +6531,7 @@ function createSuperDocUI(options) {
6401
6531
  if (!pending || !(method in pending)) return void 0;
6402
6532
  const value = pending[method];
6403
6533
  if (typeof value === "string" && value !== "") return value;
6404
- if (typeof value === "number" && Number.isFinite(value)) return String(value);
6534
+ if (isFiniteNumber(value)) return String(value);
6405
6535
  };
6406
6536
  /** Record / clear the stored inline mark for a collapsed-caret pick (SD-3654/SD-3652). */
6407
6537
  const setPendingInlineFormatOnHost = (method, value) => {
@@ -8799,9 +8929,10 @@ function createSuperDocUI(options) {
8799
8929
  for (const candidate of permissions) {
8800
8930
  let allowed;
8801
8931
  try {
8802
- allowed = canPerform.call(superdoc, {
8932
+ const permissionChange = trackedChange ?? { id };
8933
+ allowed = readBuiltInTrackedChangePermissionDecision(superdoc, canPerform, candidate, permissionChange) ?? canPerform.call(superdoc, {
8803
8934
  permission: candidate,
8804
- trackedChange: trackedChange ?? { id },
8935
+ trackedChange: permissionChange,
8805
8936
  comment: null
8806
8937
  });
8807
8938
  } catch {
@@ -9694,7 +9825,7 @@ function createSuperDocUI(options) {
9694
9825
  };
9695
9826
  /** Validate normalized payloads before invoking public SuperDoc-instance methods. */
9696
9827
  const instanceCommandPayloadIsValid = (descriptor, payload) => {
9697
- if (descriptor.id === "zoom") return typeof payload === "number" && Number.isFinite(payload) && payload > 0;
9828
+ if (descriptor.id === "zoom") return isFiniteNumber(payload) && payload > 0;
9698
9829
  if (descriptor.id === "document-mode") return payload === "editing" || payload === "suggesting" || payload === "viewing";
9699
9830
  if (descriptor.id === "measurement-unit") return payload === "in" || payload === "cm";
9700
9831
  return true;
@@ -10082,7 +10213,7 @@ function createSuperDocUI(options) {
10082
10213
  const familyValue = state.toolbar.commands["font-family"]?.value;
10083
10214
  const sizeValue = state.toolbar.commands["font-size"]?.value;
10084
10215
  const hadFamily = typeof familyValue === "string" && familyValue.length > 0;
10085
- const hadSize = typeof sizeValue === "string" && sizeValue.length > 0 || typeof sizeValue === "number" && Number.isFinite(sizeValue);
10216
+ const hadSize = typeof sizeValue === "string" && sizeValue.length > 0 || isFiniteNumber(sizeValue);
10086
10217
  return hadFamily && projected.fontFamily === void 0 || hadSize && projected.fontSize === void 0;
10087
10218
  };
10088
10219
  const syncHostSelectionSubscription = () => {
@@ -12276,12 +12407,6 @@ function createSuperDocUI(options) {
12276
12407
  keys: [...EFFECTIVE_INLINE_UNIFORMITY_KEYS, "highlight"],
12277
12408
  includeCaret: true
12278
12409
  } : null);
12279
- if (effective?.fontFamily?.state === "mixed") {
12280
- delete inlinePatch.fontFamily;
12281
- delete inlinePatch.rFonts;
12282
- mixedInlineKeys.add("fontFamily");
12283
- mixedInlineKeys.add("rFonts");
12284
- }
12285
12410
  for (const [markName, patchKey] of Object.entries(MARK_TO_PATCH)) {
12286
12411
  const entry = effective?.[markName];
12287
12412
  if (!entry) continue;
@@ -12293,6 +12418,16 @@ function createSuperDocUI(options) {
12293
12418
  mixedInlineKeys.add(patchKey);
12294
12419
  }
12295
12420
  }
12421
+ const fontFamily = effective?.fontFamily;
12422
+ if (fontFamily?.state === "uniform" && typeof fontFamily.value === "string") {
12423
+ inlinePatch.fontFamily = fontFamily.value;
12424
+ mixedInlineKeys.delete("fontFamily");
12425
+ } else if (fontFamily) {
12426
+ delete inlinePatch.fontFamily;
12427
+ delete inlinePatch.rFonts;
12428
+ mixedInlineKeys.add("fontFamily");
12429
+ mixedInlineKeys.add("rFonts");
12430
+ }
12296
12431
  const highlight = effective?.highlight;
12297
12432
  if (highlight?.state === "uniform") {
12298
12433
  inlinePatch.highlight = highlight.value;
@@ -13914,7 +14049,7 @@ function createSuperDocUI(options) {
13914
14049
  return null;
13915
14050
  };
13916
14051
  const pointHitElements = (x, y) => {
13917
- if (typeof x !== "number" || typeof y !== "number" || !Number.isFinite(x) || !Number.isFinite(y)) return null;
14052
+ if (!isFiniteNumber(x) || !isFiniteNumber(y)) return null;
13918
14053
  const dom = globalThis.document;
13919
14054
  if (!dom || typeof dom.elementFromPoint !== "function") return null;
13920
14055
  const container = resolveVisibleHost();
@@ -14692,7 +14827,7 @@ function createSuperDocUI(options) {
14692
14827
  const record = result && typeof result === "object" ? result : null;
14693
14828
  if (!record) return null;
14694
14829
  const matches = Array.isArray(record.matches) ? record.matches : [];
14695
- const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : matches.length;
14830
+ const total = isFiniteNumber(record.total) ? record.total : matches.length;
14696
14831
  const activeIndex = typeof record.activeMatchIndex === "number" ? record.activeMatchIndex : typeof record.activeIndex === "number" ? record.activeIndex : -1;
14697
14832
  const canReplace = record.canReplace === true || fallbackCanReplace;
14698
14833
  return {
@@ -15716,4 +15851,4 @@ function commandIsActive(descriptor, selection) {
15716
15851
  return descriptor.activeMark ? selection.activeMarks.includes(descriptor.activeMark) : false;
15717
15852
  }
15718
15853
  //#endregion
15719
- export { recordInteraction as S, DOM_CLASS_NAMES as _, registerFirstPartyCommandMutation as a, getWorkflowRecording as b, getCommandDescriptor as c, mutationCommittedEventChangedDocument as d, createImageFilePicker as f, isSyntheticTrackedChangeCommentLaneItem as g, isPlainObject as h, readFirstPartyPageNumbers as i, applyV2CommentInvalidationFromMutation as l, shallowEqual as m, executeFirstPartyCommandAsync as n, isRecord as o, resolveImageSrc as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, getV2TrackedChangeMutationImpact as u, closeInteractionHistory as v, isWorkflowRecordingEnabled as x, createInteractionHistory as y };
15854
+ export { createInteractionHistory as C, recordInteraction as E, closeInteractionHistory as S, isWorkflowRecordingEnabled as T, createTrackedChangePermissionResolver as _, registerFirstPartyCommandMutation as a, isPlainObject as b, getCommandDescriptor as c, mutationCommittedEventChangedDocument as d, createImageFilePicker as f, PERMISSIONS as g, BUILT_IN_PERMISSION_METHOD as h, readFirstPartyPageNumbers as i, applyV2CommentInvalidationFromMutation as l, shallowEqual as m, executeFirstPartyCommandAsync as n, isRecord as o, resolveImageSrc as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, getV2TrackedChangeMutationImpact as u, isAllowed as v, getWorkflowRecording as w, DOM_CLASS_NAMES as x, isSyntheticTrackedChangeCommentLaneItem as y };