@stll/folio-vue 0.8.1 → 0.10.0

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 (52) hide show
  1. package/dist/ListButtons-BcB7qvzQ.cjs +4 -0
  2. package/dist/{ListButtons-DXqMvba3.js → ListButtons-rpVlLZJ8.js} +689 -710
  3. package/dist/SplitCellDialog-B_TOoiMw.cjs +15 -0
  4. package/dist/{WatermarkDialog-r4wmldt4.js → SplitCellDialog-DRQuZsA3.js} +1537 -1604
  5. package/dist/components/AutocompleteCaretOverlay.types.d.ts +18 -0
  6. package/dist/components/DocxEditor/pagedEditorRef.d.ts +16 -3
  7. package/dist/components/DocxEditor/types.d.ts +27 -0
  8. package/dist/composables/index.d.ts +2 -2
  9. package/dist/composables/useColorMode.d.ts +17 -4
  10. package/dist/composables/useContextMenus.d.ts +3 -0
  11. package/dist/composables/useDocxEditor.d.ts +47 -0
  12. package/dist/composables/useDocxEditorRefApi.d.ts +14 -0
  13. package/dist/composables/useFindReplace.d.ts +24 -22
  14. package/dist/composables/useFontLifecycle.d.ts +21 -0
  15. package/dist/composables/useKeyboardShortcuts.d.ts +0 -1
  16. package/dist/composables/usePagesPointer.d.ts +14 -13
  17. package/dist/composables/useRemoteSelectionSync.d.ts +10 -0
  18. package/dist/composables/useSelectionSync.d.ts +17 -30
  19. package/dist/composables.cjs +2 -2
  20. package/dist/composables.js +93 -81
  21. package/dist/dialogs.cjs +1 -1
  22. package/dist/dialogs.js +2 -2
  23. package/dist/folio-vue.css +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.ts +4 -1
  26. package/dist/index.js +2249 -1401
  27. package/dist/renderAsync.d.ts +4 -0
  28. package/dist/styles/zIndex.d.ts +1 -0
  29. package/dist/styles.cjs +1 -1
  30. package/dist/styles.js +1 -1
  31. package/dist/ui/folio-ui.d.ts +1 -1
  32. package/dist/ui.cjs +1 -1
  33. package/dist/ui.js +10 -10
  34. package/dist/useFindReplace-CL8Rbc3y.js +59 -0
  35. package/dist/useFindReplace-ZCrdvwEk.cjs +1 -0
  36. package/dist/useZoom-DBbzwfMG.cjs +1 -0
  37. package/dist/useZoom-DwDDS7hq.js +749 -0
  38. package/dist/utils/colorMode.d.ts +3 -4
  39. package/dist/utils/embeddedFonts.d.ts +7 -0
  40. package/dist/utils/fontFaces.d.ts +10 -0
  41. package/dist/utils/hostFonts.d.ts +1 -5
  42. package/dist/zIndex-CYoLNG_N.cjs +1 -0
  43. package/dist/{zIndex-BY0qa8Au.js → zIndex-Ei9BbHSW.js} +1 -0
  44. package/package.json +1 -1
  45. package/dist/ListButtons-BvsV1yti.cjs +0 -4
  46. package/dist/WatermarkDialog-DHfk8jrg.cjs +0 -15
  47. package/dist/components/sidebar/resolveItemPositions.d.ts +0 -22
  48. package/dist/composables/useHostCallbacks.d.ts +0 -24
  49. package/dist/composables/useMenuActions.d.ts +0 -36
  50. package/dist/useZoom-C7jhL696.cjs +0 -1
  51. package/dist/useZoom-zJvuJlUd.js +0 -615
  52. package/dist/zIndex-dFsQbASx.cjs +0 -1
