Commit fc86b55
authored
fix(types): add Comment, FontConfig, exportDocx overloads, and missing PresentationEditor types (#2675)
* fix(types): add Comment, FontConfig, exportDocx overloads, and missing PresentationEditor types
- Replace thin Comment type with full runtime shape (commentId, elements, etc.)
- Add CommentElement type for comment body nodes
- Add FontConfig type for toolbar font picker options
- Add exportDocx overloads for narrowed return types per flag
- Add loadXmlData overloads accepting ArrayBuffer, narrowing out undefined
- Add replaceFile ArrayBuffer support
- Make User.name/email/image optional to match runtime behavior
- Fix Toolbar interface removing index signature for SuperToolbar compat
- Add ToolbarConfig fonts/hideButtons/pagination to JSDoc typedef
- Export LayoutState, ImageSelectedEvent, ImageDeselectedEvent, TelemetryEvent,
RemoteCursorsRenderPayload, FlowMode, ExportDocxParams, and all proofing types
- Add JSDoc re-exports in superdoc barrel for all new types
- Update consumer typecheck tests with new type imports and usage
* ci: add PR preview publish to release workflow
Adds optional `pr_number` input to workflow_dispatch. When provided,
checks out the PR branch, sets version to `<base>-pr.<number>.<timestamp>`,
builds, publishes with dist-tag `pr-<number>`, and comments on the PR
with install instructions. Normal semantic-release flow is skipped.
Also fixes replaceFile ArrayBuffer handling for fileSource assignment.
* fix(types): inject command type augmentations into dist for TS4111 compat
Consumers with noPropertyAccessFromIndexSignature get TS4111 errors on
commands like insertComment, removeComment, etc. because they fall through
to the EditorCommands index signature.
The augmentation files (comment-commands.ts, formatting-commands.ts, etc.)
already exist and extend ExtensionCommandMap, but vite-plugin-dts strips
the side-effect imports that load them.
Fix: inject /// <reference> directives into the dist index.d.ts via the
ensure-types.cjs postbuild script, so augmentations are always loaded
when consumers import from the package.
* fix(types): restore unintentionally removed code from diff application
- Restore `this.options.fragment = null` in replaceFile() collaboration
path — without it, #generatePmData() reuses the stale Yjs fragment
instead of the new file content
- Restore documentModeChange event emission in Editor.setDocumentMode()
and DocumentModeChangePayload type — SuperEditor.vue subscribes to
this for viewing-mode UI cleanup
- Fix exportDocx overload ordering — specific overloads must come before
the generic catch-all so TypeScript resolves them correctly
* refactor(types): use explicit imports for command types instead of reference directives
Replace /// <reference> directive injection (via ensure-types.cjs postbuild)
with direct import of command interfaces into ChainedCommands.ts. EditorCommands
is now composed as an explicit intersection of CoreCommandSignatures + all 9
extension command interfaces.
Export CoreCommandSignatures from core-command-map.d.ts so core commands
(insertContent, toggleMark, selectAll, etc.) are also explicitly typed.
* test(types): add consumer type compatibility test with noPropertyAccessFromIndexSignature
Comprehensive test covering the full public API surface:
- Type shapes (Comment, FontConfig, ProofingConfig, layout types, events)
- Editor/PresentationEditor constructor options with optional User fields
- Command dot-access (core + extension commands) under strict index sig
- exportDocx overloads with narrowed return types
- loadXmlData/replaceFile with ArrayBuffer
- PresentationEditor methods (layout, selection, scrolling, hit testing)
- Selection handle API
- Event handlers with typed payloads
- SuperToolbar assignable to setToolbar
- Proofing provider contract
Also fixes Toolbar.setActiveEditor param type for strict function compat.
* fix(types): expose type re-exports via superdoc/super-editor sub-export
The super-editor facade (.d.ts) only re-exported from the v1 runtime
barrel, so types like Comment, FontConfig, EditorCommands were only
available from the root 'superdoc' import, not 'superdoc/super-editor'.
Add re-export of the type-enriched index.ts barrel to the facade so
both entry points expose the full type surface.
* ci: add consumer typecheck step to CI pipeline
Packs the built superdoc package, installs it in tests/consumer-typecheck,
and runs tsc --noEmit with noPropertyAccessFromIndexSignature enabled.
Catches type regressions that source-level typechecking misses (e.g.
missing exports, broken augmentations, index signature fallbacks).
* fix(types): review fixes — track-changes fallbacks, test consolidation, CI hardening
- Add || '' fallbacks for user.name/email/image in track-changes mark
creation to prevent undefined author metadata when User fields are
optional
- Consolidate overlapping consumer typecheck files: merge unique tests
from index.ts into customer-scenario.ts, strip imports-main.ts to
imports-only, delete redundant index.ts
- Pin PR preview checkout to exact SHA instead of branch ref
- Restore missing Editor import in EditorTypes.ts (lost during rebase)1 parent 42b895e commit fc86b55
File tree
18 files changed
+968
-64
lines changed- .github/workflows
- packages
- super-editor/src
- editors/v1
- components/toolbar
- core
- commands
- types
- extensions/track-changes/trackChangesHelpers
- superdoc
- scripts
- src
- tests/consumer-typecheck
- src
18 files changed
+968
-64
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
41 | 59 | | |
42 | 60 | | |
43 | 61 | | |
| 62 | + | |
44 | 63 | | |
45 | 64 | | |
46 | 65 | | |
47 | | - | |
| 66 | + | |
48 | 67 | | |
49 | 68 | | |
50 | 69 | | |
| |||
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
84 | 114 | | |
85 | 115 | | |
86 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
87 | 143 | | |
| 144 | + | |
88 | 145 | | |
89 | 146 | | |
90 | 147 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
2238 | | - | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
2239 | 2254 | | |
2240 | 2255 | | |
2241 | 2256 | | |
| |||
3707 | 3722 | | |
3708 | 3723 | | |
3709 | 3724 | | |
3710 | | - | |
| 3725 | + | |
3711 | 3726 | | |
3712 | 3727 | | |
3713 | 3728 | | |
3714 | | - | |
| 3729 | + | |
3715 | 3730 | | |
3716 | 3731 | | |
3717 | 3732 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
Lines changed: 34 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
5 | 19 | | |
6 | 20 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 21 | + | |
10 | 22 | | |
11 | 23 | | |
12 | 24 | | |
13 | 25 | | |
14 | 26 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
104 | 120 | | |
105 | 121 | | |
106 | 122 | | |
| |||
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
87 | 108 | | |
88 | 109 | | |
89 | 110 | | |
90 | 111 | | |
91 | 112 | | |
92 | | - | |
| 113 | + | |
93 | 114 | | |
94 | 115 | | |
95 | | - | |
| 116 | + | |
96 | 117 | | |
97 | 118 | | |
98 | | - | |
| 119 | + | |
99 | 120 | | |
100 | 121 | | |
101 | 122 | | |
| |||
Lines changed: 58 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
20 | 43 | | |
21 | 44 | | |
22 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
23 | 76 | | |
24 | 77 | | |
25 | 78 | | |
| |||
51 | 104 | | |
52 | 105 | | |
53 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
54 | 110 | | |
55 | 111 | | |
56 | 112 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments