proto-plugin 0.1.1 → 0.1.2
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 +308 -29
- package/README.md +48 -6
- package/package.json +1 -1
- package/scripts/lib/host-config.example.sh +1 -1
- package/scripts/verify-prototype-preview-states.mjs +57 -0
- package/src/components/platform-ui/controls-panel-select.tsx +4 -3
- package/src/components/platform-ui/prototype-tool-dialog.tsx +117 -0
- package/src/components/platform-ui/sidebar.tsx +34 -16
- package/src/components/prototype-gallery-client.tsx +77 -37
- package/src/components/prototypes/design-exploration-variant-preview-shell.tsx +43 -0
- package/src/components/prototypes/prototype-brief-field.tsx +33 -0
- package/src/components/prototypes/prototype-change-log-panel.tsx +4 -0
- package/src/components/prototypes/prototype-comment-storage-empty-state.tsx +41 -0
- package/src/components/prototypes/prototype-create-exploration-modal.tsx +41 -64
- package/src/components/prototypes/prototype-create-prototype-modal.tsx +102 -0
- package/src/components/prototypes/prototype-create-state-modal.tsx +31 -70
- package/src/components/prototypes/prototype-default-state-map-page.tsx +4 -4
- package/src/components/prototypes/prototype-design-brief-modal.tsx +10 -10
- package/src/components/prototypes/prototype-design-brief-panel.tsx +261 -231
- package/src/components/prototypes/prototype-floating-pill.module.scss +16 -9
- package/src/components/prototypes/prototype-mobbin-gallery.tsx +18 -2
- package/src/components/prototypes/prototype-review-sidebar.tsx +11 -28
- package/src/components/prototypes/prototype-spec-panel-content.tsx +5 -5
- package/src/components/prototypes/prototype-spec-panel-empty-state.tsx +53 -0
- package/src/components/prototypes/prototype-state-canvas-overlay.module.scss +20 -47
- package/src/components/prototypes/prototype-state-canvas-overlay.tsx +4 -42
- package/src/components/prototypes/prototype-variant-explorer.tsx +32 -78
- package/src/components/prototypes/prototype-vercel-preview-modal.tsx +4 -3
- package/src/components/prototypes/state-map-annotation-tooltip.module.scss +7 -7
- package/src/components/shell/prototype-component-library-empty-state.tsx +59 -0
- package/src/components/shell/prototype-gallery-nav.tsx +124 -0
- package/src/components/shell/prototype-gallery-shell.tsx +45 -13
- package/src/components/shell/prototype-link-source-modal.tsx +100 -0
- package/src/components/ui/button.tsx +3 -1
- package/src/components/ui/dialog.tsx +43 -4
- package/src/config/create-prototype-component-library-page.tsx +74 -0
- package/src/config/create-prototype-gallery-page.tsx +26 -23
- package/src/config/create-prototype-host-app.tsx +3 -15
- package/src/config/create-prototype-site-layout.tsx +14 -1
- package/src/config/create-prototype-state-map-page.tsx +44 -0
- package/src/config/prototype-site-layout-client.tsx +20 -6
- package/src/config/with-prototype.ts +21 -0
- package/src/index.ts +54 -10
- package/src/lib/copy-text-with-attachments.ts +35 -0
- package/src/lib/format-source-directory-name.ts +12 -0
- package/src/lib/platform-ui/sidebar-interactive-cursor.ts +19 -0
- package/src/lib/pr-split/build-pr-split-plan-prompt.ts +81 -0
- package/src/lib/pr-split/pr-split-highlight.ts +3 -0
- package/src/lib/prototype-comments/core/annotation-target.ts +12 -3
- package/src/lib/prototype-comments/core/comment-capture-blocked.ts +24 -0
- package/src/lib/prototype-comments/core/screenshot.ts +68 -31
- package/src/lib/prototype-comments/core/storage.ts +3 -6
- package/src/lib/prototype-comments/core/types.ts +2 -0
- package/src/lib/prototype-comments/hooks/useLayoutShift.ts +9 -2
- package/src/lib/prototype-comments/react/CommentCaptureToolbar.tsx +45 -10
- package/src/lib/prototype-comments/react/CommentProvider.tsx +19 -0
- package/src/lib/prototype-comments/ui/CommentModeToggleButton.tsx +34 -0
- package/src/lib/prototype-comments/ui/CommentsGrid.tsx +8 -16
- package/src/lib/prototype-comments/ui/CommentsSidebar.tsx +5 -19
- package/src/lib/prototype-comments/ui/capture-styles.module.scss +5 -1
- package/src/lib/prototype-comments/ui/comments-grid-card.module.scss +0 -7
- package/src/lib/prototypes/build-design-exploration-renderers.ts +44 -0
- package/src/lib/prototypes/comment-storage-setup-prompt.ts +124 -0
- package/src/lib/prototypes/create-prototype-prompt.ts +96 -0
- package/src/lib/prototypes/create-prototype-registry.ts +5 -0
- package/src/lib/prototypes/design-exploration-types.ts +261 -10
- package/src/lib/prototypes/link-source-prompt.ts +93 -0
- package/src/lib/prototypes/populate-component-library-prompt.ts +64 -0
- package/src/lib/prototypes/prototype-config-types.ts +2 -0
- package/src/lib/prototypes/prototype-layout-classes.ts +19 -0
- package/src/lib/prototypes/prototype-preview-state-registry.ts +5 -2
- package/src/lib/prototypes/prototype-review-context.tsx +4 -4
- package/src/lib/prototypes/prototype-state-canvas-constants.ts +1 -1
- package/src/lib/prototypes/prototype-state-canvas-types.ts +0 -2
- package/src/lib/prototypes/prototype-storage-status.ts +31 -0
- package/src/lib/prototypes/sort-prototypes-by-creation-date.ts +43 -0
- package/src/lib/prototypes/use-prototype-tool-theme.tsx +1 -1
- package/src/lib/prototypes/use-toolbar-hover-panel.ts +12 -1
- package/src/lib/prototypes/variant-set-lucide-icon.tsx +24 -0
- package/src/lib/tool-portal.ts +24 -0
- package/src/lib/use-copy-to-clipboard.ts +7 -13
- package/src/server/create-host-api-route.ts +7 -16
- package/src/server/create-prototype-api-routes.ts +0 -115
- package/src/server/prototype-storage-status-route.ts +29 -0
- package/src/server.ts +0 -8
- package/src/styles/globals.css +359 -71
- package/src/lib/prototypes/design-exploration-default-storage.ts +0 -68
- package/src/lib/prototypes/design-exploration-default.ts +0 -51
- package/src/lib/prototypes/use-design-exploration-default.ts +0 -114
- package/src/server/redis/prototype-design-exploration-default.ts +0 -32
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type DesignExplorationDefaultRecord = {
|
|
2
|
-
value: string;
|
|
3
|
-
updatedAt: string;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export function prototypeDesignExplorationDefaultRedisKey(
|
|
7
|
-
storageKeyPrefix: string,
|
|
8
|
-
): string {
|
|
9
|
-
return `prototype-design-default:${storageKeyPrefix}`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function parseDesignExplorationDefault(
|
|
13
|
-
value: unknown,
|
|
14
|
-
): DesignExplorationDefaultRecord | null {
|
|
15
|
-
if (!value || typeof value !== "object") return null;
|
|
16
|
-
|
|
17
|
-
const record = value as Partial<DesignExplorationDefaultRecord>;
|
|
18
|
-
|
|
19
|
-
if (typeof record.value !== "string" || !record.value.trim()) return null;
|
|
20
|
-
if (
|
|
21
|
-
typeof record.updatedAt !== "string" ||
|
|
22
|
-
Number.isNaN(Date.parse(record.updatedAt))
|
|
23
|
-
) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
value: record.value,
|
|
29
|
-
updatedAt: record.updatedAt,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function isValidDesignExplorationDefaultRecord(
|
|
34
|
-
value: unknown,
|
|
35
|
-
): value is DesignExplorationDefaultRecord {
|
|
36
|
-
return parseDesignExplorationDefault(value) != null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function normalizeDesignExplorationDefaultPayload(
|
|
40
|
-
value: unknown,
|
|
41
|
-
validValues?: readonly string[],
|
|
42
|
-
): DesignExplorationDefaultRecord | null {
|
|
43
|
-
const parsed = parseDesignExplorationDefault(value);
|
|
44
|
-
if (!parsed) return null;
|
|
45
|
-
|
|
46
|
-
if (validValues && !validValues.includes(parsed.value)) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return parsed;
|
|
51
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { createDesignExplorationDefaultStorageAdapter } from "@prototype/lib/prototypes/design-exploration-default-storage";
|
|
4
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
-
|
|
6
|
-
type UseDesignExplorationDefaultOptions<TVariant extends string> = {
|
|
7
|
-
slug: string | null;
|
|
8
|
-
storageKeyPrefix: string;
|
|
9
|
-
validValues: readonly TVariant[];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function useDesignExplorationDefault<TVariant extends string>({
|
|
13
|
-
slug,
|
|
14
|
-
storageKeyPrefix,
|
|
15
|
-
validValues,
|
|
16
|
-
}: UseDesignExplorationDefaultOptions<TVariant>) {
|
|
17
|
-
const [persistedDefault, setPersistedDefault] = useState<TVariant | null>(null);
|
|
18
|
-
const [ready, setReady] = useState(false);
|
|
19
|
-
const [saving, setSaving] = useState(false);
|
|
20
|
-
const [error, setError] = useState<string | null>(null);
|
|
21
|
-
|
|
22
|
-
const storage = useMemo(() => {
|
|
23
|
-
if (!slug) return null;
|
|
24
|
-
return createDesignExplorationDefaultStorageAdapter(slug, storageKeyPrefix);
|
|
25
|
-
}, [slug, storageKeyPrefix]);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!storage) {
|
|
29
|
-
setReady(true);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let cancelled = false;
|
|
34
|
-
setReady(false);
|
|
35
|
-
setError(null);
|
|
36
|
-
|
|
37
|
-
async function load() {
|
|
38
|
-
const activeStorage = storage;
|
|
39
|
-
if (!activeStorage) return;
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
const record = await activeStorage.load();
|
|
43
|
-
if (cancelled) return;
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
record &&
|
|
47
|
-
validValues.includes(record.value as TVariant)
|
|
48
|
-
) {
|
|
49
|
-
setPersistedDefault(record.value as TVariant);
|
|
50
|
-
} else {
|
|
51
|
-
setPersistedDefault(null);
|
|
52
|
-
}
|
|
53
|
-
} catch (loadError) {
|
|
54
|
-
if (!cancelled) {
|
|
55
|
-
setError(
|
|
56
|
-
loadError instanceof Error
|
|
57
|
-
? loadError.message
|
|
58
|
-
: "Failed to load design default variant.",
|
|
59
|
-
);
|
|
60
|
-
setPersistedDefault(null);
|
|
61
|
-
}
|
|
62
|
-
} finally {
|
|
63
|
-
if (!cancelled) {
|
|
64
|
-
setReady(true);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
void load();
|
|
70
|
-
|
|
71
|
-
return () => {
|
|
72
|
-
cancelled = true;
|
|
73
|
-
};
|
|
74
|
-
}, [storage, validValues]);
|
|
75
|
-
|
|
76
|
-
const effectiveDefault = persistedDefault ?? validValues[0];
|
|
77
|
-
|
|
78
|
-
const setDefaultVariant = useCallback(
|
|
79
|
-
async (value: TVariant) => {
|
|
80
|
-
if (!validValues.includes(value)) return;
|
|
81
|
-
|
|
82
|
-
setPersistedDefault(value);
|
|
83
|
-
|
|
84
|
-
if (!storage) return;
|
|
85
|
-
|
|
86
|
-
setSaving(true);
|
|
87
|
-
setError(null);
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
await storage.save({
|
|
91
|
-
value,
|
|
92
|
-
updatedAt: new Date().toISOString(),
|
|
93
|
-
});
|
|
94
|
-
} catch (saveError) {
|
|
95
|
-
setError(
|
|
96
|
-
saveError instanceof Error
|
|
97
|
-
? saveError.message
|
|
98
|
-
: "Failed to save design default variant.",
|
|
99
|
-
);
|
|
100
|
-
} finally {
|
|
101
|
-
setSaving(false);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
[storage, validValues],
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
return {
|
|
108
|
-
effectiveDefault,
|
|
109
|
-
setDefaultVariant,
|
|
110
|
-
ready,
|
|
111
|
-
saving,
|
|
112
|
-
error,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeDesignExplorationDefaultPayload,
|
|
3
|
-
parseDesignExplorationDefault,
|
|
4
|
-
prototypeDesignExplorationDefaultRedisKey,
|
|
5
|
-
type DesignExplorationDefaultRecord,
|
|
6
|
-
} from "@prototype/lib/prototypes/design-exploration-default";
|
|
7
|
-
|
|
8
|
-
import { getRedis } from "./client";
|
|
9
|
-
|
|
10
|
-
export async function getPrototypeDesignExplorationDefault(
|
|
11
|
-
storageKeyPrefix: string,
|
|
12
|
-
): Promise<DesignExplorationDefaultRecord | null> {
|
|
13
|
-
const redis = getRedis();
|
|
14
|
-
const key = prototypeDesignExplorationDefaultRedisKey(storageKeyPrefix);
|
|
15
|
-
const stored = await redis.get<unknown>(key);
|
|
16
|
-
return parseDesignExplorationDefault(stored);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function setPrototypeDesignExplorationDefault(
|
|
20
|
-
storageKeyPrefix: string,
|
|
21
|
-
record: unknown,
|
|
22
|
-
validValues?: readonly string[],
|
|
23
|
-
): Promise<void> {
|
|
24
|
-
const normalized = normalizeDesignExplorationDefaultPayload(record, validValues);
|
|
25
|
-
if (!normalized) {
|
|
26
|
-
throw new Error("Invalid design exploration default record.");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const redis = getRedis();
|
|
30
|
-
const key = prototypeDesignExplorationDefaultRedisKey(storageKeyPrefix);
|
|
31
|
-
await redis.set(key, normalized);
|
|
32
|
-
}
|