chore(neurapress): sync packages/neurapress with upstream source
This commit is contained in:
parent
be795498b9
commit
e3bf8d1762
2
.gitignore
vendored
2
.gitignore
vendored
@ -35,6 +35,8 @@ dashboard/.yarn/
|
||||
dashboard/config/.runtime-env-config.yaml
|
||||
dashboard/config/.runtime-env-config.cn.yaml
|
||||
dashboard/config/.runtime-env-config.global.yaml
|
||||
packages/neurapress/.github/
|
||||
packages/neurapress/.git/
|
||||
|
||||
# Test files and test data
|
||||
tests/local/
|
||||
|
||||
@ -1,21 +1,7 @@
|
||||
{
|
||||
"name": "@internal/neurapress",
|
||||
"name": "neurapress",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"module": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./src/index.ts"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./*": {
|
||||
"types": "./src/*",
|
||||
"import": "./src/*"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_NO_WARNINGS=1 next dev",
|
||||
"build": "NODE_NO_WARNINGS=1 next build",
|
||||
@ -53,9 +39,11 @@
|
||||
"lucide-react": "^0.474.0",
|
||||
"marked": "^16.0.0",
|
||||
"mermaid": "^11.4.1",
|
||||
"next": "^16.0.0",
|
||||
"next": "14.1.0",
|
||||
"next-themes": "^0.4.4",
|
||||
"prismjs": "^1.29.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"tailwind-merge": "^2.6.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
@ -70,9 +58,5 @@
|
||||
"postcss": "^8.5.1",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
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 Link from 'next/link'
|
||||
import {
|
||||
Heart,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@internal/neurapress/components/ui/tabs'
|
||||
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 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 '@internal/neurapress/styles/code-themes.css'
|
||||
import '@/styles/code-themes.css'
|
||||
import 'katex/dist/katex.min.css'
|
||||
import { ThemeProvider } from '@internal/neurapress/components/theme/ThemeProvider'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Toaster } from '@internal/neurapress/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@internal/neurapress/components/GoogleAnalytics'
|
||||
import { ThemeProvider } from '@/components/theme/ThemeProvider'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@/components/GoogleAnalytics'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
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 {
|
||||
FileText,
|
||||
Smartphone,
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
import dynamic from 'next/dynamic'
|
||||
import { Suspense } from 'react'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { AdBanner } from '@internal/neurapress/components/ui/AdBanner'
|
||||
import { AdBanner } from '@/components/ui/AdBanner'
|
||||
|
||||
const LoadingLogo = () => (
|
||||
<div className="h-full bg-background flex items-center justify-center">
|
||||
@ -24,7 +24,7 @@ const LoadingLogo = () => (
|
||||
)
|
||||
|
||||
// Dynamically import WechatEditor with no SSR
|
||||
const WechatEditor = dynamic(() => import('@internal/neurapress/components/editor/WechatEditor'), {
|
||||
const WechatEditor = dynamic(() => import('@/components/editor/WechatEditor'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<LoadingLogo />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import XiaohongshuMarkdownEditor from '@internal/neurapress/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@internal/neurapress/components/ui/toaster'
|
||||
import XiaohongshuMarkdownEditor from '@/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
|
||||
export default function XiaohongshuPage() {
|
||||
return (
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
@ -10,7 +10,7 @@ import {
|
||||
SheetHeader,
|
||||
SheetTitle,
|
||||
SheetTrigger,
|
||||
} from '@internal/neurapress/components/ui/sheet'
|
||||
} from '@/components/ui/sheet'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@ -21,12 +21,12 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@internal/neurapress/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@internal/neurapress/components/ui/scroll-area'
|
||||
} 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 '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { Input } from '@/components/ui/input'
|
||||
|
||||
interface Article {
|
||||
id: string
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/neurapress/components/ui/select'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { Label } from '@/components/ui/label'
|
||||
|
||||
interface CodeThemeSelectorProps {
|
||||
value: CodeThemeId
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
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 { Settings } from 'lucide-react'
|
||||
import { type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/neurapress/components/ui/select'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
|
||||
const themeColors = [
|
||||
{ name: '经典黑', value: '#1a1a1a' },
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useCallback, useRef, useEffect } from 'react'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
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 '@internal/neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import '@internal/neurapress/styles/code-themes.css'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
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 '@internal/neurapress/components/ui/tabs'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
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 '@internal/neurapress/lib/utils/loadExampleContent'
|
||||
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 '@internal/neurapress/lib/utils'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Copy, Eye, Pencil } from 'lucide-react'
|
||||
|
||||
export default function XiaohongshuEditor() {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { MarkdownToolbar } from './MarkdownToolbar'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
interface DesktopEditorProps {
|
||||
editorRef: RefObject<HTMLDivElement>
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { PREVIEW_SIZES, type PreviewSize } from '../constants'
|
||||
import { Loader2, ZoomIn, ZoomOut, Maximize2, Minimize2 } from 'lucide-react'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { useState, useRef, useEffect, useMemo } from 'react'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { useTheme } from 'next-themes'
|
||||
import '@internal/neurapress/styles/code-themes.css'
|
||||
import '@/styles/code-themes.css'
|
||||
import mermaid from 'mermaid'
|
||||
import { useScrollSync } from '../hooks/useScrollSync'
|
||||
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Copy, Plus, Save, Smartphone, Settings, Github, Trash2 } from 'lucide-react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
import { TemplateManager } from '../../template/TemplateManager'
|
||||
import { StyleConfigDialog } from '../StyleConfigDialog'
|
||||
import { ArticleList } from '@internal/neurapress/components/ArticleList'
|
||||
import { ArticleList } from '@/components/ArticleList'
|
||||
import { type Article } from '../constants'
|
||||
import { type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { ThemeToggle } from '@internal/neurapress/components/theme/ThemeToggle'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
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 '@internal/neurapress/components/ui/button'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { CodeThemeSelector } from '../CodeThemeSelector'
|
||||
import { useLocalStorage } from '@internal/neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
interface EditorToolbarProps {
|
||||
value: string
|
||||
|
||||
@ -5,8 +5,8 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@internal/neurapress/components/ui/dialog"
|
||||
import { Button } from "@internal/neurapress/components/ui/button"
|
||||
} from "@/components/ui/dialog"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { HelpCircle } from 'lucide-react'
|
||||
|
||||
const cheatSheet = [
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@internal/neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@internal/neurapress/components/ui/separator'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@internal/neurapress/components/ui/tabs'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
interface MobileEditorProps {
|
||||
textareaRef: RefObject<HTMLTextAreaElement>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Copy, Save, Settings } from 'lucide-react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@internal/neurapress/components/ui/sheet'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
|
||||
interface MobileToolbarProps {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@internal/neurapress/lib/markdown/mermaid-utils'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@/lib/markdown/mermaid-utils'
|
||||
|
||||
export const useCopy = () => {
|
||||
const { toast } = useToast()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@internal/neurapress/lib/markdown/mermaid-utils'
|
||||
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'
|
||||
|
||||
interface UsePreviewContentProps {
|
||||
value: string
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { convertToWechat } from '@internal/neurapress/lib/markdown'
|
||||
import { convertToWechat } from '@/lib/markdown'
|
||||
|
||||
// 计算阅读时间(假设每分钟阅读300字)
|
||||
const calculateReadingTime = (text: string): string => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useRef, useEffect } from 'react'
|
||||
import { TooltipProvider } from '@internal/neurapress/components/ui/tooltip'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { XiaohongshuToolbar } from './components/XiaohongshuToolbar'
|
||||
import { XiaohongshuEditor } from './components/XiaohongshuEditor'
|
||||
import { XiaohongshuPreview } from './components/XiaohongshuPreview'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { Textarea } from '@internal/neurapress/components/ui/textarea'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { XiaohongshuMarkdownToolbar } from './XiaohongshuMarkdownToolbar'
|
||||
|
||||
interface XiaohongshuEditorProps {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@internal/neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@internal/neurapress/components/ui/separator'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { ZoomIn, ZoomOut, Maximize2, Minimize2, ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { xiaohongshuTemplates, type XiaohongshuTemplateId, type PageMode, type PageNumberPosition } from '../constants'
|
||||
|
||||
interface XiaohongshuPreviewProps {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import { Save, Copy, Palette, Image as ImageIcon, Settings, FileText } from 'lucide-react'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/neurapress/components/ui/select'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
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 {
|
||||
xiaohongshuTemplates,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import html2canvas from 'html2canvas'
|
||||
import JSZip from 'jszip'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import type { PageMode } from '../constants'
|
||||
|
||||
export function useImageGeneration() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { marked } from 'marked'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { defaultMarkdown, STORAGE_KEYS, type XiaohongshuTemplateId } from '../constants'
|
||||
|
||||
export function useXiaohongshuEditor() {
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { ThemeToggle } from '@internal/neurapress/components/theme-toggle'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
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 '@internal/neurapress/components/ui/button'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
const navigation = [
|
||||
{ name: '微信公众号', href: '/wechat' },
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
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 '@internal/neurapress/components/ui/tabs'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Textarea } from '@internal/neurapress/components/ui/textarea'
|
||||
import { templates as defaultTemplates, type Template } from '@internal/neurapress/config/wechat-templates'
|
||||
import { useLocalStorage } from '@internal/neurapress/hooks/use-local-storage'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
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'
|
||||
|
||||
interface TemplateManagerProps {
|
||||
onTemplateChange: () => void
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { Check } from 'lucide-react'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { cn } from '@/lib/utils'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@internal/neurapress/components/ui/dialog"
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { Button } from "@internal/neurapress/components/ui/button"
|
||||
} from "@/components/ui/dialog"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
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 "@internal/neurapress/lib/utils"
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { cn } from "@/lib/utils"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
|
||||
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 "@internal/neurapress/components/ui/button"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@internal/neurapress/components/ui/dropdown-menu"
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
|
||||
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 "@internal/neurapress/components/ui/button"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
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 "@internal/neurapress/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 "@internal/neurapress/lib/utils"
|
||||
import { buttonVariants } from "@internal/neurapress/components/ui/button"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/lib/utils"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/lib/utils"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@internal/neurapress/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 "@internal/neurapress/lib/utils"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const ToastProvider = ToastPrimitives.Provider
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import {
|
||||
ToastProvider,
|
||||
ToastTitle,
|
||||
ToastViewport,
|
||||
} from "@internal/neurapress/components/ui/toast"
|
||||
import { useToast } from "@internal/neurapress/components/ui/use-toast"
|
||||
} from "@/components/ui/toast"
|
||||
import { useToast } from "@/components/ui/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 "@internal/neurapress/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 "@internal/neurapress/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 "@internal/neurapress/components/ui/toast"
|
||||
} from "@/components/ui/toast"
|
||||
|
||||
const TOAST_LIMIT = 1
|
||||
const TOAST_REMOVE_DELAY = 1000000
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { RendererOptions } from '@internal/neurapress/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 '@internal/neurapress/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 '@internal/neurapress/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 '@internal/neurapress/config/code-themes'
|
||||
import type { CodeThemeId } from '@/config/code-themes'
|
||||
|
||||
export interface StyleOptions {
|
||||
// Layout
|
||||
|
||||
@ -18,12 +18,10 @@
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@internal/neurapress": ["./src/index.ts"],
|
||||
"@internal/neurapress/*": ["./src/*"]
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user