@folijs/view 0.6.0 → 1.0.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 (82) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +1 -1
  3. package/dist/clipboard.d.ts +1 -51
  4. package/dist/clipboard.d.ts.map +1 -1
  5. package/dist/clipboard.js +65 -13
  6. package/dist/clipboard.js.map +1 -1
  7. package/dist/extension.d.ts +90 -0
  8. package/dist/extension.d.ts.map +1 -0
  9. package/dist/extension.js +152 -0
  10. package/dist/extension.js.map +1 -0
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/layout/flow.d.ts +1 -282
  15. package/dist/layout/flow.d.ts.map +1 -1
  16. package/dist/layout/flow.js +21 -4
  17. package/dist/layout/flow.js.map +1 -1
  18. package/dist/print.d.ts +1 -17
  19. package/dist/print.d.ts.map +1 -1
  20. package/dist/print.js +5 -1
  21. package/dist/print.js.map +1 -1
  22. package/dist/render.d.ts +1 -24
  23. package/dist/render.d.ts.map +1 -1
  24. package/dist/render.js +4 -1
  25. package/dist/render.js.map +1 -1
  26. package/dist/view.d.ts +34 -67
  27. package/dist/view.d.ts.map +1 -1
  28. package/dist/view.js +209 -24
  29. package/dist/view.js.map +1 -1
  30. package/dist/word/blocks.d.ts +0 -175
  31. package/dist/word/blocks.d.ts.map +1 -1
  32. package/dist/word/blocks.js +106 -24
  33. package/dist/word/blocks.js.map +1 -1
  34. package/dist/word/columns.d.ts +1 -22
  35. package/dist/word/columns.d.ts.map +1 -1
  36. package/dist/word/columns.js +15 -3
  37. package/dist/word/columns.js.map +1 -1
  38. package/dist/word/controls.d.ts +1 -62
  39. package/dist/word/controls.d.ts.map +1 -1
  40. package/dist/word/controls.js +6 -1
  41. package/dist/word/controls.js.map +1 -1
  42. package/dist/word/edit.d.ts +1 -83
  43. package/dist/word/edit.d.ts.map +1 -1
  44. package/dist/word/edit.js +183 -5
  45. package/dist/word/edit.js.map +1 -1
  46. package/dist/word/matches.d.ts +1 -22
  47. package/dist/word/matches.d.ts.map +1 -1
  48. package/dist/word/matches.js +6 -1
  49. package/dist/word/matches.js.map +1 -1
  50. package/dist/word/notes.d.ts +0 -103
  51. package/dist/word/notes.d.ts.map +1 -1
  52. package/dist/word/notes.js +15 -4
  53. package/dist/word/notes.js.map +1 -1
  54. package/dist/word/pages.d.ts +15 -10
  55. package/dist/word/pages.d.ts.map +1 -1
  56. package/dist/word/pages.js +3 -2
  57. package/dist/word/pages.js.map +1 -1
  58. package/dist/word/regions.d.ts +0 -111
  59. package/dist/word/regions.d.ts.map +1 -1
  60. package/dist/word/regions.js +19 -5
  61. package/dist/word/regions.js.map +1 -1
  62. package/dist/word/table.d.ts +1 -78
  63. package/dist/word/table.d.ts.map +1 -1
  64. package/dist/word/table.js +13 -3
  65. package/dist/word/table.js.map +1 -1
  66. package/package.json +6 -3
  67. package/src/clipboard.ts +91 -21
  68. package/src/extension.ts +267 -0
  69. package/src/index.ts +10 -0
  70. package/src/layout/flow.ts +59 -13
  71. package/src/print.ts +9 -2
  72. package/src/render.ts +6 -1
  73. package/src/view.ts +245 -40
  74. package/src/word/blocks.ts +124 -30
  75. package/src/word/columns.ts +19 -4
  76. package/src/word/controls.ts +13 -3
  77. package/src/word/edit.ts +207 -9
  78. package/src/word/matches.ts +6 -1
  79. package/src/word/notes.ts +19 -6
  80. package/src/word/pages.ts +19 -3
  81. package/src/word/regions.ts +27 -8
  82. package/src/word/table.ts +33 -8
