@plannotator/ui 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HANDOFF.md +79 -0
- package/README.md +33 -1
- package/components/AnnotationPanel.tsx +44 -3
- package/components/BlockRenderer.tsx +55 -1
- package/components/CompletionOverlay.tsx +23 -1
- package/components/PRPlatformIcon.tsx +22 -0
- package/components/QuestionProgressChip.tsx +66 -0
- package/components/QuestionsPanelSection.tsx +121 -0
- package/components/Settings.tsx +25 -1
- package/components/Viewer.tsx +169 -6
- package/components/ai/AIProviderBar.tsx +3 -3
- package/components/blocks/QuestionBlock.tsx +591 -0
- package/config/settings.ts +17 -0
- package/hooks/useAnnotationHighlighter.ts +4 -0
- package/hooks/usePinpoint.ts +10 -0
- package/hooks/useScrollKeyRouting.ts +157 -0
- package/hooks/useUndoHistory.ts +17 -0
- package/hooks/useVimDocumentFocus.ts +2 -1
- package/package.json +2 -2
- package/styles.css +1 -1
- package/types.ts +3 -0
- package/utils/autoUpdateNotice.ts +59 -0
- package/utils/parser.ts +125 -563
- package/utils/questionAnswers.ts +227 -0
package/types.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { DiagramAnchor } from '@plannotator/core/diagram-anchor';
|
|
2
2
|
import type { DiagramRenderKind } from '@plannotator/core/annotatable';
|
|
3
|
+
import type { QuestionAnswer } from '@plannotator/core/question-block';
|
|
3
4
|
|
|
4
5
|
export type { DiagramAnchor } from '@plannotator/core/diagram-anchor';
|
|
6
|
+
export type { QuestionAnswer } from '@plannotator/core/question-block';
|
|
5
7
|
export type { DiagramRenderKind } from '@plannotator/core/annotatable';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -100,6 +102,7 @@ export interface Annotation {
|
|
|
100
102
|
elementContext?: HtmlElementContext; // raw-HTML / live-app pinpoint: bounded agent-facing description of the primary element (never used by restore)
|
|
101
103
|
htmlAdditionalTargets?: HtmlAnnotationTarget[]; // raw-HTML shift-click multi-select: extra elements this one comment covers (primary stays htmlAnchor/originalText)
|
|
102
104
|
diagramAnchor?: DiagramAnchor; // a comment on a rendered diagram part (Mermaid / Graphviz fence): the part's own id, label and document source line; the highlighter skips it and the diagram overlay restores it (see @plannotator/core/diagram-anchor)
|
|
105
|
+
questionAnswer?: QuestionAnswer; // the reviewer's answer to a `:::question` block (id `ann-question-<key>`): the Viewer draws the answer from it, the highlighter skips it, and the export prints it in the "Answers to your questions" section instead of as a numbered comment (see @plannotator/core/question-block)
|
|
103
106
|
// web-highlighter metadata for cross-element selections
|
|
104
107
|
startMeta?: AnnotationTextMeta;
|
|
105
108
|
endMeta?: AnnotationTextMeta;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time notice after a background auto-update (#1634).
|
|
3
|
+
*
|
|
4
|
+
* The compiled CLI's servers attach `autoUpdateNotice` to /api/plan and
|
|
5
|
+
* /api/diff when the data dir records an install attempt: `updated` once the
|
|
6
|
+
* running binary is the new version, `failed` when the install script exited
|
|
7
|
+
* non-zero. The notice id is stable per attempt; the "seen" marker is a cookie,
|
|
8
|
+
* which is shared across the random ports sessions run on, so the toast shows
|
|
9
|
+
* once whichever app (plan, annotate, review) loads first.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { getItem, setItem } from './storage';
|
|
13
|
+
|
|
14
|
+
export interface AutoUpdateNotice {
|
|
15
|
+
id: string;
|
|
16
|
+
kind: 'updated' | 'failed';
|
|
17
|
+
version: string;
|
|
18
|
+
releaseUrl: string;
|
|
19
|
+
logPath?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const SEEN_KEY = 'plannotator-auto-update-notice-seen';
|
|
23
|
+
|
|
24
|
+
export function parseAutoUpdateNotice(value: unknown): AutoUpdateNotice | undefined {
|
|
25
|
+
if (!value || typeof value !== 'object') return undefined;
|
|
26
|
+
const v = value as Record<string, unknown>;
|
|
27
|
+
if (typeof v.id !== 'string' || !v.id) return undefined;
|
|
28
|
+
if (v.kind !== 'updated' && v.kind !== 'failed') return undefined;
|
|
29
|
+
if (typeof v.version !== 'string' || typeof v.releaseUrl !== 'string') return undefined;
|
|
30
|
+
if (!/^https:\/\/github\.com\//.test(v.releaseUrl)) return undefined;
|
|
31
|
+
return {
|
|
32
|
+
id: v.id,
|
|
33
|
+
kind: v.kind,
|
|
34
|
+
version: v.version,
|
|
35
|
+
releaseUrl: v.releaseUrl,
|
|
36
|
+
...(typeof v.logPath === 'string' && { logPath: v.logPath }),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* True the first time a given notice is claimed in this browser, false after.
|
|
42
|
+
* Claiming marks it seen, so a caller shows the toast only when this is true.
|
|
43
|
+
*/
|
|
44
|
+
export function claimAutoUpdateNotice(notice: AutoUpdateNotice): boolean {
|
|
45
|
+
if (getItem(SEEN_KEY) === notice.id) return false;
|
|
46
|
+
setItem(SEEN_KEY, notice.id);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Title and description for the toast. */
|
|
51
|
+
export function describeAutoUpdateNotice(notice: AutoUpdateNotice): { title: string; description: string } {
|
|
52
|
+
if (notice.kind === 'updated') {
|
|
53
|
+
return { title: `Updated to v${notice.version}`, description: 'Plannotator updated itself in the background.' };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
title: 'Auto-update failed',
|
|
57
|
+
description: notice.logPath ? `See ${notice.logPath}` : `Could not install v${notice.version}.`,
|
|
58
|
+
};
|
|
59
|
+
}
|