@pptx-editor.dev/pro 0.2.0 → 0.3.0-canary.20261109032918.sha-39dc46e

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.
@@ -0,0 +1,335 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ export { R as ReviewModuleOptions, r as reviewModule } from './review-module-BreJaYRH.js';
7
+ export { P as ProLicenseOptions } from './license-Boo2wwCs.js';
8
+ import * as react from 'react';
9
+ import { ReactNode } from 'react';
10
+ import { CommentFormat, CommentAnchor, CommentExpect, CommentTextRange, PptxEditorInstance, ReviewAuthorInfo } from '@pptx-editor.dev/core/editor';
11
+ export { CommentMarkerStyle, ReviewAuthorInfo, ReviewPaneOpening, ReviewPaneOptions } from '@pptx-editor.dev/core/editor';
12
+
13
+ /**
14
+ * One comment or reply of the current slide, as the review hooks and parts read it. A thread's
15
+ * replies follow it in `UseReviewReturn.items`, and the thread names them in `replyIds`. Text and
16
+ * names come from the file: render them as text, never as markup.
17
+ *
18
+ * @public
19
+ */
20
+ interface ReviewItemView {
21
+ /** The key the actions take: the comment id. */
22
+ readonly key: string;
23
+ /** The comment id, as the comment commands take it. Equal to `key`. */
24
+ readonly id: string;
25
+ /**
26
+ * The comment's `identity` (`SlideComment.identity` says what keeps it), which can stay where
27
+ * `id` changes. The pane keys its cards, its open fields, and the selected thread by it. The
28
+ * actions send the item's author, date, and text as the command's `expect`.
29
+ */
30
+ readonly identity: string;
31
+ /** Always `comment`: PresentationML has no tracked-change markup. */
32
+ readonly kind: 'comment';
33
+ /** The author's display name, or an empty string when the file names none. */
34
+ readonly author: string;
35
+ /** The avatar text: the file's initials, else the first letters of the author's name. */
36
+ readonly initials: string;
37
+ /** The date as the file stores it (ISO 8601), or absent. */
38
+ readonly date?: string;
39
+ /** The text, with one line feed between paragraphs. */
40
+ readonly text: string;
41
+ /** The file format of the thread. */
42
+ readonly format: CommentFormat;
43
+ /** Whether the thread is resolved. A reply reports its thread's state. */
44
+ readonly resolved: boolean;
45
+ /** Where the thread points on the slide. A reply reports its thread's anchor. */
46
+ readonly anchor: CommentAnchor;
47
+ /** The name of the element the thread points at, or absent for the slide or a place. */
48
+ readonly anchorName?: string;
49
+ /** For a reply, the id of its thread; absent on a thread. */
50
+ readonly parentId?: string;
51
+ /**
52
+ * For a reply, what the item list showed of its thread: the author, date, text, and identity.
53
+ * The thread actions on a reply item (`reply`, `resolve`, `reopen`) send it as `expect`, so
54
+ * they refuse a thread that is no longer the one shown. Absent on a thread.
55
+ */
56
+ readonly parent?: CommentExpect;
57
+ /** For a thread, the ids of its replies, oldest first; empty on a reply. */
58
+ readonly replyIds: readonly string[];
59
+ /** Whether the thread is the picked one (`activeKey`). A reply reports its thread's state. */
60
+ readonly isActive: boolean;
61
+ /** Whether `edit` can replace the text. False for content that the editor cannot write back. */
62
+ readonly editable: boolean;
63
+ /** Whether `resolve` and `reopen` apply. False for the legacy format, which has no state. */
64
+ readonly resolvable: boolean;
65
+ }
66
+ /**
67
+ * The element that a new comment points at: the one selected element of the slide's top level.
68
+ * Null when the comment points at the slide. @public
69
+ */
70
+ interface ReviewCommentTarget {
71
+ readonly nodeId: string;
72
+ readonly name: string;
73
+ /** The selected text of the element, when the comment points at a range of its text. */
74
+ readonly range?: CommentTextRange;
75
+ }
76
+ /** Options of `UseReviewReturn.setActive`. @public */
77
+ interface ReviewActivationOptions {
78
+ /**
79
+ * Also ask for the **Comments** tab of the side panel (`requestPane`), as a press on the
80
+ * thread's marker does. Default `false`.
81
+ */
82
+ readonly announce?: boolean;
83
+ /**
84
+ * The `identity` of the thread as your view shows it. The pick is refused when the thread under
85
+ * `key` has another identity: the view is older than the snapshot.
86
+ */
87
+ readonly identity?: string;
88
+ }
89
+
90
+ /** Shared props of every part. @public */
91
+ interface ReviewPartProps {
92
+ /** A class name added to the part's element. */
93
+ className?: string;
94
+ /** Merge the part's wiring onto its single child element instead of the default element. */
95
+ asChild?: boolean;
96
+ /** Render nothing. Inside the packaged card, this removes the part. */
97
+ hidden?: boolean;
98
+ children?: ReactNode;
99
+ }
100
+ /** Props of the action parts, which also take an icon. @public */
101
+ interface ReviewActionProps extends ReviewPartProps {
102
+ /** The icon. Default: the part's Material Symbol; `children` also replace it. */
103
+ icon?: ReactNode;
104
+ }
105
+ /** Props of `PptxEditorReview.Draft`, the compose box of a new comment. @public */
106
+ interface ReviewDraftProps extends ReviewPartProps {
107
+ /** The element that the new comment points at. Default: the selected element, else the slide. */
108
+ nodeId?: string;
109
+ }
110
+ /** The label resolver of `PptxEditorReview`: a string for a key, or undefined for the default. @public */
111
+ type ReviewTranslate = (key: string) => string | undefined;
112
+ /** Props of `PptxEditorReview`. @public */
113
+ interface ReviewProps extends Omit<ReviewPartProps, 'children' | 'asChild'> {
114
+ /**
115
+ * Label resolver, as the toolbar and menus take one. A key it does not resolve falls back to
116
+ * the bundled catalog. Placeholders such as `{author}` are filled in.
117
+ */
118
+ t?: ReviewTranslate;
119
+ /** A class name for each card. `className` styles the pane; this styles the cards in it. */
120
+ card?: {
121
+ className?: string;
122
+ };
123
+ /**
124
+ * The parts of the pane and of its cards. Root parts (`List`, `AddComment`, `Draft`) put as
125
+ * direct children replace the packaged ones. Other children become the card template of the
126
+ * list. A function is the list's render callback, with one call for each thread.
127
+ */
128
+ children?: ReactNode | ((item: ReviewItemView) => ReactNode);
129
+ /**
130
+ * Render the packaged arrangement: the **New comment** button, the compose box, and the list.
131
+ * `false` renders only the root parts you pass, with the pane's data and context.
132
+ */
133
+ preset?: boolean;
134
+ /** Show only some threads, for example the open ones. Replies follow their thread. */
135
+ filter?: (item: ReviewItemView) => boolean;
136
+ }
137
+
138
+ /** A part's marker, which the card and the pane read to replace a packaged part in place. */
139
+ type PartMarked<T> = T & {
140
+ readonly pptxReviewPart: string;
141
+ };
142
+ /** Shown when the slide has no thread. @public */
143
+ declare const ReviewEmpty: PartMarked<({ className, hidden, children, }: ReviewPartProps) => react.JSX.Element | null>;
144
+ /**
145
+ * One thread. A press on it, or Enter or Space while it has the focus, picks the thread: its
146
+ * marker on the slide shows the pick, and the card opens its reply line. @public
147
+ */
148
+ declare const ReviewCard: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
149
+ /** The author's initials, in the author's color. @public */
150
+ declare const ReviewAvatar: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
151
+ /** The author's name, or "Unknown author". @public */
152
+ declare const ReviewAuthor: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
153
+ /** When the comment was written: month, day, and time. Nothing for a comment with no date. @public */
154
+ declare const ReviewTime: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
155
+ /** The element that the thread points at, as "On Title 1". Nothing for the slide or a place. @public */
156
+ declare const ReviewAnchor: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
157
+ /** The comment's text, or its edit box while the comment is open for an edit. @public */
158
+ declare const ReviewSummary: PartMarked<({ className, asChild, hidden, children, }: ReviewPartProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined>;
159
+ /** The replies of a thread, oldest first, each with its own author color and actions. @public */
160
+ declare const ReviewReplies: PartMarked<({ className, hidden, }: ReviewPartProps) => react.JSX.Element | null>;
161
+ /** Resolve the thread. Shown on an open thread of the threaded format. @public */
162
+ declare const ReviewResolve: PartMarked<({ className, asChild, hidden, children, icon }: ReviewActionProps) => react.JSX.Element | null>;
163
+ /** Reopen the resolved thread. @public */
164
+ declare const ReviewReopen: PartMarked<({ className, asChild, hidden, children, icon }: ReviewActionProps) => react.JSX.Element | null>;
165
+ /** Open the comment's text for an edit. Shown on hover and focus, where the editor can write it. @public */
166
+ declare const ReviewEdit: PartMarked<({ className, asChild, hidden, children, icon }: ReviewActionProps) => react.JSX.Element | null>;
167
+ /** Delete the reply, or the thread with its replies. Shown on hover and focus. @public */
168
+ declare const ReviewDelete: PartMarked<({ className, asChild, hidden, children, icon }: ReviewActionProps) => react.JSX.Element | null>;
169
+
170
+ /**
171
+ * The **New comment** button. A root part: it opens the compose box (`Draft`). Off in view mode
172
+ * and while the compose box is open. @public
173
+ */
174
+ declare function ReviewAddComment({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
175
+ declare namespace ReviewAddComment {
176
+ var pptxReviewPart: "AddComment";
177
+ }
178
+ /**
179
+ * The compose box of a new comment, in the signing author's color. It renders only while a draft
180
+ * is open (`AddComment`). The comment points at `nodeId`, else at the selected element, else at
181
+ * the slide; the box names the element. Without an author, it says so and Comment is off. @public
182
+ */
183
+ declare function ReviewDraft({ className, hidden, nodeId }: ReviewDraftProps): react.JSX.Element | null;
184
+ declare namespace ReviewDraft {
185
+ var pptxReviewPart: "Draft";
186
+ }
187
+ /**
188
+ * The reply line of the picked thread: the signing author's avatar, a field, Cancel while it holds
189
+ * text, and a round send button. Not on a resolved thread or in view mode. @public
190
+ */
191
+ declare function ReviewReply({ className, hidden, children }: ReviewPartProps): react.JSX.Element | null;
192
+ declare namespace ReviewReply {
193
+ var pptxReviewPart: "Reply";
194
+ }
195
+
196
+ /** Props of `PptxEditorReview.List`. @public */
197
+ interface ReviewListProps extends Omit<ReviewPartProps, 'children' | 'asChild'> {
198
+ /** The card template (a `Card`, or parts that replace the packaged ones), or a render callback. */
199
+ children?: ReactNode | ((item: ReviewItemView) => ReactNode);
200
+ }
201
+ /** The threads of the slide, one card each, or `Empty` when there is none. @public */
202
+ declare const ReviewList: PartMarked<({ className, hidden, children, }: ReviewListProps) => react.JSX.Element | null>;
203
+ /**
204
+ * The comments pane. Render it in the editor root, for example as the **Comments** tab of the
205
+ * side panel (`<PptxEditor.SidePanel panes={{ comments: <PptxEditorReview /> }} />`). It needs
206
+ * the review module (`reviewModule()`); without one, it says that comments are kept when you
207
+ * save. @public
208
+ */
209
+ declare function ReviewRoot({ className, hidden, t, card, children, preset, filter }: ReviewProps): react.JSX.Element | null;
210
+ /** The comments pane compound. @public */
211
+ interface PptxEditorReviewNamespace {
212
+ (props: ReviewProps): ReturnType<typeof ReviewRoot>;
213
+ /** The list of the slide's threads. A root part. */
214
+ readonly List: typeof ReviewList;
215
+ /** The **New comment** button. A root part. */
216
+ readonly AddComment: typeof ReviewAddComment;
217
+ /** The compose box of a new comment, while a draft is open. A root part. */
218
+ readonly Draft: typeof ReviewDraft;
219
+ readonly Empty: typeof ReviewEmpty;
220
+ readonly Card: typeof ReviewCard;
221
+ readonly Avatar: typeof ReviewAvatar;
222
+ readonly Author: typeof ReviewAuthor;
223
+ readonly Time: typeof ReviewTime;
224
+ /** The element that the thread points at. */
225
+ readonly Anchor: typeof ReviewAnchor;
226
+ readonly Summary: typeof ReviewSummary;
227
+ readonly Resolve: typeof ReviewResolve;
228
+ readonly Reopen: typeof ReviewReopen;
229
+ readonly Edit: typeof ReviewEdit;
230
+ readonly Delete: typeof ReviewDelete;
231
+ readonly Replies: typeof ReviewReplies;
232
+ /** The reply line of the picked thread. */
233
+ readonly Reply: typeof ReviewReply;
234
+ }
235
+ /**
236
+ * The comments pane as a compound component: `PptxEditorReview` is the root, and every part hangs
237
+ * off it, as DOCX Editor's `DocxEditorReview`. Root parts (`List`, `AddComment`, `Draft`) go as
238
+ * direct children of the root. Card parts go in `List`, or as other direct children, which
239
+ * become the card template.
240
+ *
241
+ * @example
242
+ * ```tsx
243
+ * <PptxEditorReview>
244
+ * <PptxEditorReview.List>
245
+ * <PptxEditorReview.Card>
246
+ * <PptxEditorReview.Delete hidden />
247
+ * </PptxEditorReview.Card>
248
+ * </PptxEditorReview.List>
249
+ * </PptxEditorReview>
250
+ * ```
251
+ *
252
+ * @public
253
+ */
254
+ declare const PptxEditorReview: PptxEditorReviewNamespace;
255
+
256
+ /**
257
+ * What `useReview` returns: the comments of the current slide and the things a card can do.
258
+ * Every action reports whether the editor applied it. A refused action changes nothing, and the
259
+ * editor publishes its reason (`lastRejection`), which the edit notice shows.
260
+ *
261
+ * @public
262
+ */
263
+ interface UseReviewReturn {
264
+ /**
265
+ * The comments of the current slide, in file order: each thread, then its replies. Empty
266
+ * without a review module or a deck.
267
+ */
268
+ readonly items: readonly ReviewItemView[];
269
+ /** The key of the picked thread (a marker press, `setActive`), or null. */
270
+ readonly activeKey: string | null;
271
+ /**
272
+ * Pick a thread, as a press on its marker does, or `null` for none. With `{ announce: true }`
273
+ * it also asks for the **Comments** tab of the side panel. False for a key that is not a thread
274
+ * of the current slide.
275
+ */
276
+ readonly setActive: (key: string | null, options?: ReviewActivationOptions) => boolean;
277
+ /**
278
+ * Add a thread on the current slide. It points at `target.range` of the text of
279
+ * `target.nodeId`, at `target.nodeId`, else at the selected text or element
280
+ * (`commentTarget`), else at the slide. `author` overrides `author` for this comment.
281
+ */
282
+ readonly comment: (text: string, author?: string, target?: {
283
+ readonly nodeId: string;
284
+ readonly range?: CommentTextRange;
285
+ }) => boolean;
286
+ /** Reply to a thread, or to the thread of a reply. */
287
+ readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
288
+ /** Replace the text of a comment or a reply. False when `item.editable` is false. */
289
+ readonly edit: (item: ReviewItemView, text: string) => boolean;
290
+ /** Delete a reply, or a thread with all of its replies. */
291
+ readonly remove: (item: ReviewItemView) => boolean;
292
+ /** Resolve the thread of `item`. A resolved thread reports true with no write. */
293
+ readonly resolve: (item: ReviewItemView) => boolean;
294
+ /** Reopen the thread of `item`. An open thread reports true with no write. */
295
+ readonly reopen: (item: ReviewItemView) => boolean;
296
+ /** The name that signs a new comment or reply, or null. Without one, `comment` is refused. */
297
+ readonly author: string | null;
298
+ /** Set the name that signs later comments and replies (`editor.setAuthor`). */
299
+ readonly setAuthor: (author: string | undefined) => void;
300
+ /** The element that a new comment points at, or null for the slide. */
301
+ readonly commentTarget: ReviewCommentTarget | null;
302
+ /** True while no deck is open for editing: in view mode, and before a deck opens. */
303
+ readonly readOnly: boolean;
304
+ /** False until the editor has a deck. */
305
+ readonly ready: boolean;
306
+ }
307
+ /**
308
+ * Read the comments of the current slide and act on them, in the editor root. For headless or
309
+ * server work, use the comment commands of `@pptx-editor.dev/core` or `@pptx-editor.dev/editor-api`.
310
+ *
311
+ * @public
312
+ */
313
+ declare function useReview(): UseReviewReturn;
314
+ /** `useReview` over an explicit editor, for a host that holds its own. @public */
315
+ declare function useReviewOf(editor: PptxEditorInstance | null): UseReviewReturn;
316
+
317
+ /**
318
+ * The comment that the surrounding card (or reply) renders, or null outside one. A host's own
319
+ * card content reads its item here, as the packaged parts do.
320
+ *
321
+ * @public
322
+ */
323
+ declare function useReviewItem(): ReviewItemView | null;
324
+ /**
325
+ * The look of one comment author, from the editor's review roster (`getReviewAuthors`): the
326
+ * slot and the CSS color of the thread's marker, band, ring, and card, or `undefined` without an
327
+ * author or for an author the roster does not hold. A custom card draws with it, so it keeps the
328
+ * colors of the rest of the review chrome.
329
+ *
330
+ * @public
331
+ */
332
+ declare function useReviewAuthor(author: string | undefined): ReviewAuthorInfo | undefined;
333
+
334
+ export { PptxEditorReview, useReview, useReviewAuthor, useReviewItem, useReviewOf };
335
+ export type { PptxEditorReviewNamespace, ReviewActionProps, ReviewActivationOptions, ReviewCommentTarget, ReviewDraftProps, ReviewItemView, ReviewListProps, ReviewPartProps, ReviewProps, ReviewTranslate, UseReviewReturn };
package/dist/react.js ADDED
@@ -0,0 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import{a as Be,b as W,c as Z,d as je,e as j,f as we,g as He,h as K,i as F,j as z,k as qe,l as Ue,m as J,n as Xe,o as Q,p as Ge,q as We,r as Ze}from"./chunk-WVMCUB34.js";import{a as ut}from"./chunk-B3UUTQS4.js";import"./chunk-HCD7IVOL.js";import{Fragment as st,cloneElement as Vt,isValidElement as me,useCallback as De,useEffect as pe,useMemo as U,useRef as it,useState as Oe}from"react";import{currentSlideSummary as Kt,registerCommentDraft as Ft}from"@pptx-editor.dev/core/editor";import{useEditorState as Se,usePptxEditor as $t,useReviewAuthors as Bt}from"@pptx-editor.dev/react";import{useCallback as dt,useMemo as Y,useSyncExternalStore as pt}from"react";import{usePptxEditor as mt}from"@pptx-editor.dev/react";function ye(){return ze(mt())}function ze(e){let n=dt(m=>e?e.subscribe(m):()=>{},[e]),t=pt(n,()=>e?e.snapshot():null,()=>null),o=Y(()=>Ue(e,t),[e,t]),r=Y(()=>Q(e),[e]),i=t?.selection,a=t?.shapes,s=Y(()=>i?z(i,a):null,[i,a]),l=t?.activeComment??null,c=t?.commentAuthor??null,d=J(t),v=Xe(t);return Y(()=>({items:o,activeKey:l,...r,author:c,commentTarget:s,readOnly:d,ready:v}),[o,l,r,c,s,d,v])}import{createContext as Je,useCallback as vt,useContext as ee}from"react";import{useReviewAuthors as ft,useTranslation as wt}from"@pptx-editor.dev/react";var H=Je(null),b=Je(null);function yt(){return ee(b)}function Rt(e){let n=ee(H),t=ft();if(e)return n?n.authors.get(e):t.find(o=>o.author===e)}var xt={items:[],activeKey:null,...Q(null),author:null,commentTarget:null,readOnly:!0,ready:!1},bt={t:void 0,cardClassName:void 0,review:xt,byId:new Map,authors:new Map,drafting:!1,draftTarget:null,beginDraft:()=>{},endDraft:()=>{},editing:null,setEditing:()=>{},focusCard:()=>{}};function _(){return ee(H)??bt}function x(){let e=ee(H)?.t,{t:n}=wt();return vt((t,o)=>{let r=e?.(t);return r===void 0?n(t,o):o?r.replace(/\{(\w+)\}/g,(i,a)=>Object.hasOwn(o,a)?String(o[a]):i):r},[e,n])}import{Children as It,Fragment as Dt,cloneElement as Ot,isValidElement as rt,useContext as L,useMemo as St}from"react";import{Icon as Mt}from"@pptx-editor.dev/react";import{Children as gt,cloneElement as Qe,isValidElement as ht}from"react";function Pt(e,n){return typeof n!="function"?e:typeof e!="function"?n:t=>{e(t),t.defaultPrevented||n(t)}}function _t(e,n){let t={...e,...n};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?t[o]=Pt(n[o],e[o]):o==="className"?t[o]=[e[o],n[o]].filter(Boolean).join(" "):o==="style"&&(t[o]={...e[o],...n[o]});return t}function et(e){return e==="Enter"||e===" "}function Nt(e){return et(e.key)?(e.preventDefault(),e.stopPropagation(),!0):!1}function Ye(e){return e.type==="button"}function Ct(e,n){return e.type==="a"||n.href!=null}function At(e,n,t,o){let r=i=>{typeof t=="function"&&t(i)};return{onClick:i=>{typeof e=="function"&&e(i),i.defaultPrevented||r(i),o&&i.preventDefault()},onKeyDown:i=>{if(typeof n=="function"&&n(i),!et(i.key))return;i.defaultPrevented||r(i),o&&i.preventDefault()}}}function te({engineDisabled:e,disabledReason:n,slotProps:t,children:o}){let r=gt.only(o);if(!ht(r))return null;let i=r.props,a=_t(t,i);if(!e){if(!Ye(r)){let s=At(i.onClick,i.onKeyDown,t.onClick,Ct(r,i));a.onClick=s.onClick,a.onKeyDown=s.onKeyDown}return Qe(r,a)}if(Ye(r))a.disabled=!0,delete a["aria-disabled"];else{delete a.disabled,a["aria-disabled"]=!0,a["data-disabled"]="",a.tabIndex=-1,a.href=void 0,a.role===void 0&&(a.role="button");let s=a.onKeyDown;a.onKeyDown=l=>{Nt(l)||typeof s=="function"&&s(l)}}return n&&(a.title=n),a.onClick=s=>{s.preventDefault(),s.stopPropagation()},Qe(r,a)}import{useContext as Et,useEffect as tt,useId as xe,useRef as Re,useState as M}from"react";import{Icon as nt,usePptxEditor as be}from"@pptx-editor.dev/react";import{commentInitials as Tt}from"@pptx-editor.dev/core/editor";import{Fragment as kt,jsx as p,jsxs as V}from"react/jsx-runtime";var ne=(...e)=>e.filter(Boolean).join(" ");function ge(e){let n=Re(null);return tt(()=>{let t=n.current;!e.autoFocus||!t||(t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))},[]),p("textarea",{ref:n,id:e.id,className:"pptx-review__input","data-comment-field":"",rows:1,value:e.value,maxLength:Be,"aria-label":e.label,"aria-describedby":e.describedBy,placeholder:e.placeholder??e.label,onChange:t=>e.onChange(t.target.value),onClick:t=>t.stopPropagation(),onKeyDown:t=>{let o=We({...t,isComposing:t.nativeEvent.isComposing});o&&(t.preventDefault(),t.stopPropagation(),o==="post"?e.onPost():e.onCancel())}})}function he({id:e,notice:n,current:t}){let o=x(),r=n?.rejection.reason==="errors.commentChanged";return V("span",{id:e,className:"pptx-review__refused pptx-review__notice",role:"status",children:[n?p("span",{children:je(o,n)},n.serial):null,n&&r&&t!==void 0?p("span",{className:"pptx-review__current",children:o("comments.nowReads",{text:t})}):null]})}function Pe({id:e}){let n=x();return p("span",{id:e,className:"pptx-sr-only",children:n("comments.keyHint")})}function oe({className:e,asChild:n,hidden:t,children:o}){let{beginDraft:r,drafting:i,review:a}=_(),s=x();if(t)return null;let l=s("comments.new"),c=i||a.readOnly;return n?p("div",{className:"pptx-review__bar",children:p(te,{engineDisabled:c,disabledReason:null,slotProps:{className:ne("pptx-review__add",e),"data-review-add":"",onClick:r},children:o})}):p("div",{className:"pptx-review__bar",children:V("button",{type:"button",className:ne("pptx-review__add",e),"data-review-add":"",disabled:c,onClick:r,children:[p(nt,{name:"add_comment"}),p("span",{children:o??l})]})})}oe.pptxReviewPart="AddComment";function re({className:e,hidden:n,nodeId:t}){let{drafting:o,draftTarget:r,endDraft:i,review:a,authors:s}=_(),l=be(),c=x(),[d,v]=M(""),[m,g]=M(null),w=xe();if(!o&&m&&g(null),n||!o)return null;let h=a.author??"",y=t??r?.nodeId,T=!t&&r?.range?{range:r.range}:{},k=t?null:r??a.commentTarget,I=a.author===null,A=d.trim()==="",P=()=>{if(A||I||a.readOnly)return;let R=W(l,()=>a.comment(d,void 0,y?{nodeId:y,...T}:void 0));R===null?(v(""),g(null),i()):g(Z(R,"draft",m))},S=()=>{v(""),g(null),i()};return p("div",{className:ne("pptx-review__card",e),"data-draft":"",...K(h,s),style:F(h,s),children:V("form",{className:"pptx-review__compose",onSubmit:R=>{R.preventDefault(),P()},children:[k?p("span",{className:"pptx-review__chip",children:c("comments.pointsAt",{name:k.name})}):null,p(ge,{id:w,value:d,label:c("comments.addComment"),describedBy:`${I?`${w}-blocked`:`${w}-hint`} ${w}-notice`,autoFocus:!0,onChange:R=>{v(R),g(null)},onPost:P,onCancel:S}),p(Pe,{id:`${w}-hint`}),p(he,{id:`${w}-notice`,notice:m}),I?p("span",{id:`${w}-blocked`,className:"pptx-review__refused",children:c("comments.noAuthor")}):null,V("div",{className:"pptx-review__compose-actions",children:[p("button",{type:"button",className:"pptx-review__text-button",onClick:S,children:c("comments.cancel")}),p("button",{type:"submit",className:"pptx-review__submit",disabled:A||I,children:c("comments.text")})]})]})})}re.pptxReviewPart="Draft";function q({className:e,hidden:n,children:t}){let{review:o,authors:r}=_(),i=be(),a=Et(b),s=x(),[l,c]=M(""),d=xe(),v=a?.identity??"",[m,g]=M(v),[w,h]=M(null),[y,T]=M(null);if(v!==m&&(g(v),c(""),h(null),T(null)),y&&!a?.isActive&&T(null),n||!a||!a.isActive||a.resolved||o.readOnly)return null;if(t)return p(kt,{children:t});let k=o.author??"",I=a.author||s("comments.unknownAuthor"),A=l.trim()==="",P=R=>{R?w||h(j(a)):h(null),c(R),T(null)},S=()=>{if(A||o.author===null)return;let R=W(i,()=>o.reply(w?we(a,w):a,l));if(R===null){c(""),h(null),T(null);return}R?.reason==="errors.commentChanged"&&h(j(a)),T(Z(R,"reply",y))};return V("form",{className:ne("pptx-review__reply-line",e),onSubmit:R=>{R.preventDefault(),S()},children:[k?p("span",{className:"pptx-review__avatar pptx-review__reply-avatar","aria-hidden":"true",...K(k,r),style:F(k,r),children:Tt({initials:"",author:k})}):null,p(ge,{id:d,value:l,label:s("comments.replyTo",{author:I}),placeholder:s("comments.replyText"),describedBy:`${o.author===null?`${d}-blocked`:`${d}-hint`} ${d}-notice`,onChange:P,onPost:S,onCancel:()=>{l?P(""):o.setActive(null)}}),p(Pe,{id:`${d}-hint`}),p(he,{id:`${d}-notice`,notice:y}),l?p("button",{type:"button",className:"pptx-review__text-button",onClick:()=>P(""),children:s("comments.cancel")}):null,p("button",{type:"submit",className:"pptx-review__send","aria-label":s("comments.replyTo",{author:I}),"data-pptx-tooltip":s("comments.reply"),disabled:A||o.author===null,children:p(nt,{name:"send"})}),o.author===null?p("span",{id:`${d}-blocked`,className:"pptx-review__refused",children:s("comments.noAuthor")}):null]})}q.pptxReviewPart="Reply";function ot({item:e}){let{review:n,setEditing:t,focusCard:o}=_(),r=be(),i=x(),[a,s]=M(e.text),l=xe(),c=Re(e.identity),d=e.identity!==c.current,v=Re(j(e)),[m,g]=M(null);tt(()=>{d&&t(null)},[d,t]);let w=()=>{t(null),o(e.parentId??e.key)},h=()=>{if(d||a.trim()==="")return;let y=W(r,()=>n.edit(we(e,v.current),a));if(y===null)return w();y?.reason==="errors.commentChanged"&&(v.current=j(e)),g(Z(y,"edit",m))};return V("form",{className:"pptx-review__compose",onSubmit:y=>{y.preventDefault(),h()},children:[p(ge,{id:l,value:a,label:i("comments.editText"),describedBy:`${l}-hint ${l}-notice`,autoFocus:!0,onChange:y=>{s(y),g(null)},onPost:h,onCancel:w}),p(Pe,{id:`${l}-hint`}),p(he,{id:`${l}-notice`,notice:m,current:e.text}),V("div",{className:"pptx-review__compose-actions",children:[p("button",{type:"button",className:"pptx-review__text-button",onClick:w,children:i("comments.cancel")}),p("button",{type:"submit",className:"pptx-review__submit",disabled:a.trim()==="",children:i("comments.save")})]})]})}import{Fragment as Ie,jsx as u,jsxs as D}from"react/jsx-runtime";function E(e,n){return Object.assign(e,{pptxReviewPart:n})}var O=(...e)=>e.filter(Boolean).join(" ");function $(e,n){let t=It.only(e);if(!rt(t))return null;let o=t.props;return Ot(t,{...n,...o,className:O(n.className,o.className)})}function _e(e){let n={},t=[],o=r=>{if(Array.isArray(r))return void r.forEach(o);if(!rt(r)){r!=null&&r!==!1&&t.push(r);return}if(r.type===Dt)return o(r.props.children);let i=r.type.pptxReviewPart;i?n[i]=r:t.push(r)};return o(e),t.length>0&&(n.__extra=t),n}var Ne=E(function({className:n,hidden:t,children:o}){let r=x(),{review:i}=_();return t?null:u("div",{className:O("pptx-review__empty",n),children:o??D(Ie,{children:[u("p",{className:"pptx-review__empty-title",children:r("comments.emptyTitle")}),i.readOnly?null:u("p",{className:"pptx-review__empty-body",children:r("comments.emptyBody")})]})})},"Empty"),Ce=E(function({className:n,asChild:t,hidden:o,children:r}){let{review:i,cardClassName:a,authors:s}=_(),l=L(b),c=x();if(o||!l)return null;let d=()=>{l.isActive||i.setActive(l.key,{identity:l.identity})},v={className:O("pptx-review__card",a,n),"data-comment-id":l.id,...l.isActive?{"data-active":"","aria-current":"true"}:{},...l.resolved?{"data-resolved":""}:{},...K(l.author,s),style:F(l.author,s),role:"group","aria-label":c("comments.thread",{author:l.author||c("comments.unknownAuthor")}),tabIndex:0,onClick:m=>{Ze(m.target)||d()},onKeyDown:m=>{m.target!==m.currentTarget||m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),d())}};return t?$(r,v):u("div",{...v,children:u(Lt,{children:r})})},"Card");function Lt({children:e}){let n=St(()=>_e(e),[e]),t=(o,r)=>o in n?n[o]:r;return D(Ie,{children:[D("div",{className:"pptx-review__head",children:[t("Avatar",u(ie,{})),D("div",{className:"pptx-review__meta",children:[t("Author",u(ae,{})),t("Time",u(se,{}))]}),D("div",{className:"pptx-review__actions",children:[t("Resolve",u(Te,{})),t("Reopen",u(ke,{})),t("Edit",u(ue,{})),t("Delete",u(de,{}))]})]}),t("Anchor",u(Ae,{})),t("Summary",u(le,{})),t("Replies",u(Ee,{})),t("Reply",u(q,{})),n.__extra]})}var ie=E(function({className:n,asChild:t,hidden:o,children:r}){let i=L(b);if(o||!i)return null;let a={className:O("pptx-review__avatar",n),"aria-hidden":!0};return t?$(r,a):u("span",{...a,children:r??i.initials})},"Avatar"),ae=E(function({className:n,asChild:t,hidden:o,children:r}){let i=L(b),a=x();if(o||!i)return null;let s={className:O("pptx-review__author",n)};return t?$(r,s):u("span",{...s,children:r??(i.author||a("comments.unknownAuthor"))})},"Author"),se=E(function({className:n,asChild:t,hidden:o,children:r}){let i=L(b),a=x();if(o||!i)return null;let s=Ge(i.date),l=i.resolved&&i.parentId===void 0?a("comments.resolved"):"";if(!s&&!l)return null;let c={className:O("pptx-review__time",n)};return t?$(r,c):u("span",{...c,children:r??D(Ie,{children:[s?u("time",{dateTime:i.date,children:s}):null,l?u("span",{className:"pptx-review__status",children:l}):null]})})},"Time"),Ae=E(function({className:n,asChild:t,hidden:o,children:r}){let i=L(b),a=x();if(o||!i||i.parentId!==void 0||i.anchorName===void 0)return null;let s={className:O("pptx-review__chip",n)};return t?$(r,s):u("span",{...s,children:r??a("comments.on",{name:i.anchorName})})},"Anchor"),le=E(function({className:n,asChild:t,hidden:o,children:r}){let i=L(b),{editing:a}=_();if(o||!i)return null;if(a===i.identity)return u(ot,{item:i});let s={className:O("pptx-review__summary",n)};return t?$(r,s):u("div",{...s,children:r??u("p",{className:"pptx-review__text",children:i.text})})},"Summary"),Ee=E(function({className:n,hidden:t}){let{byId:o,authors:r}=_(),i=L(b),a=x();if(t||!i||i.replyIds.length===0)return null;let s=i.replyIds.map(l=>o.get(l)).filter(l=>l!==void 0);return s.length===0?null:u("ol",{className:O("pptx-review__replies",n),"aria-label":a("comments.replies",{author:i.author||a("comments.unknownAuthor")}),children:s.map(l=>u(b.Provider,{value:l,children:D("li",{className:"pptx-review__reply","data-reply-id":l.id,...K(l.author,r),style:F(l.author,r),children:[D("div",{className:"pptx-review__head",children:[u(ie,{}),D("div",{className:"pptx-review__meta",children:[u(ae,{}),u(se,{})]}),D("div",{className:"pptx-review__actions",children:[u(ue,{}),u(de,{})]})]}),u(le,{})]})},l.identity))})},"Replies");function ce(e){function n({className:t,asChild:o,hidden:r,children:i,icon:a}){let s=_(),l=L(b),c=x();if(r||!l||s.review.readOnly||!e.shows(l))return null;let d=c(e.label(l),{author:l.author||c("comments.unknownAuthor")}),v={type:"button",className:O("pptx-review__action",t),"data-action":e.part.toLowerCase(),"aria-label":d,"data-pptx-tooltip":d,onClick:m=>{m.stopPropagation(),e.run(s,l)}};return o?u(te,{engineDisabled:!1,disabledReason:null,slotProps:v,children:i}):u("button",{...v,children:a??i??u(Mt,{name:e.icon})})}return E(n,e.part)}var Te=ce({part:"Resolve",icon:"check",label:()=>"comments.resolveOf",shows:e=>e.parentId===void 0&&!e.resolved&&e.resolvable,run:({review:e},n)=>e.resolve(n)}),ke=ce({part:"Reopen",icon:"refresh",label:()=>"comments.reopenOf",shows:e=>e.parentId===void 0&&e.resolved&&e.resolvable,run:({review:e},n)=>e.reopen(n)}),ue=ce({part:"Edit",icon:"edit",label:()=>"comments.editOf",shows:e=>e.editable,run:({setEditing:e},n)=>e(n.identity)}),de=ce({part:"Delete",icon:"delete",label:()=>"comments.deleteOf",shows:()=>!0,run:({review:e,focusCard:n},t)=>{e.remove(t)&&n(t.parentId??t.key)}});import{Fragment as Gt,jsx as N,jsxs as at}from"react/jsx-runtime";var Me=(...e)=>e.filter(Boolean).join(" "),lt=E(function({className:n,hidden:t,children:o}){let{review:r}=_(),i=x(),a=U(()=>typeof o=="function"?null:_e(o),[o]);if(t)return null;let s=r.items.filter(c=>c.parentId===void 0);if(s.length===0)return typeof o=="function"?null:N(Gt,{children:a&&"Empty"in a?a.Empty:N(Ne,{})});let l=()=>{if(a&&me(a.Card))return a.Card;let c=a?Object.entries(a).filter(([d])=>d!=="Empty"):[];return N(Ce,{children:c.map(([d,v])=>N(st,{children:v},d))})};return N("ul",{className:Me("pptx-review__list",n),"aria-label":i("comments.label"),children:s.map(c=>N(b.Provider,{value:c,children:N("li",{className:"pptx-review__slot",children:typeof o=="function"?o(c):l()})},c.identity))})},"List"),jt=new Set(["List","AddComment","Draft"]);function Ht(e){if(typeof e=="function")return{parts:{},template:e};let n={},t=[],o=r=>{if(Array.isArray(r))return void r.forEach(o);if(me(r)&&r.type===st)return o(r.props.children);let i=me(r)?r.type.pptxReviewPart:void 0;i&&jt.has(i)?n[i]=r:r!=null&&r!==!1&&t.push(r)};return o(e),{parts:n,template:t.length>0?t:void 0}}function qt({className:e,hidden:n,t,card:o,children:r,preset:i=!0,filter:a}){let s=ye(),l=$t(),c=Ut(t),d=Se(f=>f.status==="ready"&&f.comments==null),[v,m]=Oe(!1),[g,w]=Oe(null),h=Se(f=>f.shapes),y=qe(g,h),T=g!==null&&y===null;pe(()=>{T&&w(null)},[T]);let[k,I]=Oe(null),A=it(null),P=U(()=>{if(!a)return s.items;let f=new Set(s.items.filter(C=>C.parentId===void 0&&a(C)).map(C=>C.id));return s.items.filter(C=>f.has(C.parentId??C.id))},[s.items,a]),S=U(()=>new Map(P.map(f=>[f.id,f])),[P]),R=Bt(),Le=U(()=>He(R),[R]),X=Se(f=>Kt(f)?.id??""),ve=it({slide:X,readOnly:s.readOnly});pe(()=>{ve.current.slide===X&&ve.current.readOnly===s.readOnly||(ve.current={slide:X,readOnly:s.readOnly},m(!1),I(null))},[X,s.readOnly]),pe(()=>{if(!(!l||d||n))return Ft(l,()=>{let f=l.snapshot();J(f)||(w(z(f.selection,f.shapes)),m(!0),requestAnimationFrame(()=>A.current?.querySelector("[data-draft] [data-comment-field]")?.focus()))})},[l,d,n]);let Ve=De(f=>{requestAnimationFrame(()=>{let C=A.current;(C?.querySelector(`[data-comment-id="${CSS.escape(f)}"]`)??C?.querySelector("[data-review-add]"))?.focus()})},[]),Ke=De(()=>{w(null),m(!0)},[]),Fe=De(()=>{m(!1),w(null),requestAnimationFrame(()=>A.current?.querySelector("[data-review-add]")?.focus())},[]);pe(()=>{s.activeKey&&A.current?.querySelector(`[data-comment-id="${CSS.escape(s.activeKey)}"]`)?.scrollIntoView?.({block:"nearest"})},[s.activeKey]);let ct=U(()=>({t,cardClassName:o?.className,review:P===s.items?s:{...s,items:P},byId:S,authors:Le,drafting:v,draftTarget:y,beginDraft:Ke,endDraft:Fe,editing:k,setEditing:I,focusCard:Ve}),[t,o?.className,s,P,S,Le,v,y,Ke,Fe,k,Ve]);if(n)return null;if(d)return at("div",{className:Me("pptx-empty",e),children:[N("p",{className:"pptx-empty__title",children:c("panel.comments.emptyTitle")}),N("p",{className:"pptx-empty__body",children:c("panel.comments.emptyBody")})]});let{parts:fe,template:G}=Ht(r),$e=(f,C)=>f in fe?fe[f]:i?C:null,B=fe.List;return N(H.Provider,{value:ct,children:at("section",{ref:A,className:Me("pptx-review",e),"aria-label":c("panel.tabs.comments"),"data-count":P.filter(f=>f.parentId===void 0).length,children:[$e("AddComment",N(oe,{})),$e("Draft",N(re,{})),B!==void 0?me(B)&&B.props.children===void 0&&G?Vt(B,{children:G}):B:i?N(lt,{children:G}):G]})})}function Ut(e){let n=x();return t=>e?.(t)??n(t)}var Xt=Object.assign(qt,{List:lt,AddComment:oe,Draft:re,Empty:Ne,Card:Ce,Avatar:ie,Author:ae,Time:se,Anchor:Ae,Summary:le,Resolve:Te,Reopen:ke,Edit:ue,Delete:de,Replies:Ee,Reply:q});export{Xt as PptxEditorReview,ut as reviewModule,ye as useReview,Rt as useReviewAuthor,yt as useReviewItem,ze as useReviewOf};
@@ -0,0 +1,32 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import { ReviewDisplayMode, ReviewPaneOptions, EditorModule } from '@pptx-editor.dev/core/editor';
7
+ import { P as ProLicenseOptions } from './license-Boo2wwCs.js';
8
+
9
+ /** Options of `reviewModule`. @public */
10
+ interface ReviewModuleOptions extends ProLicenseOptions {
11
+ /** Display modes to unlock. Default: `final` and `markup`. */
12
+ readonly displayModes?: readonly ReviewDisplayMode[];
13
+ /**
14
+ * The comment view settings, as DOCX Editor's `pane` option: `commentMarkers` (`'icon'`, the
15
+ * default, or `'initials'`) sets how a comment marker on the slide looks, and `opening`
16
+ * (`'auto'`, the default, or `'manual'`) sets whether a press on a marker asks for the
17
+ * **Comments** tab of the side panel. An unknown field or value throws a `TypeError`.
18
+ */
19
+ readonly pane?: ReviewPaneOptions;
20
+ }
21
+ /**
22
+ * The review module. Register it with `createPptxEditor({ modules: [reviewModule()] })`: the
23
+ * editor snapshot then reports the current slide's comment threads (`comments`), the slide shows
24
+ * a marker for each thread, and `collectReviewItems` reads every comment of the deck. Render
25
+ * `PptxEditorReview` from `@pptx-editor.dev/pro/react` or `/vue` for the comments pane.
26
+ *
27
+ * @public
28
+ */
29
+ declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
30
+
31
+ export { reviewModule as r };
32
+ export type { ReviewModuleOptions as R };