Refactor neurapress imports and add fallbacks
This commit is contained in:
parent
43b44341fd
commit
5c7471a3bf
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,7 +12,6 @@ node_modules/
|
||||
# Next.js build output
|
||||
.next/
|
||||
out/
|
||||
public/_build/
|
||||
public/dl-index/
|
||||
|
||||
# Contentlayer cache
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { MainNav } from '../../components/nav/MainNav'
|
||||
import { Logo } from '../../components/icons/Logo'
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from '../../components/ui'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
Heart,
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { MainNav } from '../../components/nav/MainNav'
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
} from '../../components/ui'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
BookOpen,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { Inter } from 'next/font/google'
|
||||
import './globals.css'
|
||||
import '@/styles/code-themes.css'
|
||||
import '../styles/code-themes.css'
|
||||
import 'katex/dist/katex.min.css'
|
||||
import { ThemeProvider } from '@/components/theme/ThemeProvider'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@/components/GoogleAnalytics'
|
||||
import { ThemeProvider } from '../components/theme/ThemeProvider'
|
||||
import { cn } from '../lib/utils'
|
||||
import { Toaster } from '../components/ui'
|
||||
import { GoogleAnalytics } from '../components/GoogleAnalytics'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Button, Card, CardContent, CardDescription, CardHeader, CardTitle } from '../components/ui'
|
||||
import { MainNav } from '../components/nav/MainNav'
|
||||
import { Logo } from '../components/icons/Logo'
|
||||
import {
|
||||
FileText,
|
||||
Smartphone,
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
|
||||
import dynamic from 'next/dynamic'
|
||||
import { Suspense } from 'react'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { AdBanner } from '@/components/ui/AdBanner'
|
||||
|
||||
import { Logo } from '../../components/icons/Logo'
|
||||
import { AdBanner } from '../../components/ui'
|
||||
|
||||
const LoadingLogo = () => (
|
||||
<div className="h-full bg-background flex items-center justify-center">
|
||||
@ -24,7 +25,7 @@ const LoadingLogo = () => (
|
||||
)
|
||||
|
||||
// Dynamically import WechatEditor with no SSR
|
||||
const WechatEditor = dynamic(() => import('@/components/editor/WechatEditor'), {
|
||||
const WechatEditor = dynamic(() => import('../../components/editor/WechatEditor'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<LoadingLogo />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import XiaohongshuMarkdownEditor from '@/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
import XiaohongshuMarkdownEditor from '../../components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '../../components/ui'
|
||||
|
||||
export default function XiaohongshuPage() {
|
||||
return (
|
||||
|
||||
@ -1,16 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
SheetDescription,
|
||||
SheetHeader,
|
||||
SheetTitle,
|
||||
SheetTrigger,
|
||||
} from '@/components/ui/sheet'
|
||||
import { FileText, Trash2, Menu, Plus, Save, Edit2, Check } from 'lucide-react'
|
||||
|
||||
import { cn } from '../lib/utils'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@ -21,12 +14,18 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { FileText, Trash2, Menu, Plus, Save, Edit2, Check } from 'lucide-react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { Input } from '@/components/ui/input'
|
||||
Button,
|
||||
Input,
|
||||
ScrollArea,
|
||||
Sheet,
|
||||
SheetContent,
|
||||
SheetDescription,
|
||||
SheetHeader,
|
||||
SheetTitle,
|
||||
SheetTrigger,
|
||||
ToastAction,
|
||||
useToast,
|
||||
} from './ui'
|
||||
|
||||
interface Article {
|
||||
id: string
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { codeThemes, type CodeThemeId } from '../../config/code-themes'
|
||||
import { Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui'
|
||||
|
||||
interface CodeThemeSelectorProps {
|
||||
value: CodeThemeId
|
||||
|
||||
@ -1,13 +1,23 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
Input,
|
||||
Label,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '../ui'
|
||||
import { Settings } from 'lucide-react'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { type RendererOptions } from '../../lib/markdown'
|
||||
|
||||
const themeColors = [
|
||||
{ name: '经典黑', value: '#1a1a1a' },
|
||||
|
||||
@ -1,30 +1,36 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useCallback, useRef, useEffect } from 'react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { Copy } from 'lucide-react'
|
||||
|
||||
import { codeThemes, type CodeThemeId } from '../../config/code-themes'
|
||||
import { templates } from '../../config/wechat-templates'
|
||||
import { useLocalStorage } from '../../hooks/use-local-storage'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { getExampleContent } from '../../lib/utils/loadExampleContent'
|
||||
import { type RendererOptions } from '../../lib/markdown'
|
||||
import '../../styles/code-themes.css'
|
||||
import {
|
||||
Button,
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
ToastAction,
|
||||
useToast,
|
||||
} from '../ui'
|
||||
import { useAutoSave } from './hooks/useAutoSave'
|
||||
import { EditorToolbar } from './components/EditorToolbar'
|
||||
import { EditorPreview } from './components/EditorPreview'
|
||||
import { MarkdownToolbar } from './components/MarkdownToolbar'
|
||||
import { type PreviewSize } from './constants'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import '@/styles/code-themes.css'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { usePreviewContent } from './hooks/usePreviewContent'
|
||||
import { useEditorKeyboard } from './hooks/useEditorKeyboard'
|
||||
import { useScrollSync } from './hooks/useScrollSync'
|
||||
import { useWordStats } from './hooks/useWordStats'
|
||||
import { useCopy } from './hooks/useCopy'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { MobileEditor } from './components/MobileEditor'
|
||||
import { DesktopEditor } from './components/DesktopEditor'
|
||||
import { getExampleContent } from '@/lib/utils/loadExampleContent'
|
||||
|
||||
export default function WechatEditor() {
|
||||
const { toast } = useToast()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import { useEditor, EditorContent } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { useState } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { Copy, Eye, Pencil } from 'lucide-react'
|
||||
|
||||
export default function XiaohongshuEditor() {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
|
||||
import { type CodeThemeId } from '../../../config/code-themes'
|
||||
import { templates } from '../../../config/wechat-templates'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { MarkdownToolbar } from './MarkdownToolbar'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
interface DesktopEditorProps {
|
||||
editorRef: RefObject<HTMLDivElement>
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
'use client'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { PREVIEW_SIZES, type PreviewSize } from '../constants'
|
||||
import { Loader2, ZoomIn, ZoomOut, Maximize2, Minimize2 } from 'lucide-react'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { useState, useRef, useEffect, useMemo } from 'react'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { useTheme } from 'next-themes'
|
||||
import '@/styles/code-themes.css'
|
||||
import { Loader2, ZoomIn, ZoomOut, Maximize2, Minimize2 } from 'lucide-react'
|
||||
import mermaid from 'mermaid'
|
||||
import { useTheme } from 'next-themes'
|
||||
|
||||
import { type CodeThemeId } from '../../../config/code-themes'
|
||||
import { templates } from '../../../config/wechat-templates'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import '../../../styles/code-themes.css'
|
||||
import { PREVIEW_SIZES, type PreviewSize } from '../constants'
|
||||
import { useScrollSync } from '../hooks/useScrollSync'
|
||||
|
||||
interface EditorPreviewProps {
|
||||
|
||||
@ -1,23 +1,26 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { useState } from 'react'
|
||||
import { Copy, Plus, Save, Smartphone, Settings, Github, Trash2 } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
|
||||
import { codeThemes, type CodeThemeId } from '../../../config/code-themes'
|
||||
import { useLocalStorage } from '../../../hooks/use-local-storage'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { type RendererOptions } from '../../../lib/markdown'
|
||||
import { ArticleList } from '../../ArticleList'
|
||||
import { Logo } from '../../icons/Logo'
|
||||
import { ThemeToggle } from '../../theme/ThemeToggle'
|
||||
import {
|
||||
Button,
|
||||
ToastAction,
|
||||
useToast,
|
||||
} from '../../ui'
|
||||
import { TemplateManager } from '../../template/TemplateManager'
|
||||
import { StyleConfigDialog } from '../StyleConfigDialog'
|
||||
import { ArticleList } from '@/components/ArticleList'
|
||||
import { type Article } from '../constants'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { ThemeToggle } from '@/components/theme/ThemeToggle'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
import { CodeThemeSelector } from '../CodeThemeSelector'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { StyleConfigDialog } from '../StyleConfigDialog'
|
||||
import { type Article } from '../constants'
|
||||
|
||||
interface EditorToolbarProps {
|
||||
value: string
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog"
|
||||
import { Button } from "@/components/ui/button"
|
||||
} from '../../ui'
|
||||
import { HelpCircle } from 'lucide-react'
|
||||
|
||||
const cheatSheet = [
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
|
||||
import { Button, Separator, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
|
||||
import { type CodeThemeId } from '../../../config/code-themes'
|
||||
import { Button, Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
interface MobileEditorProps {
|
||||
textareaRef: RefObject<HTMLTextAreaElement>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Copy, Save, Settings } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'
|
||||
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '../../ui'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
|
||||
interface MobileToolbarProps {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@/lib/markdown/mermaid-utils'
|
||||
|
||||
import { initializeMermaid } from '../../../lib/markdown/mermaid-utils'
|
||||
import { useToast } from '../../ui'
|
||||
|
||||
export const useCopy = () => {
|
||||
const { toast } = useToast()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '@/lib/markdown'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@/lib/markdown/mermaid-utils'
|
||||
import { templates } from '../../../config/wechat-templates'
|
||||
import { type CodeThemeId } from '../../../config/code-themes'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '../../../lib/markdown'
|
||||
import { initializeMermaid } from '../../../lib/markdown/mermaid-utils'
|
||||
import { useToast } from '../../ui'
|
||||
|
||||
interface UsePreviewContentProps {
|
||||
value: string
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { convertToWechat } from '@/lib/markdown'
|
||||
import { convertToWechat } from '../../../lib/markdown'
|
||||
|
||||
// 计算阅读时间(假设每分钟阅读300字)
|
||||
const calculateReadingTime = (text: string): string => {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useRef, useEffect } from 'react'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
|
||||
import { TooltipProvider } from '../../ui'
|
||||
import { XiaohongshuToolbar } from './components/XiaohongshuToolbar'
|
||||
import { XiaohongshuEditor } from './components/XiaohongshuEditor'
|
||||
import { XiaohongshuPreview } from './components/XiaohongshuPreview'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { Textarea } from '../../../ui'
|
||||
import { XiaohongshuMarkdownToolbar } from './XiaohongshuMarkdownToolbar'
|
||||
|
||||
interface XiaohongshuEditorProps {
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
|
||||
import { Button, Separator, Tooltip, TooltipContent, TooltipTrigger } from '../../../ui'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { ZoomIn, ZoomOut, Maximize2, Minimize2, ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { xiaohongshuTemplates, type XiaohongshuTemplateId, type PageMode, type PageNumberPosition } from '../constants'
|
||||
|
||||
interface XiaohongshuPreviewProps {
|
||||
|
||||
@ -1,12 +1,23 @@
|
||||
'use client'
|
||||
|
||||
import { Save, Copy, Palette, Image as ImageIcon, Settings, FileText } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import Link from 'next/link'
|
||||
import { Save, Copy, Palette, Image as ImageIcon, Settings, FileText } from 'lucide-react'
|
||||
|
||||
import { Logo } from '../../../icons/Logo'
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
Label,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '../../../ui'
|
||||
import {
|
||||
xiaohongshuTemplates,
|
||||
pageModes,
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import html2canvas from 'html2canvas'
|
||||
import JSZip from 'jszip'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
|
||||
import { useToast } from '../../../ui'
|
||||
import type { PageMode } from '../constants'
|
||||
|
||||
export function useImageGeneration() {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { marked } from 'marked'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
|
||||
import { useToast } from '../../../ui'
|
||||
import { defaultMarkdown, STORAGE_KEYS, type XiaohongshuTemplateId } from '../constants'
|
||||
|
||||
export function useXiaohongshuEditor() {
|
||||
|
||||
@ -2,11 +2,12 @@
|
||||
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { ThemeToggle } from '@/components/theme-toggle'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Github } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
import { cn } from '../../lib/utils'
|
||||
import { Logo } from '../icons/Logo'
|
||||
import { ThemeToggle } from '../theme-toggle'
|
||||
import { Button } from '../ui'
|
||||
|
||||
const navigation = [
|
||||
{ name: '微信公众号', href: '/wechat' },
|
||||
|
||||
@ -1,16 +1,26 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Settings2, Download, Upload, Star, Plus } from 'lucide-react'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { templates as defaultTemplates, type Template } from '@/config/wechat-templates'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { templates as defaultTemplates, type Template } from '../../config/wechat-templates'
|
||||
import { useLocalStorage } from '../../hooks/use-local-storage'
|
||||
import { cn } from '../../lib/utils'
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
Input,
|
||||
Label,
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
Textarea,
|
||||
} from '../ui'
|
||||
|
||||
interface TemplateManagerProps {
|
||||
onTemplateChange: () => void
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { Check } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { templates } from '../../config/wechat-templates'
|
||||
import { cn } from '../../lib/utils'
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { Button } from "@/components/ui/button"
|
||||
} from '../ui'
|
||||
|
||||
interface WechatStylePickerProps {
|
||||
value?: string
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
import { Check, ChevronDown } from "lucide-react"
|
||||
import * as SelectPrimitive from '@radix-ui/react-select'
|
||||
import { cn } from "@/lib/utils"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { templates } from '../../config/wechat-templates'
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
export function WechatTemplateSelector({
|
||||
onSelectAction
|
||||
|
||||
@ -4,13 +4,13 @@ import * as React from "react"
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "next-themes"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Button } from "./ui"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
} from "./ui"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { setTheme } = useTheme()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "next-themes"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Button } from "../ui"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { X } from "lucide-react"
|
||||
import { Button } from "./button"
|
||||
import { Card } from "./card"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
interface AdBannerProps {
|
||||
id?: string // 广告ID,用于本地存储
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
import * as React from "react"
|
||||
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
import { cn } from "../../lib/utils"
|
||||
import { buttonVariants } from "./button"
|
||||
|
||||
const AlertDialog = AlertDialogPrimitive.Root
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Dialog = DialogPrimitive.Root
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
||||
import { Check, ChevronRight, Circle } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root
|
||||
|
||||
|
||||
19
packages/neurapress/src/components/ui/index.ts
Normal file
19
packages/neurapress/src/components/ui/index.ts
Normal file
@ -0,0 +1,19 @@
|
||||
export * from "./AdBanner"
|
||||
export * from "./alert-dialog"
|
||||
export * from "./button"
|
||||
export * from "./card"
|
||||
export * from "./dialog"
|
||||
export * from "./dropdown-menu"
|
||||
export * from "./input"
|
||||
export * from "./label"
|
||||
export * from "./scroll-area"
|
||||
export * from "./select"
|
||||
export * from "./separator"
|
||||
export * from "./sheet"
|
||||
export * from "./tabs"
|
||||
export * from "./textarea"
|
||||
export * from "./toast"
|
||||
export * from "./toaster"
|
||||
export * from "./toggle"
|
||||
export * from "./tooltip"
|
||||
export * from "./use-toast"
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
export interface InputProps
|
||||
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const labelVariants = cva(
|
||||
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const ScrollArea = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Select = SelectPrimitive.Root
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Separator = React.forwardRef<
|
||||
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
||||
|
||||
@ -5,7 +5,7 @@ import * as SheetPrimitive from "@radix-ui/react-dialog"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Sheet = SheetPrimitive.Root
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import * as React from "react"
|
||||
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
export interface TextareaProps
|
||||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
||||
|
||||
@ -5,7 +5,7 @@ import * as ToastPrimitives from "@radix-ui/react-toast"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const ToastProvider = ToastPrimitives.Provider
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import {
|
||||
ToastProvider,
|
||||
ToastTitle,
|
||||
ToastViewport,
|
||||
} from "@/components/ui/toast"
|
||||
import { useToast } from "@/components/ui/use-toast"
|
||||
} from "./toast"
|
||||
import { useToast } from "./use-toast"
|
||||
|
||||
export function Toaster() {
|
||||
const { toasts } = useToast()
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const toggleVariants = cva(
|
||||
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "../../lib/utils"
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import * as React from "react"
|
||||
import type {
|
||||
ToastActionElement,
|
||||
ToastProps,
|
||||
} from "@/components/ui/toast"
|
||||
} from "./toast"
|
||||
|
||||
const TOAST_LIMIT = 1
|
||||
const TOAST_REMOVE_DELAY = 1000000
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { RendererOptions } from '@/lib/markdown'
|
||||
import type { RendererOptions } from '../lib/markdown'
|
||||
|
||||
export interface Template {
|
||||
id: string
|
||||
|
||||
@ -16,7 +16,7 @@ import 'prismjs/components/prism-rust'
|
||||
import 'prismjs/components/prism-sql'
|
||||
import 'prismjs/components/prism-docker'
|
||||
import 'prismjs/components/prism-nginx'
|
||||
import type { CodeThemeId } from '@/config/code-themes'
|
||||
import type { CodeThemeId } from '../../config/code-themes'
|
||||
import { getTokenStyles } from './styles'
|
||||
|
||||
// Helper function to recursively process tokens
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { StyleOptions, RendererOptions } from './types'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { codeThemes, type CodeThemeId } from '../../config/code-themes'
|
||||
|
||||
// 将样式对象转换为 CSS 字符串
|
||||
export function cssPropertiesToString(style: StyleOptions = {}): string {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
import type { CodeThemeId } from '@/config/code-themes'
|
||||
import type { CodeThemeId } from '../../config/code-themes'
|
||||
|
||||
export interface StyleOptions {
|
||||
// Layout
|
||||
|
||||
1
public/_build/artifacts-manifest.json
Normal file
1
public/_build/artifacts-manifest.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
public/_build/cloud_iac_index.json
Normal file
1
public/_build/cloud_iac_index.json
Normal file
@ -0,0 +1 @@
|
||||
{"providers":[]}
|
||||
1
public/_build/docs_index.json
Normal file
1
public/_build/docs_index.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
public/_build/offline-package.json
Normal file
1
public/_build/offline-package.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
@ -906,7 +906,7 @@ __metadata:
|
||||
|
||||
"@internal/neurapress@file:./packages/neurapress::locator=cloudnative-dashboard%40workspace%3A.":
|
||||
version: 0.1.0
|
||||
resolution: "@internal/neurapress@file:./packages/neurapress#./packages/neurapress::hash=eebfa0&locator=cloudnative-dashboard%40workspace%3A."
|
||||
resolution: "@internal/neurapress@file:./packages/neurapress#./packages/neurapress::hash=706023&locator=cloudnative-dashboard%40workspace%3A."
|
||||
dependencies:
|
||||
"@radix-ui/react-alert-dialog": "npm:^1.1.5"
|
||||
"@radix-ui/react-dialog": "npm:^1.1.5"
|
||||
@ -945,7 +945,7 @@ __metadata:
|
||||
react-dom: "npm:^18.2.0"
|
||||
tailwind-merge: "npm:^2.6.0"
|
||||
tailwindcss-animate: "npm:^1.0.7"
|
||||
checksum: 10/16eca58164408c27beb16bdcc3b480f424d77df7df45f473ec9b17629851849265605c313d90aa61ee31793ecb870e056457a8e938f5dde3310f43ad4c417f8f
|
||||
checksum: 10/8b8b43233562f1d57f189c60d356aa3934875b6a2d5cc4ba6760925d3c97831694398fe59e4f8b73770376a9111f429563e21096c28c02e56a02a5221901b540
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user