@designa8/vibedesign-v6 1.10.7 → 1.12.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/README.md +1 -1
- package/dist/index.cjs +755 -252
- package/dist/index.js +756 -253
- package/dist/styles.css +60 -0
- package/package.json +11 -1
- package/src/atoms/AppLayout/preview.tsx +5 -14
- package/src/atoms/ChatScreen/index.ts +1 -1
- package/src/atoms/ExportDesignMdModal/ExportDesignMdModal.tsx +322 -0
- package/src/atoms/ExportDesignMdModal/index.ts +6 -0
- package/src/atoms/ExportDesignMdModal/preview.tsx +30 -0
- package/src/atoms/Modal/Modal.tsx +11 -4
- package/src/atoms/PublishModal/PublishModal.tsx +342 -0
- package/src/atoms/PublishModal/index.ts +2 -0
- package/src/atoms/PublishModal/preview.tsx +37 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Modal } from "../Modal";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
import { Input } from "../Input";
|
|
5
|
+
import { Chip } from "../Chip";
|
|
6
|
+
|
|
7
|
+
export type PublishTarget = "production" | "local";
|
|
8
|
+
|
|
9
|
+
export interface PublishModalProps {
|
|
10
|
+
/** Controls whether the modal is visible */
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
/** Called when the user dismisses the modal (backdrop, Esc, close, Cancel) */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
/** Called when the user confirms the publish/link action */
|
|
15
|
+
onPublish?: (target: PublishTarget, version: string) => void;
|
|
16
|
+
/** Package name shown in the details panel */
|
|
17
|
+
packageName?: string;
|
|
18
|
+
/** Currently published version */
|
|
19
|
+
currentVersion?: string;
|
|
20
|
+
/** Suggested next version (editable) */
|
|
21
|
+
defaultNextVersion?: string;
|
|
22
|
+
/** Which tab is selected by default */
|
|
23
|
+
defaultTarget?: PublishTarget;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const GlobeIcon = () => (
|
|
27
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
28
|
+
<circle cx="12" cy="12" r="9" />
|
|
29
|
+
<path d="M3 12h18" />
|
|
30
|
+
<path d="M12 3a13.5 13.5 0 0 1 0 18" />
|
|
31
|
+
<path d="M12 3a13.5 13.5 0 0 0 0 18" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const LinkIcon = () => (
|
|
36
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
37
|
+
<path d="M9 17H7A5 5 0 0 1 7 7h2" />
|
|
38
|
+
<path d="M15 7h2a5 5 0 1 1 0 10h-2" />
|
|
39
|
+
<line x1="8" y1="12" x2="16" y2="12" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const InfoIcon = () => (
|
|
44
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
|
|
45
|
+
<circle cx="12" cy="12" r="10" opacity="0.15" />
|
|
46
|
+
<circle cx="12" cy="7.5" r="1.15" />
|
|
47
|
+
<rect x="11" y="10.5" width="2" height="7" rx="1" />
|
|
48
|
+
</svg>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const CheckCircleIcon = () => (
|
|
52
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
53
|
+
<circle cx="12" cy="12" r="9" />
|
|
54
|
+
<path d="M8.5 12.5l2.2 2.2 4.8-5" />
|
|
55
|
+
</svg>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const LockIcon = () => (
|
|
59
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
60
|
+
<rect x="5" y="10" width="14" height="10" rx="2" />
|
|
61
|
+
<path d="M8 10V7a4 4 0 0 1 8 0v3" />
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const RefreshIcon = () => (
|
|
66
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
67
|
+
<path d="M4 4v5h5" />
|
|
68
|
+
<path d="M20 20v-5h-5" />
|
|
69
|
+
<path d="M5.5 9A7 7 0 0 1 19 12" />
|
|
70
|
+
<path d="M18.5 15A7 7 0 0 1 5 12" />
|
|
71
|
+
</svg>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const ChevronIcon = ({ open }: { open: boolean }) => (
|
|
75
|
+
<svg
|
|
76
|
+
viewBox="0 0 24 24"
|
|
77
|
+
width="14"
|
|
78
|
+
height="14"
|
|
79
|
+
fill="none"
|
|
80
|
+
stroke="currentColor"
|
|
81
|
+
strokeWidth="2"
|
|
82
|
+
strokeLinecap="round"
|
|
83
|
+
strokeLinejoin="round"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
className={["transition-transform duration-150", open ? "rotate-90" : ""].join(" ")}
|
|
86
|
+
>
|
|
87
|
+
<path d="M9 6l6 6-6 6" />
|
|
88
|
+
</svg>
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
function bumpMinor(version: string): string {
|
|
92
|
+
const parts = version.split(".").map((n) => parseInt(n, 10) || 0);
|
|
93
|
+
const [major = 0, minor = 0] = parts;
|
|
94
|
+
return `${major}.${minor + 1}.0`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
98
|
+
(
|
|
99
|
+
{
|
|
100
|
+
isOpen,
|
|
101
|
+
onClose,
|
|
102
|
+
onPublish,
|
|
103
|
+
packageName = "@plasma/vibedesign",
|
|
104
|
+
currentVersion = "1.10.9",
|
|
105
|
+
defaultNextVersion,
|
|
106
|
+
defaultTarget = "production",
|
|
107
|
+
},
|
|
108
|
+
ref
|
|
109
|
+
) => {
|
|
110
|
+
const [target, setTarget] = useState<PublishTarget>(defaultTarget);
|
|
111
|
+
const [nextVersion, setNextVersion] = useState(
|
|
112
|
+
defaultNextVersion ?? bumpMinor(currentVersion)
|
|
113
|
+
);
|
|
114
|
+
const [notesOpen, setNotesOpen] = useState(false);
|
|
115
|
+
const [notes, setNotes] = useState("");
|
|
116
|
+
|
|
117
|
+
const isProduction = target === "production";
|
|
118
|
+
|
|
119
|
+
const summaryItems = isProduction
|
|
120
|
+
? [
|
|
121
|
+
{ title: "Package validated", desc: "All required fields are valid." },
|
|
122
|
+
{ title: "No breaking changes", desc: "Compatible with previous versions." },
|
|
123
|
+
{ title: "Access", desc: "You have publish access to this package." },
|
|
124
|
+
]
|
|
125
|
+
: [
|
|
126
|
+
{ title: "Package built", desc: "Local build artifacts are up to date." },
|
|
127
|
+
{ title: "Link target resolved", desc: "A local npm link target was found." },
|
|
128
|
+
{ title: "No global conflicts", desc: "No other project links this package name." },
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const noticeText = isProduction
|
|
132
|
+
? "Publishing to npm registry makes your package publicly available to the world. Make sure you're ready to release this version."
|
|
133
|
+
: "Local publish creates an npm link only visible on this machine, for testing and internal use before a real release.";
|
|
134
|
+
|
|
135
|
+
const handlePublish = () => onPublish?.(target, nextVersion);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<Modal
|
|
139
|
+
ref={ref}
|
|
140
|
+
isOpen={isOpen}
|
|
141
|
+
onClose={onClose}
|
|
142
|
+
title="Publish package"
|
|
143
|
+
size="lg"
|
|
144
|
+
footer={
|
|
145
|
+
<div className="flex w-full items-center justify-end gap-sm">
|
|
146
|
+
<Button variant="secondary" onClick={onClose}>
|
|
147
|
+
Cancel
|
|
148
|
+
</Button>
|
|
149
|
+
<Button variant="primary" onClick={handlePublish}>
|
|
150
|
+
{isProduction ? "Publish to npm registry" : "Publish locally (npm link)"}
|
|
151
|
+
</Button>
|
|
152
|
+
</div>
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<div className="w-full space-y-lg">
|
|
156
|
+
<p className="text-body-md text-muted">
|
|
157
|
+
Publish your package to npm so others can install and use it.
|
|
158
|
+
Choose between a production release to the npm registry or a
|
|
159
|
+
local publish for testing and internal use.
|
|
160
|
+
</p>
|
|
161
|
+
|
|
162
|
+
{/* Tabs — underline style */}
|
|
163
|
+
<div
|
|
164
|
+
role="tablist"
|
|
165
|
+
aria-label="Publish target"
|
|
166
|
+
className="flex items-center gap-lg border-b border-hairline"
|
|
167
|
+
>
|
|
168
|
+
<Button
|
|
169
|
+
type="button"
|
|
170
|
+
role="tab"
|
|
171
|
+
aria-selected={isProduction}
|
|
172
|
+
variant="ghost"
|
|
173
|
+
size="sm"
|
|
174
|
+
onClick={() => setTarget("production")}
|
|
175
|
+
className={[
|
|
176
|
+
"!rounded-none border-b-2 -mb-px",
|
|
177
|
+
isProduction
|
|
178
|
+
? "text-primary border-primary"
|
|
179
|
+
: "text-muted border-transparent hover:text-ink",
|
|
180
|
+
].join(" ")}
|
|
181
|
+
>
|
|
182
|
+
<GlobeIcon />
|
|
183
|
+
Production (npm registry)
|
|
184
|
+
</Button>
|
|
185
|
+
<Button
|
|
186
|
+
type="button"
|
|
187
|
+
role="tab"
|
|
188
|
+
aria-selected={!isProduction}
|
|
189
|
+
variant="ghost"
|
|
190
|
+
size="sm"
|
|
191
|
+
onClick={() => setTarget("local")}
|
|
192
|
+
className={[
|
|
193
|
+
"!rounded-none border-b-2 -mb-px",
|
|
194
|
+
!isProduction
|
|
195
|
+
? "text-primary border-primary"
|
|
196
|
+
: "text-muted border-transparent hover:text-ink",
|
|
197
|
+
].join(" ")}
|
|
198
|
+
>
|
|
199
|
+
<LinkIcon />
|
|
200
|
+
Local (npm link)
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
{/* Two-column detail grid */}
|
|
205
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-md">
|
|
206
|
+
{/* Package details */}
|
|
207
|
+
<div className="rounded-md border border-hairline p-base space-y-base">
|
|
208
|
+
<p className="text-body-md font-weight-heading-sm text-ink">
|
|
209
|
+
Package details
|
|
210
|
+
</p>
|
|
211
|
+
|
|
212
|
+
<div className="space-y-xxs">
|
|
213
|
+
<p className="text-caption uppercase tracking-wide text-muted">
|
|
214
|
+
Package
|
|
215
|
+
</p>
|
|
216
|
+
<p className="text-body-md text-ink font-mono">{packageName}</p>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<div className="space-y-xxs">
|
|
220
|
+
<p className="text-caption uppercase tracking-wide text-muted">
|
|
221
|
+
Current version
|
|
222
|
+
</p>
|
|
223
|
+
<div className="flex items-center gap-xs">
|
|
224
|
+
<p className="text-body-md text-ink font-mono">{currentVersion}</p>
|
|
225
|
+
<Chip label="Latest" variant="primary" size="sm" />
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
{isProduction ? (
|
|
230
|
+
<div className="space-y-xxs">
|
|
231
|
+
<p className="text-caption uppercase tracking-wide text-muted">
|
|
232
|
+
Next version
|
|
233
|
+
</p>
|
|
234
|
+
<div className="flex items-center gap-xs">
|
|
235
|
+
<Input
|
|
236
|
+
aria-label="Next version"
|
|
237
|
+
value={nextVersion}
|
|
238
|
+
onChange={(e) => setNextVersion(e.target.value)}
|
|
239
|
+
fullWidth
|
|
240
|
+
/>
|
|
241
|
+
<Button
|
|
242
|
+
variant="secondary"
|
|
243
|
+
size="md"
|
|
244
|
+
aria-label="Reset to suggested version"
|
|
245
|
+
onClick={() => setNextVersion(bumpMinor(currentVersion))}
|
|
246
|
+
className="!px-sm"
|
|
247
|
+
>
|
|
248
|
+
<RefreshIcon />
|
|
249
|
+
</Button>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
) : (
|
|
253
|
+
<div className="space-y-xxs">
|
|
254
|
+
<p className="text-caption uppercase tracking-wide text-muted">
|
|
255
|
+
Link command
|
|
256
|
+
</p>
|
|
257
|
+
<p className="rounded-sm bg-surface-soft border border-hairline px-sm py-xs text-body-sm font-mono text-body">
|
|
258
|
+
npm link {packageName}
|
|
259
|
+
</p>
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
|
|
263
|
+
<div className="border border-hairline rounded-sm">
|
|
264
|
+
<Button
|
|
265
|
+
type="button"
|
|
266
|
+
variant="ghost"
|
|
267
|
+
size="sm"
|
|
268
|
+
onClick={() => setNotesOpen((v) => !v)}
|
|
269
|
+
aria-expanded={notesOpen}
|
|
270
|
+
className="w-full !justify-start !rounded-none gap-xs text-body"
|
|
271
|
+
>
|
|
272
|
+
<ChevronIcon open={notesOpen} />
|
|
273
|
+
Release notes (optional)
|
|
274
|
+
</Button>
|
|
275
|
+
{notesOpen && (
|
|
276
|
+
<div className="px-sm pb-sm">
|
|
277
|
+
<textarea
|
|
278
|
+
value={notes}
|
|
279
|
+
onChange={(e) => setNotes(e.target.value)}
|
|
280
|
+
placeholder="What changed in this release?"
|
|
281
|
+
rows={3}
|
|
282
|
+
className="w-full resize-none rounded-sm border border-hairline bg-surface px-sm py-xs text-body-sm text-ink placeholder:text-muted-soft outline-none focus:ring-2 focus:ring-primary-focus/20 focus:border-primary-focus"
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
)}
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
{/* Publish summary */}
|
|
290
|
+
<div className="rounded-md border border-hairline p-base space-y-base">
|
|
291
|
+
<p className="text-body-md font-weight-heading-sm text-ink">
|
|
292
|
+
Publish summary
|
|
293
|
+
</p>
|
|
294
|
+
|
|
295
|
+
<div className="flex items-start gap-sm rounded-sm bg-primary/10 border border-primary/30 p-sm">
|
|
296
|
+
<span className="text-primary flex-shrink-0 mt-xxs">
|
|
297
|
+
<InfoIcon />
|
|
298
|
+
</span>
|
|
299
|
+
<div>
|
|
300
|
+
<p className="text-body-sm font-weight-heading-sm text-primary">
|
|
301
|
+
{isProduction ? "Ready to publish" : "Ready to link"}
|
|
302
|
+
</p>
|
|
303
|
+
<p className="text-body-sm text-body">
|
|
304
|
+
{isProduction
|
|
305
|
+
? `This will publish version ${nextVersion} to the npm registry.`
|
|
306
|
+
: `This will link ${packageName} for local development.`}
|
|
307
|
+
</p>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div className="space-y-sm">
|
|
312
|
+
{summaryItems.map((item) => (
|
|
313
|
+
<div key={item.title} className="flex items-start gap-sm">
|
|
314
|
+
<span className="text-semantic-success flex-shrink-0 mt-xxs">
|
|
315
|
+
<CheckCircleIcon />
|
|
316
|
+
</span>
|
|
317
|
+
<div>
|
|
318
|
+
<p className="text-body-sm font-weight-heading-sm text-ink">
|
|
319
|
+
{item.title}
|
|
320
|
+
</p>
|
|
321
|
+
<p className="text-body-sm text-muted">{item.desc}</p>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
))}
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
{/* Notice */}
|
|
330
|
+
<div className="flex items-center gap-sm rounded-md bg-surface-soft border border-hairline p-base">
|
|
331
|
+
<span className="flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-sm bg-primary text-on-primary">
|
|
332
|
+
<LockIcon />
|
|
333
|
+
</span>
|
|
334
|
+
<p className="text-body-sm text-body">{noticeText}</p>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</Modal>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
PublishModal.displayName = "PublishModal";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { PublishModal } from "./PublishModal";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
export default function PublishModalPreview() {
|
|
6
|
+
const [open, setOpen] = useState(true);
|
|
7
|
+
const [localOpen, setLocalOpen] = useState(false);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
11
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
12
|
+
<Button variant="primary" onClick={() => setOpen(true)}>
|
|
13
|
+
Open publish modal (production)
|
|
14
|
+
</Button>
|
|
15
|
+
<Button variant="secondary" onClick={() => setLocalOpen(true)}>
|
|
16
|
+
Open publish modal (local)
|
|
17
|
+
</Button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<PublishModal
|
|
21
|
+
isOpen={open}
|
|
22
|
+
onClose={() => setOpen(false)}
|
|
23
|
+
onPublish={() => setOpen(false)}
|
|
24
|
+
defaultTarget="production"
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<PublishModal
|
|
28
|
+
isOpen={localOpen}
|
|
29
|
+
onClose={() => setLocalOpen(false)}
|
|
30
|
+
onPublish={() => setLocalOpen(false)}
|
|
31
|
+
defaultTarget="local"
|
|
32
|
+
packageName="@plasma/vibedesign"
|
|
33
|
+
currentVersion="1.10.9"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./atoms/Button";
|
|
|
8
8
|
export * from "./atoms/ChatScreen";
|
|
9
9
|
export * from "./atoms/Chip";
|
|
10
10
|
export * from "./atoms/ComponentCard";
|
|
11
|
+
export * from "./atoms/ExportDesignMdModal";
|
|
11
12
|
export * from "./atoms/FilterTabBar";
|
|
12
13
|
export * from "./atoms/HomePageTemplate";
|
|
13
14
|
export * from "./atoms/Input";
|
|
@@ -15,6 +16,7 @@ export * from "./atoms/Modal";
|
|
|
15
16
|
export * from "./atoms/NavItem";
|
|
16
17
|
export * from "./atoms/PreviewToolbar";
|
|
17
18
|
export * from "./atoms/PromptInputBar";
|
|
19
|
+
export * from "./atoms/PublishModal";
|
|
18
20
|
export * from "./atoms/TopNavbar";
|
|
19
21
|
export * from "./atoms/Typography";
|
|
20
22
|
export * from "./atoms/UpgradeCard";
|