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.
- package/AGENTS.md +350 -0
- package/README.md +279 -0
- package/components.json +18 -0
- package/package.json +73 -0
- package/scripts/download-mobbin-reference-images.mjs +112 -0
- package/scripts/lib/host-config.example.sh +48 -0
- package/scripts/lib/host-config.sh +25 -0
- package/scripts/lib/resolve-host-root.mjs +18 -0
- package/scripts/lib/source-path.sh +49 -0
- package/scripts/link-source-db.sh +128 -0
- package/scripts/link-source.sh +40 -0
- package/scripts/publish-package.sh +147 -0
- package/scripts/share-prototype.sh +279 -0
- package/scripts/sync-from-source.sh +74 -0
- package/scripts/verify-prototype-component-ids.mjs +151 -0
- package/scripts/verify-prototype-preview-states.mjs +135 -0
- package/src/app.ts +4 -0
- package/src/components/platform-ui/code-block.tsx +21 -0
- package/src/components/platform-ui/controls-panel-options.tsx +71 -0
- package/src/components/platform-ui/controls-panel-select.tsx +438 -0
- package/src/components/platform-ui/empty-state.tsx +15 -0
- package/src/components/platform-ui/icon-button.tsx +18 -0
- package/src/components/platform-ui/panel-select.tsx +123 -0
- package/src/components/platform-ui/panel.tsx +97 -0
- package/src/components/platform-ui/review-dropdown-menu.tsx +35 -0
- package/src/components/platform-ui/sidebar.tsx +293 -0
- package/src/components/platform-ui/toolbar-icon-button.tsx +34 -0
- package/src/components/platform-ui/toolbar.tsx +37 -0
- package/src/components/prototype-gallery-client.tsx +57 -0
- package/src/components/prototype-provider.tsx +20 -0
- package/src/components/prototypes/mini-pill-label.tsx +37 -0
- package/src/components/prototypes/prototype-change-log-panel.tsx +207 -0
- package/src/components/prototypes/prototype-comment-provider.tsx +61 -0
- package/src/components/prototypes/prototype-comment-toolbar.tsx +65 -0
- package/src/components/prototypes/prototype-control.tsx +31 -0
- package/src/components/prototypes/prototype-controls.tsx +553 -0
- package/src/components/prototypes/prototype-create-exploration-modal.tsx +117 -0
- package/src/components/prototypes/prototype-create-state-modal.tsx +117 -0
- package/src/components/prototypes/prototype-default-state-map-page.tsx +66 -0
- package/src/components/prototypes/prototype-design-brief-modal.tsx +128 -0
- package/src/components/prototypes/prototype-design-brief-panel.tsx +525 -0
- package/src/components/prototypes/prototype-design-context-panel.tsx +65 -0
- package/src/components/prototypes/prototype-floating-pill.module.scss +1341 -0
- package/src/components/prototypes/prototype-mobbin-gallery.tsx +330 -0
- package/src/components/prototypes/prototype-reference-docs.tsx +222 -0
- package/src/components/prototypes/prototype-review-chrome.module.scss +630 -0
- package/src/components/prototypes/prototype-review-chrome.tsx +1241 -0
- package/src/components/prototypes/prototype-review-dropdown-menu-item.tsx +1 -0
- package/src/components/prototypes/prototype-review-dropdown-menu-separator.tsx +1 -0
- package/src/components/prototypes/prototype-review-panel-menu-item.tsx +1 -0
- package/src/components/prototypes/prototype-review-panel-menu-separator.tsx +1 -0
- package/src/components/prototypes/prototype-review-panel-select.tsx +4 -0
- package/src/components/prototypes/prototype-review-sidebar.tsx +167 -0
- package/src/components/prototypes/prototype-share-link-restore.tsx +75 -0
- package/src/components/prototypes/prototype-share-mode.tsx +206 -0
- package/src/components/prototypes/prototype-spec-panel-content.tsx +538 -0
- package/src/components/prototypes/prototype-state-canvas-overlay.module.scss +336 -0
- package/src/components/prototypes/prototype-state-canvas-overlay.tsx +1023 -0
- package/src/components/prototypes/prototype-state-canvas.tsx +38 -0
- package/src/components/prototypes/prototype-state-screenshot-preview.tsx +47 -0
- package/src/components/prototypes/prototype-target.tsx +120 -0
- package/src/components/prototypes/prototype-tweak-highlight.tsx +132 -0
- package/src/components/prototypes/prototype-tweaks.tsx +48 -0
- package/src/components/prototypes/prototype-variant-explorer.tsx +347 -0
- package/src/components/prototypes/prototype-variant-rationale-panel.tsx +49 -0
- package/src/components/prototypes/prototype-variant-tabs.tsx +207 -0
- package/src/components/prototypes/prototype-vercel-preview-modal.tsx +120 -0
- package/src/components/prototypes/state-map-annotation-tooltip.module.scss +89 -0
- package/src/components/prototypes/state-map-annotation-tooltip.tsx +137 -0
- package/src/components/prototypes/state-map-wireframe-highlight.module.scss +25 -0
- package/src/components/prototypes/state-map-wireframe-highlight.tsx +82 -0
- package/src/components/shell/prototype-gallery-shell.tsx +79 -0
- package/src/components/shell/prototype-screenshot-capture.tsx +45 -0
- package/src/components/shell/prototype-shell.module.scss +194 -0
- package/src/components/shell/prototype-shell.tsx +160 -0
- package/src/components/shell/prototype-state-screenshot-capture.tsx +68 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/dialog.module.scss +81 -0
- package/src/components/ui/dialog.tsx +127 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/option-select.tsx +81 -0
- package/src/components/ui/scroll-area.tsx +48 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/slider.tsx +28 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/toggle-group.tsx +80 -0
- package/src/components/ui/tooltip.tsx +32 -0
- package/src/config/create-prototype-gallery-page.tsx +65 -0
- package/src/config/create-prototype-host-app.tsx +121 -0
- package/src/config/create-prototype-page.tsx +41 -0
- package/src/config/create-prototype-site-layout.tsx +28 -0
- package/src/config/define-prototype-config.ts +7 -0
- package/src/config/prototype-icon.tsx +25 -0
- package/src/config/prototype-site-layout-client.tsx +35 -0
- package/src/config/with-prototype.ts +20 -0
- package/src/index.ts +303 -0
- package/src/lib/pr-split/build-pr-agent-prompt.ts +68 -0
- package/src/lib/pr-split/build-pr-split-prototype-url.ts +12 -0
- package/src/lib/pr-split/pr-split-highlight.ts +6 -0
- package/src/lib/pr-split/pr-split-types.ts +58 -0
- package/src/lib/pr-split/resolve-source-preview-url.ts +45 -0
- package/src/lib/pr-split/use-pr-vercel-previews.ts +69 -0
- package/src/lib/prototype-comments/core/annotation-channel.ts +41 -0
- package/src/lib/prototype-comments/core/annotation-status.ts +60 -0
- package/src/lib/prototype-comments/core/annotation-target.ts +567 -0
- package/src/lib/prototype-comments/core/capture-theme.ts +41 -0
- package/src/lib/prototype-comments/core/capture.ts +11 -0
- package/src/lib/prototype-comments/core/comment-capture-blocked.ts +47 -0
- package/src/lib/prototype-comments/core/comment-threads.ts +52 -0
- package/src/lib/prototype-comments/core/element-identification.ts +615 -0
- package/src/lib/prototype-comments/core/export.ts +35 -0
- package/src/lib/prototype-comments/core/freeze-animations.ts +266 -0
- package/src/lib/prototype-comments/core/identify-element.ts +76 -0
- package/src/lib/prototype-comments/core/normalize-viewport.ts +35 -0
- package/src/lib/prototype-comments/core/react-detection.ts +704 -0
- package/src/lib/prototype-comments/core/restore.ts +7 -0
- package/src/lib/prototype-comments/core/screenshot.ts +428 -0
- package/src/lib/prototype-comments/core/source-location.ts +906 -0
- package/src/lib/prototype-comments/core/storage.ts +80 -0
- package/src/lib/prototype-comments/core/types.ts +79 -0
- package/src/lib/prototype-comments/core/validation.ts +17 -0
- package/src/lib/prototype-comments/hooks/useLayoutShift.ts +61 -0
- package/src/lib/prototype-comments/index.ts +58 -0
- package/src/lib/prototype-comments/react/CommentCaptureToolbar.tsx +1398 -0
- package/src/lib/prototype-comments/react/CommentProvider.tsx +298 -0
- package/src/lib/prototype-comments/scss.d.ts +10 -0
- package/src/lib/prototype-comments/ui/CommentAnnotationOverlay.tsx +253 -0
- package/src/lib/prototype-comments/ui/CommentDetailPage.tsx +56 -0
- package/src/lib/prototype-comments/ui/CommentHeaderCount.tsx +28 -0
- package/src/lib/prototype-comments/ui/CommentThread.tsx +331 -0
- package/src/lib/prototype-comments/ui/CommentsGrid.tsx +780 -0
- package/src/lib/prototype-comments/ui/CommentsListPage.tsx +25 -0
- package/src/lib/prototype-comments/ui/CommentsSidebar.tsx +77 -0
- package/src/lib/prototype-comments/ui/annotation-marker/index.tsx +200 -0
- package/src/lib/prototype-comments/ui/annotation-marker/styles.module.scss +194 -0
- package/src/lib/prototype-comments/ui/annotation-popup/index.tsx +335 -0
- package/src/lib/prototype-comments/ui/annotation-popup/styles.module.scss +469 -0
- package/src/lib/prototype-comments/ui/capture-styles.module.scss +2225 -0
- package/src/lib/prototype-comments/ui/comment-highlight.ts +48 -0
- package/src/lib/prototype-comments/ui/comment-thread.module.scss +203 -0
- package/src/lib/prototype-comments/ui/comments-grid-card.module.scss +253 -0
- package/src/lib/prototype-comments/ui/comments-sidebar.module.scss +123 -0
- package/src/lib/prototype-comments/ui/icon-transitions.module.scss +51 -0
- package/src/lib/prototype-comments/ui/icons.tsx +1086 -0
- package/src/lib/prototype-comments/ui/is-comment-detail-path.ts +7 -0
- package/src/lib/prototypes/capture-prototype-viewport.ts +32 -0
- package/src/lib/prototypes/changelog-meta-context.tsx +162 -0
- package/src/lib/prototypes/changelog-meta-storage.ts +62 -0
- package/src/lib/prototypes/changelog-meta.ts +95 -0
- package/src/lib/prototypes/create-prototype-registry.ts +74 -0
- package/src/lib/prototypes/create-state-screenshot-thumbnail.ts +46 -0
- package/src/lib/prototypes/design-exploration-default-storage.ts +68 -0
- package/src/lib/prototypes/design-exploration-default.ts +51 -0
- package/src/lib/prototypes/design-exploration-types.ts +203 -0
- package/src/lib/prototypes/prototype-comment-registry.tsx +145 -0
- package/src/lib/prototypes/prototype-comment-review-bridge.tsx +40 -0
- package/src/lib/prototypes/prototype-comment-review-state.ts +57 -0
- package/src/lib/prototypes/prototype-component-registry.ts +40 -0
- package/src/lib/prototypes/prototype-config-types.ts +34 -0
- package/src/lib/prototypes/prototype-preview-state-registry.ts +443 -0
- package/src/lib/prototypes/prototype-preview-state-types.ts +89 -0
- package/src/lib/prototypes/prototype-review-context.tsx +905 -0
- package/src/lib/prototypes/prototype-review-url.ts +134 -0
- package/src/lib/prototypes/prototype-share-link.ts +175 -0
- package/src/lib/prototypes/prototype-state-canvas-constants.ts +118 -0
- package/src/lib/prototypes/prototype-state-canvas-types.ts +159 -0
- package/src/lib/prototypes/prototype-state-screenshot.ts +39 -0
- package/src/lib/prototypes/prototype-tweak-registry.ts +96 -0
- package/src/lib/prototypes/prototype-tweak-types.ts +31 -0
- package/src/lib/prototypes/reference-docs.ts +137 -0
- package/src/lib/prototypes/screenshot-manifest.ts +33 -0
- package/src/lib/prototypes/screenshot-src.ts +7 -0
- package/src/lib/prototypes/share-command.ts +8 -0
- package/src/lib/prototypes/state-map-annotation.ts +70 -0
- package/src/lib/prototypes/use-design-exploration-default.ts +114 -0
- package/src/lib/prototypes/use-persisted-local-state.ts +140 -0
- package/src/lib/prototypes/use-prototype-comments.ts +63 -0
- package/src/lib/prototypes/use-prototype-mobile-viewport-frame.ts +46 -0
- package/src/lib/prototypes/use-prototype-state-screenshot-src.ts +71 -0
- package/src/lib/prototypes/use-prototype-tool-theme.tsx +115 -0
- package/src/lib/prototypes/use-prototype-viewport-frame.ts +34 -0
- package/src/lib/prototypes/use-register-prototype-reference-docs.ts +16 -0
- package/src/lib/prototypes/use-snap-corner-position.ts +417 -0
- package/src/lib/prototypes/use-toolbar-hover-panel.ts +98 -0
- package/src/lib/prototypes/variant-set-lucide-icon.tsx +55 -0
- package/src/lib/tool-portal.ts +33 -0
- package/src/lib/use-copy-to-clipboard.ts +81 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/vercel-preview/parse-vercel-github-comment.ts +81 -0
- package/src/server/create-host-api-route.ts +100 -0
- package/src/server/create-prototype-api-routes.ts +428 -0
- package/src/server/gallery/create-gallery-api.ts +56 -0
- package/src/server/gallery/folders-route.ts +156 -0
- package/src/server/gallery/gallery-env.ts +39 -0
- package/src/server/gallery/gallery-route.ts +150 -0
- package/src/server/gallery/gallery-types.ts +15 -0
- package/src/server/gallery/image-route.ts +59 -0
- package/src/server/gallery/item-route.ts +92 -0
- package/src/server/pr-vercel-preview-route.ts +162 -0
- package/src/server/redis/client.ts +55 -0
- package/src/server/redis/prototype-changelog-meta.ts +31 -0
- package/src/server/redis/prototype-comments.ts +92 -0
- package/src/server/redis/prototype-design-exploration-default.ts +32 -0
- package/src/server.ts +51 -0
- package/src/styles/globals.css +624 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { filterAnnotationsByChannel } from "@prototype/lib/prototype-comments/core/annotation-channel";
|
|
4
|
+
import { useCommentStore } from "@prototype/lib/prototype-comments/react/CommentProvider";
|
|
5
|
+
import { useCommentCaptureBridgeOptional } from "@prototype/lib/prototype-comments/react/CommentCaptureToolbar";
|
|
6
|
+
import { CommentsGrid } from "@prototype/lib/prototype-comments/ui/CommentsGrid";
|
|
7
|
+
import { useChangelogMeta } from "@prototype/lib/prototypes/changelog-meta-context";
|
|
8
|
+
import { usePrototypeReview } from "@prototype/lib/prototypes/prototype-review-context";
|
|
9
|
+
import { ToolbarIconButton } from "@prototype/components/platform-ui/toolbar-icon-button";
|
|
10
|
+
import { Label } from "@prototype/components/ui/label";
|
|
11
|
+
import { Switch } from "@prototype/components/ui/switch";
|
|
12
|
+
import { Plus, Save } from "lucide-react";
|
|
13
|
+
import { cn } from "@prototype/lib/utils";
|
|
14
|
+
import {
|
|
15
|
+
useCallback,
|
|
16
|
+
useEffect,
|
|
17
|
+
useMemo,
|
|
18
|
+
useState,
|
|
19
|
+
type ChangeEvent,
|
|
20
|
+
} from "react";
|
|
21
|
+
|
|
22
|
+
import { PrototypeReferenceDocs } from "./prototype-reference-docs";
|
|
23
|
+
|
|
24
|
+
const CHANGELOG_SECTION_TITLE_CLASS = "tool-section-label";
|
|
25
|
+
|
|
26
|
+
const CHANGELOG_SECTION_DIVIDER_CLASS = "border-t border-[var(--tool-chrome-border)]";
|
|
27
|
+
|
|
28
|
+
const CHANGELOG_SECTION_CLASS =
|
|
29
|
+
"flex flex-col gap-2 py-4 first:pt-0 first:border-t-0 last:pb-0";
|
|
30
|
+
|
|
31
|
+
const CHANGELOG_OVERVIEW_FIELD_CLASS =
|
|
32
|
+
"text-sm text-[var(--tool-chrome-text)] field-sizing-content w-full min-h-0 resize-none border-0 bg-transparent p-0 leading-relaxed shadow-none outline-none placeholder:text-[var(--tool-chrome-text-muted)] focus-visible:ring-0 focus-visible:ring-offset-0 [&::selection]:bg-[var(--tool-chrome-gray-highlight)]";
|
|
33
|
+
|
|
34
|
+
type PrototypeChangeLogPanelProps = {
|
|
35
|
+
onSelect: (id: string) => void;
|
|
36
|
+
selectedId?: string | null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function AddChangeButton({
|
|
40
|
+
placement = "empty",
|
|
41
|
+
}: {
|
|
42
|
+
placement?: "empty" | "header";
|
|
43
|
+
}) {
|
|
44
|
+
const bridge = useCommentCaptureBridgeOptional();
|
|
45
|
+
if (!bridge) return null;
|
|
46
|
+
|
|
47
|
+
const isActive = bridge.isChangelogModeActive;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<ToolbarIconButton
|
|
51
|
+
wrapperClassName={placement === "header" ? undefined : "mt-2"}
|
|
52
|
+
onClick={bridge.onEnterChangelogMode}
|
|
53
|
+
aria-pressed={isActive}
|
|
54
|
+
aria-label={isActive ? "Exit add change mode" : "Add change"}
|
|
55
|
+
>
|
|
56
|
+
<Plus size={16} strokeWidth={2} aria-hidden />
|
|
57
|
+
</ToolbarIconButton>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ProdReferenceSection() {
|
|
62
|
+
const review = usePrototypeReview();
|
|
63
|
+
|
|
64
|
+
if (!review.prodReferenceAvailable) return null;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<section
|
|
68
|
+
className={cn(CHANGELOG_SECTION_CLASS, CHANGELOG_SECTION_DIVIDER_CLASS)}
|
|
69
|
+
>
|
|
70
|
+
<div className="flex items-center justify-between gap-2">
|
|
71
|
+
<span className={CHANGELOG_SECTION_TITLE_CLASS}>
|
|
72
|
+
Current design in prod
|
|
73
|
+
</span>
|
|
74
|
+
<div className="flex items-center gap-2">
|
|
75
|
+
<Label
|
|
76
|
+
htmlFor="prototype-prod-reference-toggle"
|
|
77
|
+
className="text-muted-foreground sr-only"
|
|
78
|
+
>
|
|
79
|
+
Current design in prod
|
|
80
|
+
</Label>
|
|
81
|
+
<Switch
|
|
82
|
+
id="prototype-prod-reference-toggle"
|
|
83
|
+
checked={review.showProdReference}
|
|
84
|
+
onCheckedChange={review.setShowProdReference}
|
|
85
|
+
className="data-[state=checked]:bg-[var(--tool-chrome-text-heading)]"
|
|
86
|
+
aria-label={
|
|
87
|
+
review.showProdReference
|
|
88
|
+
? "Show prototype"
|
|
89
|
+
: "Show current design in prod"
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</section>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function PrototypeChangeLogPanel({
|
|
99
|
+
onSelect,
|
|
100
|
+
selectedId,
|
|
101
|
+
}: PrototypeChangeLogPanelProps) {
|
|
102
|
+
const {
|
|
103
|
+
annotations,
|
|
104
|
+
deleteAnnotation,
|
|
105
|
+
updateAnnotation,
|
|
106
|
+
storageError,
|
|
107
|
+
storageReady,
|
|
108
|
+
} = useCommentStore();
|
|
109
|
+
const { overview, ready: metaReady, error: metaError, setOverview } =
|
|
110
|
+
useChangelogMeta();
|
|
111
|
+
const [draftOverview, setDraftOverview] = useState(overview);
|
|
112
|
+
const changelogAnnotations = useMemo(
|
|
113
|
+
() => filterAnnotationsByChannel(annotations, "changelog"),
|
|
114
|
+
[annotations],
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (metaReady) {
|
|
119
|
+
setDraftOverview(overview);
|
|
120
|
+
}
|
|
121
|
+
}, [metaReady, overview]);
|
|
122
|
+
|
|
123
|
+
const isOverviewDirty = draftOverview !== overview;
|
|
124
|
+
|
|
125
|
+
const handleOverviewChange = useCallback(
|
|
126
|
+
(event: ChangeEvent<HTMLTextAreaElement>) => {
|
|
127
|
+
setDraftOverview(event.target.value);
|
|
128
|
+
},
|
|
129
|
+
[],
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const handleSaveOverview = useCallback(() => {
|
|
133
|
+
setOverview(draftOverview);
|
|
134
|
+
}, [draftOverview, setOverview]);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<div className="flex flex-col">
|
|
138
|
+
<section className={CHANGELOG_SECTION_CLASS}>
|
|
139
|
+
<div className="flex items-center justify-between gap-2">
|
|
140
|
+
<span className={CHANGELOG_SECTION_TITLE_CLASS}>Description</span>
|
|
141
|
+
{metaReady && !metaError ? (
|
|
142
|
+
<ToolbarIconButton
|
|
143
|
+
onClick={handleSaveOverview}
|
|
144
|
+
disabled={!isOverviewDirty}
|
|
145
|
+
aria-label="Save description"
|
|
146
|
+
>
|
|
147
|
+
<Save size={16} strokeWidth={2} aria-hidden />
|
|
148
|
+
</ToolbarIconButton>
|
|
149
|
+
) : null}
|
|
150
|
+
</div>
|
|
151
|
+
{!metaReady ? (
|
|
152
|
+
<p className="text-muted-foreground text-xs">Loading description…</p>
|
|
153
|
+
) : metaError ? (
|
|
154
|
+
<p className="text-destructive text-xs">{metaError}</p>
|
|
155
|
+
) : (
|
|
156
|
+
<textarea
|
|
157
|
+
id="prototype-changelog-overview"
|
|
158
|
+
value={draftOverview}
|
|
159
|
+
onChange={handleOverviewChange}
|
|
160
|
+
rows={1}
|
|
161
|
+
placeholder="Summarize what changed and why…"
|
|
162
|
+
aria-label="Description"
|
|
163
|
+
className={CHANGELOG_OVERVIEW_FIELD_CLASS}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
</section>
|
|
167
|
+
|
|
168
|
+
<PrototypeReferenceDocs
|
|
169
|
+
className={cn(CHANGELOG_SECTION_CLASS, CHANGELOG_SECTION_DIVIDER_CLASS)}
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<ProdReferenceSection />
|
|
173
|
+
|
|
174
|
+
<section
|
|
175
|
+
className={cn(CHANGELOG_SECTION_CLASS, CHANGELOG_SECTION_DIVIDER_CLASS)}
|
|
176
|
+
>
|
|
177
|
+
<div className="flex items-center justify-between gap-2">
|
|
178
|
+
<span className={CHANGELOG_SECTION_TITLE_CLASS}>Changes</span>
|
|
179
|
+
{storageReady && !storageError && changelogAnnotations.length > 0 ? (
|
|
180
|
+
<AddChangeButton placement="header" />
|
|
181
|
+
) : null}
|
|
182
|
+
</div>
|
|
183
|
+
{!storageReady ? (
|
|
184
|
+
<p className="text-muted-foreground text-xs">Loading changes…</p>
|
|
185
|
+
) : storageError ? (
|
|
186
|
+
<p className="text-destructive text-xs">{storageError}</p>
|
|
187
|
+
) : (
|
|
188
|
+
<CommentsGrid
|
|
189
|
+
annotations={changelogAnnotations}
|
|
190
|
+
layout="sidebar"
|
|
191
|
+
sortOrder="oldest"
|
|
192
|
+
expandComment
|
|
193
|
+
onSelect={onSelect}
|
|
194
|
+
onDelete={deleteAnnotation}
|
|
195
|
+
onUpdateComment={updateAnnotation}
|
|
196
|
+
showResolveActions={false}
|
|
197
|
+
showCopyPrompt={false}
|
|
198
|
+
showReplies={false}
|
|
199
|
+
emptyStateTitle="No changes yet"
|
|
200
|
+
emptyStateAction={<AddChangeButton />}
|
|
201
|
+
selectedId={selectedId}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
</section>
|
|
205
|
+
</div>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
import { PrototypeTargetIdProvider } from "@prototype/components/prototypes/prototype-target";
|
|
6
|
+
import { CommentProvider } from "@prototype/lib/prototype-comments/react/CommentProvider";
|
|
7
|
+
import { ChangelogMetaProvider } from "@prototype/lib/prototypes/changelog-meta-context";
|
|
8
|
+
import type { PrototypeComponentRegistry } from "@prototype/lib/prototypes/prototype-component-registry";
|
|
9
|
+
import { getPrototypeComponentRegistryForSlug } from "@prototype/lib/prototypes/create-prototype-registry";
|
|
10
|
+
import {
|
|
11
|
+
PrototypeCommentRegistryProvider,
|
|
12
|
+
usePrototypeCommentRegistry,
|
|
13
|
+
} from "@prototype/lib/prototypes/prototype-comment-registry";
|
|
14
|
+
|
|
15
|
+
function PrototypeCommentProviderInner({
|
|
16
|
+
slug,
|
|
17
|
+
children,
|
|
18
|
+
}: {
|
|
19
|
+
slug: string;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}) {
|
|
22
|
+
const { readHandlers } = usePrototypeCommentRegistry();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ChangelogMetaProvider slug={slug}>
|
|
26
|
+
<CommentProvider
|
|
27
|
+
slug={slug}
|
|
28
|
+
getLiveState={() => readHandlers()?.getLiveState() ?? {}}
|
|
29
|
+
onRestore={(live) => readHandlers()?.onRestore(live)}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</CommentProvider>
|
|
33
|
+
</ChangelogMetaProvider>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type PrototypeCommentRootProps = {
|
|
38
|
+
slug: string;
|
|
39
|
+
componentRegistry?: PrototypeComponentRegistry;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Registry + slug-scoped CommentProvider for prototype routes. */
|
|
44
|
+
export function PrototypeCommentRoot({
|
|
45
|
+
slug,
|
|
46
|
+
componentRegistry,
|
|
47
|
+
children,
|
|
48
|
+
}: PrototypeCommentRootProps) {
|
|
49
|
+
const resolvedRegistry =
|
|
50
|
+
componentRegistry ?? getPrototypeComponentRegistryForSlug(slug);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<PrototypeCommentRegistryProvider>
|
|
54
|
+
<PrototypeTargetIdProvider slug={slug} registry={resolvedRegistry}>
|
|
55
|
+
<PrototypeCommentProviderInner slug={slug}>
|
|
56
|
+
{children}
|
|
57
|
+
</PrototypeCommentProviderInner>
|
|
58
|
+
</PrototypeTargetIdProvider>
|
|
59
|
+
</PrototypeCommentRegistryProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PrototypeReviewChrome } from "@prototype/components/prototypes/prototype-review-chrome";
|
|
4
|
+
import { PrototypeShareLinkRestore } from "@prototype/components/prototypes/prototype-share-link-restore";
|
|
5
|
+
import { PrototypeShareMode } from "@prototype/components/prototypes/prototype-share-mode";
|
|
6
|
+
import {
|
|
7
|
+
CommentCaptureToolbar,
|
|
8
|
+
useCommentCaptureBridge,
|
|
9
|
+
} from "@prototype/lib/prototype-comments/react/CommentCaptureToolbar";
|
|
10
|
+
import { usePrototypeCommentRegistry } from "@prototype/lib/prototypes/prototype-comment-registry";
|
|
11
|
+
import { usePrototypeReviewOptional } from "@prototype/lib/prototypes/prototype-review-context";
|
|
12
|
+
import { usePathname } from "next/navigation";
|
|
13
|
+
|
|
14
|
+
function IntegratedReviewChrome() {
|
|
15
|
+
const bridge = useCommentCaptureBridge();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<PrototypeReviewChrome
|
|
19
|
+
onSelect={bridge.onSelect}
|
|
20
|
+
selectedId={bridge.selectedId}
|
|
21
|
+
onOpenCommentsPanel={bridge.onOpenCommentsPanel}
|
|
22
|
+
isCommentModeActive={bridge.isCommentModeActive}
|
|
23
|
+
onToggleCommentMode={bridge.onToggleCommentMode}
|
|
24
|
+
onClose={bridge.onClose}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function useOnStateMapPage(): boolean {
|
|
30
|
+
const pathname = usePathname();
|
|
31
|
+
const review = usePrototypeReviewOptional();
|
|
32
|
+
const stateMapPath = review?.stateCanvasPagePath;
|
|
33
|
+
|
|
34
|
+
if (stateMapPath != null) {
|
|
35
|
+
return pathname.startsWith(stateMapPath);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return /\/prototypes\/[^/]+\/states\/?$/.test(pathname);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function PrototypeCommentToolbar() {
|
|
42
|
+
const { readHandlers } = usePrototypeCommentRegistry();
|
|
43
|
+
const review = usePrototypeReviewOptional();
|
|
44
|
+
const onStateMapPage = useOnStateMapPage();
|
|
45
|
+
|
|
46
|
+
if (onStateMapPage) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<CommentCaptureToolbar
|
|
52
|
+
resolveTargetOptions={() =>
|
|
53
|
+
readHandlers()?.resolveTargetOptions?.() ?? {}
|
|
54
|
+
}
|
|
55
|
+
>
|
|
56
|
+
{review ? (
|
|
57
|
+
<>
|
|
58
|
+
<IntegratedReviewChrome />
|
|
59
|
+
<PrototypeShareMode />
|
|
60
|
+
<PrototypeShareLinkRestore />
|
|
61
|
+
</>
|
|
62
|
+
) : null}
|
|
63
|
+
</CommentCaptureToolbar>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@prototype/lib/utils";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
PrototypeComponent,
|
|
9
|
+
type PrototypeTargetProps,
|
|
10
|
+
} from "./prototype-target";
|
|
11
|
+
|
|
12
|
+
/** On-page prototype control for state pickers, variant tabs, and preview toggles. */
|
|
13
|
+
export function PrototypeControl({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: PrototypeTargetProps) {
|
|
17
|
+
return <PrototypeComponent {...props} className={className} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type PrototypeControlGroupProps = {
|
|
21
|
+
className?: string;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Multiple on-page controls grouped for layout. */
|
|
26
|
+
export function PrototypeControlGroup({
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
}: PrototypeControlGroupProps) {
|
|
30
|
+
return <div className={cn(className)}>{children}</div>;
|
|
31
|
+
}
|