@@ -1,34 +1,35 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./useZoom-zJvuJlUd.js";
2
- import { computed as o, onBeforeUnmount as s, onMounted as c, onScopeDispose as l, ref as u, watch as d } from "vue";
3
- import { redo as f, redoDepth as p, undo as m, undoDepth as h } from "prosemirror-history";
4
- import { copyRuns as g, parseClipboardHtml as _, runsToClipboardContent as v } from "@stll/folio-core/utils/clipboard";
5
- import { createSelectionFromDOM as y, getSelectionRuns as b } from "@stll/folio-core/managers/ClipboardManager";
6
- import { TableSelectionManager as x, findTableFromClick as S } from "@stll/folio-core/managers/TableSelectionManager";
7
- import { createVisualLineState as C, findLineElementAtPosition as w, findPositionOnLineAtClientX as T, getCaretClientX as E, handleVisualLineKeyDown as D } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
1
+ import { t as e } from "./useFindReplace-CL8Rbc3y.js";
2
+ import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-DwDDS7hq.js";
3
+ import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
4
+ import { redo as _, redoDepth as v, undo as y, undoDepth as b } from "prosemirror-history";
5
+ import { copyRuns as x, parseClipboardHtml as S, runsToClipboardContent as C } from "@stll/folio-core/utils/clipboard";
6
+ import { createSelectionFromDOM as w, getSelectionRuns as T } from "@stll/folio-core/managers/ClipboardManager";
7
+ import { TableSelectionManager as E, findTableFromClick as D } from "@stll/folio-core/managers/TableSelectionManager";
8
+ import { createVisualLineState as O, findLineElementAtPosition as k, findPositionOnLineAtClientX as A, getCaretClientX as j, handleVisualLineKeyDown as M } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
8
9
  //#region src/composables/useClipboard.ts
