@onexapis/cli 1.1.13 → 1.1.15
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/dist/cli.js +15 -24
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +15 -24
- package/dist/cli.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +2 -61
- package/package.json +1 -1
|
@@ -297,27 +297,24 @@ function PreviewApp() {
|
|
|
297
297
|
|
|
298
298
|
ws.onopen = () => {
|
|
299
299
|
setWsStatus("connected");
|
|
300
|
-
|
|
300
|
+
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
ws.onmessage = (event) => {
|
|
304
304
|
const msg = JSON.parse(event.data);
|
|
305
305
|
if (msg.type === "reload") {
|
|
306
306
|
setWsStatus("rebuilding");
|
|
307
|
-
updateToolbar("rebuilding", "Reloading...");
|
|
308
307
|
loadTheme(msg.timestamp).then(() => {
|
|
309
308
|
setWsStatus("connected");
|
|
310
|
-
|
|
309
|
+
|
|
311
310
|
});
|
|
312
311
|
} else if (msg.type === "error") {
|
|
313
312
|
setError(msg.message);
|
|
314
|
-
updateToolbar("disconnected", "Build Error");
|
|
315
313
|
}
|
|
316
314
|
};
|
|
317
315
|
|
|
318
316
|
ws.onclose = () => {
|
|
319
317
|
setWsStatus("disconnected");
|
|
320
|
-
updateToolbar("disconnected", "Disconnected");
|
|
321
318
|
// Auto-reconnect after 2s
|
|
322
319
|
setTimeout(connect, 2000);
|
|
323
320
|
};
|
|
@@ -459,52 +456,6 @@ function PreviewApp() {
|
|
|
459
456
|
|
|
460
457
|
return (
|
|
461
458
|
<>
|
|
462
|
-
{/* Page selector (if multiple pages) */}
|
|
463
|
-
{pages.length > 1 && (
|
|
464
|
-
<div
|
|
465
|
-
style={{
|
|
466
|
-
position: "fixed",
|
|
467
|
-
top: 40,
|
|
468
|
-
right: 16,
|
|
469
|
-
zIndex: 9998,
|
|
470
|
-
background: "white",
|
|
471
|
-
borderRadius: 8,
|
|
472
|
-
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
473
|
-
padding: "4px 8px",
|
|
474
|
-
display: "flex",
|
|
475
|
-
gap: 4,
|
|
476
|
-
}}
|
|
477
|
-
>
|
|
478
|
-
{pages.map((page, i) => {
|
|
479
|
-
const pageSlug = page.key.replace("PageConfig", "").toLowerCase();
|
|
480
|
-
const pagePath = pageSlug === "home" ? "/" : `/${pageSlug}`;
|
|
481
|
-
return (
|
|
482
|
-
<button
|
|
483
|
-
key={page.key}
|
|
484
|
-
onClick={() => {
|
|
485
|
-
setSelectedPage(i);
|
|
486
|
-
window.history.pushState(null, "", pagePath);
|
|
487
|
-
const el = document.getElementById("page-indicator");
|
|
488
|
-
if (el) el.textContent = page.label;
|
|
489
|
-
}}
|
|
490
|
-
style={{
|
|
491
|
-
padding: "4px 12px",
|
|
492
|
-
border: "none",
|
|
493
|
-
borderRadius: 4,
|
|
494
|
-
cursor: "pointer",
|
|
495
|
-
background: i === resolvedPage ? "#E11D48" : "transparent",
|
|
496
|
-
color: i === resolvedPage ? "white" : "#333",
|
|
497
|
-
fontSize: 12,
|
|
498
|
-
fontWeight: 500,
|
|
499
|
-
}}
|
|
500
|
-
>
|
|
501
|
-
{page.label}
|
|
502
|
-
</button>
|
|
503
|
-
);
|
|
504
|
-
})}
|
|
505
|
-
</div>
|
|
506
|
-
)}
|
|
507
|
-
|
|
508
459
|
{/* Render sections */}
|
|
509
460
|
{sections.map(({ section, registration }: any) => {
|
|
510
461
|
if (!registration) {
|
|
@@ -540,16 +491,6 @@ function PreviewApp() {
|
|
|
540
491
|
);
|
|
541
492
|
}
|
|
542
493
|
|
|
543
|
-
function updateToolbar(status: string, label: string) {
|
|
544
|
-
const statusEl = document.getElementById("ws-status");
|
|
545
|
-
const labelEl = document.getElementById("ws-label");
|
|
546
|
-
if (statusEl) {
|
|
547
|
-
statusEl.className = `status ${status}`;
|
|
548
|
-
}
|
|
549
|
-
if (labelEl) {
|
|
550
|
-
labelEl.textContent = label;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
494
|
|
|
554
495
|
// ===== 7. MOUNT =====
|
|
555
496
|
|