@docmentis/udoc-editor 0.8.17 → 0.8.19

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 (133) hide show
  1. package/dist/cell-format.d.ts +30 -0
  2. package/dist/cell-format.d.ts.map +1 -0
  3. package/dist/cell-format.js +325 -0
  4. package/dist/cell-format.js.map +1 -0
  5. package/dist/commands.js +2 -2
  6. package/dist/commands.js.map +1 -1
  7. package/dist/components/TablePropertiesModal.d.ts +12 -0
  8. package/dist/components/TablePropertiesModal.d.ts.map +1 -0
  9. package/dist/components/TablePropertiesModal.js +222 -0
  10. package/dist/components/TablePropertiesModal.js.map +1 -0
  11. package/dist/context-menu.d.ts +11 -1
  12. package/dist/context-menu.d.ts.map +1 -1
  13. package/dist/context-menu.js +87 -7
  14. package/dist/context-menu.js.map +1 -1
  15. package/dist/docmentis-theme.d.ts +2 -0
  16. package/dist/docmentis-theme.d.ts.map +1 -1
  17. package/dist/docmentis-theme.js +4 -0
  18. package/dist/docmentis-theme.js.map +1 -1
  19. package/dist/edit-client.d.ts +28 -1
  20. package/dist/edit-client.d.ts.map +1 -1
  21. package/dist/edit-client.js +33 -0
  22. package/dist/edit-client.js.map +1 -1
  23. package/dist/edit-mode.d.ts.map +1 -1
  24. package/dist/edit-mode.js +25 -7
  25. package/dist/edit-mode.js.map +1 -1
  26. package/dist/grips.d.ts.map +1 -1
  27. package/dist/grips.js +173 -10
  28. package/dist/grips.js.map +1 -1
  29. package/dist/i18n/ar.d.ts.map +1 -1
  30. package/dist/i18n/ar.js +82 -7
  31. package/dist/i18n/ar.js.map +1 -1
  32. package/dist/i18n/de.d.ts.map +1 -1
  33. package/dist/i18n/de.js +82 -7
  34. package/dist/i18n/de.js.map +1 -1
  35. package/dist/i18n/en.d.ts.map +1 -1
  36. package/dist/i18n/en.js +82 -7
  37. package/dist/i18n/en.js.map +1 -1
  38. package/dist/i18n/es.d.ts.map +1 -1
  39. package/dist/i18n/es.js +82 -7
  40. package/dist/i18n/es.js.map +1 -1
  41. package/dist/i18n/fr.d.ts.map +1 -1
  42. package/dist/i18n/fr.js +82 -7
  43. package/dist/i18n/fr.js.map +1 -1
  44. package/dist/i18n/ja.d.ts.map +1 -1
  45. package/dist/i18n/ja.js +86 -11
  46. package/dist/i18n/ja.js.map +1 -1
  47. package/dist/i18n/ko.d.ts.map +1 -1
  48. package/dist/i18n/ko.js +82 -7
  49. package/dist/i18n/ko.js.map +1 -1
  50. package/dist/i18n/messages.d.ts +154 -7
  51. package/dist/i18n/messages.d.ts.map +1 -1
  52. package/dist/i18n/pt-BR.d.ts.map +1 -1
  53. package/dist/i18n/pt-BR.js +82 -7
  54. package/dist/i18n/pt-BR.js.map +1 -1
  55. package/dist/i18n/ru.d.ts.map +1 -1
  56. package/dist/i18n/ru.js +82 -7
  57. package/dist/i18n/ru.js.map +1 -1
  58. package/dist/i18n/zh-CN.d.ts.map +1 -1
  59. package/dist/i18n/zh-CN.js +86 -11
  60. package/dist/i18n/zh-CN.js.map +1 -1
  61. package/dist/i18n/zh-TW.d.ts.map +1 -1
  62. package/dist/i18n/zh-TW.js +82 -7
  63. package/dist/i18n/zh-TW.js.map +1 -1
  64. package/dist/icons.d.ts +50 -0
  65. package/dist/icons.d.ts.map +1 -1
  66. package/dist/icons.js +50 -0
  67. package/dist/icons.js.map +1 -1
  68. package/dist/image.d.ts +5 -0
  69. package/dist/image.d.ts.map +1 -1
  70. package/dist/image.js +37 -4
  71. package/dist/image.js.map +1 -1
  72. package/dist/insert-table.d.ts +23 -0
  73. package/dist/insert-table.d.ts.map +1 -0
  74. package/dist/insert-table.js +135 -0
  75. package/dist/insert-table.js.map +1 -0
  76. package/dist/insert.d.ts +4 -1
  77. package/dist/insert.d.ts.map +1 -1
  78. package/dist/insert.js +5 -4
  79. package/dist/insert.js.map +1 -1
  80. package/dist/markup.d.ts +36 -1
  81. package/dist/markup.d.ts.map +1 -1
  82. package/dist/markup.js +175 -0
  83. package/dist/markup.js.map +1 -1
  84. package/dist/menu-action.d.ts +15 -3
  85. package/dist/menu-action.d.ts.map +1 -1
  86. package/dist/menu-action.js +21 -3
  87. package/dist/menu-action.js.map +1 -1
  88. package/dist/paint.d.ts +17 -2
  89. package/dist/paint.d.ts.map +1 -1
  90. package/dist/paint.js +11 -2
  91. package/dist/paint.js.map +1 -1
  92. package/dist/ruler-edits.js +7 -7
  93. package/dist/ruler-edits.js.map +1 -1
  94. package/dist/styles.d.ts.map +1 -1
  95. package/dist/styles.js +66 -0
  96. package/dist/styles.js.map +1 -1
  97. package/dist/table-edits.d.ts +44 -0
  98. package/dist/table-edits.d.ts.map +1 -0
  99. package/dist/table-edits.js +97 -0
  100. package/dist/table-edits.js.map +1 -0
  101. package/dist/table-format.d.ts +88 -0
  102. package/dist/table-format.d.ts.map +1 -0
  103. package/dist/table-format.js +224 -0
  104. package/dist/table-format.js.map +1 -0
  105. package/dist/table-picker.d.ts +14 -0
  106. package/dist/table-picker.d.ts.map +1 -0
  107. package/dist/table-picker.js +15 -0
  108. package/dist/table-picker.js.map +1 -0
  109. package/dist/table-properties.d.ts +12 -0
  110. package/dist/table-properties.d.ts.map +1 -0
  111. package/dist/table-properties.js +27 -0
  112. package/dist/table-properties.js.map +1 -0
  113. package/dist/table.d.ts +21 -9
  114. package/dist/table.d.ts.map +1 -1
  115. package/dist/table.js +235 -41
  116. package/dist/table.js.map +1 -1
  117. package/dist/tabs.d.ts +1 -1
  118. package/dist/tabs.d.ts.map +1 -1
  119. package/dist/tabs.js +106 -41
  120. package/dist/tabs.js.map +1 -1
  121. package/dist/text-format.d.ts +16 -6
  122. package/dist/text-format.d.ts.map +1 -1
  123. package/dist/text-format.js +89 -45
  124. package/dist/text-format.js.map +1 -1
  125. package/dist/version.d.ts +1 -1
  126. package/dist/version.js +1 -1
  127. package/dist/worker/handlers.d.ts.map +1 -1
  128. package/dist/worker/handlers.js +28 -0
  129. package/dist/worker/handlers.js.map +1 -1
  130. package/dist/worker/protocol.d.ts +38 -1
  131. package/dist/worker/protocol.d.ts.map +1 -1
  132. package/dist/worker/worker-source.js +1 -1
  133. package/package.json +3 -3