9
- function O(e = {}) {
10
- let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = u(!1), c = u(null), l = o ? { onError: o } : {};
11
- async function d(e) {
10
+ function N(e = {}) {
11
+ let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = h(!1), c = h(null), l = o ? { onError: o } : {};
12
+ async function u(e) {
12
13
  if (s.value) return !1;
13
14
  s.value = !0;
14
15
  try {
15
- let n = await g(e.runs, l);
16
+ let n = await x(e.runs, l);
16
17
  return n && t?.(e), n;
17
18
  } finally {
18
19
  s.value = !1;
19
20
  }
20
21
  }
21
- async function f(e) {
22
+ async function d(e) {
22
23
  if (s.value || !a) return !1;
23
24
  s.value = !0;
24
25
  try {
25
- let t = await g(e.runs, l);
26
+ let t = await x(e.runs, l);
26
27
  return t && n?.(e), t;
27
28
  } finally {
28
29
  s.value = !1;
29
30
  }
30
31
  }
31
- async function p(e = !1) {
32
+ async function f(e = !1) {
32
33
  if (s.value || !a) return null;
33
34
  s.value = !0;
34
35
  try {
@@ -36,7 +37,7 @@ function O(e = {}) {
36
37
  let t = await navigator.clipboard.read(), n = "", a = "";
37
38
  for (let e of t) e.types.includes("text/html") && (n = await (await e.getType("text/html")).text()), e.types.includes("text/plain") && (a = await (await e.getType("text/plain")).text());
38
39
  e && (n = "");
39
- let o = _(n, a, i);
40
+ let o = S(n, a, i);
40
41
  return c.value = o, r?.(o, e), o;
41
42
  }
42
43
  return null;
@@ -47,17 +48,17 @@ function O(e = {}) {
47
48
  }
48
49
  }
49
50
  return {
50
- copy: d,
51
- cut: f,
52
- paste: p,
51
+ copy: u,
52
+ cut: d,
53
+ paste: f,
53
54
  isProcessing: s,
54
55
  lastPastedContent: c
55
56
  };
56
57
  }
57
58
  //#endregion
58
59
  //#region src/composables/useFixedDropdown.ts
59
- function k({ isOpen: e, onClose: t, align: n = "left" }) {
60
- let r = u(null), i = u(null), a = u({
60
+ function P({ isOpen: e, onClose: t, align: n = "left" }) {
61
+ let r = h(null), i = h(null), a = h({
61
62
  position: "fixed",
62
63
  top: "0px",
63
64
  left: "0px",
@@ -78,19 +79,19 @@ function k({ isOpen: e, onClose: t, align: n = "left" }) {
78
79
  function c(e) {
79
80
  e.key === "Escape" && t();
80
81
  }
81
- function f(e) {
82
+ function l(e) {
82
83
  let n = e.target;
83
84
  n instanceof Node && i.value && i.value.contains(n) || t();
84
85
  }
85
- function p() {
86
- document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", f, !0);
86
+ function u() {
87
+ document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
87
88
  }
88
- function m() {
89
- document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", f, !0);
89
+ function d() {
90
+ document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
90
91
  }
91
- d(e, (e) => {
92
+ g(e, (e) => {
92
93
  if (!e) {
93
- m();
94
+ d();
94
95
  return;
95
96
  }
96
97
  let t = r.value;
@@ -102,37 +103,37 @@ function k({ isOpen: e, onClose: t, align: n = "left" }) {
102
103
  let t = e.getBoundingClientRect();
103
104
  o(a.bottom + 4, a.right - t.width);
104
105
  } else o(a.bottom + 4, a.left);
105
- }) : o(a.bottom + 4, a.left), p();
106
- }), l(m);
107
- function h(e) {
106
+ }) : o(a.bottom + 4, a.left), u();
107
+ }), m(d);
108
+ function f(e) {
108
109
  e.preventDefault(), e.stopPropagation();
109
110
  }
110
111
  return {
111
112
  containerRef: r,
112
113
  dropdownRef: i,
113
114
  dropdownStyle: a,
114
- handleMouseDown: h
115
+ handleMouseDown: f
115
116
  };
116
117
  }
117
118
  //#endregion
118
119
  //#region src/composables/useHistory.ts
119
- function A(e, t) {
120
- let n = o(() => {
120
+ function F(e, t) {
121
+ let n = d(() => {
121
122
  t.value;
122
123
  let n = e.value;
123
- return n ? h(n.state) > 0 : !1;
124
- }), r = o(() => {
124
+ return n ? b(n.state) > 0 : !1;
125
+ }), r = d(() => {
125
126
  t.value;
126
127
  let n = e.value;
127
- return n ? p(n.state) > 0 : !1;
128
+ return n ? v(n.state) > 0 : !1;
128
129
  });
129
130
  function i() {
130
131
  let t = e.value;
131
- return t ? m(t.state, t.dispatch) : !1;
132
+ return t ? y(t.state, t.dispatch) : !1;
132
133
  }
133
134
  function a() {
134
135
  let t = e.value;
135
- return t ? f(t.state, t.dispatch) : !1;
136
+ return t ? _(t.state, t.dispatch) : !1;
136
137
  }
137
138
  return {
138
139
  canUndo: n,
@@ -143,14 +144,14 @@ function A(e, t) {
143
144
  }
144
145
  //#endregion
145
146
  //#region src/utils/selectionHighlight.ts
146
- var j = {
147
+ var I = {
147
148
  backgroundColor: "rgba(26, 115, 232, 0.3)",
148
149
  borderRadius: 0,
149
150
  zIndex: 0,
150
151
  opacity: 1,
151
152
  mixBlendMode: "multiply"
152
153
  };
153
- function M(e) {
154
+ function L(e) {
154
155
  let t = window.getSelection();
155
156
  if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
156
157
  let n = t.getRangeAt(0);
@@ -169,7 +170,7 @@ function M(e) {
169
170
  });
170
171
  return a;
171
172
  }
172
- function N(e, t = 2) {
173
+ function R(e, t = 2) {
173
174
  if (e.length <= 1) return e;
174
175
  let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
175
176
  if (!r) return e;
@@ -185,23 +186,23 @@ function N(e, t = 2) {
185
186
  }
186
187
  return i.push(a), i;
187
188
  }
188
- function P(e) {
189
- return N(M(e));
189
+ function z(e) {
190
+ return R(L(e));
190
191
  }
191
- function F() {
192
+ function B() {
192
193
  let e = window.getSelection();
193
194
  return e !== null && !e.isCollapsed && e.rangeCount > 0;
194
195
  }
195
- function I(e) {
196
+ function V(e) {
196
197
  let t = window.getSelection();
197
198
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
198
199
  }
199
- var L = "docx-selection-styles", R = null;
200
- function z() {
201
- R &&= (R.remove(), null), document.getElementById(L)?.remove();
200
+ var H = "docx-selection-styles", U = null;
201
+ function W() {
202
+ U &&= (U.remove(), null), document.getElementById(H)?.remove();
202
203
  }
203
- function B(e = j) {
204
- z();
204
+ function G(e = I) {
205
+ W();
205
206
  let t = `
206
207
  /* DOCX Editor Selection Highlighting */
207
208
 
@@ -263,21 +264,21 @@ function B(e = j) {
263
264
  border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
264
265
  }
265
266
  `;
266
- R = document.createElement("style"), R.id = L, R.textContent = t, document.head.appendChild(R);
267
+ U = document.createElement("style"), U.id = H, U.textContent = t, document.head.appendChild(U);
267
268
  }
268
- function V() {
269
- return R !== null || document.getElementById(L) !== null;
269
+ function K() {
270
+ return U !== null || document.getElementById(H) !== null;
270
271
  }
271
272
  //#endregion
272
273
  //#region src/composables/useSelectionHighlight.ts
273
- function H() {
274
+ function q() {
274
275
  return window.getSelection()?.toString() ?? "";
275
276
  }
276
- function U(e) {
277
- let { containerRef: t, enabled: n = !0, config: r = j, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: l } = e, f = u(!1), p = u(""), m = u([]), h = u(!1), g = null, _ = 0;
277
+ function J(e) {
278
+ let { containerRef: t, enabled: n = !0, config: r = I, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, s = h(!1), c = h(""), l = h([]), u = h(!1), m = null, _ = 0;
278
279
  function v() {
279
- let e = t.value, n = F(), r = H(), a = e ? I(e) : !1;
280
- f.value = n, p.value = r, h.value = a, m.value = i && a && e ? P(e) : [], l?.(n && a, r);
280
+ let e = t.value, n = B(), r = q(), a = e ? V(e) : !1;
281
+ s.value = n, c.value = r, u.value = a, l.value = i && a && e ? z(e) : [], o?.(n && a, r);
281
282
  }
282
283
  function y() {
283
284
  v();
@@ -285,8 +286,8 @@ function U(e) {
285
286
  function b() {
286
287
  let e = performance.now();
287
288
  if (e - _ < a) {
288
- g && clearTimeout(g), g = setTimeout(() => {
289
- _ = performance.now(), v(), g = null;
289
+ m && clearTimeout(m), m = setTimeout(() => {
290
+ _ = performance.now(), v(), m = null;
290
291
  }, a);
291
292
  return;
292
293
  }
@@ -305,23 +306,23 @@ function U(e) {
305
306
  };
306
307
  return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
307
308
  }
308
- return c(() => {
309
- n && (V() || B(r), document.addEventListener("selectionchange", b));
310
- }), s(() => {
311
- document.removeEventListener("selectionchange", b), g && clearTimeout(g);
312
- }), d(t, () => v()), {
313
- hasSelection: o(() => f.value),
314
- selectedText: o(() => p.value),
315
- highlightRects: o(() => m.value),
316
- isSelectionInContainer: o(() => h.value),
309
+ return p(() => {
310
+ n && (K() || G(r), document.addEventListener("selectionchange", b));
311
+ }), f(() => {
312
+ document.removeEventListener("selectionchange", b), m && clearTimeout(m);
313
+ }), g(t, () => v()), {
314
+ hasSelection: d(() => s.value),
315
+ selectedText: d(() => c.value),
316
+ highlightRects: d(() => l.value),
317
+ isSelectionInContainer: d(() => u.value),
317
318
  refresh: y,
318
319
  getOverlayStyle: x
319
320
  };
320
321
  }
321
322
  //#endregion
322
323
  //#region src/composables/useTableSelection.ts
323
- function W() {
324
- let e = new x(), t = u(null), n = () => {
324
+ function Y() {
325
+ let e = new E(), t = h(null), n = () => {
325
326
  let n = e.getSnapshot();
326
327
  t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
327
328
  tableIndex: n.tableIndex,
@@ -329,10 +330,21 @@ function W() {
329
330
  columnIndex: n.columnIndex
330
331
  } : null;
331
332
  }, r = e.subscribe(n);
332
- n(), l(r);
333
- function i(e, t, n) {}
333
+ n(), m(r);
334
+ function i(t, n, r) {
335
+ e.selectCellCoordinates({
336
+ tableIndex: t,
337
+ rowIndex: n,
338
+ columnIndex: r
339
+ });
340
+ }
334
341
  function a(t, n) {
335
- S(t, n) || e.clearSelection();
342
+ let r = D(t, n);
343
+ if (!r) {
344
+ e.clearSelection();
345
+ return;
346
+ }
347
+ e.selectCellCoordinates(r);
336
348
  }
337
349
  function o() {
338
350
  e.clearSelection();
@@ -350,21 +362,21 @@ function W() {
350
362
  }
351
363
  //#endregion
352
364
  //#region src/composables/useVisualLineNavigation.ts
353
- function G(e) {
354
- let t = C();
365
+ function X(e) {
366
+ let t = O();
355
367
  function n(t) {
356
368
  let n = e.value;
357
- return n ? E(n, t) : null;
369
+ return n ? j(n, t) : null;
358
370
  }
359
371
  function r(t) {
360
372
  let n = e.value;
361
- return n ? w(n, t) : null;
373
+ return n ? k(n, t) : null;
362
374
  }
363
375
  function i(e, t) {
364
- return T(e, t);
376
+ return A(e, t);
365
377
  }
366
378
  function a(n, r) {
367
- return D(t, n, r, e.value);
379
+ return M(t, n, r, e.value);
368
380
  }
369
381
  return {
370
382
  state: t,
@@ -375,4 +387,4 @@ function G(e) {
375
387
  };
376
388
  }
377
389
  //#endregion
378
- export { y as createSelectionFromDOM, n as extractTrackedChanges, b as getSelectionRuns, v as runsToClipboardContent, O as useClipboard, r as useDocxEditor, e as useDragAutoScroll, k as useFixedDropdown, A as useHistory, U as useSelectionHighlight, t as useTableResize, W as useTableSelection, i as useTrackedChanges, G as useVisualLineNavigation, a as useWheelZoom, a as useZoom };
390
+ export { c as colorModePlugin, w as createSelectionFromDOM, n as defaultColorMode, a as extractTrackedChanges, T as getSelectionRuns, i as provideColorMode, C as runsToClipboardContent, N as useClipboard, u as useColorMode, o as useDocxEditor, t as useDragAutoScroll, e as useFindReplace, P as useFixedDropdown, F as useHistory, J as useSelectionHighlight, r as useTableResize, Y as useTableSelection, s as useTrackedChanges, X as useVisualLineNavigation, l as useWheelZoom, l as useZoom };
package/dist/dialogs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./WatermarkDialog-DHfk8jrg.cjs");var t=e.m,n=e.l,r=e.p,i=e.c,a=e.f,o=e.s,s=e.d,c=e.a,l=e.u,u=e.i,d=e.r,f=e.n,p=e.t;exports.FindReplaceDialog=t,exports.FootnotePropertiesDialog=n,exports.HyperlinkDialog=r,exports.ImagePositionDialog=i,exports.ImagePropertiesDialog=a,exports.InsertImageDialog=o,exports.InsertSymbolDialog=s,exports.InsertTableDialog=c,exports.PageSetupDialog=l,exports.PasteSpecialDialog=u,exports.SplitCellDialog=d,exports.TablePropertiesDialog=f,exports.WatermarkDialog=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-B_TOoiMw.cjs");var t=e.m,n=e.s,r=e.p,i=e.o,a=e.f,o=e.a,s=e.d,c=e.r,l=e.u,u=e.n,d=e.t,f=e.l,p=e.c;exports.FindReplaceDialog=t,exports.FootnotePropertiesDialog=n,exports.HyperlinkDialog=r,exports.ImagePositionDialog=i,exports.ImagePropertiesDialog=a,exports.InsertImageDialog=o,exports.InsertSymbolDialog=s,exports.InsertTableDialog=c,exports.PageSetupDialog=l,exports.PasteSpecialDialog=u,exports.SplitCellDialog=d,exports.TablePropertiesDialog=f,exports.WatermarkDialog=p;
package/dist/dialogs.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, p as c, r as l, s as u, t as d, u as f } from "./WatermarkDialog-r4wmldt4.js";
1
+ import { a as e, c as t, d as n, f as r, l as i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./SplitCellDialog-DRQuZsA3.js";
2
2
  //#region src/components/dialogs/index.ts
3
- var p = o, m = a, h = c, g = t, _ = r, v = u, y = n, b = e, x = f, S = i, C = l, w = s, T = d;
3
+ var p = a, m = u, h = c, g = s, _ = r, v = e, y = n, b = l, x = f, S = o, C = d, w = i, T = t;
4
4
  //#endregion
5
5
  export { p as FindReplaceDialog, m as FootnotePropertiesDialog, h as HyperlinkDialog, g as ImagePositionDialog, _ as ImagePropertiesDialog, v as InsertImageDialog, y as InsertSymbolDialog, b as InsertTableDialog, x as PageSetupDialog, S as PasteSpecialDialog, C as SplitCellDialog, w as TablePropertiesDialog, T as WatermarkDialog };