jamdesk 1.1.133 → 1.1.135
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamdesk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.135",
|
|
4
4
|
"description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jamdesk",
|
|
@@ -71,7 +71,22 @@ export function Widget({
|
|
|
71
71
|
const resolvedBase = slug ? `https://${slug}.jamdesk.app${prefix}` : '';
|
|
72
72
|
|
|
73
73
|
useEffect(() => {
|
|
74
|
-
if (!resolvedBase)
|
|
74
|
+
if (!resolvedBase) {
|
|
75
|
+
// No project slug in this context, so there's no canonical
|
|
76
|
+
// <slug>.jamdesk.app origin to bind the trigger to (see resolvedBase
|
|
77
|
+
// above). That's the normal state in local `jamdesk dev`, which runs a
|
|
78
|
+
// single project with no slug — the deployed multi-tenant build gets the
|
|
79
|
+
// slug from middleware's x-project-slug header. Without this line the
|
|
80
|
+
// button looks broken: no script, no click listener, and nothing in the
|
|
81
|
+
// console. Surface a one-line hint instead. Never fires in production,
|
|
82
|
+
// where the slug is always set.
|
|
83
|
+
console.info(
|
|
84
|
+
"[Jamdesk Widget] Live demo is inert here — the trigger binds to " +
|
|
85
|
+
"https://<slug>.jamdesk.app and only runs on the deployed docs site, " +
|
|
86
|
+
"not in local `jamdesk dev`.",
|
|
87
|
+
);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
75
90
|
const triggerSel = trigger ?? `#${buttonId}`;
|
|
76
91
|
|
|
77
92
|
// Idempotent guard. React Strict Mode double-invokes effects (mount →
|
|
@@ -114,12 +129,12 @@ export function Widget({
|
|
|
114
129
|
|
|
115
130
|
if (trigger) return null;
|
|
116
131
|
|
|
117
|
-
|
|
132
|
+
const buttonEl = (
|
|
118
133
|
<button
|
|
119
134
|
type="button"
|
|
120
135
|
id={buttonId}
|
|
121
136
|
className={
|
|
122
|
-
'jd-widget-trigger
|
|
137
|
+
'jd-widget-trigger inline-flex cursor-pointer items-center gap-2 rounded-lg ' +
|
|
123
138
|
'border border-gray-200 bg-white px-4 py-2 text-sm font-medium ' +
|
|
124
139
|
'text-gray-900 shadow-sm transition hover:shadow-md ' +
|
|
125
140
|
'dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100' +
|
|
@@ -130,4 +145,23 @@ export function Widget({
|
|
|
130
145
|
{label}
|
|
131
146
|
</button>
|
|
132
147
|
);
|
|
148
|
+
|
|
149
|
+
// No slug → the trigger can't bind (see the effect above), which is the
|
|
150
|
+
// normal state in local `jamdesk dev`. Render a visible caption beside the
|
|
151
|
+
// button so a clicked-but-inert button doesn't read as broken — the console
|
|
152
|
+
// hint alone is invisible to anyone without devtools open. Never renders in
|
|
153
|
+
// the deployed build, where the slug is always set and the button works.
|
|
154
|
+
if (!resolvedBase) {
|
|
155
|
+
return (
|
|
156
|
+
<span className="jd-widget-preview my-4 flex flex-col items-start gap-1.5">
|
|
157
|
+
{buttonEl}
|
|
158
|
+
<span className="text-xs text-gray-500 dark:text-gray-400">
|
|
159
|
+
Live preview — opens on your deployed docs site, not in local{' '}
|
|
160
|
+
<code className="rounded bg-gray-100 px-1 py-0.5 dark:bg-gray-800">jamdesk dev</code>.
|
|
161
|
+
</span>
|
|
162
|
+
</span>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return <span className="jd-widget my-4 inline-flex">{buttonEl}</span>;
|
|
133
167
|
}
|