package/dist/styles.js CHANGED
@@ -738,6 +738,39 @@ export const editorStyles = css `
738
738
  color: var(--udoc-color-on-surface-variant);
739
739
  }
740
740
 
741
+ /* Insert Table's grid: cells to size a table on, those inside the size
742
+ pointed at lit in the soft tint a selection takes, and above them the size
743
+ named — or the command, while nothing is pointed at. */
744
+ .udoc-ui-root .udoc-menu.udoc-table-picker {
745
+ padding: 6px 10px 10px;
746
+ }
747
+ .udoc-ui-root .udoc-table-picker__caption {
748
+ padding: 2px 0 6px;
749
+ color: var(--udoc-color-on-surface-variant);
750
+ font-size: 12px;
751
+ }
752
+ .udoc-ui-root .udoc-table-picker__grid {
753
+ display: grid;
754
+ gap: 2px;
755
+ }
756
+ .udoc-ui-root .udoc-table-picker__cell {
757
+ width: 16px;
758
+ height: 16px;
759
+ padding: 0;
760
+ border: 1px solid var(--udoc-color-outline-variant);
761
+ border-radius: 2px;
762
+ background: var(--udoc-color-surface);
763
+ cursor: pointer;
764
+ }
765
+ .udoc-ui-root .udoc-table-picker__cell--lit {
766
+ border-color: var(--udoc-color-outline);
767
+ background-image: linear-gradient(var(--udoc-state-selected) 0 0);
768
+ }
769
+ .udoc-ui-root .udoc-table-picker__cell:focus-visible {
770
+ outline: 2px solid var(--udoc-color-primary);
771
+ outline-offset: 1px;
772
+ }
773
+
741
774
  /* Text tab's size field — a narrow fixed-width combobox (a point size is short),
742
775
  so picking a different size doesn't shift the Bold / Italic buttons beside it. */
743
776
  .udoc-ui-root .udoc-size-select {
@@ -887,6 +920,39 @@ export const editorStyles = css `
887
920
  border: 1.5px solid #b8860b;
888
921
  will-change: transform;
889
922
  }
923
+ /* A word document's floating drawing, selected: its anchor, in the margin
924
+ beside the paragraph the drawing is anchored in, where formatting marks draw
925
+ it in grey. Drawn in the selection's color, sized by the layer to the box the
926
+ engine reports, and dragged onto another paragraph to anchor the drawing
927
+ there; a locked anchor wears a padlock and does not drag. Carries no pointer
928
+ events, like the rest of the chrome. */
929
+ .udoc-ui-root .udoc-ui__object-anchor {
930
+ position: absolute;
931
+ top: 0;
932
+ left: 0;
933
+ display: flex;
934
+ box-sizing: border-box;
935
+ color: var(--udoc-canvas-selection);
936
+ will-change: transform;
937
+ }
938
+ .udoc-ui-root .udoc-ui__object-anchor > svg {
939
+ width: 100%;
940
+ height: 100%;
941
+ }
942
+ .udoc-ui-root .udoc-ui__object-anchor-lock {
943
+ position: absolute;
944
+ right: -25%;
945
+ bottom: -15%;
946
+ width: 55%;
947
+ height: 55%;
948
+ display: flex;
949
+ background: #fff;
950
+ border-radius: 2px;
951
+ }
952
+ .udoc-ui-root .udoc-ui__object-anchor-lock > svg {
953
+ width: 100%;
954
+ height: 100%;
955
+ }
890
956
 
