@xbg.solutions/create-frontend 1.1.1 → 1.2.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/bin/xbg-frontend.cjs +32 -0
- package/package.json +17 -3
- package/src/commands/add.cjs +470 -0
- package/src/commands/generate.cjs +24 -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
- package/src/index.ts +0 -2
- package/tsconfig.json +0 -20
- /package/src/{generate-component.cjs → commands/generate-component.cjs} +0 -0
- /package/src/{generate-route.cjs → commands/generate-route.cjs} +0 -0
- /package/src/{generate-service.cjs → commands/generate-service.cjs} +0 -0
- /package/src/{manage-auth-users.cjs → commands/manage-auth-users.cjs} +0 -0
- /package/src/{setup.cjs → commands/setup.cjs} +0 -0
- /package/src/{validate-setup.cjs → commands/validate.cjs} +0 -0
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Advanced ImageUpload Component
|
|
3
|
+
|
|
4
|
+
Features:
|
|
5
|
+
- Firebase Storage integration
|
|
6
|
+
- Image preview and cropping
|
|
7
|
+
- Multiple file upload
|
|
8
|
+
- Progress tracking
|
|
9
|
+
- Image optimization
|
|
10
|
+
- Drag and drop support
|
|
11
|
+
- Validation and error handling
|
|
12
|
+
-->
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { Button } from '$lib/components/ui/button';
|
|
15
|
+
import { Card, CardContent } from '$lib/components/ui/card';
|
|
16
|
+
import { Badge } from '$lib/components/ui/badge';
|
|
17
|
+
import { Progress } from '$lib/components/ui/progress';
|
|
18
|
+
import { Alert, AlertDescription } from '$lib/components/ui/alert';
|
|
19
|
+
import { Input } from '$lib/components/ui/input';
|
|
20
|
+
import { Label } from '$lib/components/ui/label';
|
|
21
|
+
import {
|
|
22
|
+
Upload,
|
|
23
|
+
X,
|
|
24
|
+
Image as ImageIcon,
|
|
25
|
+
Download,
|
|
26
|
+
Eye,
|
|
27
|
+
Crop,
|
|
28
|
+
RotateCw,
|
|
29
|
+
ZoomIn,
|
|
30
|
+
ZoomOut,
|
|
31
|
+
Check,
|
|
32
|
+
AlertTriangle,
|
|
33
|
+
FileText,
|
|
34
|
+
Camera
|
|
35
|
+
} from 'lucide-svelte';
|
|
36
|
+
import { toastService as toast } from '@xbg.solutions/frontend-core';
|
|
37
|
+
import { storageService } from '@xbg.solutions/utils-file-upload';
|
|
38
|
+
|
|
39
|
+
// Types
|
|
40
|
+
export interface UploadedFile {
|
|
41
|
+
id: string;
|
|
42
|
+
file: File;
|
|
43
|
+
preview: string;
|
|
44
|
+
url?: string;
|
|
45
|
+
progress: number;
|
|
46
|
+
status: 'pending' | 'uploading' | 'completed' | 'error';
|
|
47
|
+
error?: string;
|
|
48
|
+
metadata?: {
|
|
49
|
+
size: number;
|
|
50
|
+
type: string;
|
|
51
|
+
width?: number;
|
|
52
|
+
height?: number;
|
|
53
|
+
lastModified: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ImageUploadOptions {
|
|
58
|
+
maxFiles?: number;
|
|
59
|
+
maxFileSize?: number; // in MB
|
|
60
|
+
allowedTypes?: string[];
|
|
61
|
+
uploadPath?: string;
|
|
62
|
+
autoUpload?: boolean;
|
|
63
|
+
showPreview?: boolean;
|
|
64
|
+
showProgress?: boolean;
|
|
65
|
+
enableCrop?: boolean;
|
|
66
|
+
enableResize?: boolean;
|
|
67
|
+
thumbnailSize?: { width: number; height: number };
|
|
68
|
+
quality?: number;
|
|
69
|
+
dragAndDrop?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CropConfig {
|
|
73
|
+
aspectRatio?: number;
|
|
74
|
+
minWidth?: number;
|
|
75
|
+
minHeight?: number;
|
|
76
|
+
maxWidth?: number;
|
|
77
|
+
maxHeight?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Props
|
|
81
|
+
let {
|
|
82
|
+
options = {},
|
|
83
|
+
cropConfig = {},
|
|
84
|
+
value = $bindable([]),
|
|
85
|
+
disabled = false,
|
|
86
|
+
className = '',
|
|
87
|
+
placeholder = 'Click or drag images here to upload',
|
|
88
|
+
onUpload,
|
|
89
|
+
onComplete,
|
|
90
|
+
onError,
|
|
91
|
+
onRemove,
|
|
92
|
+
onPreview,
|
|
93
|
+
onCrop,
|
|
94
|
+
}: {
|
|
95
|
+
options?: ImageUploadOptions;
|
|
96
|
+
cropConfig?: CropConfig;
|
|
97
|
+
value?: string[];
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
className?: string;
|
|
100
|
+
placeholder?: string;
|
|
101
|
+
onUpload?: (detail: { files: UploadedFile[] }) => void;
|
|
102
|
+
onComplete?: (detail: { files: UploadedFile[] }) => void;
|
|
103
|
+
onError?: (detail: { error: string; file?: UploadedFile }) => void;
|
|
104
|
+
onRemove?: (detail: { file: UploadedFile }) => void;
|
|
105
|
+
onPreview?: (detail: { file: UploadedFile }) => void;
|
|
106
|
+
onCrop?: (detail: { file: UploadedFile; config: CropConfig }) => void;
|
|
107
|
+
} = $props();
|
|
108
|
+
|
|
109
|
+
// Default options
|
|
110
|
+
const defaultOptions: ImageUploadOptions = {
|
|
111
|
+
maxFiles: 10,
|
|
112
|
+
maxFileSize: 10, // 10MB
|
|
113
|
+
allowedTypes: ['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp'],
|
|
114
|
+
uploadPath: 'uploads',
|
|
115
|
+
autoUpload: true,
|
|
116
|
+
showPreview: true,
|
|
117
|
+
showProgress: true,
|
|
118
|
+
enableCrop: false,
|
|
119
|
+
enableResize: true,
|
|
120
|
+
thumbnailSize: { width: 200, height: 200 },
|
|
121
|
+
quality: 0.8,
|
|
122
|
+
dragAndDrop: true,
|
|
123
|
+
...options
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// State
|
|
127
|
+
let files = $state<UploadedFile[]>([]);
|
|
128
|
+
let fileInput: HTMLInputElement;
|
|
129
|
+
let dragCounter = $state(0);
|
|
130
|
+
let isDragging = $state(false);
|
|
131
|
+
let isProcessing = $state(false);
|
|
132
|
+
let selectedFile = $state<UploadedFile | null>(null);
|
|
133
|
+
let showCropModal = $state(false);
|
|
134
|
+
|
|
135
|
+
// Functions
|
|
136
|
+
function generateFileId(): string {
|
|
137
|
+
return Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function validateFile(file: File): { valid: boolean; error?: string } {
|
|
141
|
+
// Check file type
|
|
142
|
+
if (!defaultOptions.allowedTypes!.includes(file.type)) {
|
|
143
|
+
return {
|
|
144
|
+
valid: false,
|
|
145
|
+
error: `File type ${file.type} is not allowed. Allowed types: ${defaultOptions.allowedTypes!.join(', ')}`
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Check file size
|
|
150
|
+
const maxSizeBytes = defaultOptions.maxFileSize! * 1024 * 1024;
|
|
151
|
+
if (file.size > maxSizeBytes) {
|
|
152
|
+
return {
|
|
153
|
+
valid: false,
|
|
154
|
+
error: `File size ${Math.round(file.size / 1024 / 1024)}MB exceeds maximum allowed size of ${defaultOptions.maxFileSize}MB`
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return { valid: true };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function createPreview(file: File): Promise<string> {
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
const reader = new FileReader();
|
|
164
|
+
reader.onload = (e) => resolve(e.target?.result as string);
|
|
165
|
+
reader.onerror = reject;
|
|
166
|
+
reader.readAsDataURL(file);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function getImageDimensions(src: string): Promise<{ width: number; height: number }> {
|
|
171
|
+
return new Promise((resolve, reject) => {
|
|
172
|
+
const img = new Image();
|
|
173
|
+
img.onload = () => resolve({ width: img.width, height: img.height });
|
|
174
|
+
img.onerror = reject;
|
|
175
|
+
img.src = src;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function resizeImage(file: File, maxWidth: number, maxHeight: number, quality: number = 0.8): Promise<File> {
|
|
180
|
+
return new Promise((resolve, reject) => {
|
|
181
|
+
const canvas = document.createElement('canvas');
|
|
182
|
+
const ctx = canvas.getContext('2d');
|
|
183
|
+
const img = new Image();
|
|
184
|
+
|
|
185
|
+
img.onload = () => {
|
|
186
|
+
// Calculate new dimensions
|
|
187
|
+
let { width, height } = img;
|
|
188
|
+
|
|
189
|
+
if (width > height) {
|
|
190
|
+
if (width > maxWidth) {
|
|
191
|
+
height = (height * maxWidth) / width;
|
|
192
|
+
width = maxWidth;
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
if (height > maxHeight) {
|
|
196
|
+
width = (width * maxHeight) / height;
|
|
197
|
+
height = maxHeight;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
canvas.width = width;
|
|
202
|
+
canvas.height = height;
|
|
203
|
+
|
|
204
|
+
// Draw and compress
|
|
205
|
+
ctx?.drawImage(img, 0, 0, width, height);
|
|
206
|
+
|
|
207
|
+
canvas.toBlob((blob) => {
|
|
208
|
+
if (blob) {
|
|
209
|
+
const resizedFile = new File([blob], file.name, {
|
|
210
|
+
type: file.type,
|
|
211
|
+
lastModified: Date.now()
|
|
212
|
+
});
|
|
213
|
+
resolve(resizedFile);
|
|
214
|
+
} else {
|
|
215
|
+
reject(new Error('Failed to resize image'));
|
|
216
|
+
}
|
|
217
|
+
}, file.type, quality);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
img.onerror = reject;
|
|
221
|
+
img.src = URL.createObjectURL(file);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function processFile(file: File): Promise<UploadedFile> {
|
|
226
|
+
const id = generateFileId();
|
|
227
|
+
const preview = await createPreview(file);
|
|
228
|
+
const dimensions = await getImageDimensions(preview);
|
|
229
|
+
|
|
230
|
+
let processedFile = file;
|
|
231
|
+
|
|
232
|
+
// Resize if enabled and needed
|
|
233
|
+
if (defaultOptions.enableResize && defaultOptions.thumbnailSize) {
|
|
234
|
+
const { width: maxWidth, height: maxHeight } = defaultOptions.thumbnailSize;
|
|
235
|
+
if (dimensions.width > maxWidth || dimensions.height > maxHeight) {
|
|
236
|
+
try {
|
|
237
|
+
processedFile = await resizeImage(file, maxWidth, maxHeight, defaultOptions.quality);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.warn('Failed to resize image, using original:', error);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
id,
|
|
246
|
+
file: processedFile,
|
|
247
|
+
preview,
|
|
248
|
+
progress: 0,
|
|
249
|
+
status: 'pending',
|
|
250
|
+
metadata: {
|
|
251
|
+
size: processedFile.size,
|
|
252
|
+
type: processedFile.type,
|
|
253
|
+
width: dimensions.width,
|
|
254
|
+
height: dimensions.height,
|
|
255
|
+
lastModified: processedFile.lastModified
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async function uploadFile(uploadedFile: UploadedFile): Promise<void> {
|
|
261
|
+
try {
|
|
262
|
+
uploadedFile.status = 'uploading';
|
|
263
|
+
files = files.map(f => f.id === uploadedFile.id ? uploadedFile : f);
|
|
264
|
+
|
|
265
|
+
const fileName = `${uploadedFile.id}-${uploadedFile.file.name}`;
|
|
266
|
+
const filePath = `${defaultOptions.uploadPath}/${fileName}`;
|
|
267
|
+
|
|
268
|
+
// Upload to Firebase Storage with progress tracking
|
|
269
|
+
const url = await storageService.uploadFile(
|
|
270
|
+
uploadedFile.file,
|
|
271
|
+
filePath,
|
|
272
|
+
(progress) => {
|
|
273
|
+
uploadedFile.progress = progress;
|
|
274
|
+
files = files.map(f => f.id === uploadedFile.id ? { ...uploadedFile, progress } : f);
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
uploadedFile.url = url;
|
|
279
|
+
uploadedFile.status = 'completed';
|
|
280
|
+
uploadedFile.progress = 100;
|
|
281
|
+
|
|
282
|
+
files = files.map(f => f.id === uploadedFile.id ? uploadedFile : f);
|
|
283
|
+
|
|
284
|
+
// Update value array
|
|
285
|
+
value = [...value, url];
|
|
286
|
+
|
|
287
|
+
toast.success(`${uploadedFile.file.name} uploaded successfully`);
|
|
288
|
+
|
|
289
|
+
} catch (error) {
|
|
290
|
+
uploadedFile.status = 'error';
|
|
291
|
+
uploadedFile.error = error instanceof Error ? error.message : 'Upload failed';
|
|
292
|
+
|
|
293
|
+
files = files.map(f => f.id === uploadedFile.id ? uploadedFile : f);
|
|
294
|
+
|
|
295
|
+
onError?.({ error: uploadedFile.error, file: uploadedFile });
|
|
296
|
+
toast.error(`Failed to upload ${uploadedFile.file.name}: ${uploadedFile.error}`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async function handleFileSelect(selectedFiles: FileList | null) {
|
|
301
|
+
if (!selectedFiles || selectedFiles.length === 0) return;
|
|
302
|
+
|
|
303
|
+
const currentFileCount = files.length;
|
|
304
|
+
const maxFiles = defaultOptions.maxFiles!;
|
|
305
|
+
|
|
306
|
+
// Check file limit
|
|
307
|
+
if (currentFileCount + selectedFiles.length > maxFiles) {
|
|
308
|
+
toast.error(`Maximum ${maxFiles} files allowed. You can upload ${maxFiles - currentFileCount} more files.`);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
isProcessing = true;
|
|
313
|
+
const newFiles: UploadedFile[] = [];
|
|
314
|
+
|
|
315
|
+
for (let i = 0; i < selectedFiles.length; i++) {
|
|
316
|
+
const file = selectedFiles[i];
|
|
317
|
+
|
|
318
|
+
// Validate file
|
|
319
|
+
const validation = validateFile(file);
|
|
320
|
+
if (!validation.valid) {
|
|
321
|
+
toast.error(validation.error!);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
const uploadedFile = await processFile(file);
|
|
327
|
+
newFiles.push(uploadedFile);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
toast.error(`Failed to process ${file.name}: ${error}`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
files = [...files, ...newFiles];
|
|
334
|
+
isProcessing = false;
|
|
335
|
+
|
|
336
|
+
onUpload?.({ files: newFiles });
|
|
337
|
+
|
|
338
|
+
// Auto-upload if enabled
|
|
339
|
+
if (defaultOptions.autoUpload) {
|
|
340
|
+
for (const file of newFiles) {
|
|
341
|
+
uploadFile(file);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function removeFile(fileToRemove: UploadedFile) {
|
|
347
|
+
// Revoke object URL to prevent memory leaks
|
|
348
|
+
URL.revokeObjectURL(fileToRemove.preview);
|
|
349
|
+
|
|
350
|
+
// Remove from Firebase Storage if uploaded
|
|
351
|
+
if (fileToRemove.url && fileToRemove.status === 'completed') {
|
|
352
|
+
storageService.deleteFile(fileToRemove.url).catch(console.error);
|
|
353
|
+
value = value.filter(url => url !== fileToRemove.url);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
files = files.filter(f => f.id !== fileToRemove.id);
|
|
357
|
+
onRemove?.({ file: fileToRemove });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function openFileDialog() {
|
|
361
|
+
if (disabled) return;
|
|
362
|
+
fileInput?.click();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function openPreview(file: UploadedFile) {
|
|
366
|
+
selectedFile = file;
|
|
367
|
+
onPreview?.({ file });
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function openCropModal(file: UploadedFile) {
|
|
371
|
+
if (!defaultOptions.enableCrop) return;
|
|
372
|
+
selectedFile = file;
|
|
373
|
+
showCropModal = true;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
async function retryUpload(file: UploadedFile) {
|
|
377
|
+
if (file.status !== 'error') return;
|
|
378
|
+
file.status = 'pending';
|
|
379
|
+
file.error = undefined;
|
|
380
|
+
files = [...files];
|
|
381
|
+
await uploadFile(file);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Drag and drop handlers
|
|
385
|
+
function handleDragEnter(e: DragEvent) {
|
|
386
|
+
if (!defaultOptions.dragAndDrop || disabled) return;
|
|
387
|
+
e.preventDefault();
|
|
388
|
+
e.stopPropagation();
|
|
389
|
+
dragCounter++;
|
|
390
|
+
isDragging = true;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function handleDragLeave(e: DragEvent) {
|
|
394
|
+
if (!defaultOptions.dragAndDrop || disabled) return;
|
|
395
|
+
e.preventDefault();
|
|
396
|
+
e.stopPropagation();
|
|
397
|
+
dragCounter--;
|
|
398
|
+
if (dragCounter === 0) {
|
|
399
|
+
isDragging = false;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function handleDragOver(e: DragEvent) {
|
|
404
|
+
if (!defaultOptions.dragAndDrop || disabled) return;
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
e.stopPropagation();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function handleDrop(e: DragEvent) {
|
|
410
|
+
if (!defaultOptions.dragAndDrop || disabled) return;
|
|
411
|
+
e.preventDefault();
|
|
412
|
+
e.stopPropagation();
|
|
413
|
+
|
|
414
|
+
isDragging = false;
|
|
415
|
+
dragCounter = 0;
|
|
416
|
+
|
|
417
|
+
const droppedFiles = e.dataTransfer?.files;
|
|
418
|
+
if (droppedFiles) {
|
|
419
|
+
handleFileSelect(droppedFiles);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function formatFileSize(bytes: number): string {
|
|
424
|
+
if (bytes === 0) return '0 Bytes';
|
|
425
|
+
const k = 1024;
|
|
426
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
427
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
428
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function getStatusColor(status: UploadedFile['status']): string {
|
|
432
|
+
switch (status) {
|
|
433
|
+
case 'completed': return 'text-green-600';
|
|
434
|
+
case 'uploading': return 'text-blue-600';
|
|
435
|
+
case 'error': return 'text-red-600';
|
|
436
|
+
default: return 'text-gray-600';
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function getStatusIcon(status: UploadedFile['status']) {
|
|
441
|
+
switch (status) {
|
|
442
|
+
case 'completed': return Check;
|
|
443
|
+
case 'uploading': return Upload;
|
|
444
|
+
case 'error': return AlertTriangle;
|
|
445
|
+
default: return FileText;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
</script>
|
|
449
|
+
|
|
450
|
+
<div class="image-upload {className}">
|
|
451
|
+
<!-- Hidden file input -->
|
|
452
|
+
<input
|
|
453
|
+
bind:this={fileInput}
|
|
454
|
+
type="file"
|
|
455
|
+
multiple={defaultOptions.maxFiles! > 1}
|
|
456
|
+
accept={defaultOptions.allowedTypes!.join(',')}
|
|
457
|
+
class="hidden"
|
|
458
|
+
onchange={(e) => handleFileSelect(e.currentTarget.files)}
|
|
459
|
+
{disabled}
|
|
460
|
+
/>
|
|
461
|
+
|
|
462
|
+
<!-- Drop Zone -->
|
|
463
|
+
<Card
|
|
464
|
+
class="border-2 border-dashed transition-colors cursor-pointer {isDragging ? 'border-primary bg-primary/5' : ''} {!isDragging && !disabled ? 'border-gray-300' : ''} {disabled ? 'border-gray-200 cursor-not-allowed' : ''}"
|
|
465
|
+
onclick={openFileDialog}
|
|
466
|
+
ondragenter={handleDragEnter}
|
|
467
|
+
ondragleave={handleDragLeave}
|
|
468
|
+
ondragover={handleDragOver}
|
|
469
|
+
ondrop={handleDrop}
|
|
470
|
+
>
|
|
471
|
+
<CardContent class="flex flex-col items-center justify-center p-8 text-center">
|
|
472
|
+
{#if isProcessing}
|
|
473
|
+
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"></div>
|
|
474
|
+
<p class="text-sm text-gray-600">Processing files...</p>
|
|
475
|
+
{:else}
|
|
476
|
+
<div class="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center mb-4">
|
|
477
|
+
{#if defaultOptions.dragAndDrop}
|
|
478
|
+
<Upload class="w-6 h-6 text-gray-400" />
|
|
479
|
+
{:else}
|
|
480
|
+
<Camera class="w-6 h-6 text-gray-400" />
|
|
481
|
+
{/if}
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
<p class="text-sm font-medium text-gray-900 mb-2">
|
|
485
|
+
{placeholder}
|
|
486
|
+
</p>
|
|
487
|
+
|
|
488
|
+
<p class="text-xs text-gray-500">
|
|
489
|
+
{#if defaultOptions.dragAndDrop}
|
|
490
|
+
Drag and drop files here or click to browse
|
|
491
|
+
{:else}
|
|
492
|
+
Click to select files
|
|
493
|
+
{/if}
|
|
494
|
+
</p>
|
|
495
|
+
|
|
496
|
+
<div class="mt-2 text-xs text-gray-400">
|
|
497
|
+
<p>Max {defaultOptions.maxFiles} files, {defaultOptions.maxFileSize}MB each</p>
|
|
498
|
+
<p>Supported: {defaultOptions.allowedTypes!.map(t => t.split('/')[1]).join(', ')}</p>
|
|
499
|
+
</div>
|
|
500
|
+
{/if}
|
|
501
|
+
</CardContent>
|
|
502
|
+
</Card>
|
|
503
|
+
|
|
504
|
+
<!-- File List -->
|
|
505
|
+
{#if files.length > 0}
|
|
506
|
+
<div class="mt-6 space-y-3">
|
|
507
|
+
<div class="flex items-center justify-between">
|
|
508
|
+
<h3 class="text-sm font-medium text-gray-900">
|
|
509
|
+
Files ({files.length}/{defaultOptions.maxFiles})
|
|
510
|
+
</h3>
|
|
511
|
+
|
|
512
|
+
<div class="flex items-center gap-2">
|
|
513
|
+
{#if !defaultOptions.autoUpload}
|
|
514
|
+
<Button
|
|
515
|
+
size="sm"
|
|
516
|
+
variant="outline"
|
|
517
|
+
disabled={files.every(f => f.status !== 'pending')}
|
|
518
|
+
onclick={() => files.filter(f => f.status === 'pending').forEach(uploadFile)}
|
|
519
|
+
>
|
|
520
|
+
<Upload class="w-4 h-4 mr-1" />
|
|
521
|
+
Upload All
|
|
522
|
+
</Button>
|
|
523
|
+
{/if}
|
|
524
|
+
|
|
525
|
+
<Button
|
|
526
|
+
size="sm"
|
|
527
|
+
variant="outline"
|
|
528
|
+
onclick={() => files.forEach(removeFile)}
|
|
529
|
+
>
|
|
530
|
+
<X class="w-4 h-4 mr-1" />
|
|
531
|
+
Clear All
|
|
532
|
+
</Button>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
|
|
536
|
+
{#each files as file}
|
|
537
|
+
<Card class="p-4">
|
|
538
|
+
<div class="flex items-center gap-4">
|
|
539
|
+
<!-- Preview -->
|
|
540
|
+
{#if defaultOptions.showPreview}
|
|
541
|
+
<div
|
|
542
|
+
class="relative w-16 h-16 bg-gray-100 rounded-lg overflow-hidden cursor-pointer"
|
|
543
|
+
onclick={() => openPreview(file)}
|
|
544
|
+
>
|
|
545
|
+
<img
|
|
546
|
+
src={file.preview}
|
|
547
|
+
alt={file.file.name}
|
|
548
|
+
class="w-full h-full object-cover"
|
|
549
|
+
/>
|
|
550
|
+
<div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-20 transition-colors flex items-center justify-center">
|
|
551
|
+
<Eye class="w-4 h-4 text-white opacity-0 hover:opacity-100 transition-opacity" />
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
{/if}
|
|
555
|
+
|
|
556
|
+
<!-- File Info -->
|
|
557
|
+
<div class="flex-1 min-w-0">
|
|
558
|
+
<div class="flex items-center gap-2">
|
|
559
|
+
<p class="text-sm font-medium text-gray-900 truncate">
|
|
560
|
+
{file.file.name}
|
|
561
|
+
</p>
|
|
562
|
+
<Badge variant="outline" class={getStatusColor(file.status)}>
|
|
563
|
+
{file.status}
|
|
564
|
+
</Badge>
|
|
565
|
+
</div>
|
|
566
|
+
|
|
567
|
+
<div class="mt-1 text-xs text-gray-500">
|
|
568
|
+
{formatFileSize(file.file.size)}
|
|
569
|
+
{#if file.metadata?.width && file.metadata?.height}
|
|
570
|
+
• {file.metadata.width}x{file.metadata.height}
|
|
571
|
+
{/if}
|
|
572
|
+
</div>
|
|
573
|
+
|
|
574
|
+
<!-- Progress Bar -->
|
|
575
|
+
{#if defaultOptions.showProgress && (file.status === 'uploading' || file.progress > 0)}
|
|
576
|
+
<Progress value={file.progress} class="h-1 mt-2" />
|
|
577
|
+
{/if}
|
|
578
|
+
|
|
579
|
+
<!-- Error Message -->
|
|
580
|
+
{#if file.error}
|
|
581
|
+
<Alert variant="destructive" class="mt-2">
|
|
582
|
+
<AlertTriangle class="h-4 w-4" />
|
|
583
|
+
<AlertDescription class="text-xs">
|
|
584
|
+
{file.error}
|
|
585
|
+
</AlertDescription>
|
|
586
|
+
</Alert>
|
|
587
|
+
{/if}
|
|
588
|
+
</div>
|
|
589
|
+
|
|
590
|
+
<!-- Actions -->
|
|
591
|
+
<div class="flex items-center gap-1">
|
|
592
|
+
{#if file.status === 'completed'}
|
|
593
|
+
<Button size="sm" variant="ghost" onclick={() => openPreview(file)}>
|
|
594
|
+
<Eye class="w-4 h-4" />
|
|
595
|
+
</Button>
|
|
596
|
+
|
|
597
|
+
{#if file.url}
|
|
598
|
+
<Button size="sm" variant="ghost" onclick={() => window.open(file.url, '_blank')}>
|
|
599
|
+
<Download class="w-4 h-4" />
|
|
600
|
+
</Button>
|
|
601
|
+
{/if}
|
|
602
|
+
|
|
603
|
+
{#if defaultOptions.enableCrop}
|
|
604
|
+
<Button size="sm" variant="ghost" onclick={() => openCropModal(file)}>
|
|
605
|
+
<Crop class="w-4 h-4" />
|
|
606
|
+
</Button>
|
|
607
|
+
{/if}
|
|
608
|
+
{:else if file.status === 'error'}
|
|
609
|
+
<Button size="sm" variant="ghost" onclick={() => retryUpload(file)}>
|
|
610
|
+
<RotateCw class="w-4 h-4" />
|
|
611
|
+
</Button>
|
|
612
|
+
{:else if !defaultOptions.autoUpload && file.status === 'pending'}
|
|
613
|
+
<Button size="sm" variant="ghost" onclick={() => uploadFile(file)}>
|
|
614
|
+
<Upload class="w-4 h-4" />
|
|
615
|
+
</Button>
|
|
616
|
+
{/if}
|
|
617
|
+
|
|
618
|
+
<Button size="sm" variant="ghost" onclick={() => removeFile(file)}>
|
|
619
|
+
<X class="w-4 h-4" />
|
|
620
|
+
</Button>
|
|
621
|
+
</div>
|
|
622
|
+
</div>
|
|
623
|
+
</Card>
|
|
624
|
+
{/each}
|
|
625
|
+
</div>
|
|
626
|
+
{/if}
|
|
627
|
+
</div>
|
|
628
|
+
|
|
629
|
+
<!-- Image Preview Modal -->
|
|
630
|
+
{#if selectedFile}
|
|
631
|
+
<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">
|
|
632
|
+
<Card class="max-w-4xl max-h-[90vh] overflow-hidden">
|
|
633
|
+
<CardContent class="p-0">
|
|
634
|
+
<div class="relative">
|
|
635
|
+
<img
|
|
636
|
+
src={selectedFile.preview}
|
|
637
|
+
alt={selectedFile.file.name}
|
|
638
|
+
class="w-full h-auto max-h-[80vh] object-contain"
|
|
639
|
+
/>
|
|
640
|
+
|
|
641
|
+
<Button
|
|
642
|
+
size="sm"
|
|
643
|
+
variant="ghost"
|
|
644
|
+
class="absolute top-2 right-2 bg-white bg-opacity-75"
|
|
645
|
+
onclick={() => selectedFile = null}
|
|
646
|
+
>
|
|
647
|
+
<X class="w-4 h-4" />
|
|
648
|
+
</Button>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
<div class="p-4 border-t">
|
|
652
|
+
<h3 class="font-medium">{selectedFile.file.name}</h3>
|
|
653
|
+
<p class="text-sm text-gray-500 mt-1">
|
|
654
|
+
{formatFileSize(selectedFile.file.size)}
|
|
655
|
+
{#if selectedFile.metadata?.width && selectedFile.metadata?.height}
|
|
656
|
+
• {selectedFile.metadata.width}x{selectedFile.metadata.height}
|
|
657
|
+
{/if}
|
|
658
|
+
</p>
|
|
659
|
+
</div>
|
|
660
|
+
</CardContent>
|
|
661
|
+
</Card>
|
|
662
|
+
</div>
|
|
663
|
+
{/if}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { default as DataTable } from './DataTable.svelte';
|
|
2
|
+
export { default as FormWizard } from './FormWizard.svelte';
|
|
3
|
+
export { default as ImageUpload } from './ImageUpload.svelte';
|
|
4
|
+
export { default as ChartWrapper } from './ChartWrapper.svelte';
|
|
5
|
+
|
|
6
|
+
// Export types
|
|
7
|
+
export type {
|
|
8
|
+
Column,
|
|
9
|
+
DataTableOptions,
|
|
10
|
+
SortConfig,
|
|
11
|
+
FilterConfig,
|
|
12
|
+
BulkAction
|
|
13
|
+
} from './DataTable.svelte';
|
|
14
|
+
|
|
15
|
+
export type {
|
|
16
|
+
WizardStep,
|
|
17
|
+
ValidationResult,
|
|
18
|
+
WizardOptions
|
|
19
|
+
} from './FormWizard.svelte';
|
|
20
|
+
|
|
21
|
+
export type {
|
|
22
|
+
UploadedFile,
|
|
23
|
+
ImageUploadOptions,
|
|
24
|
+
CropConfig
|
|
25
|
+
} from './ImageUpload.svelte';
|
|
26
|
+
|
|
27
|
+
export type {
|
|
28
|
+
ChartData,
|
|
29
|
+
Dataset,
|
|
30
|
+
ChartOptions,
|
|
31
|
+
ChartType,
|
|
32
|
+
ChartConfig
|
|
33
|
+
} from './ChartWrapper.svelte';
|