@xbg.solutions/bpsk 1.2.3
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/bin/xbg-frontend.cjs +32 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/package.json +35 -0
- package/src/commands/add.cjs +470 -0
- package/src/commands/generate-component.cjs +602 -0
- package/src/commands/generate-route.cjs +774 -0
- package/src/commands/generate-service.cjs +1306 -0
- package/src/commands/generate.cjs +24 -0
- package/src/commands/manage-auth-users.cjs +410 -0
- package/src/commands/setup.cjs +1049 -0
- package/src/commands/validate.cjs +341 -0
- package/src/manifest.json +1578 -0
- package/src/registry/advanced/ChartWrapper.svelte +587 -0
- package/src/registry/advanced/DataTable.svelte +645 -0
- package/src/registry/advanced/FormWizard.svelte +546 -0
- package/src/registry/advanced/ImageUpload.svelte +663 -0
- package/src/registry/advanced/index.ts +33 -0
- package/src/registry/atoms/calendar/Calendar.svelte +181 -0
- package/src/registry/atoms/calendar/index.ts +1 -0
- package/src/registry/atoms/dialog/Dialog.svelte +179 -0
- package/src/registry/atoms/dialog/DialogDescription.svelte +16 -0
- package/src/registry/atoms/dialog/DialogFooter.svelte +16 -0
- package/src/registry/atoms/dialog/DialogHeader.svelte +16 -0
- package/src/registry/atoms/dialog/DialogTitle.svelte +16 -0
- package/src/registry/atoms/dialog/index.ts +10 -0
- package/src/registry/atoms/icon/BrandIcon.svelte +47 -0
- package/src/registry/atoms/icon/DynamicIcon.svelte +49 -0
- package/src/registry/atoms/icon/index.ts +2 -0
- package/src/registry/atoms/legend/Legend.svelte +32 -0
- package/src/registry/atoms/legend/index.ts +1 -0
- package/src/registry/atoms/menu/MenuItem.svelte +85 -0
- package/src/registry/atoms/menu/index.ts +1 -0
- package/src/registry/atoms/message/Message.svelte +62 -0
- package/src/registry/atoms/message/index.ts +1 -0
- package/src/registry/atoms/nav/NavItem.svelte +67 -0
- package/src/registry/atoms/nav/index.ts +1 -0
- package/src/registry/atoms/notification-badge/NotificationBadge.svelte +30 -0
- package/src/registry/atoms/notification-badge/index.ts +1 -0
- package/src/registry/atoms/otp-input/OtpInput.svelte +108 -0
- package/src/registry/atoms/otp-input/index.ts +1 -0
- package/src/registry/atoms/select/Select.svelte +216 -0
- package/src/registry/atoms/select/index.ts +6 -0
- package/src/registry/atoms/settings-card/SettingsCard.svelte +48 -0
- package/src/registry/atoms/settings-card/index.ts +1 -0
- package/src/registry/atoms/sidebar-item/SidebarItem.svelte +90 -0
- package/src/registry/atoms/sidebar-item/index.ts +1 -0
- package/src/registry/atoms/statistic-card/StatisticCard.svelte +53 -0
- package/src/registry/atoms/statistic-card/index.ts +1 -0
- package/src/registry/atoms/text-editor/TextEditor.svelte +77 -0
- package/src/registry/atoms/text-editor/index.ts +1 -0
- package/src/registry/atoms/uploader/Uploader.svelte +102 -0
- package/src/registry/atoms/uploader/index.ts +1 -0
- package/src/registry/atoms/user-item/UserItem.svelte +39 -0
- package/src/registry/atoms/user-item/index.ts +1 -0
- package/src/registry/blocks/account-section/AccountSection01.svelte +112 -0
- package/src/registry/blocks/account-section/AccountSection02.svelte +190 -0
- package/src/registry/blocks/account-section/AccountSection03.svelte +161 -0
- package/src/registry/blocks/account-section/AccountSection04.svelte +164 -0
- package/src/registry/blocks/account-section/AccountSection05.svelte +76 -0
- package/src/registry/blocks/account-section/index.ts +5 -0
- package/src/registry/blocks/app-shell/AppShell01.svelte +74 -0
- package/src/registry/blocks/app-shell/AppShell02.svelte +87 -0
- package/src/registry/blocks/app-shell/AppShell03.svelte +79 -0
- package/src/registry/blocks/app-shell/AppShell04.svelte +177 -0
- package/src/registry/blocks/app-shell/index.ts +4 -0
- package/src/registry/blocks/auth/AuthSplitScreen.svelte +132 -0
- package/src/registry/blocks/auth/LoginBlock01.svelte +94 -0
- package/src/registry/blocks/auth/LoginBlock02.svelte +103 -0
- package/src/registry/blocks/auth/LoginBlock03.svelte +53 -0
- package/src/registry/blocks/auth/LoginBlock04.svelte +99 -0
- package/src/registry/blocks/auth/LoginBlock05.svelte +101 -0
- package/src/registry/blocks/auth/OtpBlock01.svelte +115 -0
- package/src/registry/blocks/auth/OtpBlock02.svelte +113 -0
- package/src/registry/blocks/auth/OtpBlock03.svelte +143 -0
- package/src/registry/blocks/auth/OtpBlock04.svelte +122 -0
- package/src/registry/blocks/auth/OtpBlock05.svelte +81 -0
- package/src/registry/blocks/auth/SignupBlock01.svelte +103 -0
- package/src/registry/blocks/auth/SignupBlock02.svelte +94 -0
- package/src/registry/blocks/auth/SignupBlock03.svelte +120 -0
- package/src/registry/blocks/auth/SignupBlock04.svelte +112 -0
- package/src/registry/blocks/auth/SignupBlock05.svelte +77 -0
- package/src/registry/blocks/auth/index.ts +31 -0
- package/src/registry/blocks/banner/Banner01.svelte +67 -0
- package/src/registry/blocks/banner/Banner02.svelte +61 -0
- package/src/registry/blocks/banner/Banner03.svelte +54 -0
- package/src/registry/blocks/banner/Banner04.svelte +49 -0
- package/src/registry/blocks/banner/Banner05.svelte +47 -0
- package/src/registry/blocks/banner/index.ts +5 -0
- package/src/registry/blocks/bento-grid/BentoGrid01.svelte +92 -0
- package/src/registry/blocks/bento-grid/BentoGrid02.svelte +79 -0
- package/src/registry/blocks/bento-grid/BentoGrid03.svelte +79 -0
- package/src/registry/blocks/bento-grid/BentoGrid04.svelte +58 -0
- package/src/registry/blocks/bento-grid/BentoGrid05.svelte +92 -0
- package/src/registry/blocks/bento-grid/BentoGrid06.svelte +42 -0
- package/src/registry/blocks/bento-grid/index.ts +14 -0
- package/src/registry/blocks/blog-section/BlogSection01.svelte +100 -0
- package/src/registry/blocks/blog-section/BlogSection02.svelte +93 -0
- package/src/registry/blocks/blog-section/BlogSection03.svelte +92 -0
- package/src/registry/blocks/blog-section/BlogSection04.svelte +97 -0
- package/src/registry/blocks/blog-section/BlogSection05.svelte +120 -0
- package/src/registry/blocks/blog-section/index.ts +15 -0
- package/src/registry/blocks/buttons/ButtonBookmark.svelte +37 -0
- package/src/registry/blocks/buttons/ButtonLike.svelte +37 -0
- package/src/registry/blocks/buttons/ButtonMenu.svelte +37 -0
- package/src/registry/blocks/buttons/ButtonSplitDropdown.svelte +46 -0
- package/src/registry/blocks/buttons/ButtonStepper.svelte +55 -0
- package/src/registry/blocks/buttons/ButtonSteps.svelte +73 -0
- package/src/registry/blocks/buttons/ButtonToggleGroup.svelte +35 -0
- package/src/registry/blocks/buttons/ButtonsGroup.svelte +63 -0
- package/src/registry/blocks/buttons/SocialButtonsHorizontal.svelte +41 -0
- package/src/registry/blocks/buttons/SocialButtonsVertical.svelte +53 -0
- package/src/registry/blocks/buttons/index.ts +10 -0
- package/src/registry/blocks/calendar/CalendarBlock01.svelte +169 -0
- package/src/registry/blocks/calendar/CalendarBlock02.svelte +133 -0
- package/src/registry/blocks/calendar/CalendarBlock03.svelte +194 -0
- package/src/registry/blocks/calendar/CalendarBlock04.svelte +96 -0
- package/src/registry/blocks/calendar/CalendarBlock05.svelte +97 -0
- package/src/registry/blocks/calendar/CalendarBlock06.svelte +98 -0
- package/src/registry/blocks/calendar/CalendarBlock07.svelte +109 -0
- package/src/registry/blocks/calendar/CalendarBlock08.svelte +71 -0
- package/src/registry/blocks/calendar/CalendarBlock09.svelte +99 -0
- package/src/registry/blocks/calendar/CalendarBlock10.svelte +88 -0
- package/src/registry/blocks/calendar/CalendarBlock11.svelte +99 -0
- package/src/registry/blocks/calendar/CalendarBlock12.svelte +121 -0
- package/src/registry/blocks/calendar/CalendarBlock13.svelte +92 -0
- package/src/registry/blocks/calendar/CalendarBlock14.svelte +71 -0
- package/src/registry/blocks/calendar/CalendarBlock15.svelte +96 -0
- package/src/registry/blocks/calendar/CalendarBlock16.svelte +98 -0
- package/src/registry/blocks/calendar/CalendarBlock17.svelte +88 -0
- package/src/registry/blocks/calendar/CalendarBlock18.svelte +84 -0
- package/src/registry/blocks/calendar/CalendarBlock19.svelte +105 -0
- package/src/registry/blocks/calendar/CalendarBlock20.svelte +78 -0
- package/src/registry/blocks/calendar/CalendarBlock21.svelte +115 -0
- package/src/registry/blocks/calendar/CalendarBlock22.svelte +136 -0
- package/src/registry/blocks/calendar/CalendarBlock23.svelte +112 -0
- package/src/registry/blocks/calendar/CalendarBlock24.svelte +116 -0
- package/src/registry/blocks/calendar/CalendarBlock25.svelte +144 -0
- package/src/registry/blocks/calendar/CalendarBlock26.svelte +163 -0
- package/src/registry/blocks/calendar/CalendarBlock27.svelte +112 -0
- package/src/registry/blocks/calendar/CalendarBlock28.svelte +109 -0
- package/src/registry/blocks/calendar/CalendarBlock29.svelte +126 -0
- package/src/registry/blocks/calendar/CalendarBlock30.svelte +122 -0
- package/src/registry/blocks/calendar/CalendarBlock31.svelte +161 -0
- package/src/registry/blocks/calendar/CalendarBlock32.svelte +154 -0
- package/src/registry/blocks/calendar/index.ts +32 -0
- package/src/registry/blocks/card/Card01.svelte +69 -0
- package/src/registry/blocks/card/Card02.svelte +50 -0
- package/src/registry/blocks/card/Card03.svelte +60 -0
- package/src/registry/blocks/card/Card04.svelte +89 -0
- package/src/registry/blocks/card/Card05.svelte +51 -0
- package/src/registry/blocks/card/Card06.svelte +77 -0
- package/src/registry/blocks/card/Card07.svelte +35 -0
- package/src/registry/blocks/card/Card08.svelte +36 -0
- package/src/registry/blocks/card/index.ts +8 -0
- package/src/registry/blocks/cart/Cart01.svelte +183 -0
- package/src/registry/blocks/cart/Cart02.svelte +103 -0
- package/src/registry/blocks/cart/Cart03.svelte +38 -0
- package/src/registry/blocks/cart/Cart04.svelte +174 -0
- package/src/registry/blocks/cart/index.ts +4 -0
- package/src/registry/blocks/checkout/Checkout01.svelte +237 -0
- package/src/registry/blocks/checkout/Checkout02.svelte +205 -0
- package/src/registry/blocks/checkout/Checkout03.svelte +189 -0
- package/src/registry/blocks/checkout/Checkout04.svelte +109 -0
- package/src/registry/blocks/checkout/index.ts +4 -0
- package/src/registry/blocks/comparison-section/ComparisonSection01.svelte +116 -0
- package/src/registry/blocks/comparison-section/ComparisonSection02.svelte +98 -0
- package/src/registry/blocks/comparison-section/ComparisonSection03.svelte +93 -0
- package/src/registry/blocks/comparison-section/ComparisonSection04.svelte +98 -0
- package/src/registry/blocks/comparison-section/ComparisonSection05.svelte +119 -0
- package/src/registry/blocks/comparison-section/ComparisonSection06.svelte +154 -0
- package/src/registry/blocks/comparison-section/index.ts +6 -0
- package/src/registry/blocks/contact-section/ContactSection01.svelte +64 -0
- package/src/registry/blocks/contact-section/ContactSection02.svelte +108 -0
- package/src/registry/blocks/contact-section/ContactSection03.svelte +64 -0
- package/src/registry/blocks/contact-section/ContactSection04.svelte +30 -0
- package/src/registry/blocks/contact-section/ContactSection05.svelte +71 -0
- package/src/registry/blocks/contact-section/ContactSection06.svelte +88 -0
- package/src/registry/blocks/contact-section/index.ts +6 -0
- package/src/registry/blocks/cta/CTA01.svelte +44 -0
- package/src/registry/blocks/cta/CTA02.svelte +48 -0
- package/src/registry/blocks/cta/CTA03.svelte +53 -0
- package/src/registry/blocks/cta/CTA04.svelte +60 -0
- package/src/registry/blocks/cta/CTA05.svelte +53 -0
- package/src/registry/blocks/cta/CTA06.svelte +44 -0
- package/src/registry/blocks/cta/CTA07.svelte +39 -0
- package/src/registry/blocks/cta/index.ts +7 -0
- package/src/registry/blocks/dashboard/ChartsBlock01.svelte +275 -0
- package/src/registry/blocks/dashboard/DashboardBlock01.svelte +207 -0
- package/src/registry/blocks/dashboard/DashboardBlock02.svelte +259 -0
- package/src/registry/blocks/dashboard/DashboardBlock03.svelte +315 -0
- package/src/registry/blocks/dashboard/DashboardBlock04.svelte +220 -0
- package/src/registry/blocks/dashboard/DashboardBlock05.svelte +158 -0
- package/src/registry/blocks/dashboard/DashboardBlock06.svelte +173 -0
- package/src/registry/blocks/dashboard/DashboardBlock07.svelte +103 -0
- package/src/registry/blocks/dashboard/index.ts +16 -0
- package/src/registry/blocks/description-list/DescriptionList01.svelte +75 -0
- package/src/registry/blocks/description-list/DescriptionList02.svelte +50 -0
- package/src/registry/blocks/description-list/DescriptionList03.svelte +74 -0
- package/src/registry/blocks/description-list/DescriptionList04.svelte +88 -0
- package/src/registry/blocks/description-list/index.ts +4 -0
- package/src/registry/blocks/empty-lp/EmptyLP01.svelte +46 -0
- package/src/registry/blocks/empty-lp/EmptyLP02.svelte +49 -0
- package/src/registry/blocks/empty-lp/EmptyLP03.svelte +61 -0
- package/src/registry/blocks/empty-lp/EmptyLP04.svelte +37 -0
- package/src/registry/blocks/empty-lp/index.ts +4 -0
- package/src/registry/blocks/empty-section/EmptySection01.svelte +47 -0
- package/src/registry/blocks/empty-section/EmptySection02.svelte +93 -0
- package/src/registry/blocks/empty-section/EmptySection03.svelte +101 -0
- package/src/registry/blocks/empty-section/EmptySection04.svelte +76 -0
- package/src/registry/blocks/empty-section/index.ts +4 -0
- package/src/registry/blocks/faq-section/FaqSection01.svelte +114 -0
- package/src/registry/blocks/faq-section/FaqSection02.svelte +137 -0
- package/src/registry/blocks/faq-section/FaqSection03.svelte +107 -0
- package/src/registry/blocks/faq-section/FaqSection04.svelte +74 -0
- package/src/registry/blocks/faq-section/FaqSection05.svelte +69 -0
- package/src/registry/blocks/faq-section/index.ts +11 -0
- package/src/registry/blocks/feature-section/FeatureSection01.svelte +94 -0
- package/src/registry/blocks/feature-section/FeatureSection02.svelte +61 -0
- package/src/registry/blocks/feature-section/FeatureSection03.svelte +85 -0
- package/src/registry/blocks/feature-section/FeatureSection04.svelte +67 -0
- package/src/registry/blocks/feature-section/FeatureSection05.svelte +61 -0
- package/src/registry/blocks/feature-section/FeatureSection06.svelte +58 -0
- package/src/registry/blocks/feature-section/FeatureSection07.svelte +79 -0
- package/src/registry/blocks/feature-section/FeatureSection08.svelte +92 -0
- package/src/registry/blocks/feature-section/FeatureSection09.svelte +58 -0
- package/src/registry/blocks/feature-section/FeatureSection10.svelte +87 -0
- package/src/registry/blocks/feature-section/FeatureSection11.svelte +118 -0
- package/src/registry/blocks/feature-section/FeatureSection12.svelte +76 -0
- package/src/registry/blocks/feature-section/FeatureSection13.svelte +88 -0
- package/src/registry/blocks/feature-section/FeatureSection14.svelte +119 -0
- package/src/registry/blocks/feature-section/FeatureSection15.svelte +122 -0
- package/src/registry/blocks/feature-section/FeatureSection16.svelte +113 -0
- package/src/registry/blocks/feature-section/FeatureSection17.svelte +93 -0
- package/src/registry/blocks/feature-section/FeatureSection18.svelte +97 -0
- package/src/registry/blocks/feature-section/FeatureSection19.svelte +74 -0
- package/src/registry/blocks/feature-section/FeatureSection20.svelte +69 -0
- package/src/registry/blocks/feature-section/index.ts +20 -0
- package/src/registry/blocks/footer/Footer01.svelte +62 -0
- package/src/registry/blocks/footer/Footer02.svelte +67 -0
- package/src/registry/blocks/footer/Footer03.svelte +87 -0
- package/src/registry/blocks/footer/Footer04.svelte +67 -0
- package/src/registry/blocks/footer/Footer05.svelte +20 -0
- package/src/registry/blocks/footer/Footer06.svelte +107 -0
- package/src/registry/blocks/footer/Footer07.svelte +88 -0
- package/src/registry/blocks/footer/Footer08.svelte +84 -0
- package/src/registry/blocks/footer/Footer09.svelte +65 -0
- package/src/registry/blocks/footer/index.ts +19 -0
- package/src/registry/blocks/forms/SettingsBlock.svelte +329 -0
- package/src/registry/blocks/forms/index.ts +1 -0
- package/src/registry/blocks/gallery-section/GallerySection01.svelte +43 -0
- package/src/registry/blocks/gallery-section/GallerySection02.svelte +45 -0
- package/src/registry/blocks/gallery-section/GallerySection03.svelte +43 -0
- package/src/registry/blocks/gallery-section/GallerySection04.svelte +49 -0
- package/src/registry/blocks/gallery-section/GallerySection05.svelte +45 -0
- package/src/registry/blocks/gallery-section/GallerySection06.svelte +49 -0
- package/src/registry/blocks/gallery-section/GallerySection07.svelte +48 -0
- package/src/registry/blocks/gallery-section/GallerySection08.svelte +43 -0
- package/src/registry/blocks/gallery-section/GallerySection09.svelte +55 -0
- package/src/registry/blocks/gallery-section/GallerySection10.svelte +43 -0
- package/src/registry/blocks/gallery-section/GallerySection11.svelte +75 -0
- package/src/registry/blocks/gallery-section/GallerySection12.svelte +76 -0
- package/src/registry/blocks/gallery-section/index.ts +12 -0
- package/src/registry/blocks/header-section/HeaderSection01.svelte +53 -0
- package/src/registry/blocks/header-section/HeaderSection02.svelte +53 -0
- package/src/registry/blocks/header-section/HeaderSection03.svelte +61 -0
- package/src/registry/blocks/header-section/HeaderSection04.svelte +63 -0
- package/src/registry/blocks/header-section/HeaderSection05.svelte +53 -0
- package/src/registry/blocks/header-section/HeaderSection06.svelte +70 -0
- package/src/registry/blocks/header-section/HeaderSection07.svelte +97 -0
- package/src/registry/blocks/header-section/HeaderSection08.svelte +61 -0
- package/src/registry/blocks/header-section/HeaderSection09.svelte +53 -0
- package/src/registry/blocks/header-section/HeaderSection10.svelte +63 -0
- package/src/registry/blocks/header-section/HeaderSection11.svelte +68 -0
- package/src/registry/blocks/header-section/HeaderSection12.svelte +60 -0
- package/src/registry/blocks/header-section/HeaderSection13.svelte +92 -0
- package/src/registry/blocks/header-section/HeaderSection14.svelte +77 -0
- package/src/registry/blocks/header-section/HeaderSection15.svelte +49 -0
- package/src/registry/blocks/header-section/HeaderSection16.svelte +74 -0
- package/src/registry/blocks/header-section/HeaderSection17.svelte +58 -0
- package/src/registry/blocks/header-section/HeaderSection18.svelte +66 -0
- package/src/registry/blocks/header-section/HeaderSection19.svelte +47 -0
- package/src/registry/blocks/header-section/HeaderSection20.svelte +53 -0
- package/src/registry/blocks/header-section/index.ts +20 -0
- package/src/registry/blocks/hero-section/HeroSection01.svelte +69 -0
- package/src/registry/blocks/hero-section/HeroSection02.svelte +47 -0
- package/src/registry/blocks/hero-section/HeroSection03.svelte +56 -0
- package/src/registry/blocks/hero-section/HeroSection04.svelte +69 -0
- package/src/registry/blocks/hero-section/HeroSection05.svelte +73 -0
- package/src/registry/blocks/hero-section/HeroSection06.svelte +78 -0
- package/src/registry/blocks/hero-section/HeroSection07.svelte +48 -0
- package/src/registry/blocks/hero-section/HeroSection08.svelte +73 -0
- package/src/registry/blocks/hero-section/HeroSection09.svelte +51 -0
- package/src/registry/blocks/hero-section/HeroSection10.svelte +47 -0
- package/src/registry/blocks/hero-section/HeroSection11.svelte +60 -0
- package/src/registry/blocks/hero-section/HeroSection12.svelte +74 -0
- package/src/registry/blocks/hero-section/HeroSection13.svelte +86 -0
- package/src/registry/blocks/hero-section/HeroSection14.svelte +116 -0
- package/src/registry/blocks/hero-section/HeroSection15.svelte +75 -0
- package/src/registry/blocks/hero-section/HeroSection16.svelte +92 -0
- package/src/registry/blocks/hero-section/HeroSection17.svelte +78 -0
- package/src/registry/blocks/hero-section/HeroSection18.svelte +82 -0
- package/src/registry/blocks/hero-section/HeroSection19.svelte +72 -0
- package/src/registry/blocks/hero-section/HeroSection20.svelte +79 -0
- package/src/registry/blocks/hero-section/HeroSection21.svelte +75 -0
- package/src/registry/blocks/hero-section/HeroSection22.svelte +103 -0
- package/src/registry/blocks/hero-section/index.ts +22 -0
- package/src/registry/blocks/logo-section/LogoSection01.svelte +54 -0
- package/src/registry/blocks/logo-section/LogoSection02.svelte +56 -0
- package/src/registry/blocks/logo-section/LogoSection03.svelte +58 -0
- package/src/registry/blocks/logo-section/LogoSection04.svelte +58 -0
- package/src/registry/blocks/logo-section/LogoSection05.svelte +43 -0
- package/src/registry/blocks/logo-section/LogoSection06.svelte +43 -0
- package/src/registry/blocks/logo-section/LogoSection07.svelte +56 -0
- package/src/registry/blocks/logo-section/index.ts +7 -0
- package/src/registry/blocks/lp-navbar/LPNavbar01.svelte +94 -0
- package/src/registry/blocks/lp-navbar/LPNavbar02.svelte +96 -0
- package/src/registry/blocks/lp-navbar/LPNavbar03.svelte +97 -0
- package/src/registry/blocks/lp-navbar/LPNavbar04.svelte +103 -0
- package/src/registry/blocks/lp-navbar/LPNavbar05.svelte +173 -0
- package/src/registry/blocks/lp-navbar/LPNavbar06.svelte +200 -0
- package/src/registry/blocks/lp-navbar/LPNavbar07.svelte +202 -0
- package/src/registry/blocks/lp-navbar/index.ts +7 -0
- package/src/registry/blocks/mail/MailBlock.svelte +321 -0
- package/src/registry/blocks/mail/index.ts +2 -0
- package/src/registry/blocks/music/MusicBlock.svelte +239 -0
- package/src/registry/blocks/music/index.ts +1 -0
- package/src/registry/blocks/navbar/Navbar01.svelte +234 -0
- package/src/registry/blocks/navbar/Navbar02.svelte +111 -0
- package/src/registry/blocks/navbar/Navbar03.svelte +88 -0
- package/src/registry/blocks/navbar/index.ts +3 -0
- package/src/registry/blocks/not-found/NotFound01.svelte +29 -0
- package/src/registry/blocks/not-found/NotFound02.svelte +28 -0
- package/src/registry/blocks/not-found/NotFound03.svelte +25 -0
- package/src/registry/blocks/not-found/index.ts +3 -0
- package/src/registry/blocks/order-history/OrderHistory01.svelte +208 -0
- package/src/registry/blocks/order-history/OrderHistory02.svelte +131 -0
- package/src/registry/blocks/order-history/OrderHistory03.svelte +133 -0
- package/src/registry/blocks/order-history/index.ts +3 -0
- package/src/registry/blocks/page-header/PageHeader01.svelte +39 -0
- package/src/registry/blocks/page-header/PageHeader02.svelte +58 -0
- package/src/registry/blocks/page-header/PageHeader03.svelte +64 -0
- package/src/registry/blocks/page-header/PageHeader04.svelte +49 -0
- package/src/registry/blocks/page-header/PageHeader05.svelte +49 -0
- package/src/registry/blocks/page-header/PageHeader06.svelte +58 -0
- package/src/registry/blocks/page-header/PageHeader07.svelte +64 -0
- package/src/registry/blocks/page-header/PageHeader08.svelte +68 -0
- package/src/registry/blocks/page-header/index.ts +8 -0
- package/src/registry/blocks/playground/PlaygroundBlock01.svelte +162 -0
- package/src/registry/blocks/playground/PlaygroundBlock02.svelte +156 -0
- package/src/registry/blocks/playground/index.ts +2 -0
- package/src/registry/blocks/pricing-section/PricingSection01.svelte +109 -0
- package/src/registry/blocks/pricing-section/PricingSection02.svelte +145 -0
- package/src/registry/blocks/pricing-section/PricingSection03.svelte +94 -0
- package/src/registry/blocks/pricing-section/PricingSection04.svelte +103 -0
- package/src/registry/blocks/pricing-section/PricingSection05.svelte +128 -0
- package/src/registry/blocks/pricing-section/index.ts +20 -0
- package/src/registry/blocks/product-card/ProductCard01.svelte +74 -0
- package/src/registry/blocks/product-card/ProductCard02.svelte +108 -0
- package/src/registry/blocks/product-card/ProductCard03.svelte +80 -0
- package/src/registry/blocks/product-card/ProductCard04.svelte +50 -0
- package/src/registry/blocks/product-card/ProductCard05.svelte +107 -0
- package/src/registry/blocks/product-card/index.ts +5 -0
- package/src/registry/blocks/product-detail/ProductDetail01.svelte +174 -0
- package/src/registry/blocks/product-detail/ProductDetail02.svelte +170 -0
- package/src/registry/blocks/product-detail/ProductDetail03.svelte +159 -0
- package/src/registry/blocks/product-detail/ProductDetail04.svelte +106 -0
- package/src/registry/blocks/product-detail/ProductDetail05.svelte +181 -0
- package/src/registry/blocks/product-detail/index.ts +5 -0
- package/src/registry/blocks/product-listing/ProductListing01.svelte +194 -0
- package/src/registry/blocks/product-listing/ProductListing02.svelte +163 -0
- package/src/registry/blocks/product-listing/ProductListing03.svelte +173 -0
- package/src/registry/blocks/product-listing/ProductListing04.svelte +179 -0
- package/src/registry/blocks/product-listing/ProductListing05.svelte +126 -0
- package/src/registry/blocks/product-listing/index.ts +5 -0
- package/src/registry/blocks/product-reviews/ProductReviews01.svelte +156 -0
- package/src/registry/blocks/product-reviews/ProductReviews02.svelte +139 -0
- package/src/registry/blocks/product-reviews/ProductReviews03.svelte +137 -0
- package/src/registry/blocks/product-reviews/ProductReviews04.svelte +129 -0
- package/src/registry/blocks/product-reviews/index.ts +4 -0
- package/src/registry/blocks/promo-section/PromoSection01.svelte +72 -0
- package/src/registry/blocks/promo-section/PromoSection02.svelte +61 -0
- package/src/registry/blocks/promo-section/PromoSection03.svelte +110 -0
- package/src/registry/blocks/promo-section/PromoSection04.svelte +103 -0
- package/src/registry/blocks/promo-section/index.ts +4 -0
- package/src/registry/blocks/rich-text/RichText01.svelte +30 -0
- package/src/registry/blocks/rich-text/RichText02.svelte +72 -0
- package/src/registry/blocks/rich-text/RichText03.svelte +52 -0
- package/src/registry/blocks/rich-text/RichText04.svelte +44 -0
- package/src/registry/blocks/rich-text/RichText05.svelte +56 -0
- package/src/registry/blocks/rich-text/index.ts +5 -0
- package/src/registry/blocks/section/Section01.svelte +38 -0
- package/src/registry/blocks/section/Section02.svelte +90 -0
- package/src/registry/blocks/section/Section03.svelte +95 -0
- package/src/registry/blocks/section/Section04.svelte +117 -0
- package/src/registry/blocks/section/index.ts +4 -0
- package/src/registry/blocks/section-footer/SectionFooter01.svelte +39 -0
- package/src/registry/blocks/section-footer/SectionFooter02.svelte +33 -0
- package/src/registry/blocks/section-footer/SectionFooter03.svelte +33 -0
- package/src/registry/blocks/section-footer/SectionFooter04.svelte +34 -0
- package/src/registry/blocks/section-footer/SectionFooter05.svelte +69 -0
- package/src/registry/blocks/section-footer/index.ts +5 -0
- package/src/registry/blocks/section-header/SectionHeader01.svelte +39 -0
- package/src/registry/blocks/section-header/SectionHeader02.svelte +58 -0
- package/src/registry/blocks/section-header/SectionHeader03.svelte +88 -0
- package/src/registry/blocks/section-header/SectionHeader04.svelte +45 -0
- package/src/registry/blocks/section-header/SectionHeader05.svelte +64 -0
- package/src/registry/blocks/section-header/index.ts +5 -0
- package/src/registry/blocks/settings/Settings01.svelte +202 -0
- package/src/registry/blocks/settings/Settings02.svelte +201 -0
- package/src/registry/blocks/settings/Settings03.svelte +156 -0
- package/src/registry/blocks/settings/Settings04.svelte +175 -0
- package/src/registry/blocks/settings/Settings05.svelte +248 -0
- package/src/registry/blocks/settings/Settings06.svelte +120 -0
- package/src/registry/blocks/settings/Settings07.svelte +136 -0
- package/src/registry/blocks/settings/index.ts +7 -0
- package/src/registry/blocks/sidebar/SidebarLayout01.svelte +108 -0
- package/src/registry/blocks/sidebar/SidebarLayout02.svelte +75 -0
- package/src/registry/blocks/sidebar/SidebarLayout03.svelte +108 -0
- package/src/registry/blocks/sidebar/SidebarLayout04.svelte +111 -0
- package/src/registry/blocks/sidebar/SidebarLayout05.svelte +103 -0
- package/src/registry/blocks/sidebar/SidebarLayout06.svelte +122 -0
- package/src/registry/blocks/sidebar/SidebarLayout07.svelte +183 -0
- package/src/registry/blocks/sidebar/SidebarLayout08.svelte +162 -0
- package/src/registry/blocks/sidebar/SidebarLayout09.svelte +167 -0
- package/src/registry/blocks/sidebar/SidebarLayout10.svelte +159 -0
- package/src/registry/blocks/sidebar/SidebarLayout11.svelte +135 -0
- package/src/registry/blocks/sidebar/SidebarLayout12.svelte +159 -0
- package/src/registry/blocks/sidebar/SidebarLayout13.svelte +103 -0
- package/src/registry/blocks/sidebar/SidebarLayout14.svelte +87 -0
- package/src/registry/blocks/sidebar/SidebarLayout15.svelte +228 -0
- package/src/registry/blocks/sidebar/index.ts +15 -0
- package/src/registry/blocks/sign-in/SignIn01.svelte +140 -0
- package/src/registry/blocks/sign-in/SignIn02.svelte +155 -0
- package/src/registry/blocks/sign-in/SignIn03.svelte +214 -0
- package/src/registry/blocks/sign-in/SignIn04.svelte +163 -0
- package/src/registry/blocks/sign-in/SignIn05.svelte +209 -0
- package/src/registry/blocks/sign-in/SignIn06.svelte +233 -0
- package/src/registry/blocks/sign-in/SignIn07.svelte +268 -0
- package/src/registry/blocks/sign-in/SignIn08.svelte +125 -0
- package/src/registry/blocks/sign-in/SignIn09.svelte +93 -0
- package/src/registry/blocks/sign-in/SignIn10.svelte +74 -0
- package/src/registry/blocks/sign-in/index.ts +10 -0
- package/src/registry/blocks/sign-up/SignUp01.svelte +124 -0
- package/src/registry/blocks/sign-up/SignUp02.svelte +110 -0
- package/src/registry/blocks/sign-up/SignUp03.svelte +182 -0
- package/src/registry/blocks/sign-up/SignUp04.svelte +126 -0
- package/src/registry/blocks/sign-up/SignUp05.svelte +182 -0
- package/src/registry/blocks/sign-up/SignUp06.svelte +221 -0
- package/src/registry/blocks/sign-up/SignUp07.svelte +98 -0
- package/src/registry/blocks/sign-up/index.ts +7 -0
- package/src/registry/blocks/stats-section/StatsSection01.svelte +66 -0
- package/src/registry/blocks/stats-section/StatsSection02.svelte +60 -0
- package/src/registry/blocks/stats-section/StatsSection03.svelte +66 -0
- package/src/registry/blocks/stats-section/StatsSection04.svelte +66 -0
- package/src/registry/blocks/stats-section/StatsSection05.svelte +60 -0
- package/src/registry/blocks/stats-section/StatsSection06.svelte +48 -0
- package/src/registry/blocks/stats-section/StatsSection07.svelte +66 -0
- package/src/registry/blocks/stats-section/index.ts +7 -0
- package/src/registry/blocks/store-navbar/StoreNavbar01.svelte +101 -0
- package/src/registry/blocks/store-navbar/StoreNavbar02.svelte +65 -0
- package/src/registry/blocks/store-navbar/StoreNavbar03.svelte +83 -0
- package/src/registry/blocks/store-navbar/StoreNavbar04.svelte +110 -0
- package/src/registry/blocks/store-navbar/StoreNavbar05.svelte +80 -0
- package/src/registry/blocks/store-navbar/index.ts +5 -0
- package/src/registry/blocks/table-header/TableHeader01.svelte +96 -0
- package/src/registry/blocks/table-header/TableHeader02.svelte +86 -0
- package/src/registry/blocks/table-header/TableHeader03.svelte +99 -0
- package/src/registry/blocks/table-header/TableHeader04.svelte +107 -0
- package/src/registry/blocks/table-header/index.ts +4 -0
- package/src/registry/blocks/tasks/TasksBlock.svelte +286 -0
- package/src/registry/blocks/tasks/index.ts +1 -0
- package/src/registry/blocks/team-section/TeamSection01.svelte +80 -0
- package/src/registry/blocks/team-section/TeamSection02.svelte +102 -0
- package/src/registry/blocks/team-section/TeamSection03.svelte +76 -0
- package/src/registry/blocks/team-section/TeamSection04.svelte +106 -0
- package/src/registry/blocks/team-section/index.ts +13 -0
- package/src/registry/blocks/testimonials/Testimonial01.svelte +74 -0
- package/src/registry/blocks/testimonials/Testimonial02.svelte +74 -0
- package/src/registry/blocks/testimonials/Testimonial03.svelte +79 -0
- package/src/registry/blocks/testimonials/Testimonial04.svelte +113 -0
- package/src/registry/blocks/testimonials/Testimonial05.svelte +74 -0
- package/src/registry/blocks/testimonials/Testimonial06.svelte +114 -0
- package/src/registry/blocks/testimonials/Testimonial07.svelte +131 -0
- package/src/registry/blocks/testimonials/Testimonials01.svelte +60 -0
- package/src/registry/blocks/testimonials/Testimonials02.svelte +61 -0
- package/src/registry/blocks/testimonials/Testimonials03.svelte +79 -0
- package/src/registry/blocks/testimonials/Testimonials04.svelte +74 -0
- package/src/registry/blocks/testimonials/Testimonials05.svelte +68 -0
- package/src/registry/blocks/testimonials/Testimonials06.svelte +82 -0
- package/src/registry/blocks/testimonials/Testimonials07.svelte +98 -0
- package/src/registry/blocks/testimonials/index.ts +16 -0
- package/src/registry/templates/cn.ts +42 -0
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Route Generator
|
|
5
|
+
*
|
|
6
|
+
* Generates a new SvelteKit route with TypeScript support, layout, and load functions.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* node __scripts__/generate-route.js <route-path> [options]
|
|
10
|
+
* npm run generate:route <route-path> [options]
|
|
11
|
+
*
|
|
12
|
+
* Options:
|
|
13
|
+
* --type <type> Route type: page|layout|api|group (default: page)
|
|
14
|
+
* --auth Require authentication
|
|
15
|
+
* --roles <roles> Required roles (comma-separated)
|
|
16
|
+
* --with-load Generate load function
|
|
17
|
+
* --with-actions Generate form actions
|
|
18
|
+
* --with-error Generate error page
|
|
19
|
+
*
|
|
20
|
+
* Examples:
|
|
21
|
+
* node __scripts__/generate-route.js dashboard --auth --roles=user,admin
|
|
22
|
+
* node __scripts__/generate-route.js api/users --type=api --with-actions
|
|
23
|
+
* node __scripts__/generate-route.js admin --type=layout --auth --roles=admin
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
// Parse command line arguments
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const routePath = args[0];
|
|
32
|
+
|
|
33
|
+
if (!routePath) {
|
|
34
|
+
console.error('ā Route path is required!');
|
|
35
|
+
console.log('Usage: node __scripts__/generate-route.js <route-path> [options]');
|
|
36
|
+
console.log('Examples:');
|
|
37
|
+
console.log(' node __scripts__/generate-route.js dashboard');
|
|
38
|
+
console.log(' node __scripts__/generate-route.js api/users --type=api');
|
|
39
|
+
console.log(' node __scripts__/generate-route.js admin --type=layout --auth');
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Parse options
|
|
44
|
+
const options = {
|
|
45
|
+
type: 'page',
|
|
46
|
+
auth: false,
|
|
47
|
+
roles: [],
|
|
48
|
+
withLoad: false,
|
|
49
|
+
withActions: false,
|
|
50
|
+
withError: false
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
args.slice(1).forEach(arg => {
|
|
54
|
+
if (arg.startsWith('--type=')) {
|
|
55
|
+
options.type = arg.split('=')[1];
|
|
56
|
+
} else if (arg.startsWith('--roles=')) {
|
|
57
|
+
options.roles = arg.split('=')[1].split(',').map(r => r.trim());
|
|
58
|
+
} else if (arg === '--auth') {
|
|
59
|
+
options.auth = true;
|
|
60
|
+
} else if (arg === '--with-load') {
|
|
61
|
+
options.withLoad = true;
|
|
62
|
+
} else if (arg === '--with-actions') {
|
|
63
|
+
options.withActions = true;
|
|
64
|
+
} else if (arg === '--with-error') {
|
|
65
|
+
options.withError = true;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Validate route type
|
|
70
|
+
if (!['page', 'layout', 'api', 'group'].includes(options.type)) {
|
|
71
|
+
console.error('ā Invalid route type. Must be: page, layout, api, or group');
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Generate file paths
|
|
76
|
+
const routeDir = path.join('src', 'routes', routePath);
|
|
77
|
+
const isApiRoute = routePath.startsWith('api/') || options.type === 'api';
|
|
78
|
+
|
|
79
|
+
// Ensure directory exists
|
|
80
|
+
if (!fs.existsSync(routeDir)) {
|
|
81
|
+
fs.mkdirSync(routeDir, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Generate route name for display
|
|
85
|
+
const routeName = routePath
|
|
86
|
+
.split('/')
|
|
87
|
+
.pop()
|
|
88
|
+
.split('-')
|
|
89
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
90
|
+
.join(' ');
|
|
91
|
+
|
|
92
|
+
// Generate page template
|
|
93
|
+
function generatePageTemplate() {
|
|
94
|
+
const authImport = options.auth ? `
|
|
95
|
+
import { authGuard } from '$lib/utils/auth-guard';
|
|
96
|
+
import { authService } from '$lib/services/auth';` : '';
|
|
97
|
+
|
|
98
|
+
const authCode = options.auth ? `
|
|
99
|
+
const user = authService.getUser();
|
|
100
|
+
const claims = authService.getUserClaims();
|
|
101
|
+
|
|
102
|
+
onMount(() => {
|
|
103
|
+
authGuard({
|
|
104
|
+
requiredRoles: ${JSON.stringify(options.roles)},
|
|
105
|
+
redirectTo: '/login',
|
|
106
|
+
currentPath: $page.url.pathname
|
|
107
|
+
});
|
|
108
|
+
});` : '';
|
|
109
|
+
|
|
110
|
+
const rolesCheck = options.roles.length > 0 ? `
|
|
111
|
+
$: hasRequiredRole = ${options.roles.map(role => `$claims?.roles?.includes('${role}')`).join(' || ')};` : '';
|
|
112
|
+
|
|
113
|
+
return `<script lang="ts">
|
|
114
|
+
import { page } from '$app/stores';
|
|
115
|
+
import { onMount } from 'svelte';${authImport}
|
|
116
|
+
import { Button } from '$lib/components/ui/button';
|
|
117
|
+
import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card';
|
|
118
|
+
${options.withLoad ? "import type { PageData } from './$types';" : ''}
|
|
119
|
+
|
|
120
|
+
${options.withLoad ? 'export let data: PageData;' : ''}
|
|
121
|
+
|
|
122
|
+
// Page state
|
|
123
|
+
let loading = false;
|
|
124
|
+
let error: string | null = null;${authCode}${rolesCheck}
|
|
125
|
+
|
|
126
|
+
onMount(() => {
|
|
127
|
+
loadPageData();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
async function loadPageData() {
|
|
131
|
+
loading = true;
|
|
132
|
+
error = null;
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
// Load page-specific data
|
|
136
|
+
console.log('Loading ${routeName} data...');
|
|
137
|
+
} catch (err) {
|
|
138
|
+
error = 'Failed to load page data';
|
|
139
|
+
console.error('${routeName} error:', err);
|
|
140
|
+
} finally {
|
|
141
|
+
loading = false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function handleRefresh() {
|
|
146
|
+
loadPageData();
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<svelte:head>
|
|
151
|
+
<title>${routeName}</title>
|
|
152
|
+
<meta name="description" content="${routeName} page" />
|
|
153
|
+
</svelte:head>
|
|
154
|
+
|
|
155
|
+
<div class="container mx-auto py-6">
|
|
156
|
+
<div class="mb-6">
|
|
157
|
+
<h1 class="text-3xl font-bold">${routeName}</h1>
|
|
158
|
+
<p class="text-gray-600">Welcome to the ${routeName.toLowerCase()} page</p>
|
|
159
|
+
</div>
|
|
160
|
+
${options.auth && options.roles.length > 0 ? `
|
|
161
|
+
{#if !hasRequiredRole}
|
|
162
|
+
<Card>
|
|
163
|
+
<CardContent class="p-6 text-center">
|
|
164
|
+
<h2 class="text-xl font-semibold mb-2">Access Denied</h2>
|
|
165
|
+
<p class="text-gray-600">You don't have permission to view this page.</p>
|
|
166
|
+
<p class="text-sm text-gray-500 mt-2">Required roles: ${options.roles.join(', ')}</p>
|
|
167
|
+
<Button href="/dashboard" variant="outline" class="mt-4">
|
|
168
|
+
Go to Dashboard
|
|
169
|
+
</Button>
|
|
170
|
+
</CardContent>
|
|
171
|
+
</Card>
|
|
172
|
+
{:else}` : ''}
|
|
173
|
+
|
|
174
|
+
{#if loading}
|
|
175
|
+
<div class="flex justify-center py-12">
|
|
176
|
+
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
|
|
177
|
+
</div>
|
|
178
|
+
{:else if error}
|
|
179
|
+
<Card>
|
|
180
|
+
<CardContent class="p-6">
|
|
181
|
+
<div class="text-center">
|
|
182
|
+
<h2 class="text-xl font-semibold mb-2 text-red-600">Error</h2>
|
|
183
|
+
<p class="text-gray-600 mb-4">{error}</p>
|
|
184
|
+
<Button on:click={handleRefresh} variant="outline">
|
|
185
|
+
Try Again
|
|
186
|
+
</Button>
|
|
187
|
+
</div>
|
|
188
|
+
</CardContent>
|
|
189
|
+
</Card>
|
|
190
|
+
{:else}
|
|
191
|
+
<div class="grid gap-6">
|
|
192
|
+
<Card>
|
|
193
|
+
<CardHeader>
|
|
194
|
+
<CardTitle>${routeName} Content</CardTitle>
|
|
195
|
+
</CardHeader>
|
|
196
|
+
<CardContent>
|
|
197
|
+
<p>Add your page content here.</p>
|
|
198
|
+
${options.auth ? `
|
|
199
|
+
{#if $user}
|
|
200
|
+
<div class="mt-4 p-4 bg-green-50 rounded-lg">
|
|
201
|
+
<p class="text-green-800">Authenticated as: {$user.email}</p>
|
|
202
|
+
{#if $claims?.roles?.length}
|
|
203
|
+
<p class="text-green-600 text-sm">Roles: {$claims.roles.join(', ')}</p>
|
|
204
|
+
{/if}
|
|
205
|
+
</div>
|
|
206
|
+
{/if}` : ''}
|
|
207
|
+
</CardContent>
|
|
208
|
+
</Card>
|
|
209
|
+
</div>
|
|
210
|
+
{/if}${options.auth && options.roles.length > 0 ? `
|
|
211
|
+
{/if}` : ''}
|
|
212
|
+
</div>`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Generate layout template
|
|
216
|
+
function generateLayoutTemplate() {
|
|
217
|
+
const authImport = options.auth ? `
|
|
218
|
+
import { authGuard } from '$lib/utils/auth-guard';
|
|
219
|
+
import { authService } from '$lib/services/auth';` : '';
|
|
220
|
+
|
|
221
|
+
const authCode = options.auth ? `
|
|
222
|
+
const user = authService.getUser();
|
|
223
|
+
const claims = authService.getUserClaims();
|
|
224
|
+
|
|
225
|
+
onMount(() => {
|
|
226
|
+
authGuard({
|
|
227
|
+
requiredRoles: ${JSON.stringify(options.roles)},
|
|
228
|
+
redirectTo: '/login',
|
|
229
|
+
currentPath: $page.url.pathname
|
|
230
|
+
});
|
|
231
|
+
});` : '';
|
|
232
|
+
|
|
233
|
+
return `<script lang="ts">
|
|
234
|
+
import { page } from '$app/stores';
|
|
235
|
+
import { onMount } from 'svelte';${authImport}
|
|
236
|
+
import { Button } from '$lib/components/ui/button';
|
|
237
|
+
${options.withLoad ? "import type { LayoutData } from './$types';" : ''}
|
|
238
|
+
|
|
239
|
+
${options.withLoad ? 'export let data: LayoutData;' : ''}${authCode}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<div class="min-h-screen bg-gray-50">
|
|
243
|
+
<!-- Navigation header -->
|
|
244
|
+
<header class="bg-white shadow-sm border-b">
|
|
245
|
+
<div class="container mx-auto px-4">
|
|
246
|
+
<div class="flex items-center justify-between h-16">
|
|
247
|
+
<div class="flex items-center">
|
|
248
|
+
<h1 class="text-xl font-semibold">${routeName}</h1>
|
|
249
|
+
<nav class="ml-8 space-x-4">
|
|
250
|
+
<!-- Add navigation links -->
|
|
251
|
+
</nav>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div class="flex items-center space-x-4">
|
|
255
|
+
${options.auth ? `
|
|
256
|
+
{#if $user}
|
|
257
|
+
<span class="text-sm text-gray-600">Welcome, {$user.email}</span>
|
|
258
|
+
<Button variant="outline" size="sm" on:click={() => authService.logout()}>
|
|
259
|
+
Logout
|
|
260
|
+
</Button>
|
|
261
|
+
{:else}
|
|
262
|
+
<Button href="/login" size="sm">
|
|
263
|
+
Login
|
|
264
|
+
</Button>
|
|
265
|
+
{/if}` : ''}
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</header>
|
|
270
|
+
|
|
271
|
+
<!-- Main content -->
|
|
272
|
+
<main>
|
|
273
|
+
<slot />
|
|
274
|
+
</main>
|
|
275
|
+
|
|
276
|
+
<!-- Footer -->
|
|
277
|
+
<footer class="bg-white border-t mt-auto">
|
|
278
|
+
<div class="container mx-auto px-4 py-4">
|
|
279
|
+
<p class="text-center text-gray-600 text-sm">
|
|
280
|
+
Ā© {new Date().getFullYear()} Your App. All rights reserved.
|
|
281
|
+
</p>
|
|
282
|
+
</div>
|
|
283
|
+
</footer>
|
|
284
|
+
</div>`;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Generate API route template
|
|
288
|
+
function generateApiTemplate() {
|
|
289
|
+
const methods = options.withActions ? ['GET', 'POST', 'PUT', 'DELETE'] : ['GET'];
|
|
290
|
+
|
|
291
|
+
let template = `import { json, error } from '@sveltejs/kit';
|
|
292
|
+
import type { RequestHandler } from './$types';
|
|
293
|
+
import { apiService } from '$lib/services/api/api.service';
|
|
294
|
+
import { handleError } from '$lib/utils/error-handler';
|
|
295
|
+
|
|
296
|
+
// Types
|
|
297
|
+
interface ${routeName}Item {
|
|
298
|
+
id: string;
|
|
299
|
+
// Add your data structure here
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface Create${routeName}Request {
|
|
303
|
+
// Add creation request structure
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface Update${routeName}Request {
|
|
307
|
+
// Add update request structure
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
`;
|
|
311
|
+
|
|
312
|
+
methods.forEach(method => {
|
|
313
|
+
switch (method) {
|
|
314
|
+
case 'GET':
|
|
315
|
+
template += `
|
|
316
|
+
// GET /${routePath}
|
|
317
|
+
export const GET: RequestHandler = async ({ url, locals }) => {
|
|
318
|
+
try {
|
|
319
|
+
// Optional: Check authentication
|
|
320
|
+
// if (!locals.user) {
|
|
321
|
+
// throw error(401, 'Unauthorized');
|
|
322
|
+
// }
|
|
323
|
+
|
|
324
|
+
// Parse query parameters
|
|
325
|
+
const limit = Number(url.searchParams.get('limit')) || 10;
|
|
326
|
+
const offset = Number(url.searchParams.get('offset')) || 0;
|
|
327
|
+
const search = url.searchParams.get('search') || '';
|
|
328
|
+
|
|
329
|
+
// Fetch data (replace with your data source)
|
|
330
|
+
const items: ${routeName}Item[] = [
|
|
331
|
+
// Mock data - replace with actual data fetching
|
|
332
|
+
];
|
|
333
|
+
|
|
334
|
+
// Apply search filter if provided
|
|
335
|
+
const filteredItems = search
|
|
336
|
+
? items.filter(item =>
|
|
337
|
+
Object.values(item).some(value =>
|
|
338
|
+
String(value).toLowerCase().includes(search.toLowerCase())
|
|
339
|
+
)
|
|
340
|
+
)
|
|
341
|
+
: items;
|
|
342
|
+
|
|
343
|
+
// Apply pagination
|
|
344
|
+
const paginatedItems = filteredItems.slice(offset, offset + limit);
|
|
345
|
+
|
|
346
|
+
return json({
|
|
347
|
+
data: paginatedItems,
|
|
348
|
+
meta: {
|
|
349
|
+
total: filteredItems.length,
|
|
350
|
+
limit,
|
|
351
|
+
offset,
|
|
352
|
+
hasMore: offset + limit < filteredItems.length
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
} catch (err) {
|
|
357
|
+
console.error('GET /${routePath} error:', err);
|
|
358
|
+
const errorResponse = handleError(err, 'Failed to fetch ${routeName.toLowerCase()}');
|
|
359
|
+
throw error(500, errorResponse);
|
|
360
|
+
}
|
|
361
|
+
};`;
|
|
362
|
+
break;
|
|
363
|
+
|
|
364
|
+
case 'POST':
|
|
365
|
+
template += `
|
|
366
|
+
|
|
367
|
+
// POST /${routePath}
|
|
368
|
+
export const POST: RequestHandler = async ({ request, locals }) => {
|
|
369
|
+
try {
|
|
370
|
+
// Check authentication
|
|
371
|
+
// if (!locals.user) {
|
|
372
|
+
// throw error(401, 'Unauthorized');
|
|
373
|
+
// }
|
|
374
|
+
|
|
375
|
+
const requestData: Create${routeName}Request = await request.json();
|
|
376
|
+
|
|
377
|
+
// Validate request data
|
|
378
|
+
if (!requestData) {
|
|
379
|
+
throw error(400, 'Invalid request data');
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Create new item (replace with your data creation logic)
|
|
383
|
+
const newItem: ${routeName}Item = {
|
|
384
|
+
id: crypto.randomUUID(),
|
|
385
|
+
...requestData,
|
|
386
|
+
// Add other fields like timestamps, user ID, etc.
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// Save to database/storage
|
|
390
|
+
// await saveItem(newItem);
|
|
391
|
+
|
|
392
|
+
return json({
|
|
393
|
+
data: newItem,
|
|
394
|
+
message: '${routeName} created successfully'
|
|
395
|
+
}, { status: 201 });
|
|
396
|
+
|
|
397
|
+
} catch (err) {
|
|
398
|
+
console.error('POST /${routePath} error:', err);
|
|
399
|
+
const errorResponse = handleError(err, 'Failed to create ${routeName.toLowerCase()}');
|
|
400
|
+
throw error(500, errorResponse);
|
|
401
|
+
}
|
|
402
|
+
};`;
|
|
403
|
+
break;
|
|
404
|
+
|
|
405
|
+
case 'PUT':
|
|
406
|
+
template += `
|
|
407
|
+
|
|
408
|
+
// PUT /${routePath}/[id]
|
|
409
|
+
export const PUT: RequestHandler = async ({ params, request, locals }) => {
|
|
410
|
+
try {
|
|
411
|
+
// Check authentication
|
|
412
|
+
// if (!locals.user) {
|
|
413
|
+
// throw error(401, 'Unauthorized');
|
|
414
|
+
// }
|
|
415
|
+
|
|
416
|
+
const { id } = params;
|
|
417
|
+
if (!id) {
|
|
418
|
+
throw error(400, 'ID parameter is required');
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const requestData: Update${routeName}Request = await request.json();
|
|
422
|
+
|
|
423
|
+
// Find existing item
|
|
424
|
+
// const existingItem = await findItemById(id);
|
|
425
|
+
// if (!existingItem) {
|
|
426
|
+
// throw error(404, '${routeName} not found');
|
|
427
|
+
// }
|
|
428
|
+
|
|
429
|
+
// Update item (replace with your update logic)
|
|
430
|
+
const updatedItem: ${routeName}Item = {
|
|
431
|
+
id,
|
|
432
|
+
...requestData,
|
|
433
|
+
// Preserve certain fields or add timestamps
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
// Save updated item
|
|
437
|
+
// await updateItem(id, updatedItem);
|
|
438
|
+
|
|
439
|
+
return json({
|
|
440
|
+
data: updatedItem,
|
|
441
|
+
message: '${routeName} updated successfully'
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
} catch (err) {
|
|
445
|
+
console.error('PUT /${routePath}/[id] error:', err);
|
|
446
|
+
const errorResponse = handleError(err, 'Failed to update ${routeName.toLowerCase()}');
|
|
447
|
+
throw error(500, errorResponse);
|
|
448
|
+
}
|
|
449
|
+
};`;
|
|
450
|
+
break;
|
|
451
|
+
|
|
452
|
+
case 'DELETE':
|
|
453
|
+
template += `
|
|
454
|
+
|
|
455
|
+
// DELETE /${routePath}/[id]
|
|
456
|
+
export const DELETE: RequestHandler = async ({ params, locals }) => {
|
|
457
|
+
try {
|
|
458
|
+
// Check authentication
|
|
459
|
+
// if (!locals.user) {
|
|
460
|
+
// throw error(401, 'Unauthorized');
|
|
461
|
+
// }
|
|
462
|
+
|
|
463
|
+
const { id } = params;
|
|
464
|
+
if (!id) {
|
|
465
|
+
throw error(400, 'ID parameter is required');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Find existing item
|
|
469
|
+
// const existingItem = await findItemById(id);
|
|
470
|
+
// if (!existingItem) {
|
|
471
|
+
// throw error(404, '${routeName} not found');
|
|
472
|
+
// }
|
|
473
|
+
|
|
474
|
+
// Delete item (replace with your deletion logic)
|
|
475
|
+
// await deleteItem(id);
|
|
476
|
+
|
|
477
|
+
return json({
|
|
478
|
+
message: '${routeName} deleted successfully'
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
} catch (err) {
|
|
482
|
+
console.error('DELETE /${routePath}/[id] error:', err);
|
|
483
|
+
const errorResponse = handleError(err, 'Failed to delete ${routeName.toLowerCase()}');
|
|
484
|
+
throw error(500, errorResponse);
|
|
485
|
+
}
|
|
486
|
+
};`;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
return template;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Generate load function
|
|
495
|
+
function generateLoadFunction() {
|
|
496
|
+
const fileName = options.type === 'layout' ? '+layout.ts' : '+page.ts';
|
|
497
|
+
|
|
498
|
+
const authCheck = options.auth ? `
|
|
499
|
+
// Check authentication
|
|
500
|
+
if (!locals.user) {
|
|
501
|
+
throw redirect(302, '/login');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Check role permissions
|
|
505
|
+
const userRoles = locals.claims?.roles || [];
|
|
506
|
+
const requiredRoles = ${JSON.stringify(options.roles)};
|
|
507
|
+
|
|
508
|
+
if (requiredRoles.length > 0 && !requiredRoles.some(role => userRoles.includes(role))) {
|
|
509
|
+
throw redirect(302, '/unauthorized');
|
|
510
|
+
}` : '';
|
|
511
|
+
|
|
512
|
+
return `import type { ${options.type === 'layout' ? 'LayoutLoad' : 'PageLoad'} } from './$types';
|
|
513
|
+
import { error, redirect } from '@sveltejs/kit';
|
|
514
|
+
import { apiService } from '$lib/services/api/api.service';
|
|
515
|
+
|
|
516
|
+
export const load: ${options.type === 'layout' ? 'LayoutLoad' : 'PageLoad'} = async ({ params, url, locals, fetch }) => {${authCheck}
|
|
517
|
+
|
|
518
|
+
try {
|
|
519
|
+
// Load page/layout data
|
|
520
|
+
const data = {
|
|
521
|
+
// Add your data loading logic here
|
|
522
|
+
title: '${routeName}',
|
|
523
|
+
user: locals.user || null,
|
|
524
|
+
claims: locals.claims || null
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
// Example: Load data from API
|
|
528
|
+
// const response = await apiService.get('/api/${routePath}', { fetch });
|
|
529
|
+
// data.items = response.data;
|
|
530
|
+
|
|
531
|
+
return data;
|
|
532
|
+
|
|
533
|
+
} catch (err) {
|
|
534
|
+
console.error('Load function error:', err);
|
|
535
|
+
throw error(500, 'Failed to load page data');
|
|
536
|
+
}
|
|
537
|
+
};`;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// Generate form actions
|
|
541
|
+
function generateFormActions() {
|
|
542
|
+
return `import { fail, redirect } from '@sveltejs/kit';
|
|
543
|
+
import type { Actions } from './$types';
|
|
544
|
+
import { apiService } from '$lib/services/api/api.service';
|
|
545
|
+
import { handleError } from '$lib/utils/error-handler';
|
|
546
|
+
|
|
547
|
+
export const actions: Actions = {
|
|
548
|
+
// Default form action
|
|
549
|
+
default: async ({ request, locals }) => {
|
|
550
|
+
${options.auth ? `
|
|
551
|
+
if (!locals.user) {
|
|
552
|
+
throw redirect(302, '/login');
|
|
553
|
+
}` : ''}
|
|
554
|
+
|
|
555
|
+
const formData = await request.formData();
|
|
556
|
+
|
|
557
|
+
try {
|
|
558
|
+
// Process form data
|
|
559
|
+
const data = {
|
|
560
|
+
// Extract form fields
|
|
561
|
+
// name: formData.get('name')?.toString(),
|
|
562
|
+
// email: formData.get('email')?.toString(),
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
// Validate data
|
|
566
|
+
if (!data) {
|
|
567
|
+
return fail(400, {
|
|
568
|
+
error: 'Invalid form data',
|
|
569
|
+
data
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// Process the form submission
|
|
574
|
+
// const result = await apiService.post('/api/${routePath}', data);
|
|
575
|
+
|
|
576
|
+
return {
|
|
577
|
+
success: true,
|
|
578
|
+
message: 'Form submitted successfully'
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
} catch (err) {
|
|
582
|
+
console.error('Form action error:', err);
|
|
583
|
+
return fail(500, {
|
|
584
|
+
error: handleError(err, 'Form submission failed'),
|
|
585
|
+
data: Object.fromEntries(formData)
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
|
|
590
|
+
// Create action
|
|
591
|
+
create: async ({ request, locals }) => {
|
|
592
|
+
${options.auth ? `
|
|
593
|
+
if (!locals.user) {
|
|
594
|
+
throw redirect(302, '/login');
|
|
595
|
+
}` : ''}
|
|
596
|
+
|
|
597
|
+
const formData = await request.formData();
|
|
598
|
+
|
|
599
|
+
try {
|
|
600
|
+
// Handle create logic
|
|
601
|
+
return { success: true };
|
|
602
|
+
} catch (err) {
|
|
603
|
+
return fail(500, { error: 'Create failed' });
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
|
|
607
|
+
// Update action
|
|
608
|
+
update: async ({ request, locals }) => {
|
|
609
|
+
${options.auth ? `
|
|
610
|
+
if (!locals.user) {
|
|
611
|
+
throw redirect(302, '/login');
|
|
612
|
+
}` : ''}
|
|
613
|
+
|
|
614
|
+
const formData = await request.formData();
|
|
615
|
+
|
|
616
|
+
try {
|
|
617
|
+
// Handle update logic
|
|
618
|
+
return { success: true };
|
|
619
|
+
} catch (err) {
|
|
620
|
+
return fail(500, { error: 'Update failed' });
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
// Delete action
|
|
625
|
+
delete: async ({ request, locals }) => {
|
|
626
|
+
${options.auth ? `
|
|
627
|
+
if (!locals.user) {
|
|
628
|
+
throw redirect(302, '/login');
|
|
629
|
+
}` : ''}
|
|
630
|
+
|
|
631
|
+
const formData = await request.formData();
|
|
632
|
+
const id = formData.get('id')?.toString();
|
|
633
|
+
|
|
634
|
+
if (!id) {
|
|
635
|
+
return fail(400, { error: 'ID is required' });
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
try {
|
|
639
|
+
// Handle delete logic
|
|
640
|
+
return { success: true };
|
|
641
|
+
} catch (err) {
|
|
642
|
+
return fail(500, { error: 'Delete failed' });
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
};`;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Generate error page
|
|
649
|
+
function generateErrorTemplate() {
|
|
650
|
+
return `<script lang="ts">
|
|
651
|
+
import { page } from '$app/stores';
|
|
652
|
+
import { Button } from '$lib/components/ui/button';
|
|
653
|
+
import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card';
|
|
654
|
+
|
|
655
|
+
$: error = $page.error;
|
|
656
|
+
$: errorMessage = error?.message || 'An unexpected error occurred';
|
|
657
|
+
$: errorCode = error?.code || 500;
|
|
658
|
+
</script>
|
|
659
|
+
|
|
660
|
+
<svelte:head>
|
|
661
|
+
<title>Error {errorCode}</title>
|
|
662
|
+
</svelte:head>
|
|
663
|
+
|
|
664
|
+
<div class="min-h-screen flex items-center justify-center bg-gray-50 px-4">
|
|
665
|
+
<Card class="max-w-md w-full">
|
|
666
|
+
<CardHeader class="text-center">
|
|
667
|
+
<div class="w-20 h-20 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
668
|
+
<svg class="w-10 h-10 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
669
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
670
|
+
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z" />
|
|
671
|
+
</svg>
|
|
672
|
+
</div>
|
|
673
|
+
<CardTitle class="text-2xl text-red-600">Error {errorCode}</CardTitle>
|
|
674
|
+
</CardHeader>
|
|
675
|
+
|
|
676
|
+
<CardContent class="text-center space-y-4">
|
|
677
|
+
<p class="text-gray-600">{errorMessage}</p>
|
|
678
|
+
|
|
679
|
+
<div class="space-y-2">
|
|
680
|
+
<Button href="/" class="w-full">
|
|
681
|
+
Go Home
|
|
682
|
+
</Button>
|
|
683
|
+
<Button href="/dashboard" variant="outline" class="w-full">
|
|
684
|
+
Go to Dashboard
|
|
685
|
+
</Button>
|
|
686
|
+
</div>
|
|
687
|
+
|
|
688
|
+
<details class="text-left mt-4">
|
|
689
|
+
<summary class="cursor-pointer text-sm text-gray-500">
|
|
690
|
+
Error Details
|
|
691
|
+
</summary>
|
|
692
|
+
<pre class="mt-2 p-3 bg-gray-100 rounded text-xs overflow-auto">
|
|
693
|
+
{JSON.stringify(error, null, 2)}
|
|
694
|
+
</pre>
|
|
695
|
+
</details>
|
|
696
|
+
</CardContent>
|
|
697
|
+
</Card>
|
|
698
|
+
</div>`;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Write files
|
|
702
|
+
try {
|
|
703
|
+
console.log(`š Generating ${options.type} route: /${routePath}`);
|
|
704
|
+
|
|
705
|
+
let filesToCreate = [];
|
|
706
|
+
|
|
707
|
+
if (isApiRoute || options.type === 'api') {
|
|
708
|
+
// API route
|
|
709
|
+
const serverFile = path.join(routeDir, '+server.ts');
|
|
710
|
+
fs.writeFileSync(serverFile, generateApiTemplate());
|
|
711
|
+
filesToCreate.push(serverFile);
|
|
712
|
+
|
|
713
|
+
} else if (options.type === 'layout') {
|
|
714
|
+
// Layout route
|
|
715
|
+
const layoutFile = path.join(routeDir, '+layout.svelte');
|
|
716
|
+
fs.writeFileSync(layoutFile, generateLayoutTemplate());
|
|
717
|
+
filesToCreate.push(layoutFile);
|
|
718
|
+
|
|
719
|
+
if (options.withLoad) {
|
|
720
|
+
const loadFile = path.join(routeDir, '+layout.ts');
|
|
721
|
+
fs.writeFileSync(loadFile, generateLoadFunction());
|
|
722
|
+
filesToCreate.push(loadFile);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
} else if (options.type === 'group') {
|
|
726
|
+
// Route group (just create directory with layout)
|
|
727
|
+
const layoutFile = path.join(routeDir, '+layout.svelte');
|
|
728
|
+
fs.writeFileSync(layoutFile, `<slot />`);
|
|
729
|
+
filesToCreate.push(layoutFile);
|
|
730
|
+
|
|
731
|
+
} else {
|
|
732
|
+
// Page route
|
|
733
|
+
const pageFile = path.join(routeDir, '+page.svelte');
|
|
734
|
+
fs.writeFileSync(pageFile, generatePageTemplate());
|
|
735
|
+
filesToCreate.push(pageFile);
|
|
736
|
+
|
|
737
|
+
if (options.withLoad) {
|
|
738
|
+
const loadFile = path.join(routeDir, '+page.ts');
|
|
739
|
+
fs.writeFileSync(loadFile, generateLoadFunction());
|
|
740
|
+
filesToCreate.push(loadFile);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (options.withActions) {
|
|
744
|
+
const actionsFile = path.join(routeDir, '+page.server.ts');
|
|
745
|
+
fs.writeFileSync(actionsFile, generateFormActions());
|
|
746
|
+
filesToCreate.push(actionsFile);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (options.withError) {
|
|
751
|
+
const errorFile = path.join(routeDir, '+error.svelte');
|
|
752
|
+
fs.writeFileSync(errorFile, generateErrorTemplate());
|
|
753
|
+
filesToCreate.push(errorFile);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
console.log(`ā
Route files created:`);
|
|
757
|
+
filesToCreate.forEach(file => {
|
|
758
|
+
console.log(` ${file}`);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
console.log(`\nš Route /${routePath} generated successfully!`);
|
|
762
|
+
console.log(`\nš View your route at: http://localhost:5173/${routePath}`);
|
|
763
|
+
|
|
764
|
+
if (options.auth) {
|
|
765
|
+
console.log(`\nš Authentication: Enabled`);
|
|
766
|
+
if (options.roles.length > 0) {
|
|
767
|
+
console.log(` Required roles: ${options.roles.join(', ')}`);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
} catch (error) {
|
|
772
|
+
console.error('ā Error generating route:', error.message);
|
|
773
|
+
process.exit(1);
|
|
774
|
+
}
|