@aravindc26/velu 0.13.14 → 0.13.16

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": "@aravindc26/velu",
3
- "version": "0.13.14",
3
+ "version": "0.13.16",
4
4
  "description": "A modern documentation site generator powered by Markdown and JSON configuration",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,9 +1,9 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { RootProvider } from 'fumadocs-ui/provider/next';
3
3
  import './global.css';
4
- import '@core/css/shared.css';
5
- import '@core/css/search.css';
6
- import '@core/css/copy-page.css';
4
+ import '../../engine-core/css/shared.css';
5
+ import '../../engine-core/css/search.css';
6
+ import '../../engine-core/css/copy-page.css';
7
7
 
8
8
  export const metadata = {
9
9
  title: 'Preview',
@@ -1,14 +1,14 @@
1
1
  import type { Metadata } from 'next';
2
2
  import type { ReactNode } from 'react';
3
- import { getAppearance, getBannerConfig, getFontsConfig, getSeoConfig, getSiteDescription, getSiteFavicon, getSiteName, getSiteOrigin, getSitePrimaryColor } from '@/lib/velu';
3
+ import { getAppearance, getBannerConfig, getCliVersion, getFontsConfig, getSeoConfig, getSiteDescription, getSiteFavicon, getSiteName, getSiteOrigin, getSitePrimaryColor } from '@/lib/velu';
4
4
  import { Providers } from '@/components/providers';
5
5
  import { VeluAssistant } from '@/components/assistant';
6
6
  import { VeluBanner } from '@/components/banner';
7
7
  import './global.css';
8
- import '@core/css/shared.css';
9
- import '@core/css/search.css';
10
- import '@core/css/assistant.css';
11
- import '@core/css/copy-page.css';
8
+ import '../engine-core/css/shared.css';
9
+ import '../engine-core/css/search.css';
10
+ import '../engine-core/css/assistant.css';
11
+ import '../engine-core/css/copy-page.css';
12
12
 
13
13
  function toAbsoluteUrl(origin: string, value: string): string {
14
14
  const trimmed = value.trim();
@@ -80,6 +80,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
80
80
  return (
81
81
  <html lang="en" suppressHydrationWarning>
82
82
  <head>
83
+ <meta name="generator" content={`velu-cli ${getCliVersion()}`} />
83
84
  <link rel="sitemap" type="application/xml" href={`${siteOrigin}/sitemap.xml`} />
84
85
  {fontsConfig && (() => {
85
86
  // Collect Google Fonts families that don't use a custom source
@@ -1032,3 +1032,14 @@ export function getSiteOrigin(src?: VeluConfigSource): string {
1032
1032
 
1033
1033
  return 'http://localhost:4321';
1034
1034
  }
1035
+
1036
+ export function getCliVersion(): string {
1037
+ try {
1038
+ const constPath = resolve(process.cwd(), 'public', 'const.json');
1039
+ if (existsSync(constPath)) {
1040
+ const parsed = JSON.parse(readFileSync(constPath, 'utf-8'));
1041
+ if (typeof parsed.version === 'string') return parsed.version;
1042
+ }
1043
+ } catch {}
1044
+ return 'unknown';
1045
+ }
@@ -478,7 +478,59 @@ function initAssistant() {
478
478
  if (savedConvToken) state.conversationToken = savedConvToken;
479
479
  if (savedSeq) state.lastSeq = parseInt(savedSeq, 10) || 0;
480
480
  if (savedFeedback) try { state.feedback = JSON.parse(savedFeedback); } catch {}
481
- if (savedMessages) messagesEl.innerHTML = savedMessages;
481
+ if (savedMessages) {
482
+ messagesEl.innerHTML = savedMessages;
483
+ // Re-bind action handlers on restored messages
484
+ messagesEl.querySelectorAll('.velu-msg-assistant').forEach((msgDiv) => {
485
+ const messageId = msgDiv.getAttribute('data-message-id');
486
+ const mid = messageId ? parseInt(messageId, 10) : null;
487
+ const likeBtn = msgDiv.querySelector('.velu-msg-like') as HTMLElement | null;
488
+ const dislikeBtn = msgDiv.querySelector('.velu-msg-dislike') as HTMLElement | null;
489
+ const copyBtn = msgDiv.querySelector('.velu-msg-copy') as HTMLElement | null;
490
+ const bubble = msgDiv.querySelector('.velu-msg-bubble') as HTMLElement | null;
491
+
492
+ if (likeBtn && dislikeBtn && mid) {
493
+ likeBtn.onclick = () => {
494
+ const isActive = likeBtn.classList.contains('velu-msg-action-active');
495
+ if (isActive) {
496
+ likeBtn.classList.remove('velu-msg-action-active');
497
+ delete state.feedback[mid];
498
+ saveFeedbackState();
499
+ retractFeedback(mid).catch(() => {});
500
+ } else {
501
+ likeBtn.classList.add('velu-msg-action-active');
502
+ dislikeBtn.classList.remove('velu-msg-action-active');
503
+ state.feedback[mid] = 'up';
504
+ saveFeedbackState();
505
+ submitFeedback(mid, 'up').catch(() => {});
506
+ }
507
+ };
508
+ dislikeBtn.onclick = () => {
509
+ const isActive = dislikeBtn.classList.contains('velu-msg-action-active');
510
+ if (isActive) {
511
+ dislikeBtn.classList.remove('velu-msg-action-active');
512
+ delete state.feedback[mid];
513
+ saveFeedbackState();
514
+ retractFeedback(mid).catch(() => {});
515
+ } else {
516
+ dislikeBtn.classList.add('velu-msg-action-active');
517
+ likeBtn.classList.remove('velu-msg-action-active');
518
+ state.feedback[mid] = 'down';
519
+ saveFeedbackState();
520
+ submitFeedback(mid, 'down').catch(() => {});
521
+ }
522
+ };
523
+ }
524
+ if (copyBtn && bubble) {
525
+ copyBtn.onclick = () => {
526
+ navigator.clipboard.writeText(bubble.textContent || '');
527
+ copyBtn.classList.add('velu-msg-action-active');
528
+ copyBtn.title = 'Copied!';
529
+ setTimeout(() => { copyBtn.classList.remove('velu-msg-action-active'); copyBtn.title = 'Copy'; }, 1500);
530
+ };
531
+ }
532
+ });
533
+ }
482
534
  if (savedExpanded === '1') {
483
535
  state.expanded = true;
484
536
  panel.classList.add('velu-assistant-expanded');