@salla.sa/twilight-theme-engine 1.0.95 → 1.0.96
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/dist/{AddToCartForm-6M57VCZU.js → AddToCartForm-DASRXMY7.js} +3 -3
- package/dist/{AddToCartForm-6M57VCZU.js.map → AddToCartForm-DASRXMY7.js.map} +1 -1
- package/dist/{BlogAuthorPage-F6RKZEXT.js → BlogAuthorPage-WFZGYSUB.js} +26 -24
- package/dist/BlogAuthorPage-WFZGYSUB.js.map +1 -0
- package/dist/{BlogCategoryPage-TMADZWDK.js → BlogCategoryPage-23PFOVVP.js} +26 -24
- package/dist/BlogCategoryPage-23PFOVVP.js.map +1 -0
- package/dist/{BlogPage-KUNTYL2L.js → BlogPage-4RFI56TW.js} +24 -22
- package/dist/BlogPage-4RFI56TW.js.map +1 -0
- package/dist/{BlogSinglePage-JCI5KX6K.js → BlogSinglePage-KMGBQUG5.js} +24 -22
- package/dist/BlogSinglePage-KMGBQUG5.js.map +1 -0
- package/dist/{BlogTagPage-6IC6HRXA.js → BlogTagPage-ZPQJKPBO.js} +26 -24
- package/dist/BlogTagPage-ZPQJKPBO.js.map +1 -0
- package/dist/{BrandsPage-CK7LZ4ZR.js → BrandsPage-FIHOZYMB.js} +25 -23
- package/dist/BrandsPage-FIHOZYMB.js.map +1 -0
- package/dist/{Breadcrumb-5RWSAJKQ.js → Breadcrumb-2IXFQL6L.js} +24 -22
- package/dist/Breadcrumb-2IXFQL6L.js.map +1 -0
- package/dist/{CartItem-AEIRNYUK.js → CartItem-GRFH5BED.js} +24 -22
- package/dist/CartItem-GRFH5BED.js.map +1 -0
- package/dist/{CartSummary-WCQL3GV5.js → CartSummary-IOCZJL26.js} +24 -22
- package/dist/CartSummary-IOCZJL26.js.map +1 -0
- package/dist/{Copyright-HRQKNNC3.js → Copyright-MDKYCKML.js} +3 -3
- package/dist/{Copyright-HRQKNNC3.js.map → Copyright-MDKYCKML.js.map} +1 -1
- package/dist/{CustomerLayout-ET4OD3VV.js → CustomerLayout-4737YCAK.js} +24 -22
- package/dist/CustomerLayout-4737YCAK.js.map +1 -0
- package/dist/{Footer-N2DCHQMO.js → Footer-2F652QDB.js} +4 -4
- package/dist/{Footer-N2DCHQMO.js.map → Footer-2F652QDB.js.map} +1 -1
- package/dist/Header-4OATF4LX.js +22 -0
- package/dist/{Header-SGRINHMD.js.map → Header-4OATF4LX.js.map} +1 -1
- package/dist/{LoyaltyPage-FLTNW6G3.js → LoyaltyPage-POFUTIPB.js} +24 -22
- package/dist/LoyaltyPage-POFUTIPB.js.map +1 -0
- package/dist/{LoyaltyPointsPage-W4QU4RDU.js → LoyaltyPointsPage-L4S4NZA2.js} +8 -7
- package/dist/LoyaltyPointsPage-L4S4NZA2.js.map +1 -0
- package/dist/{MainMenu-D5CFVBNQ.js → MainMenu-ROGX37TG.js} +7 -6
- package/dist/MainMenu-ROGX37TG.js.map +1 -0
- package/dist/{MasterLayout-DKUMEBDQ.js → MasterLayout-PGL5YU2B.js} +24 -22
- package/dist/{MasterLayout-DKUMEBDQ.js.map → MasterLayout-PGL5YU2B.js.map} +1 -1
- package/dist/{MobileMenu-3LCM35WP.js → MobileMenu-VGXWJHEF.js} +25 -23
- package/dist/MobileMenu-VGXWJHEF.js.map +1 -0
- package/dist/{NotificationsPage-KJ6WDEVH.js → NotificationsPage-PZAEKKJO.js} +24 -22
- package/dist/NotificationsPage-PZAEKKJO.js.map +1 -0
- package/dist/{OrderSinglePage-H6TGX43N.js → OrderSinglePage-KTKLXTUX.js} +25 -23
- package/dist/OrderSinglePage-KTKLXTUX.js.map +1 -0
- package/dist/{OrdersPage-BEBXUZGC.js → OrdersPage-BY6LYV5M.js} +24 -22
- package/dist/OrdersPage-BY6LYV5M.js.map +1 -0
- package/dist/{PageSingle-P5PI65M5.js → PageSingle-CJRT3HJZ.js} +6 -5
- package/dist/PageSingle-CJRT3HJZ.js.map +1 -0
- package/dist/{ProductDetails-PWS4VZWO.js → ProductDetails-O2VJVIZC.js} +7 -6
- package/dist/ProductDetails-O2VJVIZC.js.map +1 -0
- package/dist/{ProfilePage-25NC72CQ.js → ProfilePage-TB7PBODI.js} +24 -22
- package/dist/ProfilePage-TB7PBODI.js.map +1 -0
- package/dist/{RenderWhenVisible-F44J5MMG.js → RenderWhenVisible-KWAXEJOJ.js} +8 -5
- package/dist/RenderWhenVisible-KWAXEJOJ.js.map +1 -0
- package/dist/{ReviewsPage-JQJEEKR3.js → ReviewsPage-5KGCKLFR.js} +3 -3
- package/dist/{ReviewsPage-JQJEEKR3.js.map → ReviewsPage-5KGCKLFR.js.map} +1 -1
- package/dist/{SeoCartWidget-A7MCWGQ2.js → SeoCartWidget-6BU7WCTP.js} +24 -22
- package/dist/SeoCartWidget-6BU7WCTP.js.map +1 -0
- package/dist/{SettingsPage-6W32UA32.js → SettingsPage-G55AM2KS.js} +24 -22
- package/dist/SettingsPage-G55AM2KS.js.map +1 -0
- package/dist/{StoreClosedNotification-B3MQFPFY.js → StoreClosedNotification-C3BBFGAA.js} +25 -23
- package/dist/{StoreClosedNotification-B3MQFPFY.js.map → StoreClosedNotification-C3BBFGAA.js.map} +1 -1
- package/dist/{TestimonialsPage-MDYX65Z3.js → TestimonialsPage-EA4PSO7E.js} +6 -5
- package/dist/TestimonialsPage-EA4PSO7E.js.map +1 -0
- package/dist/{ThankYouPage-AFJCN3AH.js → ThankYouPage-R2OEK7ZZ.js} +24 -22
- package/dist/ThankYouPage-R2OEK7ZZ.js.map +1 -0
- package/dist/{WalletPage-S6S5ZV3A.js → WalletPage-MEWHIHUE.js} +25 -23
- package/dist/WalletPage-MEWHIHUE.js.map +1 -0
- package/dist/{WishlistPage-YH4OQPXP.js → WishlistPage-YFKG7CXU.js} +26 -24
- package/dist/WishlistPage-YFKG7CXU.js.map +1 -0
- package/dist/ambient/virtual-modules.d.ts +43 -1
- package/dist/api/advertisement.js +4 -3
- package/dist/api/apps.js +4 -3
- package/dist/api/blog.js +6 -5
- package/dist/api/brands.js +6 -5
- package/dist/api/cart.js +6 -5
- package/dist/api/category.js +6 -5
- package/dist/api/client.js +3 -2
- package/dist/api/home.js +4 -3
- package/dist/api/loyalty.js +6 -5
- package/dist/api/menu.js +4 -3
- package/dist/api/notification.js +4 -3
- package/dist/api/order.js +6 -5
- package/dist/api/page.js +6 -5
- package/dist/api/product.js +6 -5
- package/dist/api/profile.js +3 -2
- package/dist/api/profile.js.map +1 -1
- package/dist/api/store.js +4 -3
- package/dist/api/translations.js +4 -3
- package/dist/api/user.js +4 -3
- package/dist/api/wallet.js +4 -3
- package/dist/api/wishlist.js +7 -6
- package/dist/{chunk-LV6J5FMT.js → chunk-2D5TFSVG.js} +8 -8
- package/dist/{chunk-LV6J5FMT.js.map → chunk-2D5TFSVG.js.map} +1 -1
- package/dist/{chunk-HQAFPDJK.js → chunk-2FDLEB5J.js} +3 -3
- package/dist/{chunk-HQAFPDJK.js.map → chunk-2FDLEB5J.js.map} +1 -1
- package/dist/chunk-2FKZAAV7.js +90 -0
- package/dist/chunk-2FKZAAV7.js.map +1 -0
- package/dist/{chunk-FCTL7IV6.js → chunk-3GW3VFR6.js} +3 -3
- package/dist/{chunk-FCTL7IV6.js.map → chunk-3GW3VFR6.js.map} +1 -1
- package/dist/{chunk-CEYT3JER.js → chunk-56T47K7P.js} +4 -4
- package/dist/{chunk-CEYT3JER.js.map → chunk-56T47K7P.js.map} +1 -1
- package/dist/{chunk-LPQ5FUMJ.js → chunk-5SDCUGYR.js} +4 -4
- package/dist/{chunk-LPQ5FUMJ.js.map → chunk-5SDCUGYR.js.map} +1 -1
- package/dist/{chunk-QGOPTVV5.js → chunk-6EQ7G3SZ.js} +4 -3
- package/dist/chunk-6EQ7G3SZ.js.map +1 -0
- package/dist/{chunk-QFS2SHJ4.js → chunk-6RHU4TEF.js} +7 -7
- package/dist/{chunk-QFS2SHJ4.js.map → chunk-6RHU4TEF.js.map} +1 -1
- package/dist/{chunk-FZYR4BA2.js → chunk-7WTUA4WY.js} +3 -3
- package/dist/{chunk-FZYR4BA2.js.map → chunk-7WTUA4WY.js.map} +1 -1
- package/dist/{chunk-3PXONLUK.js → chunk-BH7YNCYB.js} +3 -3
- package/dist/{chunk-3PXONLUK.js.map → chunk-BH7YNCYB.js.map} +1 -1
- package/dist/{chunk-DBW7XXNE.js → chunk-BPL5H33B.js} +4 -4
- package/dist/{chunk-DBW7XXNE.js.map → chunk-BPL5H33B.js.map} +1 -1
- package/dist/{chunk-66K5P5ZX.js → chunk-CNUBL24W.js} +3 -3
- package/dist/{chunk-66K5P5ZX.js.map → chunk-CNUBL24W.js.map} +1 -1
- package/dist/chunk-COJH52VR.js +443 -0
- package/dist/chunk-COJH52VR.js.map +1 -0
- package/dist/{chunk-6OOTDFC7.js → chunk-D56TVNOG.js} +3 -3
- package/dist/{chunk-6OOTDFC7.js.map → chunk-D56TVNOG.js.map} +1 -1
- package/dist/{chunk-Y7XVWQXG.js → chunk-DNPQ2JBM.js} +4 -4
- package/dist/{chunk-Y7XVWQXG.js.map → chunk-DNPQ2JBM.js.map} +1 -1
- package/dist/{chunk-JJARU7YP.js → chunk-EWLVLDRP.js} +3 -3
- package/dist/{chunk-JJARU7YP.js.map → chunk-EWLVLDRP.js.map} +1 -1
- package/dist/{chunk-DTS3AGXT.js → chunk-FNHZEBA5.js} +9 -8
- package/dist/chunk-FNHZEBA5.js.map +1 -0
- package/dist/{chunk-HSWRYXC7.js → chunk-FO4WVGUQ.js} +3 -88
- package/dist/chunk-FO4WVGUQ.js.map +1 -0
- package/dist/{chunk-BNI6SKFL.js → chunk-G3UTLICK.js} +4 -4
- package/dist/{chunk-BNI6SKFL.js.map → chunk-G3UTLICK.js.map} +1 -1
- package/dist/{chunk-C4RXPVDF.js → chunk-GMXI6V2D.js} +6 -5
- package/dist/chunk-GMXI6V2D.js.map +1 -0
- package/dist/{chunk-RKQH63G2.js → chunk-GXHJXZBG.js} +4 -4
- package/dist/{chunk-RKQH63G2.js.map → chunk-GXHJXZBG.js.map} +1 -1
- package/dist/{chunk-43D2CG4F.js → chunk-IBSQO6LW.js} +4 -4
- package/dist/{chunk-43D2CG4F.js.map → chunk-IBSQO6LW.js.map} +1 -1
- package/dist/{chunk-ZVZGLEZ6.js → chunk-IU4KTCS3.js} +3 -3
- package/dist/{chunk-ZVZGLEZ6.js.map → chunk-IU4KTCS3.js.map} +1 -1
- package/dist/{chunk-N6OPDLCU.js → chunk-J3G4ZD76.js} +13 -12
- package/dist/chunk-J3G4ZD76.js.map +1 -0
- package/dist/{chunk-ENJ3CM5M.js → chunk-J5X4LXNM.js} +3 -3
- package/dist/{chunk-ENJ3CM5M.js.map → chunk-J5X4LXNM.js.map} +1 -1
- package/dist/{chunk-RNCISHJT.js → chunk-JKBLG344.js} +8 -7
- package/dist/chunk-JKBLG344.js.map +1 -0
- package/dist/{chunk-J47OCHM7.js → chunk-JVIPOD6M.js} +20 -19
- package/dist/chunk-JVIPOD6M.js.map +1 -0
- package/dist/{chunk-4WAUITU2.js → chunk-KNIGLCRV.js} +3 -3
- package/dist/{chunk-4WAUITU2.js.map → chunk-KNIGLCRV.js.map} +1 -1
- package/dist/{chunk-UOQR643Q.js → chunk-KQW6I5CD.js} +4 -4
- package/dist/{chunk-UOQR643Q.js.map → chunk-KQW6I5CD.js.map} +1 -1
- package/dist/{chunk-H64QXA6N.js → chunk-LXNS6CMT.js} +4 -4
- package/dist/{chunk-H64QXA6N.js.map → chunk-LXNS6CMT.js.map} +1 -1
- package/dist/chunk-MGDCJQ5P.js +14 -0
- package/dist/{chunk-7GBNI3AU.js.map → chunk-MGDCJQ5P.js.map} +1 -1
- package/dist/chunk-N45X7D55.js +63 -0
- package/dist/chunk-N45X7D55.js.map +1 -0
- package/dist/{chunk-OH2L4U2C.js → chunk-NZRJOAA7.js} +3 -3
- package/dist/{chunk-OH2L4U2C.js.map → chunk-NZRJOAA7.js.map} +1 -1
- package/dist/{chunk-TEOVJ6WU.js → chunk-O7B5JL6H.js} +4 -4
- package/dist/{chunk-TEOVJ6WU.js.map → chunk-O7B5JL6H.js.map} +1 -1
- package/dist/{chunk-UURVAJ42.js → chunk-OZP2FID7.js} +4 -4
- package/dist/{chunk-UURVAJ42.js.map → chunk-OZP2FID7.js.map} +1 -1
- package/dist/{chunk-HCA2TE4G.js → chunk-PGUKRWOY.js} +5 -5
- package/dist/{chunk-HCA2TE4G.js.map → chunk-PGUKRWOY.js.map} +1 -1
- package/dist/{chunk-3MIFT4VQ.js → chunk-Q62YEBIA.js} +4 -4
- package/dist/{chunk-3MIFT4VQ.js.map → chunk-Q62YEBIA.js.map} +1 -1
- package/dist/{chunk-6DMNJPLW.js → chunk-QS4EDTEX.js} +3 -3
- package/dist/{chunk-6DMNJPLW.js.map → chunk-QS4EDTEX.js.map} +1 -1
- package/dist/{chunk-SAGXF3MU.js → chunk-QZEQOVA5.js} +3 -3
- package/dist/{chunk-SAGXF3MU.js.map → chunk-QZEQOVA5.js.map} +1 -1
- package/dist/{chunk-JTOVO3ZU.js → chunk-RWBTMHLR.js} +5 -5
- package/dist/{chunk-JTOVO3ZU.js.map → chunk-RWBTMHLR.js.map} +1 -1
- package/dist/{chunk-DV6SJHL5.js → chunk-S34G5DL4.js} +4 -4
- package/dist/{chunk-DV6SJHL5.js.map → chunk-S34G5DL4.js.map} +1 -1
- package/dist/{chunk-MKVCFBVF.js → chunk-TIPR4JUO.js} +4 -4
- package/dist/{chunk-MKVCFBVF.js.map → chunk-TIPR4JUO.js.map} +1 -1
- package/dist/{chunk-IR47RORL.js → chunk-ULMSO2XZ.js} +7 -7
- package/dist/{chunk-IR47RORL.js.map → chunk-ULMSO2XZ.js.map} +1 -1
- package/dist/{chunk-IVBOLREE.js → chunk-VWVCSD3N.js} +3 -3
- package/dist/{chunk-IVBOLREE.js.map → chunk-VWVCSD3N.js.map} +1 -1
- package/dist/{chunk-5G7NYNX6.js → chunk-W2LNKEBF.js} +3 -3
- package/dist/{chunk-5G7NYNX6.js.map → chunk-W2LNKEBF.js.map} +1 -1
- package/dist/{chunk-ZTXEXO4W.js → chunk-XGNML7XM.js} +7 -7
- package/dist/{chunk-ZTXEXO4W.js.map → chunk-XGNML7XM.js.map} +1 -1
- package/dist/{chunk-46NBPXAI.js → chunk-XT6CLGF5.js} +3 -3
- package/dist/{chunk-46NBPXAI.js.map → chunk-XT6CLGF5.js.map} +1 -1
- package/dist/{chunk-SFZ7IIWL.js → chunk-ZEGNYJOR.js} +4 -4
- package/dist/{chunk-SFZ7IIWL.js.map → chunk-ZEGNYJOR.js.map} +1 -1
- package/dist/{chunk-6ELXANJG.js → chunk-ZPVLBXDY.js} +4 -4
- package/dist/{chunk-6ELXANJG.js.map → chunk-ZPVLBXDY.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/RenderWhenVisible.d.ts +3 -1
- package/dist/components/common/RenderWhenVisible.d.ts.map +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/common/lazy.d.ts +1 -1
- package/dist/components/common/lazy.d.ts.map +1 -1
- package/dist/components/drawer/index.js +22 -20
- package/dist/components/home/HomePageRenderer.d.ts.map +1 -1
- package/dist/components/home/index.js +26 -24
- package/dist/components/layout/index.js +6 -5
- package/dist/components/product/index.js +23 -21
- package/dist/components/store/index.js +24 -22
- package/dist/components/store/index.js.map +1 -1
- package/dist/components/toast/index.js +4 -3
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tracking/index.js +1 -1
- package/dist/dev/DevSettingsWidget.d.ts +6 -7
- package/dist/dev/DevSettingsWidget.d.ts.map +1 -1
- package/dist/dev/dev-settings-store.d.ts +89 -46
- package/dist/dev/dev-settings-store.d.ts.map +1 -1
- package/dist/dev/editor/AddElementDrawer.d.ts +17 -0
- package/dist/dev/editor/AddElementDrawer.d.ts.map +1 -0
- package/dist/dev/editor/BuilderPanel.d.ts +23 -0
- package/dist/dev/editor/BuilderPanel.d.ts.map +1 -0
- package/dist/dev/editor/SettingsPanel.d.ts +9 -0
- package/dist/dev/editor/SettingsPanel.d.ts.map +1 -0
- package/dist/dev/editor/ThemeEditor.d.ts +20 -0
- package/dist/dev/editor/ThemeEditor.d.ts.map +1 -0
- package/dist/dev/editor/catalog.d.ts +10 -0
- package/dist/dev/editor/catalog.d.ts.map +1 -0
- package/dist/dev/editor/fields.d.ts +18 -0
- package/dist/dev/editor/fields.d.ts.map +1 -0
- package/dist/dev/editor/i18n.d.ts +72 -0
- package/dist/dev/editor/i18n.d.ts.map +1 -0
- package/dist/dev/editor/icons.d.ts +21 -0
- package/dist/dev/editor/icons.d.ts.map +1 -0
- package/dist/dev/editor/index.d.ts +8 -0
- package/dist/dev/editor/index.d.ts.map +1 -0
- package/dist/dev/editor/index.js +2059 -0
- package/dist/dev/editor/index.js.map +1 -0
- package/dist/dev/editor/lookup.d.ts +22 -0
- package/dist/dev/editor/lookup.d.ts.map +1 -0
- package/dist/dev/editor/mount.d.ts +4 -0
- package/dist/dev/editor/mount.d.ts.map +1 -0
- package/dist/dev/editor/paths.d.ts +44 -0
- package/dist/dev/editor/paths.d.ts.map +1 -0
- package/dist/dev/editor/pickers.d.ts +12 -0
- package/dist/dev/editor/pickers.d.ts.map +1 -0
- package/dist/dev/editor/styles.d.ts +8 -0
- package/dist/dev/editor/styles.d.ts.map +1 -0
- package/dist/dev/index.d.ts +1 -1
- package/dist/dev/index.d.ts.map +1 -1
- package/dist/dev/index.js +35 -309
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/schema-types.d.ts +124 -4
- package/dist/dev/schema-types.d.ts.map +1 -1
- package/dist/dev/store-lookup.d.ts +13 -0
- package/dist/dev/store-lookup.d.ts.map +1 -0
- package/dist/document-class-2RROXH4K.js +29 -0
- package/dist/{document-class-BRRNAIKV.js.map → document-class-2RROXH4K.js.map} +1 -1
- package/dist/hooks/index.js +22 -20
- package/dist/hooks/useComments.js +3 -2
- package/dist/hooks/useGtm.js +22 -20
- package/dist/hooks/useMoney.js +22 -20
- package/dist/hooks/useProduct.js +3 -2
- package/dist/hooks/useStore.js +22 -20
- package/dist/hooks/useUser.js +5 -4
- package/dist/hooks/useWishlist.js +3 -2
- package/dist/index.js +22 -20
- package/dist/index.js.map +1 -1
- package/dist/native-app/index.js +3 -2
- package/dist/{navigation-KTFJWOWI.js → navigation-JB2CJXBF.js} +7 -6
- package/dist/navigation-JB2CJXBF.js.map +1 -0
- package/dist/navigation-KTMLD4VB.js +14 -0
- package/dist/{navigation-BARZWXJZ.js.map → navigation-KTMLD4VB.js.map} +1 -1
- package/dist/{not-found-VJDPMT6N.js → not-found-ZM6VIELR.js} +25 -23
- package/dist/not-found-ZM6VIELR.js.map +1 -0
- package/dist/providers/index.js +22 -20
- package/dist/routes/account/orders.js +7 -6
- package/dist/routes/account.js +16 -15
- package/dist/routes/account.js.map +1 -1
- package/dist/routes/blog.js +11 -10
- package/dist/routes/blog.js.map +1 -1
- package/dist/routes/brands.js +7 -6
- package/dist/routes/brands.js.map +1 -1
- package/dist/routes/cart.js +30 -28
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home/HomePage.d.ts.map +1 -1
- package/dist/routes/home.js +27 -25
- package/dist/routes/index.js +6 -5
- package/dist/routes/loyalty.js +8 -7
- package/dist/routes/loyalty.js.map +1 -1
- package/dist/routes/page.js +7 -6
- package/dist/routes/page.js.map +1 -1
- package/dist/routes/product-listing.js +28 -26
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +26 -24
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/seo-redirects.js +6 -5
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +7 -6
- package/dist/routes/thank-you.js.map +1 -1
- package/dist/skeleton.js +27 -25
- package/dist/store-lookup-T4TK7CKA.js +114 -0
- package/dist/store-lookup-T4TK7CKA.js.map +1 -0
- package/dist/tanstack.js +17 -16
- package/dist/tanstack.js.map +1 -1
- package/dist/utils/index.js +6 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/vite/index.js +415 -23
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/twilight-schema.d.ts +7 -2
- package/dist/vite/plugins/twilight-schema.d.ts.map +1 -1
- package/dist/vite/plugins/twilight-schema.plugin.d.ts +26 -0
- package/dist/vite/plugins/twilight-schema.plugin.d.ts.map +1 -1
- package/package.json +5 -1
- package/tailwind/components/common/RenderWhenVisible.tsx.txt +9 -2
- package/tailwind/components/home/HomePageRenderer.tsx.txt +2 -0
- package/tailwind/routes/home/HomePage.tsx.txt +7 -6
- package/dist/BlogAuthorPage-F6RKZEXT.js.map +0 -1
- package/dist/BlogCategoryPage-TMADZWDK.js.map +0 -1
- package/dist/BlogPage-KUNTYL2L.js.map +0 -1
- package/dist/BlogSinglePage-JCI5KX6K.js.map +0 -1
- package/dist/BlogTagPage-6IC6HRXA.js.map +0 -1
- package/dist/BrandsPage-CK7LZ4ZR.js.map +0 -1
- package/dist/Breadcrumb-5RWSAJKQ.js.map +0 -1
- package/dist/CartItem-AEIRNYUK.js.map +0 -1
- package/dist/CartSummary-WCQL3GV5.js.map +0 -1
- package/dist/CustomerLayout-ET4OD3VV.js.map +0 -1
- package/dist/Header-SGRINHMD.js +0 -21
- package/dist/LoyaltyPage-FLTNW6G3.js.map +0 -1
- package/dist/LoyaltyPointsPage-W4QU4RDU.js.map +0 -1
- package/dist/MainMenu-D5CFVBNQ.js.map +0 -1
- package/dist/MobileMenu-3LCM35WP.js.map +0 -1
- package/dist/NotificationsPage-KJ6WDEVH.js.map +0 -1
- package/dist/OrderSinglePage-H6TGX43N.js.map +0 -1
- package/dist/OrdersPage-BEBXUZGC.js.map +0 -1
- package/dist/PageSingle-P5PI65M5.js.map +0 -1
- package/dist/ProductDetails-PWS4VZWO.js.map +0 -1
- package/dist/ProfilePage-25NC72CQ.js.map +0 -1
- package/dist/RenderWhenVisible-F44J5MMG.js.map +0 -1
- package/dist/SeoCartWidget-A7MCWGQ2.js.map +0 -1
- package/dist/SettingsPage-6W32UA32.js.map +0 -1
- package/dist/TestimonialsPage-MDYX65Z3.js.map +0 -1
- package/dist/ThankYouPage-AFJCN3AH.js.map +0 -1
- package/dist/WalletPage-S6S5ZV3A.js.map +0 -1
- package/dist/WishlistPage-YH4OQPXP.js.map +0 -1
- package/dist/chunk-2JV6WZ6O.js +0 -136
- package/dist/chunk-2JV6WZ6O.js.map +0 -1
- package/dist/chunk-7GBNI3AU.js +0 -14
- package/dist/chunk-C4RXPVDF.js.map +0 -1
- package/dist/chunk-DTS3AGXT.js.map +0 -1
- package/dist/chunk-HSWRYXC7.js.map +0 -1
- package/dist/chunk-J47OCHM7.js.map +0 -1
- package/dist/chunk-N6OPDLCU.js.map +0 -1
- package/dist/chunk-QGOPTVV5.js.map +0 -1
- package/dist/chunk-RNCISHJT.js.map +0 -1
- package/dist/document-class-BRRNAIKV.js +0 -28
- package/dist/navigation-BARZWXJZ.js +0 -13
- package/dist/navigation-KTFJWOWI.js.map +0 -1
- package/dist/not-found-VJDPMT6N.js.map +0 -1
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/device.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/device.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AASO,SAAS,WAAA,GAAwB;AACtC,EAAA,IAAI,OAAO,SAAA,KAAc,WAAA,EAAa,OAAO,OAAA;AAC7C,EAAA,MAAM,EAAA,GAAK,UAAU,SAAA,IAAa,EAAA;AAClC,EAAA,IAAI,UAAA,CAAW,IAAA,CAAK,EAAE,CAAA,EAAG,OAAO,SAAA;AAEhC,EAAA,IAAI,kBAAA,CAAmB,IAAA,CAAK,EAAE,CAAA,IAAM,WAAA,CAAY,KAAK,EAAE,CAAA,IAAK,SAAA,CAAU,cAAA,GAAiB,CAAA,EAAI;AACzF,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,OAAA;AACT;AAWO,SAAS,kBAAA,CACd,IAAA,EACA,EAAA,GAAe,WAAA,EAAY,EACP;AACpB,EAAA,IAAI,CAAC,MAAM,OAAO,MAAA;AAClB,EAAA,IAAI,EAAA,KAAO,SAAA,EAAW,OAAO,IAAA,CAAK,cAAc,IAAA,CAAK,QAAA;AACrD,EAAA,OAAO,IAAA,CAAK,YAAY,IAAA,CAAK,UAAA;AAC/B","file":"index.js","sourcesContent":["import type { StoreApps } from '../types';\n\n/** The visitor's mobile operating system, or `'other'` (desktop/unknown/server). */\nexport type MobileOS = 'ios' | 'android' | 'other';\n\n/**\n * Detects the current mobile OS from the User-Agent.\n * Returns `'other'` on the server (no `navigator`) and on desktop/unknown agents.\n */\nexport function getMobileOS(): MobileOS {\n if (typeof navigator === 'undefined') return 'other';\n const ua = navigator.userAgent || '';\n if (/android/i.test(ua)) return 'android';\n // iOS, incl. iPadOS which reports a desktop \"Macintosh\" UA but exposes touch\n if (/iPad|iPhone|iPod/.test(ua) || (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1)) {\n return 'ios';\n }\n return 'other';\n}\n\n/**\n * Picks the mobile-app store URL for the given OS:\n * - `ios` → App Store, falling back to Google Play\n * - `android` → Google Play, falling back to App Store\n * - `other` → App Store, falling back to Google Play\n *\n * `os` defaults to {@link getMobileOS}; pass `'other'` during SSR/first render\n * to keep the output stable and avoid a hydration mismatch on the resolved URL.\n */\nexport function resolveAppStoreUrl(\n apps?: StoreApps,\n os: MobileOS = getMobileOS()\n): string | undefined {\n if (!apps) return undefined;\n if (os === 'android') return apps.googleplay || apps.appstore;\n return apps.appstore || apps.googleplay;\n}\n"]}
|
package/dist/vite/index.js
CHANGED
|
@@ -3,17 +3,18 @@ export { REACT_THEME_TYPE, describeThemeTypeIssue, getThemeType, isReactThemeMan
|
|
|
3
3
|
import { tanstackHeadAdapter } from '../chunk-N2A72R2I.js';
|
|
4
4
|
import { nextjsHeadAdapter } from '../chunk-HOSHJBPS.js';
|
|
5
5
|
import '../chunk-RV54D2D7.js';
|
|
6
|
+
import { EMPTY_DEV_SCHEMA, DEV_PREVIEW_GLOBAL, DEV_PREVIEW_ENDPOINT, normalizePreviewState, DEV_PREVIEW_EVENT, DEV_EDITOR_PATH, DEV_PREVIEW_IMAGE_ENDPOINT, DEV_PREVIEW_IMAGE_MAX_BYTES } from '../chunk-N45X7D55.js';
|
|
6
7
|
import { setHeadAdapter } from '../chunk-GD26FI4J.js';
|
|
7
8
|
import '../chunk-4SZZPXM2.js';
|
|
8
9
|
import { RouteId } from '../chunk-OUW6WESU.js';
|
|
9
10
|
import '../chunk-N2S25NXP.js';
|
|
10
11
|
import '../chunk-T72DAX7R.js';
|
|
11
12
|
import '../chunk-DGUM43GV.js';
|
|
12
|
-
import { readFile, readdir } from 'fs/promises';
|
|
13
|
+
import { readFile, readdir, writeFile, mkdir } from 'fs/promises';
|
|
13
14
|
import { dirname, join, relative, resolve, basename, sep } from 'path';
|
|
15
|
+
import { createHash } from 'crypto';
|
|
14
16
|
import { parseSync } from 'oxc-parser';
|
|
15
17
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, rmSync, readdirSync, statSync } from 'fs';
|
|
16
|
-
import { createHash } from 'crypto';
|
|
17
18
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
18
19
|
import Module, { createRequire } from 'module';
|
|
19
20
|
import { transformSync } from 'esbuild';
|
|
@@ -160,7 +161,33 @@ ${entries.join(",\n")}
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
// src/vite/plugins/twilight-schema.ts
|
|
163
|
-
var
|
|
164
|
+
var TEXT_FORMATS = /* @__PURE__ */ new Set(["text", "icon", "line", "hidden", "url", "email", "color"]);
|
|
165
|
+
function text(value) {
|
|
166
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
167
|
+
}
|
|
168
|
+
function num(value) {
|
|
169
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
170
|
+
}
|
|
171
|
+
function toConditions(raw) {
|
|
172
|
+
if (!Array.isArray(raw)) return void 0;
|
|
173
|
+
const conditions = raw.flatMap((c) => {
|
|
174
|
+
const obj = c ?? {};
|
|
175
|
+
if (typeof obj.id !== "string" || !obj.id) return [];
|
|
176
|
+
const operation = typeof obj.operation === "string" && obj.operation ? obj.operation : "=";
|
|
177
|
+
return [{ id: obj.id, operation, value: obj.value }];
|
|
178
|
+
});
|
|
179
|
+
return conditions.length ? conditions : void 0;
|
|
180
|
+
}
|
|
181
|
+
function extras(entry) {
|
|
182
|
+
const out = {};
|
|
183
|
+
const description = text(entry.description);
|
|
184
|
+
const placeholder = text(entry.placeholder);
|
|
185
|
+
const conditions = toConditions(entry.conditions);
|
|
186
|
+
if (description) out.description = description;
|
|
187
|
+
if (placeholder) out.placeholder = placeholder;
|
|
188
|
+
if (conditions) out.conditions = conditions;
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
164
191
|
function labelOf(entry, fallback) {
|
|
165
192
|
return typeof entry.label === "string" && entry.label.trim() ? entry.label : fallback;
|
|
166
193
|
}
|
|
@@ -196,6 +223,47 @@ function firstScalar(v) {
|
|
|
196
223
|
}
|
|
197
224
|
return v;
|
|
198
225
|
}
|
|
226
|
+
var ENTITY_SOURCES = ["products", "categories", "brands"];
|
|
227
|
+
function isEntitySource(source) {
|
|
228
|
+
return ENTITY_SOURCES.includes(source);
|
|
229
|
+
}
|
|
230
|
+
function classifyString(entry, id, label) {
|
|
231
|
+
const { format } = entry;
|
|
232
|
+
const value = typeof entry.value === "string" ? entry.value : "";
|
|
233
|
+
const base = { id, label, default: value, ...extras(entry) };
|
|
234
|
+
if (format === "textarea") return { ...base, kind: "textarea" };
|
|
235
|
+
if (format === "image") return { ...base, kind: "image" };
|
|
236
|
+
if (typeof format === "string" && TEXT_FORMATS.has(format)) return { ...base, kind: "text" };
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
function classifyCollection(entry, id, label) {
|
|
240
|
+
const prefix = `${id}.`;
|
|
241
|
+
const fields = [];
|
|
242
|
+
for (const sub of Array.isArray(entry.fields) ? entry.fields : []) {
|
|
243
|
+
const subId = typeof sub.id === "string" && sub.id.startsWith(prefix) ? sub.id.slice(prefix.length) : sub.id;
|
|
244
|
+
const field = classify({ ...sub, id: subId });
|
|
245
|
+
if (!field) continue;
|
|
246
|
+
field.conditions = field.conditions?.map(
|
|
247
|
+
(c) => c.id.startsWith(prefix) ? { ...c, id: c.id.slice(prefix.length) } : c
|
|
248
|
+
);
|
|
249
|
+
if (!field.conditions) delete field.conditions;
|
|
250
|
+
fields.push(field);
|
|
251
|
+
}
|
|
252
|
+
const min = num(entry.minLength);
|
|
253
|
+
const max = num(entry.maxLength);
|
|
254
|
+
const itemLabel = text(entry.item_label);
|
|
255
|
+
return {
|
|
256
|
+
id,
|
|
257
|
+
label,
|
|
258
|
+
kind: "collection",
|
|
259
|
+
default: collectionRows(entry),
|
|
260
|
+
fields,
|
|
261
|
+
...min !== void 0 ? { min } : {},
|
|
262
|
+
...max !== void 0 ? { max } : {},
|
|
263
|
+
...itemLabel ? { itemLabel } : {},
|
|
264
|
+
...extras(entry)
|
|
265
|
+
};
|
|
266
|
+
}
|
|
199
267
|
function classify(entry) {
|
|
200
268
|
const id = typeof entry.id === "string" ? entry.id : "";
|
|
201
269
|
if (!id) return null;
|
|
@@ -207,35 +275,103 @@ function classify(entry) {
|
|
|
207
275
|
id,
|
|
208
276
|
label,
|
|
209
277
|
kind: "toggle",
|
|
210
|
-
default: typeof entry.value === "boolean" ? entry.value : false
|
|
278
|
+
default: typeof entry.value === "boolean" ? entry.value : false,
|
|
279
|
+
...extras(entry)
|
|
211
280
|
};
|
|
212
281
|
}
|
|
213
282
|
if (type === "items" && format === "dropdown-list") {
|
|
214
283
|
const options = toOptions(entry.options);
|
|
284
|
+
if (!options && isEntitySource(entry.source)) {
|
|
285
|
+
const min = num(entry.minLength);
|
|
286
|
+
const max = num(entry.maxLength);
|
|
287
|
+
return {
|
|
288
|
+
id,
|
|
289
|
+
label,
|
|
290
|
+
kind: "entities",
|
|
291
|
+
source: entry.source,
|
|
292
|
+
multiple: entry.multichoice === true,
|
|
293
|
+
default: Array.isArray(entry.value) ? entry.value : [],
|
|
294
|
+
...min !== void 0 ? { min } : {},
|
|
295
|
+
...max !== void 0 ? { max } : {},
|
|
296
|
+
...extras(entry)
|
|
297
|
+
};
|
|
298
|
+
}
|
|
215
299
|
if (!options) {
|
|
216
300
|
return {
|
|
217
301
|
id,
|
|
218
302
|
label,
|
|
219
303
|
kind: "readonly",
|
|
220
304
|
default: null,
|
|
221
|
-
note: `remote (${entry.source ?? "dynamic"})
|
|
305
|
+
note: `remote (${entry.source ?? "dynamic"})`,
|
|
306
|
+
...extras(entry)
|
|
222
307
|
};
|
|
223
308
|
}
|
|
224
309
|
const fallback = options[0]?.value;
|
|
225
310
|
const def = firstScalar(entry.value) ?? firstScalar(entry.selected) ?? fallback;
|
|
226
|
-
return { id, label, kind: "select", default: def ?? "", options };
|
|
311
|
+
return { id, label, kind: "select", default: def ?? "", options, ...extras(entry) };
|
|
312
|
+
}
|
|
313
|
+
if (type === "string") {
|
|
314
|
+
const field = classifyString(entry, id, label);
|
|
315
|
+
if (field) return field;
|
|
316
|
+
}
|
|
317
|
+
if (type === "number") {
|
|
318
|
+
const min = num(entry.minimum);
|
|
319
|
+
const max = num(entry.maximum);
|
|
320
|
+
return {
|
|
321
|
+
id,
|
|
322
|
+
label,
|
|
323
|
+
kind: "number",
|
|
324
|
+
default: num(entry.value) ?? null,
|
|
325
|
+
...min !== void 0 ? { min } : {},
|
|
326
|
+
...max !== void 0 ? { max } : {},
|
|
327
|
+
...extras(entry)
|
|
328
|
+
};
|
|
227
329
|
}
|
|
228
|
-
if (type === "
|
|
229
|
-
|
|
330
|
+
if (type === "collection") return classifyCollection(entry, id, label);
|
|
331
|
+
if (type === "items" && format === "variable-list") {
|
|
332
|
+
const linkSources = toOptions(entry.sources);
|
|
333
|
+
return {
|
|
334
|
+
id,
|
|
335
|
+
label,
|
|
336
|
+
kind: "link",
|
|
337
|
+
default: typeof entry.value === "string" ? entry.value : "",
|
|
338
|
+
...linkSources ? { linkSources } : {},
|
|
339
|
+
...extras(entry)
|
|
340
|
+
};
|
|
230
341
|
}
|
|
231
342
|
return {
|
|
232
343
|
id,
|
|
233
344
|
label,
|
|
234
345
|
kind: "readonly",
|
|
235
346
|
default: null,
|
|
236
|
-
note: `${type ?? "unknown"}/${format ?? "?"}
|
|
347
|
+
note: `${type ?? "unknown"}/${format ?? "?"}`,
|
|
348
|
+
...extras(entry)
|
|
237
349
|
};
|
|
238
350
|
}
|
|
351
|
+
function collectionRows(entry) {
|
|
352
|
+
if (!Array.isArray(entry.value)) return [];
|
|
353
|
+
const prefix = `${entry.id}.`;
|
|
354
|
+
return entry.value.filter((row) => !!row && typeof row === "object").map(
|
|
355
|
+
(row) => Object.fromEntries(
|
|
356
|
+
Object.entries(row).map(([key, value]) => [
|
|
357
|
+
key.startsWith(prefix) ? key.slice(prefix.length) : key,
|
|
358
|
+
value
|
|
359
|
+
])
|
|
360
|
+
)
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
function blockDefaultsFor(fieldsRaw, fields) {
|
|
364
|
+
const out = {};
|
|
365
|
+
for (const entry of fieldsRaw) {
|
|
366
|
+
if (typeof entry.id !== "string" || !entry.id || entry.type === "static") continue;
|
|
367
|
+
if (entry.type === "collection") out[entry.id] = collectionRows(entry);
|
|
368
|
+
else if (entry.type === "items" && entry.format === "variable-list")
|
|
369
|
+
out[entry.id] = typeof entry.value === "string" ? entry.value : "";
|
|
370
|
+
else if (entry.type === "items" && !toOptions(entry.options)) out[entry.id] = [];
|
|
371
|
+
else if (entry.value !== void 0) out[entry.id] = entry.value;
|
|
372
|
+
}
|
|
373
|
+
return { ...out, ...defaultsFor(fields) };
|
|
374
|
+
}
|
|
239
375
|
function defaultsFor(fields) {
|
|
240
376
|
const out = {};
|
|
241
377
|
for (const f of fields) {
|
|
@@ -243,6 +379,14 @@ function defaultsFor(fields) {
|
|
|
243
379
|
}
|
|
244
380
|
return out;
|
|
245
381
|
}
|
|
382
|
+
function localizedOf(name) {
|
|
383
|
+
if (typeof name === "string" && name) return { ar: name, en: name };
|
|
384
|
+
if (!name || typeof name !== "object") return void 0;
|
|
385
|
+
const entries = Object.entries(name).filter(
|
|
386
|
+
(entry) => typeof entry[1] === "string" && entry[1] !== ""
|
|
387
|
+
);
|
|
388
|
+
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
389
|
+
}
|
|
246
390
|
function buildTwilightSchema(raw) {
|
|
247
391
|
const root = raw ?? {};
|
|
248
392
|
const settingsRaw = Array.isArray(root.settings) ? root.settings : [];
|
|
@@ -254,6 +398,7 @@ function buildTwilightSchema(raw) {
|
|
|
254
398
|
const componentsRaw = Array.isArray(root.components) ? root.components : [];
|
|
255
399
|
const components = [];
|
|
256
400
|
const componentDefaults = {};
|
|
401
|
+
const blockDefaults = {};
|
|
257
402
|
for (const c of componentsRaw) {
|
|
258
403
|
const path = typeof c.path === "string" && c.path || typeof c.key === "string" && c.key || "";
|
|
259
404
|
if (!path) continue;
|
|
@@ -263,33 +408,271 @@ function buildTwilightSchema(raw) {
|
|
|
263
408
|
const field = classify(fr);
|
|
264
409
|
if (field) fields.push(field);
|
|
265
410
|
}
|
|
266
|
-
|
|
411
|
+
const key = typeof c.key === "string" && c.key ? c.key : void 0;
|
|
412
|
+
const titles = c.title && typeof c.title === "object" ? localizedOf(c.title) : void 0;
|
|
413
|
+
components.push({
|
|
414
|
+
path,
|
|
415
|
+
...key ? { key } : {},
|
|
416
|
+
title: titleOf(c),
|
|
417
|
+
...titles ? { titles } : {},
|
|
418
|
+
...text(c.image) ? { image: text(c.image) } : {},
|
|
419
|
+
...typeof c.icon === "string" && /^sicon-[a-z0-9-]+$/.test(c.icon) ? { icon: c.icon } : {},
|
|
420
|
+
fields
|
|
421
|
+
});
|
|
267
422
|
componentDefaults[path] = defaultsFor(fields);
|
|
423
|
+
blockDefaults[path] = blockDefaultsFor(fieldsRaw, fields);
|
|
268
424
|
}
|
|
425
|
+
const themeName = localizedOf(root.name);
|
|
269
426
|
return {
|
|
427
|
+
...themeName ? { themeName } : {},
|
|
270
428
|
settings,
|
|
271
429
|
components,
|
|
272
430
|
settingsDefaults: defaultsFor(settings),
|
|
273
|
-
componentDefaults
|
|
431
|
+
componentDefaults,
|
|
432
|
+
blockDefaults
|
|
274
433
|
};
|
|
275
434
|
}
|
|
276
435
|
|
|
277
|
-
// src/dev/schema-types.ts
|
|
278
|
-
var EMPTY_DEV_SCHEMA = {
|
|
279
|
-
settings: [],
|
|
280
|
-
components: [],
|
|
281
|
-
settingsDefaults: {},
|
|
282
|
-
componentDefaults: {}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
436
|
// src/vite/plugins/twilight-schema.plugin.ts
|
|
286
437
|
var VIRTUAL_ID2 = "virtual:twilight/schema";
|
|
287
438
|
var RESOLVED_ID2 = "\0" + VIRTUAL_ID2;
|
|
439
|
+
var EDITOR_ENTRY_ID = "virtual:twilight/editor";
|
|
440
|
+
var RESOLVED_EDITOR_ENTRY_ID = "\0" + EDITOR_ENTRY_ID;
|
|
441
|
+
var EDITOR_ENTRY = [
|
|
442
|
+
`import schema from '${VIRTUAL_ID2}';`,
|
|
443
|
+
`import { mountThemeEditor } from '@salla.sa/twilight-theme-engine/dev/editor';`,
|
|
444
|
+
`mountThemeEditor(document.getElementById('root'), schema);`
|
|
445
|
+
].join("\n");
|
|
446
|
+
var EDITOR_HTML = `<!doctype html>
|
|
447
|
+
<html lang="ar" dir="rtl">
|
|
448
|
+
<head>
|
|
449
|
+
<meta charset="utf-8" />
|
|
450
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
451
|
+
<title>Theme editor</title>
|
|
452
|
+
<link rel="stylesheet" href="https://cdn.salla.network/fonts/pingarlt.css" />
|
|
453
|
+
<link rel="stylesheet" href="https://cdn.salla.network/fonts/sallaicons.css" />
|
|
454
|
+
</head>
|
|
455
|
+
<body>
|
|
456
|
+
<div id="root"></div>
|
|
457
|
+
<script type="module" src="/@id/__x00__${EDITOR_ENTRY_ID}"></script>
|
|
458
|
+
</body>
|
|
459
|
+
</html>
|
|
460
|
+
`;
|
|
461
|
+
function serveEditorPage(server, onShown) {
|
|
462
|
+
server.middlewares.use(DEV_EDITOR_PATH, (req, res, next) => {
|
|
463
|
+
const rest = (req.url ?? "/").split("?")[0];
|
|
464
|
+
if (req.method !== "GET" || rest !== "/" && rest !== "") {
|
|
465
|
+
next();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
onShown();
|
|
469
|
+
server.transformIndexHtml(req.originalUrl ?? DEV_EDITOR_PATH, EDITOR_HTML).then((html) => {
|
|
470
|
+
res.statusCode = 200;
|
|
471
|
+
res.setHeader("content-type", "text/html; charset=utf-8");
|
|
472
|
+
res.end(html);
|
|
473
|
+
}).catch(next);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
var EDITOR_OPT_OUT = /(?:^|&)editor=off(?:&|$)/;
|
|
477
|
+
function isStorefrontPage(path) {
|
|
478
|
+
if (/^\/(?:@|__|node_modules\/|_serverFn)/.test(path)) return false;
|
|
479
|
+
const last = path.split("/").pop() ?? "";
|
|
480
|
+
return !last.includes(".");
|
|
481
|
+
}
|
|
482
|
+
function openEditorFirst(server, editorShown) {
|
|
483
|
+
server.middlewares.use((req, res, next) => {
|
|
484
|
+
const url = req.url ?? "/";
|
|
485
|
+
const [path, query = ""] = url.split("?");
|
|
486
|
+
const opens = req.method === "GET" && req.headers["sec-fetch-dest"] === "document" && !EDITOR_OPT_OUT.test(query) && isStorefrontPage(path) && (path === "/" || !editorShown());
|
|
487
|
+
if (!opens) {
|
|
488
|
+
next();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const location = url === "/" ? DEV_EDITOR_PATH : `${DEV_EDITOR_PATH}?path=${encodeURIComponent(url)}`;
|
|
492
|
+
res.statusCode = 302;
|
|
493
|
+
res.setHeader("location", location);
|
|
494
|
+
res.end();
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
function serveEditor(server) {
|
|
498
|
+
let shown = false;
|
|
499
|
+
serveEditorPage(server, () => {
|
|
500
|
+
shown = true;
|
|
501
|
+
});
|
|
502
|
+
openEditorFirst(server, () => shown);
|
|
503
|
+
}
|
|
288
504
|
var EMPTY_MODULE = `export default ${JSON.stringify(EMPTY_DEV_SCHEMA)};`;
|
|
289
505
|
var LOG_PREFIX = "[twilight-react:schema]";
|
|
290
506
|
var MAX_REPORTED = 8;
|
|
507
|
+
var DEV_PREVIEW_FILE = "twilight.preview.json";
|
|
508
|
+
var MAX_PREVIEW_BYTES = 2 * 1024 * 1024;
|
|
509
|
+
async function readPreview(path) {
|
|
510
|
+
try {
|
|
511
|
+
return normalizePreviewState(JSON.parse(await readFile(path, "utf-8")));
|
|
512
|
+
} catch {
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function readBody(req, limit) {
|
|
517
|
+
return new Promise((resolveBody, reject) => {
|
|
518
|
+
let size = 0;
|
|
519
|
+
const chunks = [];
|
|
520
|
+
req.on("data", (chunk) => {
|
|
521
|
+
size += chunk.length;
|
|
522
|
+
if (size > limit) {
|
|
523
|
+
reject(new Error("request too large"));
|
|
524
|
+
req.destroy();
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
chunks.push(chunk);
|
|
528
|
+
});
|
|
529
|
+
req.on("end", () => resolveBody(Buffer.concat(chunks)));
|
|
530
|
+
req.on("error", reject);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
function isSameOrigin(req) {
|
|
534
|
+
const { origin, host } = req.headers;
|
|
535
|
+
const site = req.headers["sec-fetch-site"];
|
|
536
|
+
if (site !== void 0 && site !== "same-origin" && site !== "none") return false;
|
|
537
|
+
if (origin === void 0) return true;
|
|
538
|
+
try {
|
|
539
|
+
return new URL(origin).host === host;
|
|
540
|
+
} catch {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
var IMAGE_EXTENSIONS = {
|
|
545
|
+
"image/png": "png",
|
|
546
|
+
"image/jpeg": "jpg",
|
|
547
|
+
"image/webp": "webp",
|
|
548
|
+
"image/gif": "gif",
|
|
549
|
+
"image/avif": "avif"
|
|
550
|
+
};
|
|
551
|
+
var IMAGE_TYPES = Object.fromEntries(
|
|
552
|
+
Object.entries(IMAGE_EXTENSIONS).map(([type, ext]) => [ext, type])
|
|
553
|
+
);
|
|
554
|
+
var IMAGE_NAME = /^[a-f0-9]{16}\.(png|jpg|webp|gif|avif)$/;
|
|
555
|
+
var DEV_PREVIEW_ASSETS_DIR = "twilight-preview-assets";
|
|
556
|
+
function send(res, status, body, type = "text/plain") {
|
|
557
|
+
res.statusCode = status;
|
|
558
|
+
if (body !== void 0) res.setHeader("content-type", type);
|
|
559
|
+
res.end(body);
|
|
560
|
+
}
|
|
561
|
+
function refreshServerModules(server, resolvedId) {
|
|
562
|
+
const environments = Object.values(server.environments ?? {});
|
|
563
|
+
if (!environments.length) {
|
|
564
|
+
const mod = server.moduleGraph.getModuleById(resolvedId);
|
|
565
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
for (const environment of environments) {
|
|
569
|
+
const mod = environment.moduleGraph.getModuleById(resolvedId);
|
|
570
|
+
if (mod) environment.moduleGraph.invalidateModule(mod);
|
|
571
|
+
if (environment.name !== "client") environment.hot.send({ type: "full-reload" });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function imageRoutes(assets) {
|
|
575
|
+
const saveImage = async (req, res) => {
|
|
576
|
+
const ext = IMAGE_EXTENSIONS[String(req.headers["content-type"]).split(";")[0].trim()];
|
|
577
|
+
if (!ext) {
|
|
578
|
+
send(res, 415, "expected a png, jpeg, webp, gif or avif image");
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const bytes = await readBody(req, DEV_PREVIEW_IMAGE_MAX_BYTES);
|
|
582
|
+
const name = `${createHash("sha256").update(bytes).digest("hex").slice(0, 16)}.${ext}`;
|
|
583
|
+
await mkdir(assets, { recursive: true });
|
|
584
|
+
await writeFile(resolve(assets, name), bytes);
|
|
585
|
+
send(
|
|
586
|
+
res,
|
|
587
|
+
201,
|
|
588
|
+
JSON.stringify({ url: `${DEV_PREVIEW_IMAGE_ENDPOINT}/${name}` }),
|
|
589
|
+
"application/json"
|
|
590
|
+
);
|
|
591
|
+
};
|
|
592
|
+
const serveImage = async (name, res) => {
|
|
593
|
+
if (!IMAGE_NAME.test(name)) {
|
|
594
|
+
send(res, 404);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
try {
|
|
598
|
+
const bytes = await readFile(resolve(assets, name));
|
|
599
|
+
res.statusCode = 200;
|
|
600
|
+
res.setHeader("x-content-type-options", "nosniff");
|
|
601
|
+
res.setHeader("content-type", IMAGE_TYPES[name.slice(name.lastIndexOf(".") + 1)]);
|
|
602
|
+
res.end(bytes);
|
|
603
|
+
} catch {
|
|
604
|
+
send(res, 404);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
return { saveImage, serveImage };
|
|
608
|
+
}
|
|
609
|
+
function servePreviewFile(server, preview) {
|
|
610
|
+
let lastWritten;
|
|
611
|
+
let writes = Promise.resolve();
|
|
612
|
+
const { saveImage, serveImage } = imageRoutes(resolve(dirname(preview), DEV_PREVIEW_ASSETS_DIR));
|
|
613
|
+
server.watcher.add(preview);
|
|
614
|
+
const onPreviewFile = async (file) => {
|
|
615
|
+
if (file !== preview) return;
|
|
616
|
+
let content;
|
|
617
|
+
try {
|
|
618
|
+
content = await readFile(preview, "utf-8");
|
|
619
|
+
} catch {
|
|
620
|
+
content = void 0;
|
|
621
|
+
}
|
|
622
|
+
if (content !== void 0 && content === lastWritten) return;
|
|
623
|
+
refreshServerModules(server, RESOLVED_ID2);
|
|
624
|
+
server.ws.send({ type: "full-reload" });
|
|
625
|
+
};
|
|
626
|
+
server.watcher.on("change", (file) => void onPreviewFile(file));
|
|
627
|
+
server.watcher.on("add", (file) => void onPreviewFile(file));
|
|
628
|
+
server.watcher.on("unlink", (file) => void onPreviewFile(file));
|
|
629
|
+
const saveState = async (req, res) => {
|
|
630
|
+
if (!String(req.headers["content-type"]).startsWith("application/json")) {
|
|
631
|
+
send(res, 415, "expected application/json");
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
const body = JSON.parse((await readBody(req, MAX_PREVIEW_BYTES)).toString("utf-8"));
|
|
635
|
+
const state = normalizePreviewState(body.state);
|
|
636
|
+
if (!state) throw new Error("not a preview state");
|
|
637
|
+
const content = `${JSON.stringify(state, null, 2)}
|
|
638
|
+
`;
|
|
639
|
+
const write = writes.then(async () => {
|
|
640
|
+
lastWritten = content;
|
|
641
|
+
await writeFile(preview, content);
|
|
642
|
+
});
|
|
643
|
+
writes = write.catch(() => {
|
|
644
|
+
});
|
|
645
|
+
await write;
|
|
646
|
+
refreshServerModules(server, RESOLVED_ID2);
|
|
647
|
+
server.ws.send({
|
|
648
|
+
type: "custom",
|
|
649
|
+
event: DEV_PREVIEW_EVENT,
|
|
650
|
+
data: { state, from: typeof body.from === "string" ? body.from : null }
|
|
651
|
+
});
|
|
652
|
+
send(res, 204);
|
|
653
|
+
};
|
|
654
|
+
server.middlewares.use(DEV_PREVIEW_ENDPOINT, (req, res) => {
|
|
655
|
+
const route = (req.url ?? "/").split("?")[0];
|
|
656
|
+
if (req.method === "GET" && route.startsWith("/image/")) {
|
|
657
|
+
void serveImage(route.slice("/image/".length), res);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
if (req.method !== "POST" || route !== "/" && route !== "" && route !== "/image") {
|
|
661
|
+
send(res, 405);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
if (!isSameOrigin(req)) {
|
|
665
|
+
send(res, 403, "cross-origin write refused");
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
(route === "/image" ? saveImage(req, res) : saveState(req, res)).catch(
|
|
669
|
+
(error) => send(res, 400, error instanceof Error ? error.message : "bad request")
|
|
670
|
+
);
|
|
671
|
+
});
|
|
672
|
+
}
|
|
291
673
|
function twilightSchemaPlugin(twilightJsonPath = "twilight.json") {
|
|
292
674
|
let filePath;
|
|
675
|
+
let previewPath;
|
|
293
676
|
let isDevServer = false;
|
|
294
677
|
async function checkManifest() {
|
|
295
678
|
if (!isDevServer || !filePath) return;
|
|
@@ -321,23 +704,30 @@ function twilightSchemaPlugin(twilightJsonPath = "twilight.json") {
|
|
|
321
704
|
configResolved(config) {
|
|
322
705
|
isDevServer = config.command === "serve";
|
|
323
706
|
filePath = resolve(config.root, twilightJsonPath);
|
|
707
|
+
previewPath = resolve(config.root, DEV_PREVIEW_FILE);
|
|
324
708
|
},
|
|
325
709
|
buildStart() {
|
|
326
710
|
return checkManifest();
|
|
327
711
|
},
|
|
328
712
|
resolveId(id) {
|
|
329
713
|
if (id === VIRTUAL_ID2) return RESOLVED_ID2;
|
|
714
|
+
if (id === EDITOR_ENTRY_ID && isDevServer) return RESOLVED_EDITOR_ENTRY_ID;
|
|
330
715
|
},
|
|
331
716
|
async load(id) {
|
|
717
|
+
if (id === RESOLVED_EDITOR_ENTRY_ID) return EDITOR_ENTRY;
|
|
332
718
|
if (id !== RESOLVED_ID2) return;
|
|
333
719
|
if (!isDevServer || !filePath) return EMPTY_MODULE;
|
|
720
|
+
const preview = previewPath ? await readPreview(previewPath) : null;
|
|
721
|
+
let schema = EMPTY_DEV_SCHEMA;
|
|
334
722
|
try {
|
|
335
|
-
|
|
336
|
-
const schema = buildTwilightSchema(raw);
|
|
337
|
-
return `export default ${JSON.stringify(schema)};`;
|
|
723
|
+
schema = buildTwilightSchema(JSON.parse(await readFile(filePath, "utf-8")));
|
|
338
724
|
} catch {
|
|
339
|
-
return EMPTY_MODULE;
|
|
340
725
|
}
|
|
726
|
+
return [
|
|
727
|
+
`const schema = ${JSON.stringify({ ...schema, preview })};`,
|
|
728
|
+
`globalThis[${JSON.stringify(DEV_PREVIEW_GLOBAL)}] = schema.preview;`,
|
|
729
|
+
"export default schema;"
|
|
730
|
+
].join("\n");
|
|
341
731
|
},
|
|
342
732
|
configureServer(server) {
|
|
343
733
|
if (!filePath) return;
|
|
@@ -354,6 +744,8 @@ function twilightSchemaPlugin(twilightJsonPath = "twilight.json") {
|
|
|
354
744
|
};
|
|
355
745
|
server.watcher.on("change", invalidate);
|
|
356
746
|
server.watcher.on("add", invalidate);
|
|
747
|
+
if (previewPath) servePreviewFile(server, previewPath);
|
|
748
|
+
serveEditor(server);
|
|
357
749
|
}
|
|
358
750
|
};
|
|
359
751
|
}
|