@harbour-enterprises/superdoc 1.0.0-alpha.14 → 1.0.0-alpha.16

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/style.css CHANGED
@@ -19069,20 +19069,20 @@ body {
19069
19069
  mix-blend-mode: difference;
19070
19070
  }
19071
19071
 
19072
- .comment-doc[data-v-13d89078] {
19072
+ .comment-doc[data-v-df7ef0d6] {
19073
19073
  position: relative;
19074
19074
  }
19075
- .comments-layer[data-v-13d89078] {
19075
+ .comments-layer[data-v-df7ef0d6] {
19076
19076
  position: relative;
19077
19077
  }
19078
- .comment-anchor[data-v-13d89078] {
19078
+ .comment-anchor[data-v-df7ef0d6] {
19079
19079
  position: absolute;
19080
19080
  cursor: pointer;
19081
19081
  z-index: 3;
19082
19082
  border-radius: 4px;
19083
19083
  transition: background-color 250ms ease;
19084
19084
  }
19085
- .comments-container[data-v-13d89078] {
19085
+ .comments-container[data-v-df7ef0d6] {
19086
19086
  /* pointer-events: none; */
19087
19087
  }
19088
19088
 
@@ -19134,7 +19134,7 @@ span[data-v-36fffb56] {
19134
19134
  }
19135
19135
 
19136
19136
 
19137
- .comments-dialog[data-v-25f7474c] {
19137
+ .comments-dialog[data-v-01544401] {
19138
19138
  position: absolute;
19139
19139
  display: flex;
19140
19140
  flex-direction: column;
@@ -19147,14 +19147,14 @@ span[data-v-36fffb56] {
19147
19147
  box-shadow: 0px 0px 1px 1px rgba(50, 50, 50, 0.15);
19148
19148
  z-index: 5;
19149
19149
  }
19150
- .is-active[data-v-25f7474c] {
19150
+ .is-active[data-v-01544401] {
19151
19151
  z-index: 10;
19152
19152
  }
19153
- .overflow-menu[data-v-25f7474c] {
19153
+ .overflow-menu[data-v-01544401] {
19154
19154
  flex-shrink: 1;
19155
19155
  display: flex;
19156
19156
  }
19157
- .overflow-menu i[data-v-25f7474c] {
19157
+ .overflow-menu i[data-v-01544401] {
19158
19158
  width: 20px;
19159
19159
  height: 20px;
19160
19160
  display: flex;
@@ -19166,69 +19166,69 @@ span[data-v-36fffb56] {
19166
19166
  margin-left: 2px;
19167
19167
  cursor: pointer;
19168
19168
  }
19169
- .overflow-menu i[data-v-25f7474c]:hover {
19169
+ .overflow-menu i[data-v-01544401]:hover {
19170
19170
  background-color: #DBDBDB;
19171
19171
  }
19172
- .comment-entry[data-v-25f7474c] {
19172
+ .comment-entry[data-v-01544401] {
19173
19173
  flex-grow: 1;
19174
19174
  margin: 5px 0;
19175
19175
  }
19176
- .comment-entry input[data-v-25f7474c] {
19176
+ .comment-entry input[data-v-01544401] {
19177
19177
  border-radius: 12px;
19178
19178
  padding: 6px 10px;
19179
19179
  outline: none;
19180
19180
  border: 1px solid #DBDBDB;
19181
19181
  width: 100%;
19182
19182
  }
19183
- .comment-header[data-v-25f7474c] {
19183
+ .comment-header[data-v-01544401] {
19184
19184
  display: flex;
19185
19185
  align-items: center;
19186
19186
  justify-content: space-between;
19187
19187
  }
19188
- .comment-header-left[data-v-25f7474c] {
19188
+ .comment-header-left[data-v-01544401] {
19189
19189
  display: flex;
19190
19190
  justify-content: space-between;
19191
19191
  align-items: center;
19192
19192
  }
19193
- .avatar[data-v-25f7474c] {
19193
+ .avatar[data-v-01544401] {
19194
19194
  margin-right: 10px;
19195
19195
  }
19196
- .user-info[data-v-25f7474c] {
19196
+ .user-info[data-v-01544401] {
19197
19197
  display: flex;
19198
19198
  flex-direction: column;
19199
19199
  font-size: 12px;
19200
19200
  }
19201
- .user-name[data-v-25f7474c] {
19201
+ .user-name[data-v-01544401] {
19202
19202
  font-weight: 600;
19203
19203
  line-height: 1.2em;
19204
19204
  }
19205
- .user-timestamp[data-v-25f7474c] {
19205
+ .user-timestamp[data-v-01544401] {
19206
19206
  line-height: 1.2em;
19207
19207
  font-size: 12px;
19208
19208
  color: #999;
19209
19209
  }
19210
- .sd-button[data-v-25f7474c] {
19210
+ .sd-button[data-v-01544401] {
19211
19211
  margin-right: 5px;
19212
19212
  font-size: 12px;
19213
19213
  }
19214
- .comment[data-v-25f7474c] {
19214
+ .comment[data-v-01544401] {
19215
19215
  font-size: 14px;
19216
19216
  margin: 5px 0;
19217
19217
  }
19218
- .conversation-item[data-v-25f7474c] {
19218
+ .conversation-item[data-v-01544401] {
19219
19219
  border-bottom: 1px solid #DBDBDB;
19220
19220
  padding-bottom: 10px;
19221
19221
  }
19222
- .comment-footer[data-v-25f7474c] {
19222
+ .comment-footer[data-v-01544401] {
19223
19223
  margin: 5px 0;
19224
19224
  }
19225
19225
 
19226
- .section-wrapper[data-v-858cd0cf] {
19226
+ .section-wrapper[data-v-2284c669] {
19227
19227
  position: relative;
19228
19228
  min-height: 100%;
19229
19229
  width: 300px;
19230
19230
  }
19231
- .floating-comment[data-v-858cd0cf] {
19231
+ .floating-comment[data-v-2284c669] {
19232
19232
  position: absolute;
19233
19233
  min-width: 300px;
19234
19234
  }
@@ -19278,7 +19278,7 @@ img[data-v-47d1dee5] {
19278
19278
  }
19279
19279
 
19280
19280
  /* Right sidebar drawer */
19281
- .right-sidebar[data-v-49e265f8] {
19281
+ .right-sidebar[data-v-f1f5c2b0] {
19282
19282
  width: 320px;
19283
19283
  padding: 0 10px;
19284
19284
  min-height: 100%;
@@ -19286,50 +19286,50 @@ img[data-v-47d1dee5] {
19286
19286
  }
19287
19287
 
19288
19288
  /* General Styles */
19289
- .box-sizing[data-v-49e265f8], .layers[data-v-49e265f8] {
19289
+ .box-sizing[data-v-f1f5c2b0], .layers[data-v-f1f5c2b0] {
19290
19290
  box-sizing: border-box;
19291
19291
  }
19292
- .cursor-pointer[data-v-49e265f8], .tools i[data-v-49e265f8], .toolbar-item[data-v-49e265f8] {
19292
+ .cursor-pointer[data-v-f1f5c2b0], .tools i[data-v-f1f5c2b0], .toolbar-item[data-v-f1f5c2b0] {
19293
19293
  cursor: pointer;
19294
19294
  }
19295
- .flex[data-v-49e265f8] {
19295
+ .flex[data-v-f1f5c2b0] {
19296
19296
  display: flex;
19297
19297
  }
19298
- .flex-column[data-v-49e265f8] {
19298
+ .flex-column[data-v-f1f5c2b0] {
19299
19299
  flex-direction: column;
19300
19300
  }
19301
- .flex-center[data-v-49e265f8] {
19301
+ .flex-center[data-v-f1f5c2b0] {
19302
19302
  display: flex;
19303
19303
  align-items: center;
19304
19304
  justify-content: center;
19305
19305
  }
19306
19306
 
19307
19307
  /* Layer Styles */
19308
- .comments-layer[data-v-49e265f8] {
19308
+ .comments-layer[data-v-f1f5c2b0] {
19309
19309
  position: absolute;
19310
19310
  top: 0;
19311
19311
  height: 100%;
19312
19312
  }
19313
- .layers[data-v-49e265f8] {
19313
+ .layers[data-v-f1f5c2b0] {
19314
19314
  position: relative;
19315
19315
  }
19316
19316
 
19317
19317
  /* Document Styles */
19318
- .docx[data-v-49e265f8] {
19318
+ .docx[data-v-f1f5c2b0] {
19319
19319
  border: 1px solid #DFDFDF;
19320
19320
  pointer-events: auto;
19321
19321
  }
19322
- .sub-document[data-v-49e265f8] {
19322
+ .sub-document[data-v-f1f5c2b0] {
19323
19323
  position: relative;
19324
19324
  }
19325
19325
 
19326
19326
  /* Toolbar Styles */
19327
- .toolbar[data-v-49e265f8] {
19327
+ .toolbar[data-v-f1f5c2b0] {
19328
19328
  height: 25px;
19329
19329
  background-color: #fff;
19330
19330
  margin-bottom: 5px;
19331
19331
  }
19332
- .toolbar-item[data-v-49e265f8] {
19332
+ .toolbar-item[data-v-f1f5c2b0] {
19333
19333
  width: 20px;
19334
19334
  height: 20px;
19335
19335
  border-radius: 8px;
@@ -19341,12 +19341,12 @@ img[data-v-47d1dee5] {
19341
19341
  justify-content: center;
19342
19342
  transition: all 250ms ease;
19343
19343
  }
19344
- .toolbar-item[data-v-49e265f8]:hover {
19344
+ .toolbar-item[data-v-f1f5c2b0]:hover {
19345
19345
  background-color: #DBDBDB;
19346
19346
  }
19347
19347
 
19348
19348
  /* Tools Styles */
19349
- .tools[data-v-49e265f8] {
19349
+ .tools[data-v-f1f5c2b0] {
19350
19350
  position: absolute;
19351
19351
  width: 50px;
19352
19352
  height: 50px;
@@ -19357,7 +19357,7 @@ img[data-v-47d1dee5] {
19357
19357
  align-items: center;
19358
19358
  justify-content: center;
19359
19359
  }
19360
- .tools i[data-v-49e265f8] {
19360
+ .tools i[data-v-f1f5c2b0] {
19361
19361
  font-size: 20px;
19362
19362
  border-radius: 12px;
19363
19363
  border: none;
@@ -19365,11 +19365,11 @@ img[data-v-47d1dee5] {
19365
19365
  background-color: #DBDBDB;
19366
19366
  }
19367
19367
  @media (max-width: 768px) {
19368
- .sub-document[data-v-49e265f8] {
19368
+ .sub-document[data-v-f1f5c2b0] {
19369
19369
  max-width: 100%;
19370
19370
  overflow: hidden;
19371
19371
  }
19372
- .right-sidebar[data-v-49e265f8] {
19372
+ .right-sidebar[data-v-f1f5c2b0] {
19373
19373
  padding: 10px;
19374
19374
  width: 55px;
19375
19375
  position: relative;
@@ -37437,10 +37437,11 @@ const _sfc_main$b = {
37437
37437
  };
37438
37438
  const setFloatingCommentOffset = (conversation, e) => {
37439
37439
  const floatingConvo = visibleConversations.value.find((c2) => c2.id === conversation.conversationId);
37440
- const parentTop = props.parent.getBoundingClientRect().top;
37441
- const top = floatingConvo.position.top;
37442
- const eTop = e.target.getBoundingClientRect().top;
37443
- floatingCommentsOffset.value = top - eTop + parentTop;
37440
+ conversation.selection.getContainerLocation(props.parent).top;
37441
+ props.parent.getBoundingClientRect().top;
37442
+ floatingConvo.position.top;
37443
+ e.target.getBoundingClientRect().top;
37444
+ floatingCommentsOffset.value = conversation.selection.selectionBounds.top;
37444
37445
  };
37445
37446
  const handleHighlightClick = (conversation, e) => {
37446
37447
  conversation.isFocused = true;
@@ -37472,7 +37473,7 @@ const _sfc_main$b = {
37472
37473
  };
37473
37474
  }
37474
37475
  };
37475
- const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-13d89078"]]);
37476
+ const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-df7ef0d6"]]);
37476
37477
  function OrderedMap(content) {
37477
37478
  this.content = content;
37478
37479
  }
@@ -48516,6 +48517,19 @@ const _sfc_main$8 = {
48516
48517
  });
48517
48518
  if (pendingComment.value && pendingComment.value.conversationId === props.data.conversationId) {
48518
48519
  const newConversation = { ...pendingComment.value };
48520
+ const selection = pendingComment.value.selection.getValues();
48521
+ const bounds = selection.selectionBounds;
48522
+ if (bounds.top > bounds.bottom) {
48523
+ const temp = bounds.top;
48524
+ bounds.top = bounds.bottom;
48525
+ bounds.bottom = temp;
48526
+ }
48527
+ if (bounds.left > bounds.right) {
48528
+ const temp = bounds.left;
48529
+ bounds.left = bounds.right;
48530
+ bounds.right = temp;
48531
+ }
48532
+ newConversation.selection = useSelection(selection);
48519
48533
  pendingComment.value = null;
48520
48534
  selectionPosition.value = null;
48521
48535
  newConversation.comments.push(comment);
@@ -48562,6 +48576,8 @@ const _sfc_main$8 = {
48562
48576
  const cleanConversations = () => {
48563
48577
  if (props.data.comments.length)
48564
48578
  return;
48579
+ if (pendingComment.value)
48580
+ selectionPosition.value = null;
48565
48581
  const id = props.data.conversationId;
48566
48582
  pendingComment.value = null;
48567
48583
  props.currentDocument.removeConversation(id);
@@ -48671,7 +48687,7 @@ const _sfc_main$8 = {
48671
48687
  };
48672
48688
  }
48673
48689
  };
48674
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-25f7474c"]]);
48690
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-01544401"]]);
48675
48691
  function useFloatingConveration(params) {
48676
48692
  const id = params.conversationId;
48677
48693
  const conversation = ref(params);
@@ -48754,6 +48770,9 @@ const _sfc_main$7 = {
48754
48770
  }
48755
48771
  if (currentItem.id === activeComment.value) {
48756
48772
  floatingCommentsOffset.value += currentItem.offset;
48773
+ updatedPosition.top;
48774
+ const diff = updatedPosition.top - proposedPosition.top;
48775
+ floatingCommentsOffset.value += diff;
48757
48776
  }
48758
48777
  return updatedPosition;
48759
48778
  };
@@ -48793,6 +48812,14 @@ const _sfc_main$7 = {
48793
48812
  };
48794
48813
  });
48795
48814
  watch(documentsWithConverations, (newVal) => newVal.length && initialize());
48815
+ watch(activeComment, (newVal) => {
48816
+ setTimeout(() => {
48817
+ if (!activeComment.value) {
48818
+ floatingCommentsOffset.value = 0;
48819
+ initialize();
48820
+ }
48821
+ });
48822
+ });
48796
48823
  onMounted(() => {
48797
48824
  initialize();
48798
48825
  });
@@ -48825,7 +48852,7 @@ const _sfc_main$7 = {
48825
48852
  };
48826
48853
  }
48827
48854
  };
48828
- const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-858cd0cf"]]);
48855
+ const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-2284c669"]]);
48829
48856
  const _sfc_main$6 = {
48830
48857
  __name: "TextField",
48831
48858
  props: {
@@ -52081,9 +52108,8 @@ const _sfc_main = {
52081
52108
  zIndex: 10
52082
52109
  };
52083
52110
  };
52084
- const handleSelectionDrag = (selection, e) => {
52085
- if (!selection.selectionBounds)
52086
- return;
52111
+ const setSelectionPosition = (selection) => {
52112
+ activeSelection.value = selection;
52087
52113
  const containerBounds = selection.getContainerLocation(layers.value);
52088
52114
  let left = selection.selectionBounds.left;
52089
52115
  let top = selection.selectionBounds.top + containerBounds.top;
@@ -52102,7 +52128,11 @@ const _sfc_main = {
52102
52128
  height: Math.abs(selection.selectionBounds.bottom - selection.selectionBounds.top) + "px",
52103
52129
  borderRadius: "4px"
52104
52130
  };
52105
- activeSelection.value = selection;
52131
+ };
52132
+ const handleSelectionDrag = (selection, e) => {
52133
+ if (!selection.selectionBounds)
52134
+ return;
52135
+ setSelectionPosition(selection);
52106
52136
  };
52107
52137
  const handleSelectionDragEnd = () => {
52108
52138
  if (!selectionPosition.value)
@@ -52114,18 +52144,23 @@ const _sfc_main = {
52114
52144
  comments: showAddComment
52115
52145
  };
52116
52146
  if (tool in toolOptions) {
52147
+ setSelectionPosition(activeSelection.value);
52117
52148
  toolOptions[tool](activeSelection.value, selectionPosition.value);
52118
52149
  }
52119
52150
  activeSelection.value = null;
52120
52151
  toolsMenuPosition.value = null;
52121
52152
  };
52122
52153
  const handleDocumentMouseDown = (e) => {
52154
+ if (pendingComment.value)
52155
+ return;
52123
52156
  selectionPosition.value = null;
52124
- document.removeEventListener("mousedown", handleDocumentMouseDown);
52125
52157
  };
52126
52158
  const handleHighlightClick = () => {
52127
52159
  toolsMenuPosition.value = null;
52128
52160
  };
52161
+ const cancelPendingComment = () => {
52162
+ selectionPosition.value = null;
52163
+ };
52129
52164
  onMounted(() => {
52130
52165
  if ("comments" in modules && !modules.comments.readOnly) {
52131
52166
  document.addEventListener("mousedown", handleDocumentMouseDown);
@@ -52135,6 +52170,7 @@ const _sfc_main = {
52135
52170
  document.removeEventListener("mousedown", handleDocumentMouseDown);
52136
52171
  });
52137
52172
  return (_ctx, _cache) => {
52173
+ const _directive_click_outside = resolveDirective("click-outside");
52138
52174
  return openBlock(), createElementBlock("div", _hoisted_1, [
52139
52175
  createBaseVNode("div", {
52140
52176
  class: "layers",
@@ -52202,13 +52238,15 @@ const _sfc_main = {
52202
52238
  ])
52203
52239
  ], 512),
52204
52240
  (unref(pendingComment) || unref(documentsWithConverations).length) && layers.value && unref(isReady) ? (openBlock(), createElementBlock("div", _hoisted_3, [
52205
- unref(pendingComment) ? (openBlock(), createBlock(CommentDialog, {
52241
+ unref(pendingComment) ? withDirectives((openBlock(), createBlock(CommentDialog, {
52206
52242
  key: 0,
52207
52243
  data: unref(pendingComment),
52208
52244
  "current-document": unref(getDocument2)(unref(pendingComment).documentId),
52209
52245
  user: unref(user),
52210
52246
  parent: layers.value
52211
- }, null, 8, ["data", "current-document", "user", "parent"])) : createCommentVNode("", true),
52247
+ }, null, 8, ["data", "current-document", "user", "parent"])), [
52248
+ [_directive_click_outside, cancelPendingComment]
52249
+ ]) : createCommentVNode("", true),
52212
52250
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(documentsWithConverations), (doc2) => {
52213
52251
  return openBlock(), createBlock(FloatingComments, {
52214
52252
  parent: layers.value,
@@ -52220,7 +52258,7 @@ const _sfc_main = {
52220
52258
  };
52221
52259
  }
52222
52260
  };
52223
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e265f8"]]);
52261
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f1f5c2b0"]]);
52224
52262
  const createMyApp = () => {
52225
52263
  const app = createApp(App);
52226
52264
  const pinia = createPinia();