├── .DS_Store ├── flowmix-print.gif ├── postcss.config.js ├── postcss.config.mjs ├── components ├── ui │ ├── aspect-ratio.tsx │ ├── skeleton.tsx │ ├── collapsible.tsx │ ├── use-mobile.tsx │ ├── label.tsx │ ├── textarea.tsx │ ├── separator.tsx │ ├── input.tsx │ ├── progress.tsx │ ├── toaster.tsx │ ├── sonner.tsx │ ├── slider.tsx │ ├── checkbox.tsx │ ├── switch.tsx │ ├── badge.tsx │ ├── tooltip.tsx │ ├── hover-card.tsx │ ├── popover.tsx │ ├── avatar.tsx │ ├── radio-group.tsx │ ├── toggle.tsx │ ├── scroll-area.tsx │ ├── alert.tsx │ ├── resizable.tsx │ ├── card.tsx │ ├── button.tsx │ ├── toggle-group.tsx │ ├── tabs.tsx │ ├── accordion.tsx │ ├── input-otp.tsx │ ├── calendar.tsx │ ├── table.tsx │ ├── breadcrumb.tsx │ ├── pagination.tsx │ ├── drawer.tsx │ ├── dialog.tsx │ ├── use-toast.ts │ ├── sheet.tsx │ ├── form.tsx │ ├── alert-dialog.tsx │ ├── toast.tsx │ ├── command.tsx │ ├── navigation-menu.tsx │ ├── select.tsx │ ├── carousel.tsx │ ├── dropdown-menu.tsx │ └── context-menu.tsx ├── theme-provider.tsx ├── editor │ ├── snap-lines.tsx │ ├── editor-footer.tsx │ ├── print-editor.tsx │ ├── elements │ │ ├── image-element.tsx │ │ ├── barcode-element.tsx │ │ ├── text-element.tsx │ │ ├── chart-element.tsx │ │ ├── shape-element.tsx │ │ └── table-element.tsx │ ├── page-controls.tsx │ └── canvas-element.tsx └── mode-toggle.tsx ├── next-env.d.ts ├── types ├── user.ts └── editor.ts ├── next.config.mjs ├── components.json ├── public ├── placeholder-logo.png ├── placeholder.jpg ├── placeholder-user.jpg ├── placeholder-logo.svg └── placeholder.svg ├── hooks ├── use-mobile.tsx └── use-toast.ts ├── app ├── editor │ └── page.tsx ├── layout.tsx ├── login │ └── page.tsx └── register │ └── page.tsx ├── tsconfig.json ├── package.json ├── README.md ├── tailwind.config.ts ├── styles └── globals.css ├── .gitignore └── lib ├── auth-utils.ts └── utils.ts /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrXujiang/flowmix-print/HEAD/.DS_Store -------------------------------------------------------------------------------- /flowmix-print.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrXujiang/flowmix-print/HEAD/flowmix-print.gif -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | 8 | -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 4 | 5 | const AspectRatio = AspectRatioPrimitive.Root 6 | 7 | export { AspectRatio } 8 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | import { ThemeProvider as NextThemesProvider } from "next-themes" 3 | import type { ThemeProviderProps } from "next-themes" 4 | 5 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 6 | return {children} 7 | } 8 | 9 | -------------------------------------------------------------------------------- /components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /components/ui/collapsible.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" 4 | 5 | const Collapsible = CollapsiblePrimitive.Root 6 | 7 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger 8 | 9 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent 10 | 11 | export { Collapsible, CollapsibleTrigger, CollapsibleContent } 12 | -------------------------------------------------------------------------------- /types/user.ts: -------------------------------------------------------------------------------- 1 | export interface User { 2 | id: string 3 | username: string 4 | password: string // 实际应用中应该存储哈希值而非明文密码 5 | email?: string 6 | activationCode?: string 7 | createdAt: string 8 | lastLogin?: string 9 | } 10 | 11 | export interface AuthState { 12 | user: User | null 13 | isAuthenticated: boolean 14 | isLoading: boolean 15 | error: string | null 16 | } 17 | 18 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | swcMinify: true, 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | typescript: { 9 | ignoreBuildErrors: true, 10 | }, 11 | images: { 12 | unoptimized: true, 13 | }, 14 | experimental: { 15 | webpackBuildWorker: true, 16 | parallelServerBuildTraces: true, 17 | parallelServerCompiles: true, 18 | }, 19 | } 20 | 21 | export default nextConfig 22 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /public/placeholder-logo.png: -------------------------------------------------------------------------------- 1 | �PNG 2 |  3 | IHDR�M��0PLTEZ? tRNS� �@��`P0p���w �IDATx��ؽJ3Q�7'��%�|?� ���E�l�7���(X�D������w`����[�*t����D���mD�}��4; ;�DDDDDDDDDDDD_�_İ��!�y�`�_�:�� ;Ļ�'|� ��;.I"����3*5����J�1�� �T��FI�� ��=��3܃�2~�b���0��U9\��]�4�#w0��Gt\&1 �?21,���o!e�m��ĻR�����5�� ؽAJ�9��R)�5�0.FFASaǃ�T�#|�K���I�������1� 4 | M������N"��$����G�V�T� ��T^^��A�$S��h(�������G]co"J׸^^�'�=���%� �W�6Ы�W��w�a�߇*�^^�YG�c���`'F����������������^5_�,�S�%IEND�B`� -------------------------------------------------------------------------------- /components/editor/snap-lines.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | interface SnapLinesProps { 4 | horizontal: number[] 5 | vertical: number[] 6 | zoom: number 7 | } 8 | 9 | export default function SnapLines({ horizontal, vertical, zoom }: SnapLinesProps) { 10 | return ( 11 | <> 12 | {horizontal.map((y, index) => ( 13 |
14 | ))} 15 | {vertical.map((x, index) => ( 16 |
17 | ))} 18 | 19 | ) 20 | } 21 | 22 | -------------------------------------------------------------------------------- /hooks/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /components/ui/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /app/editor/page.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { useEffect } from "react" 4 | import { useRouter } from "next/navigation" 5 | import PrintEditor from "@/components/editor/print-editor" 6 | import { isAuthenticated } from "@/lib/auth-utils" 7 | import { useToast } from "@/components/ui/use-toast" 8 | 9 | export default function EditorPage() { 10 | const router = useRouter() 11 | const { toast } = useToast() 12 | 13 | useEffect(() => { 14 | // 检查用户是否已登录 15 | if (!isAuthenticated()) { 16 | toast({ 17 | title: "需要登录", 18 | description: "请先登录后再访问编辑器", 19 | variant: "destructive", 20 | }) 21 | router.push("/login") 22 | } 23 | }, [router, toast]) 24 | 25 | return 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70") 10 | 11 | const Label = React.forwardRef< 12 | React.ElementRef, 13 | React.ComponentPropsWithoutRef & VariantProps 14 | >(({ className, ...props }, ref) => ( 15 | 16 | )) 17 | Label.displayName = LabelPrimitive.Root.displayName 18 | 19 | export { Label } 20 | 21 | -------------------------------------------------------------------------------- /components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Textarea = React.forwardRef< 6 | HTMLTextAreaElement, 7 | React.ComponentProps<"textarea"> 8 | >(({ className, ...props }, ref) => { 9 | return ( 10 |