@designa8/vibedesign-v6 1.20.15 → 1.20.17
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 +37 -46
- package/dist/index.js +39 -48
- package/dist/styles.css +15 -0
- package/package.json +1 -1
- package/src/atoms/PublishModal/PublishModal.tsx +44 -60
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @plasma/vibedesign-v6
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **1.20.
|
|
3
|
+
Complete design system generated by Atoms Design, version **1.20.17**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -6155,30 +6155,26 @@ PricingPageTemplate.displayName = "PricingPageTemplate";
|
|
|
6155
6155
|
// virtual-pkg:src/atoms/PublishModal/PublishModal.tsx
|
|
6156
6156
|
var import_react30 = __toESM(require("react"));
|
|
6157
6157
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6158
|
-
function bumpMinor(version) {
|
|
6159
|
-
const parts = version.split(".").map((n) => parseInt(n, 10) || 0);
|
|
6160
|
-
const [major = 0, minor = 0] = parts;
|
|
6161
|
-
return `${major}.${minor + 1}.0`;
|
|
6162
|
-
}
|
|
6163
6158
|
var PublishModal = import_react30.default.forwardRef(
|
|
6164
6159
|
({
|
|
6165
6160
|
isOpen,
|
|
6166
6161
|
onClose,
|
|
6167
6162
|
onPublish,
|
|
6168
|
-
packageName
|
|
6169
|
-
currentVersion
|
|
6163
|
+
packageName,
|
|
6164
|
+
currentVersion,
|
|
6170
6165
|
defaultNextVersion,
|
|
6171
6166
|
defaultTarget = "production",
|
|
6172
6167
|
loading = false
|
|
6173
6168
|
}, ref) => {
|
|
6174
6169
|
const target = defaultTarget;
|
|
6175
|
-
const
|
|
6176
|
-
defaultNextVersion ?? bumpMinor(currentVersion)
|
|
6177
|
-
);
|
|
6170
|
+
const version = defaultNextVersion ?? currentVersion ?? "";
|
|
6178
6171
|
const isProduction = target === "production";
|
|
6172
|
+
const hasPackageName = Boolean(packageName && packageName.length > 0);
|
|
6173
|
+
const hasCurrentVersion = Boolean(currentVersion && currentVersion.length > 0);
|
|
6174
|
+
const showLinkCommand = !isProduction && hasPackageName;
|
|
6179
6175
|
const introText = isProduction ? "Publish your package to the npm registry so others can install and use it." : "Publish this package locally with npm link for testing and internal use before a real release.";
|
|
6180
6176
|
const noticeText = isProduction ? "Publishing to npm registry makes your package publicly available to the world. Make sure you're ready to release this version." : "Local publish creates an npm link only visible on this machine, for testing and internal use before a real release.";
|
|
6181
|
-
const handlePublish = () => onPublish?.(target,
|
|
6177
|
+
const handlePublish = () => onPublish?.(target, version);
|
|
6182
6178
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6183
6179
|
Modal,
|
|
6184
6180
|
{
|
|
@@ -6188,18 +6184,27 @@ var PublishModal = import_react30.default.forwardRef(
|
|
|
6188
6184
|
title: "Publish package",
|
|
6189
6185
|
size: "lg",
|
|
6190
6186
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-full items-center justify-end gap-sm", children: [
|
|
6191
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { variant: "secondary", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6192
6187
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6193
6188
|
Button,
|
|
6194
6189
|
{
|
|
6190
|
+
type: "button",
|
|
6191
|
+
variant: "secondary",
|
|
6192
|
+
onClick: onClose,
|
|
6193
|
+
disabled: loading,
|
|
6194
|
+
children: "Cancel"
|
|
6195
|
+
}
|
|
6196
|
+
),
|
|
6197
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6198
|
+
Button,
|
|
6199
|
+
{
|
|
6200
|
+
type: "button",
|
|
6195
6201
|
variant: "primary",
|
|
6196
6202
|
onClick: handlePublish,
|
|
6197
6203
|
disabled: loading,
|
|
6204
|
+
loading,
|
|
6205
|
+
pushEffect: false,
|
|
6198
6206
|
"aria-busy": loading,
|
|
6199
|
-
children:
|
|
6200
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "loading-spinner", size: 16, className: "animate-spin" }),
|
|
6201
|
-
isProduction ? "Publishing\u2026" : "Linking\u2026"
|
|
6202
|
-
] }) : isProduction ? "Publish to npm registry" : "Publish locally (npm link)"
|
|
6207
|
+
children: isProduction ? "Publish to npm registry" : "Publish locally (npm link)"
|
|
6203
6208
|
}
|
|
6204
6209
|
)
|
|
6205
6210
|
] }),
|
|
@@ -6209,42 +6214,28 @@ var PublishModal = import_react30.default.forwardRef(
|
|
|
6209
6214
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-body-md font-weight-heading-sm text-ink", children: "Package details" }),
|
|
6210
6215
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-xxs", children: [
|
|
6211
6216
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Package" }),
|
|
6212
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-body-md text-ink font-mono", children: packageName })
|
|
6217
|
+
hasPackageName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-body-md text-ink font-mono", children: packageName }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6218
|
+
"div",
|
|
6219
|
+
{
|
|
6220
|
+
className: "h-4 w-40 animate-pulse rounded-sm bg-surface-soft border border-hairline",
|
|
6221
|
+
"aria-hidden": "true"
|
|
6222
|
+
}
|
|
6223
|
+
)
|
|
6213
6224
|
] }),
|
|
6214
6225
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-xxs", children: [
|
|
6215
6226
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Current version" }),
|
|
6216
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-xs", children: [
|
|
6227
|
+
hasCurrentVersion ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-xs", children: [
|
|
6217
6228
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-body-md text-ink font-mono", children: currentVersion }),
|
|
6218
6229
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Chip, { label: "Latest", variant: "primary", size: "sm" })
|
|
6219
|
-
] })
|
|
6230
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6231
|
+
"div",
|
|
6232
|
+
{
|
|
6233
|
+
className: "h-4 w-20 animate-pulse rounded-sm bg-surface-soft border border-hairline",
|
|
6234
|
+
"aria-hidden": "true"
|
|
6235
|
+
}
|
|
6236
|
+
)
|
|
6220
6237
|
] }),
|
|
6221
|
-
|
|
6222
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Next version" }),
|
|
6223
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-xs", children: [
|
|
6224
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6225
|
-
Input,
|
|
6226
|
-
{
|
|
6227
|
-
"aria-label": "Next version",
|
|
6228
|
-
value: nextVersion,
|
|
6229
|
-
onChange: (e) => setNextVersion(e.target.value),
|
|
6230
|
-
fullWidth: true,
|
|
6231
|
-
disabled: loading
|
|
6232
|
-
}
|
|
6233
|
-
),
|
|
6234
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6235
|
-
Button,
|
|
6236
|
-
{
|
|
6237
|
-
variant: "secondary",
|
|
6238
|
-
size: "md",
|
|
6239
|
-
"aria-label": "Reset to suggested version",
|
|
6240
|
-
onClick: () => setNextVersion(bumpMinor(currentVersion)),
|
|
6241
|
-
disabled: loading,
|
|
6242
|
-
className: "!px-sm",
|
|
6243
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "refresh", size: 16 })
|
|
6244
|
-
}
|
|
6245
|
-
)
|
|
6246
|
-
] })
|
|
6247
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-xxs", children: [
|
|
6238
|
+
showLinkCommand && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-xxs", children: [
|
|
6248
6239
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Link command" }),
|
|
6249
6240
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "rounded-sm bg-surface-soft border border-hairline px-sm py-xs text-body-sm font-mono text-body", children: [
|
|
6250
6241
|
"npm link ",
|
package/dist/index.js
CHANGED
|
@@ -6086,32 +6086,28 @@ var PricingPageTemplate = React32.forwardRef(
|
|
|
6086
6086
|
PricingPageTemplate.displayName = "PricingPageTemplate";
|
|
6087
6087
|
|
|
6088
6088
|
// virtual-pkg:src/atoms/PublishModal/PublishModal.tsx
|
|
6089
|
-
import React33
|
|
6090
|
-
import {
|
|
6091
|
-
function bumpMinor(version) {
|
|
6092
|
-
const parts = version.split(".").map((n) => parseInt(n, 10) || 0);
|
|
6093
|
-
const [major = 0, minor = 0] = parts;
|
|
6094
|
-
return `${major}.${minor + 1}.0`;
|
|
6095
|
-
}
|
|
6089
|
+
import React33 from "react";
|
|
6090
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6096
6091
|
var PublishModal = React33.forwardRef(
|
|
6097
6092
|
({
|
|
6098
6093
|
isOpen,
|
|
6099
6094
|
onClose,
|
|
6100
6095
|
onPublish,
|
|
6101
|
-
packageName
|
|
6102
|
-
currentVersion
|
|
6096
|
+
packageName,
|
|
6097
|
+
currentVersion,
|
|
6103
6098
|
defaultNextVersion,
|
|
6104
6099
|
defaultTarget = "production",
|
|
6105
6100
|
loading = false
|
|
6106
6101
|
}, ref) => {
|
|
6107
6102
|
const target = defaultTarget;
|
|
6108
|
-
const
|
|
6109
|
-
defaultNextVersion ?? bumpMinor(currentVersion)
|
|
6110
|
-
);
|
|
6103
|
+
const version = defaultNextVersion ?? currentVersion ?? "";
|
|
6111
6104
|
const isProduction = target === "production";
|
|
6105
|
+
const hasPackageName = Boolean(packageName && packageName.length > 0);
|
|
6106
|
+
const hasCurrentVersion = Boolean(currentVersion && currentVersion.length > 0);
|
|
6107
|
+
const showLinkCommand = !isProduction && hasPackageName;
|
|
6112
6108
|
const introText = isProduction ? "Publish your package to the npm registry so others can install and use it." : "Publish this package locally with npm link for testing and internal use before a real release.";
|
|
6113
6109
|
const noticeText = isProduction ? "Publishing to npm registry makes your package publicly available to the world. Make sure you're ready to release this version." : "Local publish creates an npm link only visible on this machine, for testing and internal use before a real release.";
|
|
6114
|
-
const handlePublish = () => onPublish?.(target,
|
|
6110
|
+
const handlePublish = () => onPublish?.(target, version);
|
|
6115
6111
|
return /* @__PURE__ */ jsx33(
|
|
6116
6112
|
Modal,
|
|
6117
6113
|
{
|
|
@@ -6121,18 +6117,27 @@ var PublishModal = React33.forwardRef(
|
|
|
6121
6117
|
title: "Publish package",
|
|
6122
6118
|
size: "lg",
|
|
6123
6119
|
footer: /* @__PURE__ */ jsxs31("div", { className: "flex w-full items-center justify-end gap-sm", children: [
|
|
6124
|
-
/* @__PURE__ */ jsx33(Button, { variant: "secondary", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6125
6120
|
/* @__PURE__ */ jsx33(
|
|
6126
6121
|
Button,
|
|
6127
6122
|
{
|
|
6123
|
+
type: "button",
|
|
6124
|
+
variant: "secondary",
|
|
6125
|
+
onClick: onClose,
|
|
6126
|
+
disabled: loading,
|
|
6127
|
+
children: "Cancel"
|
|
6128
|
+
}
|
|
6129
|
+
),
|
|
6130
|
+
/* @__PURE__ */ jsx33(
|
|
6131
|
+
Button,
|
|
6132
|
+
{
|
|
6133
|
+
type: "button",
|
|
6128
6134
|
variant: "primary",
|
|
6129
6135
|
onClick: handlePublish,
|
|
6130
6136
|
disabled: loading,
|
|
6137
|
+
loading,
|
|
6138
|
+
pushEffect: false,
|
|
6131
6139
|
"aria-busy": loading,
|
|
6132
|
-
children:
|
|
6133
|
-
/* @__PURE__ */ jsx33(Icon, { name: "loading-spinner", size: 16, className: "animate-spin" }),
|
|
6134
|
-
isProduction ? "Publishing\u2026" : "Linking\u2026"
|
|
6135
|
-
] }) : isProduction ? "Publish to npm registry" : "Publish locally (npm link)"
|
|
6140
|
+
children: isProduction ? "Publish to npm registry" : "Publish locally (npm link)"
|
|
6136
6141
|
}
|
|
6137
6142
|
)
|
|
6138
6143
|
] }),
|
|
@@ -6142,42 +6147,28 @@ var PublishModal = React33.forwardRef(
|
|
|
6142
6147
|
/* @__PURE__ */ jsx33("p", { className: "text-body-md font-weight-heading-sm text-ink", children: "Package details" }),
|
|
6143
6148
|
/* @__PURE__ */ jsxs31("div", { className: "space-y-xxs", children: [
|
|
6144
6149
|
/* @__PURE__ */ jsx33("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Package" }),
|
|
6145
|
-
/* @__PURE__ */ jsx33("p", { className: "text-body-md text-ink font-mono", children: packageName })
|
|
6150
|
+
hasPackageName ? /* @__PURE__ */ jsx33("p", { className: "text-body-md text-ink font-mono", children: packageName }) : /* @__PURE__ */ jsx33(
|
|
6151
|
+
"div",
|
|
6152
|
+
{
|
|
6153
|
+
className: "h-4 w-40 animate-pulse rounded-sm bg-surface-soft border border-hairline",
|
|
6154
|
+
"aria-hidden": "true"
|
|
6155
|
+
}
|
|
6156
|
+
)
|
|
6146
6157
|
] }),
|
|
6147
6158
|
/* @__PURE__ */ jsxs31("div", { className: "space-y-xxs", children: [
|
|
6148
6159
|
/* @__PURE__ */ jsx33("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Current version" }),
|
|
6149
|
-
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-xs", children: [
|
|
6160
|
+
hasCurrentVersion ? /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-xs", children: [
|
|
6150
6161
|
/* @__PURE__ */ jsx33("p", { className: "text-body-md text-ink font-mono", children: currentVersion }),
|
|
6151
6162
|
/* @__PURE__ */ jsx33(Chip, { label: "Latest", variant: "primary", size: "sm" })
|
|
6152
|
-
] })
|
|
6163
|
+
] }) : /* @__PURE__ */ jsx33(
|
|
6164
|
+
"div",
|
|
6165
|
+
{
|
|
6166
|
+
className: "h-4 w-20 animate-pulse rounded-sm bg-surface-soft border border-hairline",
|
|
6167
|
+
"aria-hidden": "true"
|
|
6168
|
+
}
|
|
6169
|
+
)
|
|
6153
6170
|
] }),
|
|
6154
|
-
|
|
6155
|
-
/* @__PURE__ */ jsx33("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Next version" }),
|
|
6156
|
-
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-xs", children: [
|
|
6157
|
-
/* @__PURE__ */ jsx33(
|
|
6158
|
-
Input,
|
|
6159
|
-
{
|
|
6160
|
-
"aria-label": "Next version",
|
|
6161
|
-
value: nextVersion,
|
|
6162
|
-
onChange: (e) => setNextVersion(e.target.value),
|
|
6163
|
-
fullWidth: true,
|
|
6164
|
-
disabled: loading
|
|
6165
|
-
}
|
|
6166
|
-
),
|
|
6167
|
-
/* @__PURE__ */ jsx33(
|
|
6168
|
-
Button,
|
|
6169
|
-
{
|
|
6170
|
-
variant: "secondary",
|
|
6171
|
-
size: "md",
|
|
6172
|
-
"aria-label": "Reset to suggested version",
|
|
6173
|
-
onClick: () => setNextVersion(bumpMinor(currentVersion)),
|
|
6174
|
-
disabled: loading,
|
|
6175
|
-
className: "!px-sm",
|
|
6176
|
-
children: /* @__PURE__ */ jsx33(Icon, { name: "refresh", size: 16 })
|
|
6177
|
-
}
|
|
6178
|
-
)
|
|
6179
|
-
] })
|
|
6180
|
-
] }) : /* @__PURE__ */ jsxs31("div", { className: "space-y-xxs", children: [
|
|
6171
|
+
showLinkCommand && /* @__PURE__ */ jsxs31("div", { className: "space-y-xxs", children: [
|
|
6181
6172
|
/* @__PURE__ */ jsx33("p", { className: "text-caption uppercase tracking-wide text-muted", children: "Link command" }),
|
|
6182
6173
|
/* @__PURE__ */ jsxs31("p", { className: "rounded-sm bg-surface-soft border border-hairline px-sm py-xs text-body-sm font-mono text-body", children: [
|
|
6183
6174
|
"npm link ",
|
package/dist/styles.css
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
48
48
|
--animate-spin: spin 1s linear infinite;
|
|
49
49
|
--animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
|
|
50
|
+
--animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
50
51
|
--default-transition-duration: 150ms;
|
|
51
52
|
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
52
53
|
--default-font-family: var(--font-body);
|
|
@@ -695,6 +696,12 @@
|
|
|
695
696
|
.w-16 {
|
|
696
697
|
width: calc(var(--spacing) * 16);
|
|
697
698
|
}
|
|
699
|
+
.w-20 {
|
|
700
|
+
width: calc(var(--spacing) * 20);
|
|
701
|
+
}
|
|
702
|
+
.w-40 {
|
|
703
|
+
width: calc(var(--spacing) * 40);
|
|
704
|
+
}
|
|
698
705
|
.w-56 {
|
|
699
706
|
width: calc(var(--spacing) * 56);
|
|
700
707
|
}
|
|
@@ -848,6 +855,9 @@
|
|
|
848
855
|
.animate-ping {
|
|
849
856
|
animation: var(--animate-ping);
|
|
850
857
|
}
|
|
858
|
+
.animate-pulse {
|
|
859
|
+
animation: var(--animate-pulse);
|
|
860
|
+
}
|
|
851
861
|
.animate-spin {
|
|
852
862
|
animation: var(--animate-spin);
|
|
853
863
|
}
|
|
@@ -2372,6 +2382,11 @@
|
|
|
2372
2382
|
opacity: 0;
|
|
2373
2383
|
}
|
|
2374
2384
|
}
|
|
2385
|
+
@keyframes pulse {
|
|
2386
|
+
50% {
|
|
2387
|
+
opacity: 0.5;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2375
2390
|
@layer properties {
|
|
2376
2391
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
2377
2392
|
*, ::before, ::after, ::backdrop {
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Modal } from "../Modal";
|
|
3
3
|
import { Button } from "../Button";
|
|
4
|
-
import { Input } from "../Input";
|
|
5
4
|
import { Chip } from "../Chip";
|
|
6
5
|
import { Icon } from "../Icon";
|
|
7
6
|
|
|
@@ -14,32 +13,26 @@ export interface PublishModalProps {
|
|
|
14
13
|
onClose: () => void;
|
|
15
14
|
/** Called when the user confirms the publish/link action */
|
|
16
15
|
onPublish?: (target: PublishTarget, version: string) => void;
|
|
17
|
-
/** Package name shown in the details panel */
|
|
16
|
+
/** Package name shown in the details panel. Omit/empty while still loading — a skeleton renders instead of a placeholder value. */
|
|
18
17
|
packageName?: string;
|
|
19
|
-
/** Currently published version */
|
|
18
|
+
/** Currently published version. Omit/empty while still loading — a skeleton renders instead of a placeholder value. */
|
|
20
19
|
currentVersion?: string;
|
|
21
|
-
/** Suggested next version
|
|
20
|
+
/** Suggested next version. Kept for backwards compatibility; version bumping is automatic server-side and no longer editable in this UI. */
|
|
22
21
|
defaultNextVersion?: string;
|
|
23
22
|
/** The env-determined publish target. There is no in-modal switcher — this is the target. */
|
|
24
23
|
defaultTarget?: PublishTarget;
|
|
25
|
-
/** When true, the publish action is in-flight: disables
|
|
24
|
+
/** When true, the publish action is in-flight: disables Cancel and shows a spinner on the submit button */
|
|
26
25
|
loading?: boolean;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
function bumpMinor(version: string): string {
|
|
30
|
-
const parts = version.split(".").map((n) => parseInt(n, 10) || 0);
|
|
31
|
-
const [major = 0, minor = 0] = parts;
|
|
32
|
-
return `${major}.${minor + 1}.0`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
28
|
export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
36
29
|
(
|
|
37
30
|
{
|
|
38
31
|
isOpen,
|
|
39
32
|
onClose,
|
|
40
33
|
onPublish,
|
|
41
|
-
packageName
|
|
42
|
-
currentVersion
|
|
34
|
+
packageName,
|
|
35
|
+
currentVersion,
|
|
43
36
|
defaultNextVersion,
|
|
44
37
|
defaultTarget = "production",
|
|
45
38
|
loading = false,
|
|
@@ -47,11 +40,14 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
|
47
40
|
ref
|
|
48
41
|
) => {
|
|
49
42
|
const target = defaultTarget;
|
|
50
|
-
const
|
|
51
|
-
defaultNextVersion ?? bumpMinor(currentVersion)
|
|
52
|
-
);
|
|
43
|
+
const version = defaultNextVersion ?? currentVersion ?? "";
|
|
53
44
|
|
|
54
45
|
const isProduction = target === "production";
|
|
46
|
+
const hasPackageName = Boolean(packageName && packageName.length > 0);
|
|
47
|
+
const hasCurrentVersion = Boolean(currentVersion && currentVersion.length > 0);
|
|
48
|
+
// Only reveal the local npm-link UI once we actually have a real package
|
|
49
|
+
// name to link against — never show it as a loading placeholder.
|
|
50
|
+
const showLinkCommand = !isProduction && hasPackageName;
|
|
55
51
|
|
|
56
52
|
const introText = isProduction
|
|
57
53
|
? "Publish your package to the npm registry so others can install and use it."
|
|
@@ -61,7 +57,7 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
|
61
57
|
? "Publishing to npm registry makes your package publicly available to the world. Make sure you're ready to release this version."
|
|
62
58
|
: "Local publish creates an npm link only visible on this machine, for testing and internal use before a real release.";
|
|
63
59
|
|
|
64
|
-
const handlePublish = () => onPublish?.(target,
|
|
60
|
+
const handlePublish = () => onPublish?.(target, version);
|
|
65
61
|
|
|
66
62
|
return (
|
|
67
63
|
<Modal
|
|
@@ -72,25 +68,24 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
|
72
68
|
size="lg"
|
|
73
69
|
footer={
|
|
74
70
|
<div className="flex w-full items-center justify-end gap-sm">
|
|
75
|
-
<Button
|
|
71
|
+
<Button
|
|
72
|
+
type="button"
|
|
73
|
+
variant="secondary"
|
|
74
|
+
onClick={onClose}
|
|
75
|
+
disabled={loading}
|
|
76
|
+
>
|
|
76
77
|
Cancel
|
|
77
78
|
</Button>
|
|
78
79
|
<Button
|
|
80
|
+
type="button"
|
|
79
81
|
variant="primary"
|
|
80
82
|
onClick={handlePublish}
|
|
81
83
|
disabled={loading}
|
|
84
|
+
loading={loading}
|
|
85
|
+
pushEffect={false}
|
|
82
86
|
aria-busy={loading}
|
|
83
87
|
>
|
|
84
|
-
{
|
|
85
|
-
<>
|
|
86
|
-
<Icon name="loading-spinner" size={16} className="animate-spin" />
|
|
87
|
-
{isProduction ? "Publishing…" : "Linking…"}
|
|
88
|
-
</>
|
|
89
|
-
) : isProduction ? (
|
|
90
|
-
"Publish to npm registry"
|
|
91
|
-
) : (
|
|
92
|
-
"Publish locally (npm link)"
|
|
93
|
-
)}
|
|
88
|
+
{isProduction ? "Publish to npm registry" : "Publish locally (npm link)"}
|
|
94
89
|
</Button>
|
|
95
90
|
</div>
|
|
96
91
|
}
|
|
@@ -108,45 +103,34 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
|
|
|
108
103
|
<p className="text-caption uppercase tracking-wide text-muted">
|
|
109
104
|
Package
|
|
110
105
|
</p>
|
|
111
|
-
|
|
106
|
+
{hasPackageName ? (
|
|
107
|
+
<p className="text-body-md text-ink font-mono">{packageName}</p>
|
|
108
|
+
) : (
|
|
109
|
+
<div
|
|
110
|
+
className="h-4 w-40 animate-pulse rounded-sm bg-surface-soft border border-hairline"
|
|
111
|
+
aria-hidden="true"
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
112
114
|
</div>
|
|
113
115
|
|
|
114
116
|
<div className="space-y-xxs">
|
|
115
117
|
<p className="text-caption uppercase tracking-wide text-muted">
|
|
116
118
|
Current version
|
|
117
119
|
</p>
|
|
118
|
-
|
|
119
|
-
<p className="text-body-md text-ink font-mono">{currentVersion}</p>
|
|
120
|
-
<Chip label="Latest" variant="primary" size="sm" />
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
{isProduction ? (
|
|
125
|
-
<div className="space-y-xxs">
|
|
126
|
-
<p className="text-caption uppercase tracking-wide text-muted">
|
|
127
|
-
Next version
|
|
128
|
-
</p>
|
|
120
|
+
{hasCurrentVersion ? (
|
|
129
121
|
<div className="flex items-center gap-xs">
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
value={nextVersion}
|
|
133
|
-
onChange={(e) => setNextVersion(e.target.value)}
|
|
134
|
-
fullWidth
|
|
135
|
-
disabled={loading}
|
|
136
|
-
/>
|
|
137
|
-
<Button
|
|
138
|
-
variant="secondary"
|
|
139
|
-
size="md"
|
|
140
|
-
aria-label="Reset to suggested version"
|
|
141
|
-
onClick={() => setNextVersion(bumpMinor(currentVersion))}
|
|
142
|
-
disabled={loading}
|
|
143
|
-
className="!px-sm"
|
|
144
|
-
>
|
|
145
|
-
<Icon name="refresh" size={16} />
|
|
146
|
-
</Button>
|
|
122
|
+
<p className="text-body-md text-ink font-mono">{currentVersion}</p>
|
|
123
|
+
<Chip label="Latest" variant="primary" size="sm" />
|
|
147
124
|
</div>
|
|
148
|
-
|
|
149
|
-
|
|
125
|
+
) : (
|
|
126
|
+
<div
|
|
127
|
+
className="h-4 w-20 animate-pulse rounded-sm bg-surface-soft border border-hairline"
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
{showLinkCommand && (
|
|
150
134
|
<div className="space-y-xxs">
|
|
151
135
|
<p className="text-caption uppercase tracking-wide text-muted">
|
|
152
136
|
Link command
|