create-tauri-ui 0.1.0
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/README.md +41 -0
- package/dist/index.mjs +53 -0
- package/index.js +3 -0
- package/package.json +62 -0
- package/templates/next/.env +1 -0
- package/templates/next/.github/workflows/release.yml +108 -0
- package/templates/next/.vscode/extensions.json +3 -0
- package/templates/next/LICENSE +21 -0
- package/templates/next/README.md +82 -0
- package/templates/next/app-icon.png +0 -0
- package/templates/next/next-env.d.ts +5 -0
- package/templates/next/next.config.js +17 -0
- package/templates/next/package.json +82 -0
- package/templates/next/pnpm-lock.yaml +4318 -0
- package/templates/next/postcss.config.js +6 -0
- package/templates/next/prettier.config.js +35 -0
- package/templates/next/public/avatars/01.png +0 -0
- package/templates/next/public/avatars/02.png +0 -0
- package/templates/next/public/avatars/03.png +0 -0
- package/templates/next/public/avatars/04.png +0 -0
- package/templates/next/public/avatars/05.png +0 -0
- package/templates/next/src/app/examples/authentication/components/user-auth-form.tsx +71 -0
- package/templates/next/src/app/examples/authentication/page.tsx +80 -0
- package/templates/next/src/app/examples/cards/components/cookie-settings.tsx +60 -0
- package/templates/next/src/app/examples/cards/components/create-account.tsx +60 -0
- package/templates/next/src/app/examples/cards/components/date-picker.tsx +18 -0
- package/templates/next/src/app/examples/cards/components/github-card.tsx +81 -0
- package/templates/next/src/app/examples/cards/components/notifications.tsx +51 -0
- package/templates/next/src/app/examples/cards/components/payment-method.tsx +117 -0
- package/templates/next/src/app/examples/cards/components/report-an-issue.tsx +82 -0
- package/templates/next/src/app/examples/cards/components/share-document.tsx +116 -0
- package/templates/next/src/app/examples/cards/components/team-members.tsx +147 -0
- package/templates/next/src/app/examples/cards/page.tsx +75 -0
- package/templates/next/src/app/examples/cards/styles.css +63 -0
- package/templates/next/src/app/examples/dashboard/components/date-range-picker.tsx +66 -0
- package/templates/next/src/app/examples/dashboard/components/main-nav.tsx +38 -0
- package/templates/next/src/app/examples/dashboard/components/overview.tsx +78 -0
- package/templates/next/src/app/examples/dashboard/components/recent-sales.tsx +67 -0
- package/templates/next/src/app/examples/dashboard/components/search.tsx +13 -0
- package/templates/next/src/app/examples/dashboard/components/team-switcher.tsx +205 -0
- package/templates/next/src/app/examples/dashboard/components/user-nav.tsx +67 -0
- package/templates/next/src/app/examples/dashboard/page.tsx +147 -0
- package/templates/next/src/app/examples/forms/account/account-form.tsx +219 -0
- package/templates/next/src/app/examples/forms/account/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/appearance/appearance-form.tsx +164 -0
- package/templates/next/src/app/examples/forms/appearance/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/components/sidebar-nav.tsx +43 -0
- package/templates/next/src/app/examples/forms/display/display-form.tsx +132 -0
- package/templates/next/src/app/examples/forms/display/page.tsx +17 -0
- package/templates/next/src/app/examples/forms/layout.tsx +57 -0
- package/templates/next/src/app/examples/forms/notifications/notifications-form.tsx +221 -0
- package/templates/next/src/app/examples/forms/notifications/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/page.tsx +17 -0
- package/templates/next/src/app/examples/forms/profile-form.tsx +190 -0
- package/templates/next/src/app/examples/layout.tsx +7 -0
- package/templates/next/src/app/examples/music/components/album-artwork.tsx +84 -0
- package/templates/next/src/app/examples/music/components/menu.tsx +178 -0
- package/templates/next/src/app/examples/music/components/podcast-empty-placeholder.tsx +53 -0
- package/templates/next/src/app/examples/music/components/sidebar.tsx +100 -0
- package/templates/next/src/app/examples/music/data/albums.ts +71 -0
- package/templates/next/src/app/examples/music/data/playlists.ts +16 -0
- package/templates/next/src/app/examples/music/page.tsx +134 -0
- package/templates/next/src/app/examples/music/styles.css +65 -0
- package/templates/next/src/app/examples/playground/components/code-viewer.tsx +89 -0
- package/templates/next/src/app/examples/playground/components/icons.tsx +153 -0
- package/templates/next/src/app/examples/playground/components/maxlength-selector.tsx +55 -0
- package/templates/next/src/app/examples/playground/components/model-selector.tsx +163 -0
- package/templates/next/src/app/examples/playground/components/preset-actions.tsx +124 -0
- package/templates/next/src/app/examples/playground/components/preset-save.tsx +44 -0
- package/templates/next/src/app/examples/playground/components/preset-selector.tsx +82 -0
- package/templates/next/src/app/examples/playground/components/preset-share.tsx +46 -0
- package/templates/next/src/app/examples/playground/components/temperature-selector.tsx +57 -0
- package/templates/next/src/app/examples/playground/components/top-p-selector.tsx +54 -0
- package/templates/next/src/app/examples/playground/data/models.ts +62 -0
- package/templates/next/src/app/examples/playground/data/presets.ts +47 -0
- package/templates/next/src/app/examples/playground/page.tsx +160 -0
- package/templates/next/src/app/examples/playground/styles.css +65 -0
- package/templates/next/src/app/examples/tasks/components/columns.tsx +120 -0
- package/templates/next/src/app/examples/tasks/components/data-table-column-header.tsx +66 -0
- package/templates/next/src/app/examples/tasks/components/data-table-faceted-filter.tsx +147 -0
- package/templates/next/src/app/examples/tasks/components/data-table-pagination.tsx +97 -0
- package/templates/next/src/app/examples/tasks/components/data-table-row-actions.tsx +82 -0
- package/templates/next/src/app/examples/tasks/components/data-table-toolbar.tsx +63 -0
- package/templates/next/src/app/examples/tasks/components/data-table-view-options.tsx +59 -0
- package/templates/next/src/app/examples/tasks/components/data-table.tsx +126 -0
- package/templates/next/src/app/examples/tasks/components/user-nav.tsx +67 -0
- package/templates/next/src/app/examples/tasks/data/data.tsx +71 -0
- package/templates/next/src/app/examples/tasks/data/schema.ts +13 -0
- package/templates/next/src/app/examples/tasks/data/seed.ts +20 -0
- package/templates/next/src/app/examples/tasks/data/tasks.json +702 -0
- package/templates/next/src/app/examples/tasks/page.tsx +47 -0
- package/templates/next/src/app/layout.tsx +43 -0
- package/templates/next/src/app/page.tsx +5 -0
- package/templates/next/src/assets/Inter.var.woff2 +0 -0
- package/templates/next/src/assets/logo.png +0 -0
- package/templates/next/src/components/examples/.eslintrc.json +6 -0
- package/templates/next/src/components/examples/accordion/demo.tsx +32 -0
- package/templates/next/src/components/examples/alert/demo.tsx +15 -0
- package/templates/next/src/components/examples/alert/destructive.tsx +15 -0
- package/templates/next/src/components/examples/alert-dialog/demo.tsx +35 -0
- package/templates/next/src/components/examples/aspect-ratio/demo.tsx +16 -0
- package/templates/next/src/components/examples/avatar/demo.tsx +10 -0
- package/templates/next/src/components/examples/badge/demo.tsx +5 -0
- package/templates/next/src/components/examples/badge/destructive.tsx +5 -0
- package/templates/next/src/components/examples/badge/outline.tsx +5 -0
- package/templates/next/src/components/examples/badge/secondary.tsx +5 -0
- package/templates/next/src/components/examples/button/as-child.tsx +10 -0
- package/templates/next/src/components/examples/button/demo.tsx +5 -0
- package/templates/next/src/components/examples/button/destructive.tsx +5 -0
- package/templates/next/src/components/examples/button/ghost.tsx +5 -0
- package/templates/next/src/components/examples/button/link.tsx +5 -0
- package/templates/next/src/components/examples/button/loading.tsx +12 -0
- package/templates/next/src/components/examples/button/outline.tsx +5 -0
- package/templates/next/src/components/examples/button/secondary.tsx +5 -0
- package/templates/next/src/components/examples/button/with-icon.tsx +11 -0
- package/templates/next/src/components/examples/calendar/date-picker.tsx +43 -0
- package/templates/next/src/components/examples/calendar/date-range-picker.tsx +65 -0
- package/templates/next/src/components/examples/calendar/demo.tsx +18 -0
- package/templates/next/src/components/examples/calendar/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/calendar/with-presets.tsx +62 -0
- package/templates/next/src/components/examples/card/demo.tsx +79 -0
- package/templates/next/src/components/examples/card/with-form.tsx +59 -0
- package/templates/next/src/components/examples/checkbox/demo.tsx +17 -0
- package/templates/next/src/components/examples/checkbox/disabled.tsx +15 -0
- package/templates/next/src/components/examples/checkbox/react-hook-form-multiple.tsx +127 -0
- package/templates/next/src/components/examples/checkbox/react-hook-form-single.tsx +72 -0
- package/templates/next/src/components/examples/checkbox/with-text.tsx +22 -0
- package/templates/next/src/components/examples/collapsible/demo.tsx +46 -0
- package/templates/next/src/components/examples/combobox/demo.tsx +90 -0
- package/templates/next/src/components/examples/combobox/dropdown-menu.tsx +110 -0
- package/templates/next/src/components/examples/combobox/popover.tsx +124 -0
- package/templates/next/src/components/examples/combobox/react-hook-form.tsx +135 -0
- package/templates/next/src/components/examples/command/combobox.tsx +90 -0
- package/templates/next/src/components/examples/command/demo.tsx +62 -0
- package/templates/next/src/components/examples/command/dialog.tsx +86 -0
- package/templates/next/src/components/examples/command/dropdown-menu.tsx +110 -0
- package/templates/next/src/components/examples/command/popover.tsx +124 -0
- package/templates/next/src/components/examples/context-menu/demo.tsx +67 -0
- package/templates/next/src/components/examples/data-table/columns.tsx +110 -0
- package/templates/next/src/components/examples/data-table/data-table.tsx +185 -0
- package/templates/next/src/components/examples/data-table/demo.tsx +41 -0
- package/templates/next/src/components/examples/date-picker/demo.tsx +43 -0
- package/templates/next/src/components/examples/date-picker/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/date-picker/with-presets.tsx +62 -0
- package/templates/next/src/components/examples/date-picker/with-range.tsx +65 -0
- package/templates/next/src/components/examples/dialog/demo.tsx +47 -0
- package/templates/next/src/components/examples/dropdown-menu/checkboxes.tsx +53 -0
- package/templates/next/src/components/examples/dropdown-menu/demo.tsx +122 -0
- package/templates/next/src/components/examples/dropdown-menu/radio-group.tsx +37 -0
- package/templates/next/src/components/examples/hover-card/demo.tsx +39 -0
- package/templates/next/src/components/examples/index.tsx +213 -0
- package/templates/next/src/components/examples/input/demo.tsx +5 -0
- package/templates/next/src/components/examples/input/disabled.tsx +5 -0
- package/templates/next/src/components/examples/input/file.tsx +11 -0
- package/templates/next/src/components/examples/input/react-hook-form.tsx +65 -0
- package/templates/next/src/components/examples/input/with-button.tsx +11 -0
- package/templates/next/src/components/examples/input/with-label.tsx +11 -0
- package/templates/next/src/components/examples/input/with-text.tsx +12 -0
- package/templates/next/src/components/examples/label/demo.tsx +13 -0
- package/templates/next/src/components/examples/menubar/demo.tsx +107 -0
- package/templates/next/src/components/examples/navigation-menu/demo.tsx +144 -0
- package/templates/next/src/components/examples/popover/demo.tsx +67 -0
- package/templates/next/src/components/examples/progress/demo.tsx +16 -0
- package/templates/next/src/components/examples/radio-group/demo.tsx +21 -0
- package/templates/next/src/components/examples/radio-group/react-hook-form.tsx +88 -0
- package/templates/next/src/components/examples/scroll-area/demo.tsx +26 -0
- package/templates/next/src/components/examples/select/demo.tsx +31 -0
- package/templates/next/src/components/examples/select/react-hook-form.tsx +83 -0
- package/templates/next/src/components/examples/separator/demo.tsx +22 -0
- package/templates/next/src/components/examples/sheet/demo.tsx +47 -0
- package/templates/next/src/components/examples/sheet/position.tsx +75 -0
- package/templates/next/src/components/examples/sheet/size.tsx +75 -0
- package/templates/next/src/components/examples/skeleton/demo.tsx +13 -0
- package/templates/next/src/components/examples/slider/demo.tsx +16 -0
- package/templates/next/src/components/examples/switch/demo.tsx +11 -0
- package/templates/next/src/components/examples/switch/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/table/demo.tsx +80 -0
- package/templates/next/src/components/examples/tabs/demo.tsx +69 -0
- package/templates/next/src/components/examples/textarea/demo.tsx +5 -0
- package/templates/next/src/components/examples/textarea/disabled.tsx +5 -0
- package/templates/next/src/components/examples/textarea/react-hook-form.tsx +77 -0
- package/templates/next/src/components/examples/textarea/with-button.tsx +11 -0
- package/templates/next/src/components/examples/textarea/with-label.tsx +11 -0
- package/templates/next/src/components/examples/textarea/with-text.tsx +14 -0
- package/templates/next/src/components/examples/toast/demo.tsx +26 -0
- package/templates/next/src/components/examples/toast/destructive.tsx +25 -0
- package/templates/next/src/components/examples/toast/simple.tsx +21 -0
- package/templates/next/src/components/examples/toast/with-action.tsx +24 -0
- package/templates/next/src/components/examples/toast/with-title.tsx +22 -0
- package/templates/next/src/components/examples/toggle/demo.tsx +11 -0
- package/templates/next/src/components/examples/toggle/disabled.tsx +11 -0
- package/templates/next/src/components/examples/toggle/lg.tsx +11 -0
- package/templates/next/src/components/examples/toggle/outline.tsx +11 -0
- package/templates/next/src/components/examples/toggle/sm.tsx +11 -0
- package/templates/next/src/components/examples/toggle/with-text.tsx +12 -0
- package/templates/next/src/components/examples/tooltip/demo.tsx +27 -0
- package/templates/next/src/components/examples/typography/blockquote.tsx +8 -0
- package/templates/next/src/components/examples/typography/demo.tsx +119 -0
- package/templates/next/src/components/examples/typography/h1.tsx +7 -0
- package/templates/next/src/components/examples/typography/h2.tsx +7 -0
- package/templates/next/src/components/examples/typography/h3.tsx +7 -0
- package/templates/next/src/components/examples/typography/h4.tsx +7 -0
- package/templates/next/src/components/examples/typography/inline-code.tsx +7 -0
- package/templates/next/src/components/examples/typography/large.tsx +5 -0
- package/templates/next/src/components/examples/typography/lead.tsx +8 -0
- package/templates/next/src/components/examples/typography/list.tsx +9 -0
- package/templates/next/src/components/examples/typography/muted.tsx +5 -0
- package/templates/next/src/components/examples/typography/p.tsx +8 -0
- package/templates/next/src/components/examples/typography/small.tsx +5 -0
- package/templates/next/src/components/examples/typography/table.tsx +44 -0
- package/templates/next/src/components/examples-nav.tsx +70 -0
- package/templates/next/src/components/greeting.tsx +21 -0
- package/templates/next/src/components/icons.tsx +154 -0
- package/templates/next/src/components/menu-mode-toggle.tsx +46 -0
- package/templates/next/src/components/menu.tsx +268 -0
- package/templates/next/src/components/mode-toggle.tsx +43 -0
- package/templates/next/src/components/page-header.tsx +50 -0
- package/templates/next/src/components/react-hook-form/form.tsx +176 -0
- package/templates/next/src/components/style-switcher.tsx +19 -0
- package/templates/next/src/components/tailwind-indicator.tsx +18 -0
- package/templates/next/src/components/theme-provider.tsx +9 -0
- package/templates/next/src/components/ui/accordion.tsx +60 -0
- package/templates/next/src/components/ui/alert-dialog.tsx +150 -0
- package/templates/next/src/components/ui/alert.tsx +61 -0
- package/templates/next/src/components/ui/aspect-ratio.tsx +7 -0
- package/templates/next/src/components/ui/avatar.tsx +50 -0
- package/templates/next/src/components/ui/badge.tsx +36 -0
- package/templates/next/src/components/ui/button.tsx +51 -0
- package/templates/next/src/components/ui/calendar.tsx +64 -0
- package/templates/next/src/components/ui/card.tsx +81 -0
- package/templates/next/src/components/ui/checkbox.tsx +30 -0
- package/templates/next/src/components/ui/collapsible.tsx +11 -0
- package/templates/next/src/components/ui/command.tsx +155 -0
- package/templates/next/src/components/ui/context-menu.tsx +200 -0
- package/templates/next/src/components/ui/dialog.tsx +128 -0
- package/templates/next/src/components/ui/dropdown-menu.tsx +200 -0
- package/templates/next/src/components/ui/hover-card.tsx +29 -0
- package/templates/next/src/components/ui/input.tsx +27 -0
- package/templates/next/src/components/ui/label.tsx +26 -0
- package/templates/next/src/components/ui/menubar.tsx +236 -0
- package/templates/next/src/components/ui/navigation-menu.tsx +130 -0
- package/templates/next/src/components/ui/popover.tsx +31 -0
- package/templates/next/src/components/ui/progress.tsx +28 -0
- package/templates/next/src/components/ui/radio-group.tsx +44 -0
- package/templates/next/src/components/ui/scroll-area.tsx +48 -0
- package/templates/next/src/components/ui/select.tsx +120 -0
- package/templates/next/src/components/ui/separator.tsx +31 -0
- package/templates/next/src/components/ui/sheet.tsx +230 -0
- package/templates/next/src/components/ui/skeleton.tsx +17 -0
- package/templates/next/src/components/ui/slider.tsx +28 -0
- package/templates/next/src/components/ui/switch.tsx +29 -0
- package/templates/next/src/components/ui/table.tsx +114 -0
- package/templates/next/src/components/ui/tabs.tsx +55 -0
- package/templates/next/src/components/ui/textarea.tsx +26 -0
- package/templates/next/src/components/ui/toast.tsx +129 -0
- package/templates/next/src/components/ui/toaster.tsx +35 -0
- package/templates/next/src/components/ui/toggle.tsx +45 -0
- package/templates/next/src/components/ui/tooltip.tsx +30 -0
- package/templates/next/src/components/ui/use-toast.ts +191 -0
- package/templates/next/src/data/albums.ts +71 -0
- package/templates/next/src/data/playlists.ts +16 -0
- package/templates/next/src/hooks/use-lock-body.ts +12 -0
- package/templates/next/src/hooks/use-mounted.ts +11 -0
- package/templates/next/src/hooks/use-mutation-observer.ts +20 -0
- package/templates/next/src/lib/fonts.ts +11 -0
- package/templates/next/src/lib/utils.ts +19 -0
- package/templates/next/src/styles/globals.css +124 -0
- package/templates/next/src-tauri/Cargo.lock +3636 -0
- package/templates/next/src-tauri/Cargo.toml +36 -0
- package/templates/next/src-tauri/build.rs +3 -0
- package/templates/next/src-tauri/icons/128x128.png +0 -0
- package/templates/next/src-tauri/icons/128x128@2x.png +0 -0
- package/templates/next/src-tauri/icons/32x32.png +0 -0
- package/templates/next/src-tauri/icons/Square107x107Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square142x142Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square150x150Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square284x284Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square30x30Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square310x310Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square44x44Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square71x71Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square89x89Logo.png +0 -0
- package/templates/next/src-tauri/icons/StoreLogo.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/icon.icns +0 -0
- package/templates/next/src-tauri/icons/icon.ico +0 -0
- package/templates/next/src-tauri/icons/icon.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-512@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-60x60@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-60x60@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-76x76@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-76x76@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png +0 -0
- package/templates/next/src-tauri/src/main.rs +19 -0
- package/templates/next/src-tauri/tauri.conf.json +63 -0
- package/templates/next/tailwind.config.js +80 -0
- package/templates/next/tsconfig.json +35 -0
- package/templates/vite/.github/workflows/release.yml +108 -0
- package/templates/vite/.vscode/extensions.json +3 -0
- package/templates/vite/README.md +7 -0
- package/templates/vite/app-icon.png +0 -0
- package/templates/vite/index.html +16 -0
- package/templates/vite/package.json +75 -0
- package/templates/vite/pnpm-lock.yaml +4569 -0
- package/templates/vite/postcss.config.js +6 -0
- package/templates/vite/prettier.config.cjs +35 -0
- package/templates/vite/src/App.tsx +39 -0
- package/templates/vite/src/aa +34 -0
- package/templates/vite/src/assets/Inter.var.woff2 +0 -0
- package/templates/vite/src/components/icons.tsx +154 -0
- package/templates/vite/src/components/menu-mode-toggle.tsx +46 -0
- package/templates/vite/src/components/menu.tsx +232 -0
- package/templates/vite/src/components/tailwind-indicator.tsx +18 -0
- package/templates/vite/src/components/theme-provider.tsx +9 -0
- package/templates/vite/src/components/ui/accordion.tsx +60 -0
- package/templates/vite/src/components/ui/alert-dialog.tsx +150 -0
- package/templates/vite/src/components/ui/alert.tsx +61 -0
- package/templates/vite/src/components/ui/aspect-ratio.tsx +7 -0
- package/templates/vite/src/components/ui/avatar.tsx +50 -0
- package/templates/vite/src/components/ui/badge.tsx +36 -0
- package/templates/vite/src/components/ui/button.tsx +51 -0
- package/templates/vite/src/components/ui/calendar.tsx +64 -0
- package/templates/vite/src/components/ui/card.tsx +81 -0
- package/templates/vite/src/components/ui/checkbox.tsx +30 -0
- package/templates/vite/src/components/ui/collapsible.tsx +11 -0
- package/templates/vite/src/components/ui/command.tsx +155 -0
- package/templates/vite/src/components/ui/context-menu.tsx +200 -0
- package/templates/vite/src/components/ui/dialog.tsx +128 -0
- package/templates/vite/src/components/ui/dropdown-menu.tsx +200 -0
- package/templates/vite/src/components/ui/hover-card.tsx +29 -0
- package/templates/vite/src/components/ui/input.tsx +27 -0
- package/templates/vite/src/components/ui/label.tsx +26 -0
- package/templates/vite/src/components/ui/menubar.tsx +236 -0
- package/templates/vite/src/components/ui/navigation-menu.tsx +130 -0
- package/templates/vite/src/components/ui/popover.tsx +31 -0
- package/templates/vite/src/components/ui/progress.tsx +28 -0
- package/templates/vite/src/components/ui/radio-group.tsx +44 -0
- package/templates/vite/src/components/ui/scroll-area.tsx +48 -0
- package/templates/vite/src/components/ui/select.tsx +120 -0
- package/templates/vite/src/components/ui/separator.tsx +31 -0
- package/templates/vite/src/components/ui/sheet.tsx +230 -0
- package/templates/vite/src/components/ui/skeleton.tsx +17 -0
- package/templates/vite/src/components/ui/slider.tsx +28 -0
- package/templates/vite/src/components/ui/switch.tsx +29 -0
- package/templates/vite/src/components/ui/table.tsx +114 -0
- package/templates/vite/src/components/ui/tabs.tsx +55 -0
- package/templates/vite/src/components/ui/textarea.tsx +26 -0
- package/templates/vite/src/components/ui/toast.tsx +129 -0
- package/templates/vite/src/components/ui/toaster.tsx +35 -0
- package/templates/vite/src/components/ui/toggle.tsx +45 -0
- package/templates/vite/src/components/ui/tooltip.tsx +30 -0
- package/templates/vite/src/components/ui/use-toast.ts +191 -0
- package/templates/vite/src/dashboard/components/date-range-picker.tsx +66 -0
- package/templates/vite/src/dashboard/components/main-nav.tsx +38 -0
- package/templates/vite/src/dashboard/components/overview.tsx +78 -0
- package/templates/vite/src/dashboard/components/recent-sales.tsx +67 -0
- package/templates/vite/src/dashboard/components/search.tsx +13 -0
- package/templates/vite/src/dashboard/components/team-switcher.tsx +205 -0
- package/templates/vite/src/dashboard/components/user-nav.tsx +67 -0
- package/templates/vite/src/dashboard/page.tsx +140 -0
- package/templates/vite/src/lib/utils.ts +19 -0
- package/templates/vite/src/main.tsx +10 -0
- package/templates/vite/src/styles/globals.css +124 -0
- package/templates/vite/src/vite-env.d.ts +1 -0
- package/templates/vite/src-tauri/Cargo.lock +3636 -0
- package/templates/vite/src-tauri/Cargo.toml +33 -0
- package/templates/vite/src-tauri/build.rs +3 -0
- package/templates/vite/src-tauri/icons/128x128.png +0 -0
- package/templates/vite/src-tauri/icons/128x128@2x.png +0 -0
- package/templates/vite/src-tauri/icons/32x32.png +0 -0
- package/templates/vite/src-tauri/icons/Square107x107Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square142x142Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square150x150Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square284x284Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square30x30Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square310x310Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square44x44Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square71x71Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square89x89Logo.png +0 -0
- package/templates/vite/src-tauri/icons/StoreLogo.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/icon.icns +0 -0
- package/templates/vite/src-tauri/icons/icon.ico +0 -0
- package/templates/vite/src-tauri/icons/icon.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-512@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-60x60@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-60x60@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-76x76@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-76x76@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png +0 -0
- package/templates/vite/src-tauri/src/main.rs +16 -0
- package/templates/vite/src-tauri/tauri.conf.json +63 -0
- package/templates/vite/tailwind.config.js +78 -0
- package/templates/vite/tsconfig.json +26 -0
- package/templates/vite/tsconfig.node.json +9 -0
- package/templates/vite/vite.config.ts +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# create-tauri-ui
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx create-tauri-ui@latest
|
|
7
|
+
|
|
8
|
+
pnpm create tauri-ui
|
|
9
|
+
|
|
10
|
+
npm create tauri-ui@latest
|
|
11
|
+
|
|
12
|
+
yarn create tauri-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Then follow the prompts!
|
|
16
|
+
|
|
17
|
+
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a Tauri-UI project, run:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# npm 7+, extra double-dash is needed:
|
|
21
|
+
npm create tauri-ui@latest my-tauri-app -- --template vite
|
|
22
|
+
|
|
23
|
+
# yarn
|
|
24
|
+
yarn create tauri-ui my-tauri-app --template vite
|
|
25
|
+
|
|
26
|
+
# pnpm
|
|
27
|
+
pnpm create tauri-ui my-tauri-app --template vite
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Currently supported template presets include:
|
|
31
|
+
|
|
32
|
+
- `Vite`
|
|
33
|
+
- `Next.js`
|
|
34
|
+
|
|
35
|
+
You can use `.` for the project name to scaffold in the current directory.
|
|
36
|
+
|
|
37
|
+
## Acknowledgements
|
|
38
|
+
|
|
39
|
+
This project utilizes code from the following repository:
|
|
40
|
+
|
|
41
|
+
- [vitejs/create-vite](https://github.com/vitejs/vite/blob/main/packages/create-vite)
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import y from"node:fs";import x from"node:path";import{fileURLToPath as ie}from"node:url";import re from"readline";import M from"sisteransi";import ne from"events";import vt from"@iarna/toml";function wt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function oe(s,t){var e=s;t.slice(0,-1).forEach(function(n){e=e[n]||{}});var i=t[t.length-1];return i in e}function yt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function $t(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var le=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(a){e.bools[a]=!0});var i={};function n(a){return i[a].some(function(v){return e.bools[v]})}Object.keys(t.alias||{}).forEach(function(a){i[a]=[].concat(t.alias[a]),i[a].forEach(function(v){i[v]=[a].concat(i[a].filter(function(E){return v!==E}))})}),[].concat(t.string).filter(Boolean).forEach(function(a){e.strings[a]=!0,i[a]&&[].concat(i[a]).forEach(function(v){e.strings[v]=!0})});var o=t.default||{},r={_:[]};function l(a,v){return e.allBools&&/^--[^=]+$/.test(v)||e.strings[a]||e.bools[a]||i[a]}function f(a,v,E){for(var m=a,z=0;z<v.length-1;z++){var T=v[z];if($t(m,T))return;m[T]===void 0&&(m[T]={}),(m[T]===Object.prototype||m[T]===Number.prototype||m[T]===String.prototype)&&(m[T]={}),m[T]===Array.prototype&&(m[T]=[]),m=m[T]}var I=v[v.length-1];$t(m,I)||((m===Object.prototype||m===Number.prototype||m===String.prototype)&&(m={}),m===Array.prototype&&(m=[]),m[I]===void 0||e.bools[I]||typeof m[I]=="boolean"?m[I]=E:Array.isArray(m[I])?m[I].push(E):m[I]=[m[I],E])}function u(a,v,E){if(!(E&&e.unknownFn&&!l(a,E)&&e.unknownFn(E)===!1)){var m=!e.strings[a]&&yt(v)?Number(v):v;f(r,a.split("."),m),(i[a]||[]).forEach(function(z){f(r,z.split("."),m)})}}Object.keys(e.bools).forEach(function(a){u(a,o[a]===void 0?!1:o[a])});var S=[];s.indexOf("--")!==-1&&(S=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));for(var g=0;g<s.length;g++){var h=s[g],c,w;if(/^--.+=/.test(h)){var O=h.match(/^--([^=]+)=([\s\S]*)$/);c=O[1];var H=O[2];e.bools[c]&&(H=H!=="false"),u(c,H,h)}else if(/^--no-.+/.test(h))c=h.match(/^--no-(.+)/)[1],u(c,!1,h);else if(/^--.+/.test(h))c=h.match(/^--(.+)/)[1],w=s[g+1],w!==void 0&&!/^(-|--)[^-]/.test(w)&&!e.bools[c]&&!e.allBools&&(!i[c]||!n(c))?(u(c,w,h),g+=1):/^(true|false)$/.test(w)?(u(c,w==="true",h),g+=1):u(c,e.strings[c]?"":!0,h);else if(/^-[^-]+/.test(h)){for(var $=h.slice(1,-1).split(""),j=!1,d=0;d<$.length;d++){if(w=h.slice(d+2),w==="-"){u($[d],w,h);continue}if(/[A-Za-z]/.test($[d])&&w[0]==="="){u($[d],w.slice(1),h),j=!0;break}if(/[A-Za-z]/.test($[d])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(w)){u($[d],w,h),j=!0;break}if($[d+1]&&$[d+1].match(/\W/)){u($[d],h.slice(d+2),h),j=!0;break}else u($[d],e.strings[$[d]]?"":!0,h)}c=h.slice(-1)[0],!j&&c!=="-"&&(s[g+1]&&!/^(-|--)[^-]/.test(s[g+1])&&!e.bools[c]&&(!i[c]||!n(c))?(u(c,s[g+1],h),g+=1):s[g+1]&&/^(true|false)$/.test(s[g+1])?(u(c,s[g+1]==="true",h),g+=1):u(c,e.strings[c]?"":!0,h))}else if((!e.unknownFn||e.unknownFn(h)!==!1)&&r._.push(e.strings._||!yt(h)?h:Number(h)),t.stopEarly){r._.push.apply(r._,s.slice(g+1));break}}return Object.keys(o).forEach(function(a){oe(r,a.split("."))||(f(r,a.split("."),o[a]),(i[a]||[]).forEach(function(v){f(r,v.split("."),o[a])}))}),t["--"]?r["--"]=S.slice():S.forEach(function(a){r._.push(a)}),r};const he=wt(le);var xt={};const{FORCE_COLOR:ae,NODE_DISABLE_COLORS:ue,TERM:ce}=process.env,p={enabled:!ue&&ce!=="dumb"&&ae!=="0",reset:b(0,0),bold:b(1,22),dim:b(2,22),italic:b(3,23),underline:b(4,24),inverse:b(7,27),hidden:b(8,28),strikethrough:b(9,29),black:b(30,39),red:b(31,39),green:b(32,39),yellow:b(33,39),blue:b(34,39),magenta:b(35,39),cyan:b(36,39),white:b(37,39),gray:b(90,39),grey:b(90,39),bgBlack:b(40,49),bgRed:b(41,49),bgGreen:b(42,49),bgYellow:b(43,49),bgBlue:b(44,49),bgMagenta:b(45,49),bgCyan:b(46,49),bgWhite:b(47,49)};function St(s,t){let e=0,i,n="",o="";for(;e<s.length;e++)i=s[e],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function de(s,t){let e={has:s,keys:t};return e.reset=p.reset.bind(e),e.bold=p.bold.bind(e),e.dim=p.dim.bind(e),e.italic=p.italic.bind(e),e.underline=p.underline.bind(e),e.inverse=p.inverse.bind(e),e.hidden=p.hidden.bind(e),e.strikethrough=p.strikethrough.bind(e),e.black=p.black.bind(e),e.red=p.red.bind(e),e.green=p.green.bind(e),e.yellow=p.yellow.bind(e),e.blue=p.blue.bind(e),e.magenta=p.magenta.bind(e),e.cyan=p.cyan.bind(e),e.white=p.white.bind(e),e.gray=p.gray.bind(e),e.grey=p.grey.bind(e),e.bgBlack=p.bgBlack.bind(e),e.bgRed=p.bgRed.bind(e),e.bgGreen=p.bgGreen.bind(e),e.bgYellow=p.bgYellow.bind(e),e.bgBlue=p.bgBlue.bind(e),e.bgMagenta=p.bgMagenta.bind(e),e.bgCyan=p.bgCyan.bind(e),e.bgWhite=p.bgWhite.bind(e),e}function b(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:p.enabled?St(this.keys,i+""):i+""):i===void 0?de([s],[e]):p.enabled?St([e],i+""):i+""}}var P=p,fe=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},rt=s=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const pe=rt,{erase:Ot,cursor:me}=M,ge=s=>[...pe(s)].length;var be=function(s,t){if(!t)return Ot.line+me.to(0);let e=0;const i=s.split(/\r?\n/);for(let n of i)e+=1+Math.floor(Math.max(ge(n)-1,0)/t);return Ot.lines(e)};const J={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},ve={arrowUp:J.arrowUp,arrowDown:J.arrowDown,arrowLeft:J.arrowLeft,arrowRight:J.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},we=process.platform==="win32"?ve:J;var Mt=we;const B=P,Y=Mt,nt=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),ye=s=>nt[s]||nt.default,W=Object.freeze({aborted:B.red(Y.cross),done:B.green(Y.tick),exited:B.yellow(Y.cross),default:B.cyan("?")}),$e=(s,t,e)=>t?W.aborted:e?W.exited:s?W.done:W.default,xe=s=>B.gray(s?Y.ellipsis:Y.pointerSmall),Se=(s,t)=>B.gray(s?t?Y.pointerSmall:"+":Y.line);var Oe={styles:nt,render:ye,symbols:W,symbol:$e,delimiter:xe,item:Se};const Me=rt;var Pe=function(s,t){let e=String(Me(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):e.length},Te=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+e.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${e}${r}`),o),[e]).join(`
|
|
2
|
+
`)).join(`
|
|
3
|
+
`)},Ce=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let n=Math.min(i+e,t);return{startIndex:i,endIndex:n}},C={action:fe,clear:be,style:Oe,strip:rt,figures:Mt,lines:Pe,wrap:Te,entriesToDisplay:Ce};const Pt=re,{action:De}=C,Ee=ne,{beep:Ie,cursor:_e}=M,Re=P;let Ae=class extends Ee{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const e=Pt.createInterface({input:this.in,escapeCodeTimeout:50});Pt.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let l=De(r,i);l===!1?this._&&this._(o,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(_e.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ie)}render(){this.onRender(Re),this.firstRender&&(this.firstRender=!1)}};var F=Ae;const X=P,je=F,{erase:Fe,cursor:G}=M,{style:ot,clear:lt,lines:Ne,figures:Le}=C;class Ye extends je{constructor(t={}){super(t),this.transform=ot.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=lt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=X.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
4
|
+
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
5
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(G.down(Ne(this.outputError,this.out.columns)-1)+lt(this.outputError,this.out.columns)),this.out.write(lt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ot.symbol(this.done,this.aborted),X.bold(this.msg),ot.delimiter(this.done),this.red?X.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
6
|
+
`).reduce((t,e,i)=>t+`
|
|
7
|
+
${i?" ":Le.pointerSmall} ${X.red().italic(e)}`,"")),this.out.write(Fe.line+G.to(0)+this.outputText+G.save+this.outputError+G.restore+G.move(this.cursorOffset,0)))}}var Ve=Ye;const _=P,He=F,{style:Tt,clear:Ct,figures:Q,wrap:Be,entriesToDisplay:ke}=C,{cursor:Ue}=M;class ze extends He{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?i:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ct("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
8
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
9
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Ue.hide):this.out.write(Ct(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ke(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Tt.symbol(this.done,this.aborted),_.bold(this.msg),Tt.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_.yellow(this.warn):_.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
10
|
+
`;for(let i=t;i<e;i++){let n,o,r="",l=this.choices[i];i===t&&t>0?o=Q.arrowUp:i===e-1&&e<this.choices.length?o=Q.arrowDown:o=" ",l.disabled?(n=this.cursor===i?_.gray().underline(l.title):_.strikethrough().gray(l.title),o=(this.cursor===i?_.bold().gray(Q.pointer)+" ":" ")+o):(n=this.cursor===i?_.cyan().underline(l.title):l.title,o=(this.cursor===i?_.cyan(Q.pointer)+" ":" ")+o,l.description&&this.cursor===i&&(r=` - ${l.description}`,(o.length+n.length+r.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(r=`
|
|
11
|
+
`+Be(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${_.gray(r)}
|
|
12
|
+
`}}this.out.write(this.outputText)}}var Je=ze;const tt=P,We=F,{style:Dt,clear:Ge}=C,{cursor:Et,erase:Ze}=M;class Ke extends We{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
13
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
14
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Et.hide):this.out.write(Ge(this.outputText,this.out.columns)),super.render(),this.outputText=[Dt.symbol(this.done,this.aborted),tt.bold(this.msg),Dt.delimiter(this.done),this.value?this.inactive:tt.cyan().underline(this.inactive),tt.gray("/"),this.value?tt.cyan().underline(this.active):this.active].join(" "),this.out.write(Ze.line+Et.to(0)+this.outputText))}}var qe=Ke;let Xe=class bt{constructor({token:t,date:e,parts:i,locales:n}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof bt)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,n)=>n>e&&i instanceof bt)}toString(){return String(this.date)}};var R=Xe;const Qe=R;let ts=class extends Qe{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var es=ts;const ss=R,is=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let rs=class extends ss{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+is(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var ns=rs;const os=R;let ls=class extends os{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var hs=ls;const as=R;let us=class extends as{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var cs=us;const ds=R;let fs=class extends ds{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var ps=fs;const ms=R;let gs=class extends ms{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var bs=gs;const vs=R;let ws=class extends vs{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var ys=ws;const $s=R;let xs=class extends $s{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var Ss=xs,Os={DatePart:R,Meridiem:es,Day:ns,Hours:hs,Milliseconds:cs,Minutes:ps,Month:bs,Seconds:ys,Year:Ss};const ht=P,Ms=F,{style:It,clear:_t,figures:Ps}=C,{erase:Ts,cursor:Rt}=M,{DatePart:At,Meridiem:Cs,Day:Ds,Hours:Es,Milliseconds:Is,Minutes:_s,Month:Rs,Seconds:As,Year:js}=Os,Fs=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,jt={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new Ds(s),3:s=>new Rs(s),4:s=>new js(s),5:s=>new Cs(s),6:s=>new Es(s),7:s=>new _s(s),8:s=>new As(s),9:s=>new Is(s)},Ns={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class Ls extends Ms{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ns,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=_t("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=Fs.exec(t);){let n=e.shift(),o=e.findIndex(r=>r!=null);this.parts.push(o in jt?jt[o]({token:e[o]||n,date:this.date,parts:this.parts,locales:this.locales}):e[o]||n)}let i=this.parts.reduce((n,o)=>(typeof o=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=o:n.push(o),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof At)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
+
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof At)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Rt.hide):this.out.write(_t(this.outputText,this.out.columns)),super.render(),this.outputText=[It.symbol(this.done,this.aborted),ht.bold(this.msg),It.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?ht.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
17
|
+
`).reduce((t,e,i)=>t+`
|
|
18
|
+
${i?" ":Ps.pointerSmall} ${ht.red().italic(e)}`,"")),this.out.write(Ts.line+Rt.to(0)+this.outputText))}}var Ys=Ls;const et=P,Vs=F,{cursor:st,erase:Hs}=M,{style:at,figures:Bs,clear:Ft,lines:ks}=C,Us=/[0-9]/,ut=s=>s!==void 0,Nt=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class zs extends Vs{constructor(t={}){super(t),this.transform=at.render(t.style),this.msg=t.message,this.initial=ut(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ut(t.min)?t.min:-1/0,this.max=ut(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=et.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Nt(t,this.round)}`),this._value=Nt(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Us.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
19
|
+
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(st.down(ks(this.outputError,this.out.columns)-1)+Ft(this.outputError,this.out.columns)),this.out.write(Ft(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[at.symbol(this.done,this.aborted),et.bold(this.msg),at.delimiter(this.done),!this.done||!this.done&&!this.placeholder?et[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
21
|
+
`).reduce((t,e,i)=>t+`
|
|
22
|
+
${i?" ":Bs.pointerSmall} ${et.red().italic(e)}`,"")),this.out.write(Hs.line+st.to(0)+this.outputText+st.save+this.outputError+st.restore))}}var Js=zs;const D=P,{cursor:Ws}=M,Gs=F,{clear:Lt,figures:N,style:Yt,wrap:Zs,entriesToDisplay:Ks}=C;let qs=class extends Gs{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?i:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=Lt("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
23
|
+
`),this.close()}submit(){const t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
24
|
+
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
25
|
+
Instructions:
|
|
26
|
+
${N.arrowUp}/${N.arrowDown}: Highlight option
|
|
27
|
+
${N.arrowLeft}/${N.arrowRight}/[space]: Toggle selection
|
|
28
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
29
|
+
`:"")+" enter/return: Complete answer":""}renderOption(t,e,i,n){const o=(e.selected?D.green(N.radioOn):N.radioOff)+" "+n+" ";let r,l;return e.disabled?r=t===i?D.gray().underline(e.title):D.strikethrough().gray(e.title):(r=t===i?D.cyan().underline(e.title):e.title,t===i&&e.description&&(l=` - ${e.description}`,(o.length+r.length+l.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(l=`
|
|
30
|
+
`+Zs(e.description,{margin:o.length,width:this.out.columns})))),o+r+D.gray(l||"")}paginateOptions(t){if(t.length===0)return D.red("No matches for this query.");let{startIndex:e,endIndex:i}=Ks(this.cursor,t.length,this.optionsPerPage),n,o=[];for(let r=e;r<i;r++)r===e&&e>0?n=N.arrowUp:r===i-1&&i<t.length?n=N.arrowDown:n=" ",o.push(this.renderOption(this.cursor,t[r],r,n));return`
|
|
31
|
+
`+o.join(`
|
|
32
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[D.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(D.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ws.hide),super.render();let t=[Yt.symbol(this.done,this.aborted),D.bold(this.msg),Yt.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=D.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Lt(t,this.out.columns)}};var Vt=qs;const Z=P,Xs=F,{erase:Qs,cursor:Ht}=M,{style:ct,clear:Bt,figures:dt,wrap:ti,entriesToDisplay:ei}=C,kt=(s,t)=>s[t]&&(s[t].value||s[t].title||s[t]),si=(s,t)=>s[t]&&(s[t].title||s[t].value||s[t]),ii=(s,t)=>{const e=s.findIndex(i=>i.value===t||i.title===t);return e>-1?e:void 0};class ri extends Xs{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:ii(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ct.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Bt("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=kt(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const e=this.completing=this.suggest(this.input,this.choices),i=await e;if(this.completing!==e)return;this.suggestions=i.map((o,r,l)=>({title:si(l,r),value:kt(l,r),description:o.description})),this.completing=!1;const n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
33
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
34
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
|
+
`),this.close()}_(t,e){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,e,i,n){let o,r=i?dt.arrowUp:n?dt.arrowDown:" ",l=e?Z.cyan().underline(t.title):t.title;return r=(e?Z.cyan(dt.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
36
|
+
`+ti(t.description,{margin:3,width:this.out.columns}))),r+" "+l+Z.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Ht.hide):this.out.write(Bt(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ei(this.select,this.choices.length,this.limit);if(this.outputText=[ct.symbol(this.done,this.aborted,this.exited),Z.bold(this.msg),ct.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const i=this.suggestions.slice(t,e).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
|
|
37
|
+
`);this.outputText+=`
|
|
38
|
+
`+(i||Z.gray(this.fallback.title))}this.out.write(Qs.line+Ht.to(0)+this.outputText)}}var ni=ri;const A=P,{cursor:oi}=M,li=Vt,{clear:Ut,style:zt,figures:k}=C;class hi extends li{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Ut("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const e=this.filteredOptions.findIndex(i=>i===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
39
|
+
Instructions:
|
|
40
|
+
${k.arrowUp}/${k.arrowDown}: Highlight option
|
|
41
|
+
${k.arrowLeft}/${k.arrowRight}/[space]: Toggle selection
|
|
42
|
+
[a,b,c]/delete: Filter choices
|
|
43
|
+
enter/return: Complete answer
|
|
44
|
+
`:""}renderCurrentInput(){return`
|
|
45
|
+
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
46
|
+
`}renderOption(t,e,i){let n;return e.disabled?n=t===i?A.gray().underline(e.title):A.strikethrough().gray(e.title):n=t===i?A.cyan().underline(e.title):e.title,(e.selected?A.green(k.radioOn):k.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(A.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(oi.hide),super.render();let t=[zt.symbol(this.done,this.aborted),A.bold(this.msg),zt.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=A.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Ut(t,this.out.columns)}}var ai=hi;const Jt=P,ui=F,{style:Wt,clear:ci}=C,{erase:di,cursor:Gt}=M;class fi extends ui{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
47
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
48
|
+
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Gt.hide):this.out.write(ci(this.outputText,this.out.columns)),super.render(),this.outputText=[Wt.symbol(this.done,this.aborted),Jt.bold(this.msg),Wt.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Jt.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(di.line+Gt.to(0)+this.outputText))}}var pi=fi,mi={TextPrompt:Ve,SelectPrompt:Je,TogglePrompt:qe,DatePrompt:Ys,NumberPrompt:Js,MultiselectPrompt:Vt,AutocompletePrompt:ni,AutocompleteMultiselectPrompt:ai,ConfirmPrompt:pi};(function(s){const t=s,e=mi,i=r=>r;function n(r,l,f={}){return new Promise((u,S)=>{const g=new e[r](l),h=f.onAbort||i,c=f.onSubmit||i,w=f.onExit||i;g.on("state",l.onState||i),g.on("submit",O=>u(c(O))),g.on("exit",O=>u(w(O))),g.on("abort",O=>S(h(O)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:f=>f.split(l).map(u=>u.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(u=>u.selected).map(u=>u.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(u=>u.selected).map(u=>u.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(f=>f.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(xt);const ft=xt,gi=["suggest","format","onState","validate","onRender","type"],Zt=()=>{};async function L(s=[],{onSubmit:t=Zt,onCancel:e=Zt}={}){const i={},n=L._override||{};s=[].concat(s);let o,r,l,f,u,S;const g=async(h,c,w=!1)=>{if(!(!w&&h.validate&&h.validate(c)!==!0))return h.format?await h.format(c,i):c};for(r of s)if({name:f,type:u}=r,typeof u=="function"&&(u=await u(o,{...i},r),r.type=u),!!u){for(let h in r){if(gi.includes(h))continue;let c=r[h];r[h]=typeof c=="function"?await c(o,{...i},S):c}if(S=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:f,type:u}=r,ft[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(n[r.name]!==void 0&&(o=await g(r,n[r.name]),o!==void 0)){i[f]=o;continue}try{o=L._injected?bi(L._injected,r.initial):await ft[u](r),i[f]=o=await g(r,o,!0),l=await t(r,o,i)}catch{l=!await e(r,i)}if(l)return i}return i}function bi(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function vi(s){L._injected=(L._injected||[]).concat(s)}function wi(s){L._override=Object.assign({},s)}var yi=Object.assign(L,{prompt:L,prompts:ft,inject:vi,override:wi});const $i=wt(yi);let V=!0;const U=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let K=0;if(U.process&&U.process.env&&U.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,NO_COLOR:e,TERM:i,COLORTERM:n}=U.process.env;t||e||s==="0"?V=!1:s==="1"||s==="2"||s==="3"?V=!0:i==="dumb"?V=!1:"CI"in U.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in U.process.env)?V=!0:V=process.stdout.isTTY,V&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?K=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?K=2:K=1)}let Kt={enabled:V,supportLevel:K};function q(s,t,e=1){const i=`\x1B[${s}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Kt.enabled&&Kt.supportLevel>=e?i+(""+r).replace(o,i)+n:""+r}const it=q(0,0),qt=q(31,39),xi=q(34,39),Si=q(90,39),Oi=q(92,39);function Xt(s){return s?.trim().replace(/\/+$/g,"")}function Qt(s,t){y.statSync(s).isDirectory()?Pi(s,t):y.copyFileSync(s,t)}function te(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function Mi(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Pi(s,t){y.mkdirSync(t,{recursive:!0});for(const e of y.readdirSync(s)){const i=x.resolve(s,e),n=x.resolve(t,e);Qt(i,n)}}function Ti(s){const t=y.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function Ci(s){if(y.existsSync(s))for(const t of y.readdirSync(s))t!==".git"&&y.rmSync(x.resolve(s,t),{recursive:!0,force:!0})}function Di(s){if(!s)return;const t=s.split(" ")[0].split("/");return{name:t[0],version:t[1]}}const pt=he(process.argv.slice(2),{string:["_"]}),mt=process.cwd(),ee=[{name:"vite",display:"Vite \u26A1",color:xi},{name:"next",display:"Next.js \u25B2",color:Oi}],se=ee.map(s=>s.name),Ei={_gitignore:".gitignore"},gt="tauri-ui";async function Ii(){const s=Xt(pt._[0]),t=pt.template||pt.t;let e=s||gt;const i=()=>e==="."?x.basename(x.resolve()):e,n=await $i([{type:s?null:"text",name:"projectName",message:it("Project name:"),initial:gt,onState:d=>{e=Xt(d.value)||gt}},{type:()=>!y.existsSync(e)||Ti(e)?null:"confirm",name:"overwrite",message:()=>(e==="."?"Current directory":`Target directory "${e}"`)+" is not empty. Remove existing files and continue?"},{type:(d,{overwrite:a})=>{if(a===!1)throw new Error(qt("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>te(i())?null:"text",name:"packageName",message:it("Package name:"),initial:()=>Mi(i()),validate:d=>te(d)||"Invalid package.json name"},{type:t&&se.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!se.includes(t)?it(`"${t}" isn't a valid template. Please choose from below: `):it("Select a framework:"),initial:0,choices:ee.map(d=>{const a=d.color;return{title:a(d.display||d.name),value:d}})}],{onCancel:()=>{throw new Error(qt("\u2716")+" Operation cancelled")}}),{framework:o,overwrite:r,packageName:l}=n,f=x.join(mt,e);r?Ci(f):y.existsSync(f)||y.mkdirSync(f,{recursive:!0});let u=o?.name||t;const S=Di(process.env.npm_config_user_agent),g=S?S.name:"npm";console.log(`
|
|
49
|
+
Scaffolding project in ${Si(f)}`);const h=x.resolve(ie(import.meta.url),"../../templates/",u),c=(d,a)=>{const v=x.join(f,Ei[d]??d);a?y.writeFileSync(v,a):Qt(x.join(h,d),v)},w=y.readdirSync(h);for(const d of w.filter(a=>a!=="package.json"||"tauri.conf.json"))c(d);const O=JSON.parse(y.readFileSync(x.join(h,"package.json"),"utf-8"));O.name=l||i(),c("package.json",JSON.stringify(O,null,2)+`
|
|
50
|
+
`);const H=vt.parse(y.readFileSync(x.join(h,"/src-tauri/Cargo.toml"),"utf-8"));H.package.name=l||i(),c("/src-tauri/Cargo.toml",vt.stringify(H)+`
|
|
51
|
+
`);const $=JSON.parse(y.readFileSync(x.join(h,"/src-tauri/tauri.conf.json"),"utf-8"));$.tauri.windows[0].title=l||i(),$.package.productName=l||i(),c("/src-tauri/tauri.conf.json",JSON.stringify($,null,2)+`
|
|
52
|
+
`);const j=x.relative(mt,f);switch(console.log(`
|
|
53
|
+
Done. Now run:`),f!==mt&&console.log(` cd ${j.includes(" ")?`"${j}"`:j}`),g){case"yarn":console.log(" yarn"),console.log(" yarn tauri dev");break;case"pnpm":console.log(" pnpm i"),console.log(" pnpm tauri dev");break;default:console.log(` ${g} install`),console.log(` ${g} run tauri dev`);break}console.log()}Ii().catch(s=>{console.error(s)});
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-tauri-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create modern Tauri desktop apps with ease using shadcn/ui, Next.js & Vite in just a few simple steps.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "agmmnn",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "unbuild --stub",
|
|
11
|
+
"build": "unbuild",
|
|
12
|
+
"start": "unbuild --stub && node index.js",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"prepublishOnly": "npm run build",
|
|
15
|
+
"format": "npx prettier --write . --ignore-path .gitignore ",
|
|
16
|
+
"taze": "taze minor -r -w -i false",
|
|
17
|
+
"taze:major": "taze major -r -w -i false"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"create-tauri-ui": "index.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"templates",
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"tauri",
|
|
29
|
+
"desktop",
|
|
30
|
+
"app"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/agmmnn/create-tauri-ui.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/agmmnn/create-tauri-ui/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/agmmnn/create-tauri-ui",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@clack/core": "^0.3.2",
|
|
42
|
+
"@clack/prompts": "^0.6.3",
|
|
43
|
+
"@iarna/toml": "^2.2.5",
|
|
44
|
+
"js-yaml": "^4.1.0",
|
|
45
|
+
"picocolors": "^1.0.0",
|
|
46
|
+
"sisteransi": "^1.0.5",
|
|
47
|
+
"zod": "^3.21.4"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/js-yaml": "^4.0.5",
|
|
51
|
+
"@types/minimist": "^1.2.2",
|
|
52
|
+
"@types/node": "^20.2.3",
|
|
53
|
+
"@types/prompts": "^2.4.4",
|
|
54
|
+
"commander": "^10.0.1",
|
|
55
|
+
"cross-spawn": "^7.0.3",
|
|
56
|
+
"kolorist": "^1.8.0",
|
|
57
|
+
"minimist": "^1.2.8",
|
|
58
|
+
"prompts": "^2.4.2",
|
|
59
|
+
"typescript": "^5.0.4",
|
|
60
|
+
"unbuild": "^1.2.1"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: "release"
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "*"
|
|
7
|
+
jobs:
|
|
8
|
+
create-release:
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
runs-on: ubuntu-20.04
|
|
12
|
+
outputs:
|
|
13
|
+
release_id: ${{ steps.create-release.outputs.result }}
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
- name: setup node
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: 16
|
|
21
|
+
- name: get version
|
|
22
|
+
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
|
|
23
|
+
- name: create release
|
|
24
|
+
id: create-release
|
|
25
|
+
uses: actions/github-script@v6
|
|
26
|
+
with:
|
|
27
|
+
script: |
|
|
28
|
+
const { data } = await github.rest.repos.createRelease({
|
|
29
|
+
owner: context.repo.owner,
|
|
30
|
+
repo: context.repo.repo,
|
|
31
|
+
tag_name: `v${process.env.PACKAGE_VERSION}`,
|
|
32
|
+
name: `v${process.env.PACKAGE_VERSION}`,
|
|
33
|
+
body: '*This release was generated automatically using GitHub Actions.*',
|
|
34
|
+
draft: true,
|
|
35
|
+
prerelease: false
|
|
36
|
+
})
|
|
37
|
+
return data.id
|
|
38
|
+
|
|
39
|
+
build-tauri:
|
|
40
|
+
needs: create-release
|
|
41
|
+
permissions:
|
|
42
|
+
contents: write
|
|
43
|
+
strategy:
|
|
44
|
+
fail-fast: false
|
|
45
|
+
matrix:
|
|
46
|
+
platform: [macos-latest, ubuntu-latest, windows-latest]
|
|
47
|
+
|
|
48
|
+
runs-on: ${{ matrix.platform }}
|
|
49
|
+
steps:
|
|
50
|
+
- name: Checkout repository
|
|
51
|
+
uses: actions/checkout@v3
|
|
52
|
+
|
|
53
|
+
- name: Install Rust
|
|
54
|
+
uses: dtolnay/rust-toolchain@stable
|
|
55
|
+
with:
|
|
56
|
+
toolchain: stable
|
|
57
|
+
|
|
58
|
+
- name: Rust cache
|
|
59
|
+
uses: Swatinem/rust-cache@v2
|
|
60
|
+
with:
|
|
61
|
+
workspaces: v2 -> v2/target
|
|
62
|
+
|
|
63
|
+
- name: Install Node.js
|
|
64
|
+
uses: actions/setup-node@v3
|
|
65
|
+
with:
|
|
66
|
+
node-version: "lts/*"
|
|
67
|
+
cache-dependency-path: v2/package-lock.json
|
|
68
|
+
|
|
69
|
+
- name: Install apt dependencies (ubuntu only)
|
|
70
|
+
if: matrix.platform == 'ubuntu-latest'
|
|
71
|
+
run: |
|
|
72
|
+
sudo apt-get update
|
|
73
|
+
sudo apt install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
|
74
|
+
|
|
75
|
+
- name: Install pnpm
|
|
76
|
+
run: npm install -g pnpm
|
|
77
|
+
|
|
78
|
+
- name: Install frontend dependencies
|
|
79
|
+
run: pnpm install
|
|
80
|
+
|
|
81
|
+
- name: Build the app
|
|
82
|
+
uses: tauri-apps/tauri-action@v0
|
|
83
|
+
env:
|
|
84
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
85
|
+
with:
|
|
86
|
+
releaseId: ${{ needs.create-release.outputs.release_id }}
|
|
87
|
+
|
|
88
|
+
publish-release:
|
|
89
|
+
permissions:
|
|
90
|
+
contents: write
|
|
91
|
+
runs-on: ubuntu-20.04
|
|
92
|
+
needs: [create-release, build-tauri]
|
|
93
|
+
|
|
94
|
+
steps:
|
|
95
|
+
- name: publish release
|
|
96
|
+
id: publish-release
|
|
97
|
+
uses: actions/github-script@v6
|
|
98
|
+
env:
|
|
99
|
+
release_id: ${{ needs.create-release.outputs.release_id }}
|
|
100
|
+
with:
|
|
101
|
+
script: |
|
|
102
|
+
github.rest.repos.updateRelease({
|
|
103
|
+
owner: context.repo.owner,
|
|
104
|
+
repo: context.repo.repo,
|
|
105
|
+
release_id: process.env.release_id,
|
|
106
|
+
draft: false,
|
|
107
|
+
prerelease: false
|
|
108
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 agmmnn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Tauri UI Template
|
|
4
|
+
|
|
5
|
+
Tauri UI Template is a starting point for building modern desktop applications with web technologies. Customizable UI components with [shadcn/ui](https://github.com/shadcn/ui), a lightweight and secure desktop app framework [Tauri 2](https://github.com/tauri-apps/tauri), the React-based framework [Next.js 13](https://beta.nextjs.org/docs), the utility-first CSS framework [Tailwind](https://tailwindcss.com/).
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
gh repo clone agmmnn/tauri-ui
|
|
11
|
+
cd tauri-ui
|
|
12
|
+
pnpm i
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pnpm tauri dev
|
|
17
|
+
pnpm tauri build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Support for dark and light modes
|
|
23
|
+
- Components-based UI design
|
|
24
|
+
- A draggable titlebar with minimize, maximize, and close buttons
|
|
25
|
+
- [Radix UI](https://www.radix-ui.com/) for UI primitives
|
|
26
|
+
- [Lucide Icons](https://lucide.dev/)
|
|
27
|
+
- [Bundle size optimized](https://github.com/johnthagen/min-sized-rust) [`Cargo.toml`](/src-tauri/Cargo.toml) (.exe 3mb, .msi 2mb)
|
|
28
|
+
- [Tauri GitHub Action](https://github.com/tauri-apps/tauri-action)
|
|
29
|
+
|
|
30
|
+
> _You can download pre-built final bundles from the [Releases](https://github.com/agmmnn/tauri-ui/releases) section._
|
|
31
|
+
|
|
32
|
+
> _[Next.js](https://nextjs.org/) is used in this template to facilitate quick integration of the [`/examples`](https://github.com/shadcn/ui/tree/main/apps/www/app/examples) directory of shadcn/ui. You can also easily use shadcn/ui with the [React + Vite](https://tauri.app/v1/guides/getting-started/setup/vite/) stack and any [React router library](https://react.libhunt.com/libs/router) (optionally) in Tauri._
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
## Customization
|
|
37
|
+
|
|
38
|
+
The template can be customized by editing the following files:
|
|
39
|
+
|
|
40
|
+
- [src-tauri/tauri.conf.json](src-tauri/tauri.conf.json)
|
|
41
|
+
- [package.json](/package.json)
|
|
42
|
+
- [src-tauri/cargo.toml](src-tauri/Cargo.toml)
|
|
43
|
+
- To change the app icon, update `app-icon.png`, and then run `pnpm tauri icon`. This will automatically generate icon files into _src-tauri/icons_.
|
|
44
|
+
|
|
45
|
+
## Update Components
|
|
46
|
+
|
|
47
|
+
Note that **shadcn/ui** [is not a library](https://ui.shadcn.com/docs#faqs), therefore you will need to update the components manually. To do so, you can [download](https://download-directory.github.io/?url=https%3A%2F%2Fgithub.com%2Fshadcn%2Fui%2Ftree%2Fmain%2Fapps%2Fwww%2Fcomponents%2Fui) the _[shadcn/ui/apps/www/components/ui](https://github.com/shadcn/ui/tree/main/apps/www/components/ui)_ directory and paste it into _[src/components/ui](/src/components/ui)_.
|
|
48
|
+
|
|
49
|
+
## Folder Structure
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
.
|
|
53
|
+
├── next-env.d.ts
|
|
54
|
+
├── next.config.js //nextjs config file https://nextjs.org/docs/api-reference/next.config.js/introduction
|
|
55
|
+
├── package.json
|
|
56
|
+
├── postcss.config.js
|
|
57
|
+
├── README.md
|
|
58
|
+
├── public
|
|
59
|
+
├── src //frontend src:
|
|
60
|
+
│ ├── app //next.js appdir https://beta.nextjs.org/docs/routing/fundamentals
|
|
61
|
+
│ ├── assets
|
|
62
|
+
│ ├── components //from shadcn/ui
|
|
63
|
+
│ │ └── ui
|
|
64
|
+
│ ├── data
|
|
65
|
+
│ ├── hooks
|
|
66
|
+
│ ├── lib
|
|
67
|
+
│ └── styles
|
|
68
|
+
├── src-tauri //backend src:
|
|
69
|
+
│ ├── build.rs
|
|
70
|
+
│ ├── Cargo.lock
|
|
71
|
+
│ ├── Cargo.toml //https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
72
|
+
│ ├── icons //https://tauri.app/v1/guides/features/icons/
|
|
73
|
+
│ ├── src //rust codes
|
|
74
|
+
│ └── tauri.conf.json //tauri config file https://next--tauri.netlify.app/next/api/config
|
|
75
|
+
├── prettier.config.js //prettier config file https://prettier.io/docs/en/configuration.html
|
|
76
|
+
├── tailwind.config.js //tailwind config file https://tailwindcss.com/docs/configuration
|
|
77
|
+
└── tsconfig.json //typescript config file https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Recommended IDE Setup
|
|
81
|
+
|
|
82
|
+
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {import('next').NextConfig} */
|
|
2
|
+
|
|
3
|
+
const nextConfig = {
|
|
4
|
+
reactStrictMode: true,
|
|
5
|
+
swcMinify: true,
|
|
6
|
+
images: {
|
|
7
|
+
unoptimized: true,
|
|
8
|
+
domains: ["avatars.githubusercontent.com", "images.unsplash.com"],
|
|
9
|
+
},
|
|
10
|
+
experimental: {
|
|
11
|
+
appDir: true,
|
|
12
|
+
},
|
|
13
|
+
output: "export",
|
|
14
|
+
distDir: "dist",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = nextConfig
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tauri-ui",
|
|
3
|
+
"private": true,
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"version": "0.1.3",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "next dev -p 1420",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"format": "npx prettier --write . --ignore-path .gitignore ",
|
|
10
|
+
"taze": "taze major -I",
|
|
11
|
+
"taze:minor": "taze minor -w",
|
|
12
|
+
"tauri": "tauri"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@faker-js/faker": "^8.0.1",
|
|
16
|
+
"@hookform/resolvers": "^3.1.0",
|
|
17
|
+
"@radix-ui/react-accessible-icon": "^1.0.2",
|
|
18
|
+
"@radix-ui/react-accordion": "^1.1.1",
|
|
19
|
+
"@radix-ui/react-alert-dialog": "^1.0.3",
|
|
20
|
+
"@radix-ui/react-aspect-ratio": "^1.0.2",
|
|
21
|
+
"@radix-ui/react-avatar": "^1.0.2",
|
|
22
|
+
"@radix-ui/react-checkbox": "^1.0.3",
|
|
23
|
+
"@radix-ui/react-collapsible": "^1.0.2",
|
|
24
|
+
"@radix-ui/react-context-menu": "^2.1.3",
|
|
25
|
+
"@radix-ui/react-dialog": "^1.0.3",
|
|
26
|
+
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
|
27
|
+
"@radix-ui/react-hover-card": "^1.0.5",
|
|
28
|
+
"@radix-ui/react-label": "^2.0.1",
|
|
29
|
+
"@radix-ui/react-menubar": "^1.0.2",
|
|
30
|
+
"@radix-ui/react-navigation-menu": "^1.1.2",
|
|
31
|
+
"@radix-ui/react-popover": "^1.0.5",
|
|
32
|
+
"@radix-ui/react-progress": "^1.0.2",
|
|
33
|
+
"@radix-ui/react-radio-group": "^1.1.2",
|
|
34
|
+
"@radix-ui/react-scroll-area": "^1.0.3",
|
|
35
|
+
"@radix-ui/react-select": "^1.2.1",
|
|
36
|
+
"@radix-ui/react-separator": "^1.0.2",
|
|
37
|
+
"@radix-ui/react-slider": "^1.1.1",
|
|
38
|
+
"@radix-ui/react-slot": "^1.0.1",
|
|
39
|
+
"@radix-ui/react-switch": "^1.0.2",
|
|
40
|
+
"@radix-ui/react-tabs": "^1.0.3",
|
|
41
|
+
"@radix-ui/react-toast": "^1.1.3",
|
|
42
|
+
"@radix-ui/react-toggle": "^1.0.2",
|
|
43
|
+
"@radix-ui/react-toggle-group": "^1.0.3",
|
|
44
|
+
"@radix-ui/react-tooltip": "^1.0.5",
|
|
45
|
+
"@tailwindcss/line-clamp": "^0.4.4",
|
|
46
|
+
"@tanstack/react-table": "^8.9.1",
|
|
47
|
+
"@tauri-apps/api": "2.0.0-alpha.4",
|
|
48
|
+
"@tauri-apps/plugin-window": "github:tauri-apps/tauri-plugin-window#v2",
|
|
49
|
+
"class-variance-authority": "^0.6.0",
|
|
50
|
+
"clsx": "^1.2.1",
|
|
51
|
+
"cmdk": "^0.2.0",
|
|
52
|
+
"date-fns": "^2.30.0",
|
|
53
|
+
"lucide-react": "^0.220.0",
|
|
54
|
+
"nanoid": "^4.0.2",
|
|
55
|
+
"next": "^13.4.4-canary.1",
|
|
56
|
+
"next-themes": "^0.2.1",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-day-picker": "^8.7.1",
|
|
59
|
+
"react-dom": "^18.2.0",
|
|
60
|
+
"react-hook-form": "^7.43.9",
|
|
61
|
+
"react-wrap-balancer": "^0.5.0",
|
|
62
|
+
"recharts": "^2.6.2",
|
|
63
|
+
"tailwind-merge": "^1.12.0",
|
|
64
|
+
"tailwindcss-animate": "^1.0.5",
|
|
65
|
+
"zod": "^3.21.4"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
|
|
69
|
+
"@tauri-apps/cli": "2.0.0-alpha.9",
|
|
70
|
+
"@types/node": "^20.2.3",
|
|
71
|
+
"@types/react": "^18.2.6",
|
|
72
|
+
"@types/react-dom": "^18.2.4",
|
|
73
|
+
"autoprefixer": "^10.4.14",
|
|
74
|
+
"postcss": "^8.4.23",
|
|
75
|
+
"prettier": "^2.8.8",
|
|
76
|
+
"prettier-plugin-tailwindcss": "^0.3.0",
|
|
77
|
+
"tailwind-scrollbar": "^3.0.4",
|
|
78
|
+
"tailwindcss": "^3.3.2",
|
|
79
|
+
"taze": "^0.10.1",
|
|
80
|
+
"typescript": "^5.0.4"
|
|
81
|
+
}
|
|
82
|
+
}
|