891
957
  /* The ruler's controls (ruler-controls.ts), in the layers over its strips:
892
958
  each margin's edge, and the indent markers and tab stops of the paragraph a
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,uEAAuE;AACvE,+EAA+E;AAC/E,4BAA4B;AAC5B,MAAM,GAAG,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAiB,EAAU,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;AAErH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAimC9B,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { TableSelectionEdit, TableSelectionProperties, TextSelection, UDocSelection } from "@docmentis/udoc-wasm";
2
+ /** The value a consensus holds, `null` where it holds several or none. */
3
+ export declare function consensusValue<T>(consensus: "absent" | "mixed" | {
4
+ value: T;
5
+ } | undefined): T | null;
6
+ /** The one position the innermost table `text` is in takes in its story, as a
7
+ * range over it — what a delete of that table deletes. `null` outside a table. */
8
+ export declare function tableSlotSelection(text: TextSelection): TextSelection | null;
9
+ /** A word document's selection with the table it is in selected as text — the
10
+ * body's, a header's or a footer's — or `null` where it isn't in one. */
11
+ export declare function wordTableSelection(selection: UDocSelection): UDocSelection | null;
12
+ /** The four sides of a cell's margins, by name. */
13
+ export type MarginSide = "top" | "bottom" | "left" | "right";
14
+ export declare const MARGIN_SIDES: readonly MarginSide[];
15
+ /** What the dialog shows: each value the selection holds one of, `null` where
16
+ * it holds several (or none) — a blank field. In points. */
17
+ export interface TablePropertiesValues {
18
+ rowHeight: number | null;
19
+ columnWidth: number | null;
20
+ margins: Record<MarginSide, number | null>;
21
+ /** Repeat Header Rows — a word document's alone. */
22
+ header: boolean | null;
23
+ }
24
+ /** What the dialog opens on: the selection's values, and how its rows declare
25
+ * their height, which an edited height keeps. */
26
+ export interface TablePropertiesSeed {
27
+ values: TablePropertiesValues;
28
+ /** `exact` where every selected row is exactly its height; `atLeast` — a
29
+ * minimum, a deck's only rule and a word document's default — otherwise. */
30
+ heightRule: "atLeast" | "exact";
31
+ /** Whether Repeat Header Rows shows — in a word document, which repeats a
32
+ * table's header rows across pages; a deck's table never splits. */
33
+ showHeader: boolean;
34
+ }
35
+ /** The dialog's opening values for `table`, the selection's table properties. */
36
+ export declare function tablePropertiesSeed(table: TableSelectionProperties, wordprocessing: boolean): TablePropertiesSeed;
37
+ /**
38
+ * The edits OK sends for `values` against what the dialog opened on: only what
39
+ * changed, at most one per kind — the rows' height and header together, the
40
+ * columns' width, the cells' margins with only the sides that moved — so a
41
+ * field left as it was stays as each cell has it.
42
+ */
43
+ export declare function tablePropertiesEdits(seed: TablePropertiesSeed, values: TablePropertiesValues): TableSelectionEdit[];
44
+ //# sourceMappingURL=table-edits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-edits.d.ts","sourceRoot":"","sources":["../src/table-edits.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGR,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,aAAa,EAChB,MAAM,sBAAsB,CAAC;AAE9B,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG,SAAS,GAAG,CAAC,GAAG,IAAI,CAEpG;AAED;mFACmF;AACnF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI,CAS5E;AAED;0EAC0E;AAC1E,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI,CAiBjF;AAED,mDAAmD;AACnD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAC7D,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAAuC,CAAC;AAEtF;6DAC6D;AAC7D,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,oDAAoD;IACpD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1B;AAED;kDACkD;AAClD,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,qBAAqB,CAAC;IAC9B;iFAC6E;IAC7E,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC;yEACqE;IACrE,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,OAAO,GAAG,mBAAmB,CAmBjH;AAQD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,qBAAqB,GAAG,kBAAkB,EAAE,CAqBnH"}
@@ -0,0 +1,97 @@
1
+ /** The value a consensus holds, `null` where it holds several or none. */
2
+ export function consensusValue(consensus) {
3
+ return typeof consensus === "object" ? consensus.value : null;
4
+ }
5
+ /** The one position the innermost table `text` is in takes in its story, as a
6
+ * range over it — what a delete of that table deletes. `null` outside a table. */
7
+ export function tableSlotSelection(text) {
8
+ if (!("table" in text))
9
+ return null;
10
+ const { story, offset, table } = text.table;
11
+ // A table in a cell of this one is the innermost: descend through the cell.
12
+ if ("cellText" in table) {
13
+ const inner = tableSlotSelection(table.cellText.text);
14
+ if (inner)
15
+ return { table: { story, offset, table: { cellText: { ...table.cellText, text: inner } } } };
16
+ }
17
+ return { range: { story, anchor: offset, focus: offset + 1 } };
18
+ }
19
+ /** A word document's selection with the table it is in selected as text — the
20
+ * body's, a header's or a footer's — or `null` where it isn't in one. */
21
+ export function wordTableSelection(selection) {
22
+ if (!("wordprocessing" in selection))
23
+ return null;
24
+ const word = selection.wordprocessing;
25
+ if (typeof word !== "object")
26
+ return null;
27
+ if ("sectionText" in word) {
28
+ const slot = tableSlotSelection(word.sectionText.selection);
29
+ return slot && { wordprocessing: { sectionText: { ...word.sectionText, selection: slot } } };
30
+ }
31
+ if ("headerText" in word) {
32
+ const slot = tableSlotSelection(word.headerText.selection);
33
+ return slot && { wordprocessing: { headerText: { ...word.headerText, selection: slot } } };
34
+ }
35
+ if ("footerText" in word) {
36
+ const slot = tableSlotSelection(word.footerText.selection);
37
+ return slot && { wordprocessing: { footerText: { ...word.footerText, selection: slot } } };
38
+ }
39
+ return null;
40
+ }
41
+ export const MARGIN_SIDES = ["top", "bottom", "left", "right"];
42
+ /** The dialog's opening values for `table`, the selection's table properties. */
43
+ export function tablePropertiesSeed(table, wordprocessing) {
44
+ const height = consensusValue(table.height);
45
+ const margins = consensusValue(table.margins);
46
+ return {
47
+ values: {
48
+ // An automatic height states no measure: the field opens blank.
49
+ rowHeight: height === null || height === "auto" ? null : "exact" in height ? height.exact : height.atLeast,
50
+ columnWidth: consensusValue(table.width),
51
+ margins: {
52
+ top: margins?.top ?? null,
53
+ bottom: margins?.bottom ?? null,
54
+ left: margins?.left ?? null,
55
+ right: margins?.right ?? null,
56
+ },
57
+ header: consensusValue(table.header),
58
+ },
59
+ heightRule: height !== null && height !== "auto" && "exact" in height ? "exact" : "atLeast",
60
+ showHeader: wordprocessing,
61
+ };
62
+ }
63
+ /** Whether `next` is a value other than `was` — a blank field never is, and a
64
+ * measure differs once it moves by a hundredth of a point. */
65
+ function changed(next, was) {
66
+ return next !== null && (was === null || Math.abs(next - was) >= 0.005);
67
+ }
68
+ /**
69
+ * The edits OK sends for `values` against what the dialog opened on: only what
70
+ * changed, at most one per kind — the rows' height and header together, the
71
+ * columns' width, the cells' margins with only the sides that moved — so a
72
+ * field left as it was stays as each cell has it.
73
+ */
74
+ export function tablePropertiesEdits(seed, values) {
75
+ const was = seed.values;
76
+ const edits = [];
77
+ const row = {};
78
+ if (changed(values.rowHeight, was.rowHeight)) {
79
+ row.height = seed.heightRule === "exact" ? { exact: values.rowHeight } : { atLeast: values.rowHeight };
80
+ }
81
+ if (seed.showHeader && values.header !== null && values.header !== was.header)
82
+ row.header = values.header;
83
+ if (Object.keys(row).length > 0)
84
+ edits.push({ patchRowProperties: { properties: row } });
85
+ if (changed(values.columnWidth, was.columnWidth))
86
+ edits.push({ setColumnWidth: { width: values.columnWidth } });
87
+ const margins = {};
88
+ for (const side of MARGIN_SIDES) {
89
+ const next = values.margins[side];
90
+ if (changed(next, was.margins[side]))
91
+ margins[side] = next;
92
+ }
93
+ if (Object.keys(margins).length > 0)
94
+ edits.push({ patchCellProperties: { properties: { margins } } });
95
+ return edits;
96
+ }
97
+ //# sourceMappingURL=table-edits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-edits.js","sourceRoot":"","sources":["../src/table-edits.ts"],"names":[],"mappings":"AAYA,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAI,SAAwD;IACtF,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAED;mFACmF;AACnF,MAAM,UAAU,kBAAkB,CAAC,IAAmB;IAClD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;IAC5C,4EAA4E;IAC5E,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;IAC5G,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EA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/D,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,mBAAmB,EAAE,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAEtG,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,88 @@
1
+ import type { TableBorder, TableCellBorderEdge, TableLook, TableSelectionEdit, TableSelectionProperties, UDocSelectionProperties } from "@docmentis/udoc-wasm";
2
+ import type { LineDash, PaintSpec, RibbonControl, RibbonControlEnv, UIShellHost } from "@docmentis/udoc-ui/internal";
3
+ import type { MessageKey } from "./i18n/index.js";
4
+ import type { EditTools } from "./tools.js";
5
+ /** The selection's table properties — what the Table tab's controls mirror —
6
+ * or `null` outside a table. */
7
+ export declare function selectionTable(properties: UDocSelectionProperties | null): TableSelectionProperties | null;
8
+ /** Turn one of the Table Style Options on or off — the rest of the look as the
9
+ * table has it, since the look is set whole. */
10
+ export declare function toggleTableLook(host: UIShellHost, flag: keyof TableLook): Promise<void>;
11
+ /**
12
+ * Delete the table the selection is in. A deck's table is its frame, a shape
13
+ * like any other, so it goes as the selected shape does. A word document's
14
+ * takes one position in its story, so that position is selected and deleted as
15
+ * text — the paragraphs either side stay apart, as a table's own position is
16
+ * all a delete of it covers.
17
+ */
18
+ export declare function deleteTable(host: UIShellHost): Promise<void>;
19
+ /** Run `edit` on the table the selection is in — one committing edit. */
20
+ export declare function runTableEdit(host: UIShellHost, edit: TableSelectionEdit): Promise<void>;
21
+ /** The theme block the color panels show: the document's palette for an Office
22
+ * document, none for a PDF. */
23
+ export declare function themeOf(env: RibbonControlEnv): readonly import("@docmentis/udoc-ui/internal").ThemeSwatch[] | null;
24
+ /**
25
+ * The Shading dropdown: the cells' fill. Like the Shape tab's Fill it mirrors
26
+ * the selection — the swatch is the shading of the cells it covers, the one a
27
+ * table style's banding gives them included — and the caret opens the color
28
+ * panel, whose No Fill row takes the shading away.
29
+ */
30
+ export declare function tableShadingControl(env: RibbonControlEnv, tools: EditTools): RibbonControl;
31
+ /** The pen a Border lays: a color, a weight in points and a dash. */
32
+ export interface BorderPen {
33
+ paint: PaintSpec;
34
+ weight: number;
35
+ dash: LineDash;
36
+ }
37
+ /** The pen a Border starts with: Office's, a 1pt solid black line. */
38
+ export declare const DEFAULT_BORDER_PEN: BorderPen;
39
+ /** Diagonal Down Border: the top-left to bottom-right diagonal. */
40
+ export declare const ICON_BORDER_DIAGONAL_DOWN = "<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M144-144v-72h72v72h-72ZM144-294v-72h72v72h-72ZM144-444v-72h72v72h-72ZM144-594v-72h72v72h-72ZM144-744v-72h72v72h-72ZM744-144v-72h72v72h-72ZM744-294v-72h72v72h-72ZM744-444v-72h72v72h-72ZM744-594v-72h72v72h-72ZM744-744v-72h72v72h-72ZM294-744v-72h72v72h-72ZM444-744v-72h72v72h-72ZM594-744v-72h72v72h-72ZM294-144v-72h72v72h-72ZM444-144v-72h72v72h-72ZM594-144v-72h72v72h-72Z\"/><path d=\"M144-816h51l621 621v51h-51L144-765v-51Z\"/></svg>";
41
+ /** Diagonal Up Border: the bottom-left to top-right diagonal. */
42
+ export declare const ICON_BORDER_DIAGONAL_UP = "<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M144-144v-72h72v72h-72ZM144-294v-72h72v72h-72ZM144-444v-72h72v72h-72ZM144-594v-72h72v72h-72ZM144-744v-72h72v72h-72ZM744-144v-72h72v72h-72ZM744-294v-72h72v72h-72ZM744-444v-72h72v72h-72ZM744-594v-72h72v72h-72ZM744-744v-72h72v72h-72ZM294-744v-72h72v72h-72ZM444-744v-72h72v72h-72ZM594-744v-72h72v72h-72ZM294-144v-72h72v72h-72ZM444-144v-72h72v72h-72ZM594-144v-72h72v72h-72Z\"/><path d=\"M144-144h51l621-621v-51h-51L144-195v51Z\"/></svg>";
43
+ /** One of the Border menu's edge choices: what it lays the pen on, its name, and
44
+ * its glyph. */
45
+ export interface EdgeChoice {
46
+ edges: TableCellBorderEdge;
47
+ label: MessageKey;
48
+ icon: string;
49
+ }
50
+ /** The edge choices, in Word's and PowerPoint's order. */
51
+ export declare const BORDER_EDGES: readonly EdgeChoice[];
52
+ /** The border `pen` draws as: its `DrawingML` line alone, which the renderer
53
+ * strokes and a save of either format writes. */
54
+ export declare function borderOfPen(pen: BorderPen): TableBorder;
55
+ /** No Border's line: one with no fill, which draws nothing — laid on every
56
+ * edge, the diagonals included. */
57
+ export declare function noBorder(): TableBorder;
58
+ /** The edit that lays `border` on `edges` of the selected block. */
59
+ export declare function borderEdit(edges: TableCellBorderEdge, border: TableBorder): TableSelectionEdit;
60
+ /** The pen the Border control lays — what the Border Color and Border
61
+ * controls share, made once for edit mode and kept across the ribbon's
62
+ * rebuilds. */
63
+ export interface BorderState {
64
+ pen: BorderPen;
65
+ }
66
+ /** A border state at Office's starting pen. */
67
+ export declare function createBorderState(): BorderState;
68
+ /**
69
+ * A Border Color dropdown, for command `command`: the pen the Border control
70
+ * lays — its color, and its weight and dash in the panel's fly-outs. It sets
71
+ * the pen and nothing else, as Word's Pen Color does: the borders already drawn
72
+ * keep theirs, and the next Border draws with it. The swatch shows the pen's
73
+ * color.
74
+ */
75
+ export declare function borderColorControl(env: RibbonControlEnv, tools: EditTools, state: BorderState, command: string): RibbonControl;
76
+ /** What a Border control does with a choice: lays `pen` on `edges` of the
77
+ * selected block, or with `null` takes the borders there away. */
78
+ export type LayBorder = (edges: TableCellBorderEdge, pen: BorderPen | null) => void;
79
+ /** A table's {@link LayBorder}: its cells' borders, as `DrawingML` lines. */
80
+ export declare function layTableBorder(host: UIShellHost): LayBorder;
81
+ /**
82
+ * A Border split button, for command `command`: the main part lays the pen on
83
+ * All Borders, which its glyph shows; the caret lists the edge choices, then No
84
+ * Border, each laying the pen (or taking the borders away) at once, as `lay`
85
+ * does.
86
+ */
87
+ export declare function borderControl(env: RibbonControlEnv, tools: EditTools, state: BorderState, command: string, lay: LayBorder): RibbonControl;
88
+ //# sourceMappingURL=table-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-format.d.ts","sourceRoot":"","sources":["../src/table-format.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EAC1B,MAAM,sBAAsB,CAAC;AAa9B,OAAO,KAAK,EACR,QAAQ,EAER,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkBlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;iCACiC;AACjC,wBAAgB,cAAc,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI,GAAG,wBAAwB,GAAG,IAAI,CAE1G;AAED;iDACiD;AACjD,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvF;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlE;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF;AAED;gCACgC;AAChC,wBAAgB,OAAO,CAAC,GAAG,EAAE,gBAAgB,uEAG5C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,aAAa,CAgC1F;AAED,qEAAqE;AACrE,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;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AChB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,SAAS,GACf,aAAa,CAqCf"}
@@ -0,0 +1,224 @@
1
+ import { applyPaintBar, buildPaintPanel, createDropdownButton, createMenuItem, createSplitButton, displayToActivePaint, drawingProperties, ICON_FILL as ICON_SHADING, paintSwatch, tableShadingDisplay, } from "@docmentis/udoc-ui/internal";
2
+ import { ICON_BORDER_ALL, ICON_BORDER_BOTTOM, ICON_BORDER_COLOR, ICON_BORDER_INSIDE, ICON_BORDER_INSIDE_HORIZONTAL, ICON_BORDER_INSIDE_VERTICAL, ICON_BORDER_LEFT, ICON_BORDER_NONE, ICON_BORDER_OUTSIDE, ICON_BORDER_RIGHT, ICON_BORDER_TOP, } from "./icons.js";
3
+ import { changedDrawingLine } from "./line-edit.js";
4
+ import { mapThemeColors, paintToDrawingFill, THEMED } from "./paint.js";
5
+ import { editState } from "./state.js";
6
+ import { consensusValue, wordTableSelection } from "./table-edits.js";
7
+ /** The selection's table properties — what the Table tab's controls mirror —
8
+ * or `null` outside a table. */
9
+ export function selectionTable(properties) {
10
+ return drawingProperties(properties)?.table ?? null;
11
+ }
12
+ /** Turn one of the Table Style Options on or off — the rest of the look as the
13
+ * table has it, since the look is set whole. */
14
+ export function toggleTableLook(host, flag) {
15
+ const look = consensusValue(selectionTable(editState(host.store.getState()).selectionProperties)?.look);
16
+ if (!look)
17
+ return Promise.resolve();
18
+ return runTableEdit(host, { patchTableProperties: { properties: { look: { ...look, [flag]: !look[flag] } } } });
19
+ }
20
+ /**
21
+ * Delete the table the selection is in. A deck's table is its frame, a shape
22
+ * like any other, so it goes as the selected shape does. A word document's
23
+ * takes one position in its story, so that position is selected and deleted as
24
+ * text — the paragraphs either side stay apart, as a table's own position is
25
+ * all a delete of it covers.
26
+ */
27
+ export async function deleteTable(host) {
28
+ if (host.store.getState().docType === "wordprocessing") {
29
+ const selection = await host.client.selection();
30
+ const slot = selection && wordTableSelection(selection);
31
+ if (!slot)
32
+ return;
33
+ host.client.setSelection(slot);
34
+ await host.commit(() => host.client.executeOnSelection({ kind: "deleteText", forward: true }));
35
+ return;
36
+ }
37
+ await host.commit(() => host.client.executeOnSelection({ kind: "deleteShapes" }));
38
+ }
39
+ /** Run `edit` on the table the selection is in — one committing edit. */
40
+ export function runTableEdit(host, edit) {
41
+ return host.commit(() => host.client.executeOnSelection(edit));
42
+ }
43
+ /** The theme block the color panels show: the document's palette for an Office
44
+ * document, none for a PDF. */
45
+ export function themeOf(env) {
46
+ const state = env.store.getState();
47
+ return state.docType !== null && THEMED.has(state.docType) ? mapThemeColors(editState(state).themePalette) : null;
48
+ }
49
+ /**
50
+ * The Shading dropdown: the cells' fill. Like the Shape tab's Fill it mirrors
51
+ * the selection — the swatch is the shading of the cells it covers, the one a
52
+ * table style's banding gives them included — and the caret opens the color
53
+ * panel, whose No Fill row takes the shading away.
54
+ */
55
+ export function tableShadingControl(env, tools) {
56
+ const { i18n } = tools;
57
+ const shading = () => tableShadingDisplay(editState(env.store.getState()).selectionProperties);
58
+ const dd = createDropdownButton({ icon: paintSwatch(ICON_SHADING, shading()), label: env.label }, {
59
+ menuLabel: i18n.t("ribbon.paintOptions", { label: env.label }),
60
+ onOpen: () => buildPaintPanel(dd.menu, {
61
+ i18n,
62
+ variant: "fill",
63
+ theme: themeOf(env),
64
+ recent: env.recentPaint.fill,
65
+ active: displayToActivePaint(shading()),
66
+ stroke: null,
67
+ onPick: (paint) => {
68
+ if (paint.kind !== "none")
69
+ env.pushRecent("fill", paint.hex);
70
+ dd.controller.close();
71
+ void runTableEdit(tools.host, {
72
+ patchCellProperties: { properties: { fill: paintToDrawingFill(paint) } },
73
+ });
74
+ },
75
+ }),
76
+ });
77
+ dd.trigger.dataset.command = "tableShading";
78
+ return {
79
+ el: dd.el,
80
+ sync: (state) => applyPaintBar(dd.trigger, tableShadingDisplay(editState(state).selectionProperties)),
81
+ close: () => dd.controller.close(),
82
+ destroy: () => dd.destroy(),
83
+ };
84
+ }
85
+ /** The pen a Border starts with: Office's, a 1pt solid black line. */
86
+ export const DEFAULT_BORDER_PEN = { paint: { kind: "solid", hex: "#000000" }, weight: 1, dash: "solid" };
87
+ // The two diagonal borders Material Symbols has no symbol for, drawn from
88
+ // `border_clear`, the no-border glyph: its dotted frame, less the dotted cross
89
+ // inside it — a diagonal is a cell's own, and the cross's centre would sit on
90
+ // it — with one solid diagonal corner to corner, as thick across as Material's
91
+ // own diagonals. Modified from Material Symbols, © Google LLC, licensed under
92
+ // the Apache License 2.0: https://www.apache.org/licenses/LICENSE-2.0
93
+ /** Diagonal Down Border: the top-left to bottom-right diagonal. */
94
+ export const ICON_BORDER_DIAGONAL_DOWN = `<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M144-144v-72h72v72h-72ZM144-294v-72h72v72h-72ZM144-444v-72h72v72h-72ZM144-594v-72h72v72h-72ZM144-744v-72h72v72h-72ZM744-144v-72h72v72h-72ZM744-294v-72h72v72h-72ZM744-444v-72h72v72h-72ZM744-594v-72h72v72h-72ZM744-744v-72h72v72h-72ZM294-744v-72h72v72h-72ZM444-744v-72h72v72h-72ZM594-744v-72h72v72h-72ZM294-144v-72h72v72h-72ZM444-144v-72h72v72h-72ZM594-144v-72h72v72h-72Z"/><path d="M144-816h51l621 621v51h-51L144-765v-51Z"/></svg>`;
95
+ /** Diagonal Up Border: the bottom-left to top-right diagonal. */
96
+ export const ICON_BORDER_DIAGONAL_UP = `<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M144-144v-72h72v72h-72ZM144-294v-72h72v72h-72ZM144-444v-72h72v72h-72ZM144-594v-72h72v72h-72ZM144-744v-72h72v72h-72ZM744-144v-72h72v72h-72ZM744-294v-72h72v72h-72ZM744-444v-72h72v72h-72ZM744-594v-72h72v72h-72ZM744-744v-72h72v72h-72ZM294-744v-72h72v72h-72ZM444-744v-72h72v72h-72ZM594-744v-72h72v72h-72ZM294-144v-72h72v72h-72ZM444-144v-72h72v72h-72ZM594-144v-72h72v72h-72Z"/><path d="M144-144h51l621-621v-51h-51L144-195v51Z"/></svg>`;
97
+ /** The edge choices, in Word's and PowerPoint's order. */
98
+ export const BORDER_EDGES = [
99
+ { edges: "all", label: "table.borderAll", icon: ICON_BORDER_ALL },
100
+ { edges: "outside", label: "table.borderOutside", icon: ICON_BORDER_OUTSIDE },
101
+ { edges: "inside", label: "table.borderInside", icon: ICON_BORDER_INSIDE },
102
+ { edges: "top", label: "table.borderTop", icon: ICON_BORDER_TOP },
103
+ { edges: "bottom", label: "table.borderBottom", icon: ICON_BORDER_BOTTOM },
104
+ { edges: "left", label: "table.borderLeft", icon: ICON_BORDER_LEFT },
105
+ { edges: "right", label: "table.borderRight", icon: ICON_BORDER_RIGHT },
106
+ { edges: "insideHorizontal", label: "table.borderInsideHorizontal", icon: ICON_BORDER_INSIDE_HORIZONTAL },
107
+ { edges: "insideVertical", label: "table.borderInsideVertical", icon: ICON_BORDER_INSIDE_VERTICAL },
108
+ { edges: "diagonalDown", label: "table.borderDiagonalDown", icon: ICON_BORDER_DIAGONAL_DOWN },
109
+ { edges: "diagonalUp", label: "table.borderDiagonalUp", icon: ICON_BORDER_DIAGONAL_UP },
110
+ ];
111
+ /** The border `pen` draws as: its `DrawingML` line alone, which the renderer
112
+ * strokes and a save of either format writes. */
113
+ export function borderOfPen(pen) {
114
+ const line = changedDrawingLine(null, {}, { fill: paintToDrawingFill(pen.paint), weight: pen.weight, dash: pen.dash });
115
+ return { line };
116
+ }
117
+ /** No Border's line: one with no fill, which draws nothing — laid on every
118
+ * edge, the diagonals included. */
119
+ export function noBorder() {
120
+ return { line: changedDrawingLine(null, { fill: "none" }, { fill: "none", weight: 1, dash: "solid" }) };
121
+ }
122
+ /** The edit that lays `border` on `edges` of the selected block. */
123
+ export function borderEdit(edges, border) {
124
+ return { patchCellBorders: { edges, border } };
125
+ }
126
+ /** A border state at Office's starting pen. */
127
+ export function createBorderState() {
128
+ return { pen: { ...DEFAULT_BORDER_PEN } };
129
+ }
130
+ /**
131
+ * A Border Color dropdown, for command `command`: the pen the Border control
132
+ * lays — its color, and its weight and dash in the panel's fly-outs. It sets
133
+ * the pen and nothing else, as Word's Pen Color does: the borders already drawn
134
+ * keep theirs, and the next Border draws with it. The swatch shows the pen's
135
+ * color.
136
+ */
137
+ export function borderColorControl(env, tools, state, command) {
138
+ const { i18n } = tools;
139
+ const dd = createDropdownButton({ icon: paintSwatch(ICON_BORDER_COLOR, displayOfPen(state.pen)), label: env.label }, {
140
+ menuLabel: i18n.t("ribbon.paintOptions", { label: env.label }),
141
+ onOpen: () => {
142
+ buildPaintPanel(dd.menu, {
143
+ i18n,
144
+ variant: "stroke",
145
+ theme: themeOf(env),
146
+ recent: env.recentPaint.stroke,
147
+ active: state.pen.paint,
148
+ stroke: { weight: state.pen.weight, dash: state.pen.dash },
149
+ onPick: (paint) => {
150
+ if (paint.kind !== "none")
151
+ env.pushRecent("stroke", paint.hex);
152
+ setPen({ ...state.pen, paint });
153
+ },
154
+ onWeight: (weight) => setPen({ ...state.pen, weight }),
155
+ onDash: (dash) => setPen({ ...state.pen, dash }),
156
+ });
157
+ // A pen has a color; taking the borders away is the Border
158
+ // menu's No Border.
159
+ dd.menu.querySelector(".udoc-paintpanel__none")?.remove();
160
+ },
161
+ });
162
+ dd.trigger.dataset.command = command;
163
+ function setPen(pen) {
164
+ state.pen = pen;
165
+ applyPaintBar(dd.trigger, displayOfPen(pen));
166
+ dd.controller.close();
167
+ }
168
+ return {
169
+ el: dd.el,
170
+ close: () => dd.controller.close(),
171
+ destroy: () => dd.destroy(),
172
+ };
173
+ }
174
+ /** A table's {@link LayBorder}: its cells' borders, as `DrawingML` lines. */
175
+ export function layTableBorder(host) {
176
+ return (edges, pen) => void runTableEdit(host, borderEdit(edges, pen ? borderOfPen(pen) : noBorder()));
177
+ }
178
+ /**
179
+ * A Border split button, for command `command`: the main part lays the pen on
180
+ * All Borders, which its glyph shows; the caret lists the edge choices, then No
181
+ * Border, each laying the pen (or taking the borders away) at once, as `lay`
182
+ * does.
183
+ */
184
+ export function borderControl(env, tools, state, command, lay) {
185
+ const { i18n } = tools;
186
+ const split = createSplitButton({
187
+ mainLabel: env.label,
188
+ mainIcon: ICON_BORDER_ALL,
189
+ caretLabel: i18n.t("table.borderOptions"),
190
+ menuLabel: i18n.t("table.borderOptions"),
191
+ onOpen: () => fill(),
192
+ });
193
+ split.main.dataset.command = command;
194
+ split.caret.dataset.command = command;
195
+ split.main.addEventListener("click", () => lay("all", state.pen));
196
+ function fill() {
197
+ split.menu.innerHTML = "";
198
+ const row = (icon, label, run) => {
199
+ const item = createMenuItem({ icon, text: i18n.t(label) });
200
+ item.addEventListener("click", (e) => {
201
+ e.stopPropagation();
202
+ split.controller.close();
203
+ run();
204
+ });
205
+ return item;
206
+ };
207
+ for (const choice of BORDER_EDGES) {
208
+ split.menu.append(row(choice.icon, choice.label, () => lay(choice.edges, state.pen)));
209
+ }
210
+ const none = row(ICON_BORDER_NONE, "table.borderNone", () => lay("allAndDiagonals", null));
211
+ none.classList.add("udoc-toolbar__menu-item--divider");
212
+ split.menu.append(none);
213
+ }
214
+ return {
215
+ el: split.el,
216
+ close: () => split.controller.close(),
217
+ destroy: () => split.destroy(),
218
+ };
219
+ }
220
+ /** The bar a pen's color shows as under the Border Color glyph. */
221
+ function displayOfPen(pen) {
222
+ return pen.paint.kind === "none" ? { kind: "none" } : { kind: "solid", hex: pen.paint.hex };
223
+ }
224
+ //# sourceMappingURL=table-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-format.js","sourceRoot":"","sources":["../src/table-format.ts"],"names":[],"mappings":"AAWA,OAAO,EACH,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,IAAI,YAAY,EACzB,WAAW,EACX,mBAAmB,GACtB,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB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kBAAkB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3F,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QACvD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACH,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE;KACjC,CAAC;AACN,CAAC;AAED,mEAAmE;AACnE,SAAS,YAAY,CAAC,GAAc;IAChC,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChG,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** The grid's size: the largest table it inserts, as Word's and PowerPoint's. */
2
+ export declare const PICKER_ROWS = 8;
3
+ export declare const PICKER_COLUMNS = 10;
4
+ /** A table's size, in rows and columns. */
5
+ export interface TableSize {
6
+ rows: number;
7
+ columns: number;
8
+ }
9
+ /** The size the grid's cell at `row`, `column` (0-based) stands for: every cell
10
+ * up to it and left of it, inclusive. */
11
+ export declare function pickedSize(row: number, column: number): TableSize;
12
+ /** Whether the grid's cell at `row`, `column` lies inside `size`, so it lights. */
13
+ export declare function inSize(size: TableSize | null, row: number, column: number): boolean;
14
+ //# sourceMappingURL=table-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-picker.d.ts","sourceRoot":"","sources":["../src/table-picker.ts"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,2CAA2C;AAC3C,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;0CAC0C;AAC1C,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAEjE;AAED,mFAAmF;AACnF,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnF"}
@@ -0,0 +1,15 @@
1
+ // The sizing behind Insert Table's grid, apart from the grid itself: which
2
+ // table a cell of it stands for, and which cells light for a size.
3
+ /** The grid's size: the largest table it inserts, as Word's and PowerPoint's. */
4
+ export const PICKER_ROWS = 8;
5
+ export const PICKER_COLUMNS = 10;
6
+ /** The size the grid's cell at `row`, `column` (0-based) stands for: every cell
7
+ * up to it and left of it, inclusive. */
8
+ export function pickedSize(row, column) {
9
+ return { rows: row + 1, columns: column + 1 };
10
+ }
11
+ /** Whether the grid's cell at `row`, `column` lies inside `size`, so it lights. */
12
+ export function inSize(size, row, column) {
13
+ return size !== null && row < size.rows && column < size.columns;
14
+ }
15
+ //# sourceMappingURL=table-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-picker.js","sourceRoot":"","sources":["../src/table-picker.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,mEAAmE;AAEnE,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAQjC;0CAC0C;AAC1C,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAClD,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,MAAM,CAAC,IAAsB,EAAE,GAAW,EAAE,MAAc;IACtE,OAAO,IAAI,KAAK,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;AACrE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { EditHost } from "./edit-client.js";
2
+ import type { I18n } from "./i18n/index.js";
3
+ /** The Table Properties dialog, mounted into a shell. */
4
+ export interface TableProperties {
5
+ /** Open the dialog on the table the selection is in. */
6
+ open(): void;
7
+ destroy(): void;
8
+ }
9
+ /** Mount the Table Properties dialog into `host` — once, seeded from the
10
+ * selection each open. Its OK sends one edit per kind that changed, in turn. */
11
+ export declare function mountTableProperties(host: EditHost, i18n: I18n): TableProperties;
12
+ //# sourceMappingURL=table-properties.d.ts.map