package/src/word/table.ts CHANGED
@@ -5,19 +5,27 @@
5
5
  * table, row and cell elements around its units, built from the model for the rows a page holds.
6
6
  * Built with createElement only.
7
7
  */
8
- import type { CellFormat, Node as ModelNode, Resolver } from "@folijs/core";
8
+ import type { Node as ModelNode } from "@folijs/core";
9
+ import type { CellFormat, Resolver } from "@folijs/core/internal";
9
10
  import { borderJsonCss, PX_PER_TWIP } from "./blocks.js";
10
11
 
11
- /** A block the view renders: its node, the position before it, and the cell format it is in. */
12
+ /**
13
+ * A block the view renders: its node, the position before it, and the cell format it is in.
14
+ * @internal
15
+ */
12
16
  export interface Unit {
13
17
  readonly node: ModelNode;
14
18
  readonly pos: number;
15
19
  readonly cell: CellFormat | null;
16
20
  }
17
21
 
18
- /** What a cell holds, in order: units (by index) and nested tables. */
22
+ /**
23
+ * What a cell holds, in order: units (by index) and nested tables.
24
+ * @internal
25
+ */
19
26
  export type CellItem = { unit: number } | { frame: Frame };
20
27
 
28
+ /** @internal */
21
29
  export interface FrameCell {
22
30
  readonly node: ModelNode;
23
31
  /** The first grid column it covers, and how many. */
@@ -28,6 +36,7 @@ export interface FrameCell {
28
36
  readonly items: readonly CellItem[];
29
37
  }
30
38
 
39
+ /** @internal */
31
40
  export interface FrameRow {
32
41
  readonly node: ModelNode;
33
42
  readonly header: boolean;
@@ -37,7 +46,10 @@ export interface FrameRow {
37
46
  readonly cells: readonly FrameCell[];
38
47
  }
39
48
 
40
- /** A table as the view draws it. */
49
+ /**
50
+ * A table as the view draws it.
51
+ * @internal
52
+ */
41
53
  export interface Frame {
42
54
  readonly node: ModelNode;
43
55
  readonly pos: number;
@@ -52,10 +64,16 @@ export interface Frame {
52
64
  readonly end: number;
53
65
  }
54
66
 
55
- /** A top-level item of the page flow: a unit (paragraph, opaque block) or a table. */
67
+ /**
68
+ * A top-level item of the page flow: a unit (paragraph, opaque block) or a table.
69
+ * @internal
70
+ */
56
71
  export type FlowItem = { unit: number; frame?: undefined } | { frame: Frame; unit?: undefined };
57
72
 
58
- /** The units and flow items of `doc`, in document order. */
73
+ /**
74
+ * The units and flow items of `doc`, in document order.
75
+ * @internal
76
+ */
59
77
  export function collect(doc: ModelNode, resolver: Resolver): { units: Unit[]; items: FlowItem[] } {
60
78
  const units: Unit[] = [];
61
79
  const items: FlowItem[] = [];
@@ -142,9 +160,15 @@ function frameOf(table: ModelNode, pos: number, resolver: Resolver, units: Unit[
142
160
  };
143
161
  }
144
162
 
145
- /** Marks a table's elements (wrapper, table, rows, cells): they hold blocks, not content. */
163
+ /**
164
+ * Marks a table's elements (wrapper, table, rows, cells): they hold blocks, not content.
165
+ * @internal
166
+ */
146
167
  export const FRAME_ATTR = "data-foli-frame";
147
- /** Marks a repeated header row: shown, not document content. */
168
+ /**
169
+ * Marks a repeated header row: shown, not document content.
170
+ * @internal
171
+ */
148
172
  export const REPEATED_ATTR = "data-foli-repeated";
149
173
 
150
174
  /**
@@ -152,6 +176,7 @@ export const REPEATED_ATTR = "data-foli-repeated";
152
176
  * header rows drawn again above them, not editable). `content(row, cell)` gives what a cell
153
177
  * shows on this page; a cell a vertical merge covers is drawn by the merge's first cell when
154
178
  * that is on the page (spanning the rows it covers here), else as an empty cell of its own.
179
+ * @internal
155
180
  */
156
181
  export function frameElement(
157
182
  frame: Frame,