proto-plugin 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/AGENTS.md +350 -0
  2. package/README.md +279 -0
  3. package/components.json +18 -0
  4. package/package.json +73 -0
  5. package/scripts/download-mobbin-reference-images.mjs +112 -0
  6. package/scripts/lib/host-config.example.sh +48 -0
  7. package/scripts/lib/host-config.sh +25 -0
  8. package/scripts/lib/resolve-host-root.mjs +18 -0
  9. package/scripts/lib/source-path.sh +49 -0
  10. package/scripts/link-source-db.sh +128 -0
  11. package/scripts/link-source.sh +40 -0
  12. package/scripts/publish-package.sh +147 -0
  13. package/scripts/share-prototype.sh +279 -0
  14. package/scripts/sync-from-source.sh +74 -0
  15. package/scripts/verify-prototype-component-ids.mjs +151 -0
  16. package/scripts/verify-prototype-preview-states.mjs +135 -0
  17. package/src/app.ts +4 -0
  18. package/src/components/platform-ui/code-block.tsx +21 -0
  19. package/src/components/platform-ui/controls-panel-options.tsx +71 -0
  20. package/src/components/platform-ui/controls-panel-select.tsx +438 -0
  21. package/src/components/platform-ui/empty-state.tsx +15 -0
  22. package/src/components/platform-ui/icon-button.tsx +18 -0
  23. package/src/components/platform-ui/panel-select.tsx +123 -0
  24. package/src/components/platform-ui/panel.tsx +97 -0
  25. package/src/components/platform-ui/review-dropdown-menu.tsx +35 -0
  26. package/src/components/platform-ui/sidebar.tsx +293 -0
  27. package/src/components/platform-ui/toolbar-icon-button.tsx +34 -0
  28. package/src/components/platform-ui/toolbar.tsx +37 -0
  29. package/src/components/prototype-gallery-client.tsx +57 -0
  30. package/src/components/prototype-provider.tsx +20 -0
  31. package/src/components/prototypes/mini-pill-label.tsx +37 -0
  32. package/src/components/prototypes/prototype-change-log-panel.tsx +207 -0
  33. package/src/components/prototypes/prototype-comment-provider.tsx +61 -0
  34. package/src/components/prototypes/prototype-comment-toolbar.tsx +65 -0
  35. package/src/components/prototypes/prototype-control.tsx +31 -0
  36. package/src/components/prototypes/prototype-controls.tsx +553 -0
  37. package/src/components/prototypes/prototype-create-exploration-modal.tsx +117 -0
  38. package/src/components/prototypes/prototype-create-state-modal.tsx +117 -0
  39. package/src/components/prototypes/prototype-default-state-map-page.tsx +66 -0
  40. package/src/components/prototypes/prototype-design-brief-modal.tsx +128 -0
  41. package/src/components/prototypes/prototype-design-brief-panel.tsx +525 -0
  42. package/src/components/prototypes/prototype-design-context-panel.tsx +65 -0
  43. package/src/components/prototypes/prototype-floating-pill.module.scss +1341 -0
  44. package/src/components/prototypes/prototype-mobbin-gallery.tsx +330 -0
  45. package/src/components/prototypes/prototype-reference-docs.tsx +222 -0
  46. package/src/components/prototypes/prototype-review-chrome.module.scss +630 -0
  47. package/src/components/prototypes/prototype-review-chrome.tsx +1241 -0
  48. package/src/components/prototypes/prototype-review-dropdown-menu-item.tsx +1 -0
  49. package/src/components/prototypes/prototype-review-dropdown-menu-separator.tsx +1 -0
  50. package/src/components/prototypes/prototype-review-panel-menu-item.tsx +1 -0
  51. package/src/components/prototypes/prototype-review-panel-menu-separator.tsx +1 -0
  52. package/src/components/prototypes/prototype-review-panel-select.tsx +4 -0
  53. package/src/components/prototypes/prototype-review-sidebar.tsx +167 -0
  54. package/src/components/prototypes/prototype-share-link-restore.tsx +75 -0
  55. package/src/components/prototypes/prototype-share-mode.tsx +206 -0
  56. package/src/components/prototypes/prototype-spec-panel-content.tsx +538 -0
  57. package/src/components/prototypes/prototype-state-canvas-overlay.module.scss +336 -0
  58. package/src/components/prototypes/prototype-state-canvas-overlay.tsx +1023 -0
  59. package/src/components/prototypes/prototype-state-canvas.tsx +38 -0
  60. package/src/components/prototypes/prototype-state-screenshot-preview.tsx +47 -0
  61. package/src/components/prototypes/prototype-target.tsx +120 -0
  62. package/src/components/prototypes/prototype-tweak-highlight.tsx +132 -0
  63. package/src/components/prototypes/prototype-tweaks.tsx +48 -0
  64. package/src/components/prototypes/prototype-variant-explorer.tsx +347 -0
  65. package/src/components/prototypes/prototype-variant-rationale-panel.tsx +49 -0
  66. package/src/components/prototypes/prototype-variant-tabs.tsx +207 -0
  67. package/src/components/prototypes/prototype-vercel-preview-modal.tsx +120 -0
  68. package/src/components/prototypes/state-map-annotation-tooltip.module.scss +89 -0
  69. package/src/components/prototypes/state-map-annotation-tooltip.tsx +137 -0
  70. package/src/components/prototypes/state-map-wireframe-highlight.module.scss +25 -0
  71. package/src/components/prototypes/state-map-wireframe-highlight.tsx +82 -0
  72. package/src/components/shell/prototype-gallery-shell.tsx +79 -0
  73. package/src/components/shell/prototype-screenshot-capture.tsx +45 -0
  74. package/src/components/shell/prototype-shell.module.scss +194 -0
  75. package/src/components/shell/prototype-shell.tsx +160 -0
  76. package/src/components/shell/prototype-state-screenshot-capture.tsx +68 -0
  77. package/src/components/ui/button.tsx +58 -0
  78. package/src/components/ui/dialog.module.scss +81 -0
  79. package/src/components/ui/dialog.tsx +127 -0
  80. package/src/components/ui/dropdown-menu.tsx +200 -0
  81. package/src/components/ui/input.tsx +22 -0
  82. package/src/components/ui/label.tsx +26 -0
  83. package/src/components/ui/option-select.tsx +81 -0
  84. package/src/components/ui/scroll-area.tsx +48 -0
  85. package/src/components/ui/separator.tsx +31 -0
  86. package/src/components/ui/slider.tsx +28 -0
  87. package/src/components/ui/switch.tsx +29 -0
  88. package/src/components/ui/tabs.tsx +55 -0
  89. package/src/components/ui/toggle-group.tsx +80 -0
  90. package/src/components/ui/tooltip.tsx +32 -0
  91. package/src/config/create-prototype-gallery-page.tsx +65 -0
  92. package/src/config/create-prototype-host-app.tsx +121 -0
  93. package/src/config/create-prototype-page.tsx +41 -0
  94. package/src/config/create-prototype-site-layout.tsx +28 -0
  95. package/src/config/define-prototype-config.ts +7 -0
  96. package/src/config/prototype-icon.tsx +25 -0
  97. package/src/config/prototype-site-layout-client.tsx +35 -0
  98. package/src/config/with-prototype.ts +20 -0
  99. package/src/index.ts +303 -0
  100. package/src/lib/pr-split/build-pr-agent-prompt.ts +68 -0
  101. package/src/lib/pr-split/build-pr-split-prototype-url.ts +12 -0
  102. package/src/lib/pr-split/pr-split-highlight.ts +6 -0
  103. package/src/lib/pr-split/pr-split-types.ts +58 -0
  104. package/src/lib/pr-split/resolve-source-preview-url.ts +45 -0
  105. package/src/lib/pr-split/use-pr-vercel-previews.ts +69 -0
  106. package/src/lib/prototype-comments/core/annotation-channel.ts +41 -0
  107. package/src/lib/prototype-comments/core/annotation-status.ts +60 -0
  108. package/src/lib/prototype-comments/core/annotation-target.ts +567 -0
  109. package/src/lib/prototype-comments/core/capture-theme.ts +41 -0
  110. package/src/lib/prototype-comments/core/capture.ts +11 -0
  111. package/src/lib/prototype-comments/core/comment-capture-blocked.ts +47 -0
  112. package/src/lib/prototype-comments/core/comment-threads.ts +52 -0
  113. package/src/lib/prototype-comments/core/element-identification.ts +615 -0
  114. package/src/lib/prototype-comments/core/export.ts +35 -0
  115. package/src/lib/prototype-comments/core/freeze-animations.ts +266 -0
  116. package/src/lib/prototype-comments/core/identify-element.ts +76 -0
  117. package/src/lib/prototype-comments/core/normalize-viewport.ts +35 -0
  118. package/src/lib/prototype-comments/core/react-detection.ts +704 -0
  119. package/src/lib/prototype-comments/core/restore.ts +7 -0
  120. package/src/lib/prototype-comments/core/screenshot.ts +428 -0
  121. package/src/lib/prototype-comments/core/source-location.ts +906 -0
  122. package/src/lib/prototype-comments/core/storage.ts +80 -0
  123. package/src/lib/prototype-comments/core/types.ts +79 -0
  124. package/src/lib/prototype-comments/core/validation.ts +17 -0
  125. package/src/lib/prototype-comments/hooks/useLayoutShift.ts +61 -0
  126. package/src/lib/prototype-comments/index.ts +58 -0
  127. package/src/lib/prototype-comments/react/CommentCaptureToolbar.tsx +1398 -0
  128. package/src/lib/prototype-comments/react/CommentProvider.tsx +298 -0
  129. package/src/lib/prototype-comments/scss.d.ts +10 -0
  130. package/src/lib/prototype-comments/ui/CommentAnnotationOverlay.tsx +253 -0
  131. package/src/lib/prototype-comments/ui/CommentDetailPage.tsx +56 -0
  132. package/src/lib/prototype-comments/ui/CommentHeaderCount.tsx +28 -0
  133. package/src/lib/prototype-comments/ui/CommentThread.tsx +331 -0
  134. package/src/lib/prototype-comments/ui/CommentsGrid.tsx +780 -0
  135. package/src/lib/prototype-comments/ui/CommentsListPage.tsx +25 -0
  136. package/src/lib/prototype-comments/ui/CommentsSidebar.tsx +77 -0
  137. package/src/lib/prototype-comments/ui/annotation-marker/index.tsx +200 -0
  138. package/src/lib/prototype-comments/ui/annotation-marker/styles.module.scss +194 -0
  139. package/src/lib/prototype-comments/ui/annotation-popup/index.tsx +335 -0
  140. package/src/lib/prototype-comments/ui/annotation-popup/styles.module.scss +469 -0
  141. package/src/lib/prototype-comments/ui/capture-styles.module.scss +2225 -0
  142. package/src/lib/prototype-comments/ui/comment-highlight.ts +48 -0
  143. package/src/lib/prototype-comments/ui/comment-thread.module.scss +203 -0
  144. package/src/lib/prototype-comments/ui/comments-grid-card.module.scss +253 -0
  145. package/src/lib/prototype-comments/ui/comments-sidebar.module.scss +123 -0
  146. package/src/lib/prototype-comments/ui/icon-transitions.module.scss +51 -0
  147. package/src/lib/prototype-comments/ui/icons.tsx +1086 -0
  148. package/src/lib/prototype-comments/ui/is-comment-detail-path.ts +7 -0
  149. package/src/lib/prototypes/capture-prototype-viewport.ts +32 -0
  150. package/src/lib/prototypes/changelog-meta-context.tsx +162 -0
  151. package/src/lib/prototypes/changelog-meta-storage.ts +62 -0
  152. package/src/lib/prototypes/changelog-meta.ts +95 -0
  153. package/src/lib/prototypes/create-prototype-registry.ts +74 -0
  154. package/src/lib/prototypes/create-state-screenshot-thumbnail.ts +46 -0
  155. package/src/lib/prototypes/design-exploration-default-storage.ts +68 -0
  156. package/src/lib/prototypes/design-exploration-default.ts +51 -0
  157. package/src/lib/prototypes/design-exploration-types.ts +203 -0
  158. package/src/lib/prototypes/prototype-comment-registry.tsx +145 -0
  159. package/src/lib/prototypes/prototype-comment-review-bridge.tsx +40 -0
  160. package/src/lib/prototypes/prototype-comment-review-state.ts +57 -0
  161. package/src/lib/prototypes/prototype-component-registry.ts +40 -0
  162. package/src/lib/prototypes/prototype-config-types.ts +34 -0
  163. package/src/lib/prototypes/prototype-preview-state-registry.ts +443 -0
  164. package/src/lib/prototypes/prototype-preview-state-types.ts +89 -0
  165. package/src/lib/prototypes/prototype-review-context.tsx +905 -0
  166. package/src/lib/prototypes/prototype-review-url.ts +134 -0
  167. package/src/lib/prototypes/prototype-share-link.ts +175 -0
  168. package/src/lib/prototypes/prototype-state-canvas-constants.ts +118 -0
  169. package/src/lib/prototypes/prototype-state-canvas-types.ts +159 -0
  170. package/src/lib/prototypes/prototype-state-screenshot.ts +39 -0
  171. package/src/lib/prototypes/prototype-tweak-registry.ts +96 -0
  172. package/src/lib/prototypes/prototype-tweak-types.ts +31 -0
  173. package/src/lib/prototypes/reference-docs.ts +137 -0
  174. package/src/lib/prototypes/screenshot-manifest.ts +33 -0
  175. package/src/lib/prototypes/screenshot-src.ts +7 -0
  176. package/src/lib/prototypes/share-command.ts +8 -0
  177. package/src/lib/prototypes/state-map-annotation.ts +70 -0
  178. package/src/lib/prototypes/use-design-exploration-default.ts +114 -0
  179. package/src/lib/prototypes/use-persisted-local-state.ts +140 -0
  180. package/src/lib/prototypes/use-prototype-comments.ts +63 -0
  181. package/src/lib/prototypes/use-prototype-mobile-viewport-frame.ts +46 -0
  182. package/src/lib/prototypes/use-prototype-state-screenshot-src.ts +71 -0
  183. package/src/lib/prototypes/use-prototype-tool-theme.tsx +115 -0
  184. package/src/lib/prototypes/use-prototype-viewport-frame.ts +34 -0
  185. package/src/lib/prototypes/use-register-prototype-reference-docs.ts +16 -0
  186. package/src/lib/prototypes/use-snap-corner-position.ts +417 -0
  187. package/src/lib/prototypes/use-toolbar-hover-panel.ts +98 -0
  188. package/src/lib/prototypes/variant-set-lucide-icon.tsx +55 -0
  189. package/src/lib/tool-portal.ts +33 -0
  190. package/src/lib/use-copy-to-clipboard.ts +81 -0
  191. package/src/lib/utils.ts +6 -0
  192. package/src/lib/vercel-preview/parse-vercel-github-comment.ts +81 -0
  193. package/src/server/create-host-api-route.ts +100 -0
  194. package/src/server/create-prototype-api-routes.ts +428 -0
  195. package/src/server/gallery/create-gallery-api.ts +56 -0
  196. package/src/server/gallery/folders-route.ts +156 -0
  197. package/src/server/gallery/gallery-env.ts +39 -0
  198. package/src/server/gallery/gallery-route.ts +150 -0
  199. package/src/server/gallery/gallery-types.ts +15 -0
  200. package/src/server/gallery/image-route.ts +59 -0
  201. package/src/server/gallery/item-route.ts +92 -0
  202. package/src/server/pr-vercel-preview-route.ts +162 -0
  203. package/src/server/redis/client.ts +55 -0
  204. package/src/server/redis/prototype-changelog-meta.ts +31 -0
  205. package/src/server/redis/prototype-comments.ts +92 -0
  206. package/src/server/redis/prototype-design-exploration-default.ts +32 -0
  207. package/src/server.ts +51 -0
  208. package/src/styles/globals.css +624 -0
  209. package/tsconfig.json +19 -0
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+
5
+ import { useCommentStore } from "../react/CommentProvider";
6
+ import { CommentsGrid } from "./CommentsGrid";
7
+
8
+ type CommentsListPageProps = {
9
+ basePath?: string;
10
+ };
11
+
12
+ export function CommentsListPage({ basePath = "/canvas" }: CommentsListPageProps) {
13
+ const router = useRouter();
14
+ const { annotations, deleteAnnotation, updateAnnotation, resolveAnnotation } = useCommentStore();
15
+
16
+ return (
17
+ <CommentsGrid
18
+ annotations={annotations}
19
+ onSelect={(id) => router.push(`${basePath}/${id}`)}
20
+ onDelete={deleteAnnotation}
21
+ onUpdateComment={updateAnnotation}
22
+ onResolve={resolveAnnotation}
23
+ />
24
+ );
25
+ }
@@ -0,0 +1,77 @@
1
+ "use client";
2
+
3
+ import { countUnresolvedAnnotations } from "../core/annotation-status";
4
+ import { useCommentStore } from "../react/CommentProvider";
5
+ import { CommentHeaderCount } from "./CommentHeaderCount";
6
+ import { CommentsGrid } from "./CommentsGrid";
7
+ import {
8
+ SIDEBAR_ICON_BUTTON_CLASS,
9
+ Sidebar,
10
+ } from "@prototype/components/platform-ui/sidebar";
11
+ import { IconButton } from "@prototype/components/platform-ui/icon-button";
12
+ import { cn } from "@prototype/lib/utils";
13
+ import { MessageSquarePlus } from "lucide-react";
14
+
15
+ type CommentsSidebarProps = {
16
+ open: boolean;
17
+ onClose: () => void;
18
+ onSelect: (id: string) => void;
19
+ selectedId?: string | null;
20
+ isCommentModeActive?: boolean;
21
+ onToggleCommentMode?: () => void;
22
+ };
23
+
24
+ export function CommentsSidebar({
25
+ open,
26
+ onClose,
27
+ onSelect,
28
+ selectedId,
29
+ isCommentModeActive = false,
30
+ onToggleCommentMode,
31
+ }: CommentsSidebarProps) {
32
+ const { annotations, deleteAnnotation, updateAnnotation, resolveAnnotation } =
33
+ useCommentStore();
34
+ const unresolvedCount = countUnresolvedAnnotations(annotations);
35
+ const totalCount = annotations.length;
36
+
37
+ return (
38
+ <Sidebar
39
+ open={open}
40
+ text="Comments"
41
+ titleAddon={
42
+ <CommentHeaderCount unresolved={unresolvedCount} total={totalCount} />
43
+ }
44
+ onClose={onClose}
45
+ ariaLabel="Comments"
46
+ dataAttribute="data-comments-sidebar"
47
+ widthCssVar="--comments-sidebar-width"
48
+ headerActions={
49
+ onToggleCommentMode ? (
50
+ <IconButton
51
+ type="button"
52
+ onClick={onToggleCommentMode}
53
+ onMouseDown={(event) => event.preventDefault()}
54
+ aria-label={isCommentModeActive ? "Exit comment mode" : "Add comment"}
55
+ aria-pressed={isCommentModeActive}
56
+ className={cn(
57
+ SIDEBAR_ICON_BUTTON_CLASS,
58
+ isCommentModeActive && "bg-accent text-accent-foreground",
59
+ )}
60
+ >
61
+ <MessageSquarePlus size={16} strokeWidth={2} />
62
+ </IconButton>
63
+ ) : null
64
+ }
65
+ >
66
+ <CommentsGrid
67
+ annotations={annotations}
68
+ layout="sidebar"
69
+ onSelect={onSelect}
70
+ onDelete={deleteAnnotation}
71
+ onUpdateComment={updateAnnotation}
72
+ onResolve={resolveAnnotation}
73
+ selectedId={selectedId}
74
+ />
75
+ </Sidebar>
76
+ );
77
+ }
@@ -0,0 +1,200 @@
1
+ import type { CommentAnnotationFields } from "../../core/types";
2
+ import { IconEdit, IconPlus, IconXmark } from "../icons";
3
+
4
+ type MarkerAnnotation = CommentAnnotationFields & {
5
+ status?: "pending" | "acknowledged" | "resolved" | "dismissed";
6
+ };
7
+ import styles from "./styles.module.scss";
8
+
9
+ type MarkerClickBehavior = "edit" | "delete";
10
+
11
+ // =============================================================================
12
+ // AnnotationMarker
13
+ // =============================================================================
14
+
15
+ type AnnotationMarkerProps = {
16
+ annotation: MarkerAnnotation;
17
+ globalIndex: number;
18
+ /** Display index within this layer (for staggered animation delays) */
19
+ layerIndex: number;
20
+ layerSize: number;
21
+ isExiting: boolean;
22
+ isClearing: boolean;
23
+ isAnimated: boolean;
24
+ isHovered: boolean;
25
+ isDeleting: boolean;
26
+ isEditingAny: boolean;
27
+ renumberFrom: number | null;
28
+ markerClickBehavior: MarkerClickBehavior;
29
+ tooltipStyle?: React.CSSProperties;
30
+ positionStyle?: { left: string; top: number };
31
+ onHoverEnter: (annotation: MarkerAnnotation) => void;
32
+ onHoverLeave: () => void;
33
+ onClick: (annotation: MarkerAnnotation) => void;
34
+ onContextMenu?: (annotation: MarkerAnnotation) => void;
35
+ };
36
+
37
+ export function AnnotationMarker({
38
+ annotation,
39
+ globalIndex,
40
+ layerIndex,
41
+ layerSize,
42
+ isExiting,
43
+ isClearing,
44
+ isAnimated,
45
+ isHovered,
46
+ isDeleting,
47
+ isEditingAny,
48
+ renumberFrom,
49
+ markerClickBehavior,
50
+ tooltipStyle,
51
+ positionStyle,
52
+ onHoverEnter,
53
+ onHoverLeave,
54
+ onClick,
55
+ onContextMenu,
56
+ }: AnnotationMarkerProps) {
57
+ const showDeleteState = (isHovered || isDeleting) && !isEditingAny;
58
+ const showDeleteHover = showDeleteState && markerClickBehavior === "delete";
59
+ const isMulti = annotation.isMultiSelect;
60
+
61
+ const markerColor = isMulti
62
+ ? "var(--prototype-comment-color-green)"
63
+ : "var(--prototype-comment-color-accent)";
64
+
65
+ const animClass = isExiting
66
+ ? styles.exit
67
+ : isClearing
68
+ ? styles.clearing
69
+ : !isAnimated
70
+ ? styles.enter
71
+ : "";
72
+
73
+ const animationDelay = isExiting
74
+ ? `${(layerSize - 1 - layerIndex) * 20}ms`
75
+ : `${layerIndex * 20}ms`;
76
+
77
+ return (
78
+ <div
79
+ className={`${styles.marker} ${isMulti ? styles.multiSelect : ""} ${animClass} ${showDeleteHover ? styles.hovered : ""}`}
80
+ data-annotation-marker
81
+ style={{
82
+ left: positionStyle?.left ?? `${annotation.x}%`,
83
+ top: positionStyle?.top ?? annotation.y,
84
+ backgroundColor: showDeleteHover ? undefined : markerColor,
85
+ animationDelay,
86
+ }}
87
+ onMouseEnter={() => onHoverEnter(annotation)}
88
+ onMouseLeave={onHoverLeave}
89
+ onClick={(e) => {
90
+ e.stopPropagation();
91
+ if (!isExiting) onClick(annotation);
92
+ }}
93
+ onContextMenu={
94
+ onContextMenu
95
+ ? (e) => {
96
+ if (markerClickBehavior === "delete") {
97
+ e.preventDefault();
98
+ e.stopPropagation();
99
+ if (!isExiting) onContextMenu(annotation);
100
+ }
101
+ }
102
+ : undefined
103
+ }
104
+ >
105
+ {showDeleteState ? (
106
+ showDeleteHover ? (
107
+ <IconXmark size={isMulti ? 18 : 16} />
108
+ ) : (
109
+ <IconEdit size={16} />
110
+ )
111
+ ) : (
112
+ <span
113
+ className={
114
+ renumberFrom !== null && globalIndex >= renumberFrom
115
+ ? styles.renumber
116
+ : undefined
117
+ }
118
+ >
119
+ {globalIndex + 1}
120
+ </span>
121
+ )}
122
+
123
+ {isHovered && !isEditingAny && (
124
+ <div
125
+ className={`${styles.markerTooltip} ${styles.enter}`}
126
+ style={tooltipStyle}
127
+ >
128
+ <span className={styles.markerQuote}>
129
+ {annotation.element}
130
+ {annotation.selectedText &&
131
+ ` "${annotation.selectedText.slice(0, 30)}${annotation.selectedText.length > 30 ? "..." : ""}"`}
132
+ </span>
133
+ <span className={styles.markerNote}>{annotation.comment}</span>
134
+ </div>
135
+ )}
136
+ </div>
137
+ );
138
+ }
139
+
140
+ // =============================================================================
141
+ // PendingMarker
142
+ // =============================================================================
143
+
144
+ type PendingMarkerProps = {
145
+ x: number;
146
+ y: number;
147
+ isMultiSelect?: boolean;
148
+ isExiting: boolean;
149
+ positionStyle?: { left: string; top: number };
150
+ };
151
+
152
+ export function PendingMarker({
153
+ x,
154
+ y,
155
+ isMultiSelect,
156
+ isExiting,
157
+ positionStyle,
158
+ }: PendingMarkerProps) {
159
+ return (
160
+ <div
161
+ className={`${styles.marker} ${styles.pending} ${isMultiSelect ? styles.multiSelect : ""} ${isExiting ? styles.exit : styles.enter}`}
162
+ data-annotation-marker
163
+ style={{
164
+ left: positionStyle?.left ?? `${x}%`,
165
+ top: positionStyle?.top ?? y,
166
+ backgroundColor: isMultiSelect
167
+ ? "var(--prototype-comment-color-green)"
168
+ : "var(--prototype-comment-color-accent)",
169
+ }}
170
+ >
171
+ <IconPlus size={12} />
172
+ </div>
173
+ );
174
+ }
175
+
176
+ // =============================================================================
177
+ // ExitingMarker
178
+ // =============================================================================
179
+
180
+ type ExitingMarkerProps = {
181
+ annotation: MarkerAnnotation;
182
+ fixed?: boolean;
183
+ positionStyle?: { left: string; top: number };
184
+ };
185
+
186
+ export function ExitingMarker({ annotation, fixed, positionStyle }: ExitingMarkerProps) {
187
+ const isMulti = annotation.isMultiSelect;
188
+ return (
189
+ <div
190
+ className={`${styles.marker} ${fixed ? styles.fixed : ""} ${styles.hovered} ${isMulti ? styles.multiSelect : ""} ${styles.exit}`}
191
+ data-annotation-marker
192
+ style={{
193
+ left: positionStyle?.left ?? `${annotation.x}%`,
194
+ top: positionStyle?.top ?? annotation.y,
195
+ }}
196
+ >
197
+ <IconXmark size={isMulti ? 12 : 10} />
198
+ </div>
199
+ );
200
+ }
@@ -0,0 +1,194 @@
1
+ @keyframes markerIn {
2
+ 0% {
3
+ opacity: 0;
4
+ transform: translate(-50%, -50%) scale(0.3);
5
+ }
6
+ 100% {
7
+ opacity: 1;
8
+ transform: translate(-50%, -50%) scale(1);
9
+ }
10
+ }
11
+
12
+ @keyframes markerOut {
13
+ 0% {
14
+ opacity: 1;
15
+ transform: translate(-50%, -50%) scale(1);
16
+ }
17
+ 100% {
18
+ opacity: 0;
19
+ transform: translate(-50%, -50%) scale(0.3);
20
+ }
21
+ }
22
+
23
+ @keyframes tooltipIn {
24
+ from {
25
+ opacity: 0;
26
+ transform: translateX(-50%) translateY(2px) scale(0.891);
27
+ }
28
+ to {
29
+ opacity: 1;
30
+ transform: translateX(-50%) translateY(0) scale(0.909);
31
+ }
32
+ }
33
+
34
+ @keyframes renumberRoll {
35
+ 0% {
36
+ transform: translateX(-40%);
37
+ opacity: 0;
38
+ }
39
+ 100% {
40
+ transform: translateX(0);
41
+ opacity: 1;
42
+ }
43
+ }
44
+
45
+ .marker {
46
+ position: absolute;
47
+ width: 22px;
48
+ height: 22px;
49
+ background: var(--prototype-comment-color-blue);
50
+ color: white;
51
+ border-radius: 50%;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ font-size: 0.6875rem;
56
+ font-weight: 600;
57
+ transform: translate(-50%, -50%) scale(1);
58
+ opacity: 1;
59
+ cursor: pointer;
60
+ box-shadow:
61
+ 0 2px 6px rgba(0, 0, 0, 0.2),
62
+ inset 0 0 0 1px rgba(0, 0, 0, 0.04);
63
+ user-select: none;
64
+ will-change: transform, opacity;
65
+ contain: layout style;
66
+ z-index: 1;
67
+
68
+ &:hover {
69
+ z-index: 2;
70
+ }
71
+
72
+ &:not(.enter):not(.exit):not(.clearing) {
73
+ transition:
74
+ background-color 0.15s ease,
75
+ transform 0.1s ease;
76
+ }
77
+
78
+ &.enter {
79
+ animation: markerIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
80
+ }
81
+
82
+ &.exit {
83
+ animation: markerOut 0.2s ease-out both;
84
+ pointer-events: none;
85
+ }
86
+
87
+ &.clearing {
88
+ animation: markerOut 0.15s ease-out both;
89
+ pointer-events: none;
90
+ }
91
+
92
+ &:not(.enter):not(.exit):not(.clearing):hover {
93
+ transform: translate(-50%, -50%) scale(1.1);
94
+ }
95
+
96
+ &.pending {
97
+ position: fixed;
98
+ background-color: var(--prototype-comment-color-blue);
99
+ cursor: default;
100
+ }
101
+
102
+ &.fixed {
103
+ position: fixed;
104
+ }
105
+
106
+ &.multiSelect {
107
+ background-color: var(--prototype-comment-color-green);
108
+ width: 26px;
109
+ height: 26px;
110
+ border-radius: 6px;
111
+ font-size: 0.75rem;
112
+
113
+ &.pending {
114
+ background-color: var(--prototype-comment-color-green);
115
+ }
116
+ }
117
+
118
+ &.hovered {
119
+ background-color: var(--prototype-comment-color-red);
120
+ }
121
+ }
122
+
123
+ .renumber {
124
+ display: block;
125
+ animation: renumberRoll 0.2s ease-out;
126
+ }
127
+
128
+ .markerTooltip {
129
+ position: absolute;
130
+ top: calc(100% + 10px);
131
+ left: 50%;
132
+ transform: translateX(-50%) scale(0.909);
133
+ z-index: 100002;
134
+ background: #1e1e1e;
135
+ padding: 8px 0.75rem;
136
+ border-radius: 0.75rem;
137
+ font-family:
138
+ var(--tool-font-body, "DM Sans", ui-sans-serif, system-ui, sans-serif);
139
+ font-weight: 400;
140
+ color: #fff;
141
+ box-shadow:
142
+ 0 4px 20px rgba(0, 0, 0, 0.3),
143
+ 0 0 0 1px rgba(255, 255, 255, 0.08);
144
+ min-width: 120px;
145
+ max-width: 200px;
146
+ pointer-events: none;
147
+ cursor: default;
148
+
149
+ &.enter {
150
+ animation: tooltipIn 0.1s ease-out forwards;
151
+ }
152
+ }
153
+
154
+ .markerQuote {
155
+ display: block;
156
+ font-size: 12px;
157
+ font-style: italic;
158
+ color: rgba(255, 255, 255, 0.6);
159
+ margin-bottom: 0.3125rem;
160
+ line-height: 1.4;
161
+ white-space: nowrap;
162
+ overflow: hidden;
163
+ text-overflow: ellipsis;
164
+ }
165
+
166
+ .markerNote {
167
+ display: block;
168
+ font-size: 13px;
169
+ font-weight: 400;
170
+ line-height: 1.4;
171
+ color: #fff;
172
+ white-space: nowrap;
173
+ overflow: hidden;
174
+ text-overflow: ellipsis;
175
+ padding-bottom: 2px;
176
+ }
177
+
178
+ // Light mode overrides
179
+ [data-prototype-comment-theme="light"] {
180
+ .markerTooltip {
181
+ background: #fff;
182
+ box-shadow:
183
+ 0 4px 20px rgba(0, 0, 0, 0.12),
184
+ 0 0 0 1px rgba(0, 0, 0, 0.06);
185
+
186
+ .markerQuote {
187
+ color: rgba(0, 0, 0, 0.5);
188
+ }
189
+
190
+ .markerNote {
191
+ color: rgba(0, 0, 0, 0.85);
192
+ }
193
+ }
194
+ }