@eldrajs/theme-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +203 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +3 -0
- package/dist/validate-C6jB8_Oc.js +510 -0
- package/package.json +56 -3
- package/template/.eldra/block-types.d.ts +429 -0
- package/template/.eldra/manifest.json +9377 -0
- package/template/.eldra/previews.json +36 -0
- package/template/.github/workflows/eldra-deploy.yml +24 -0
- package/template/.gitlab-ci.yml +16 -0
- package/template/.storybook/eldra.ts +123 -0
- package/template/.storybook/i18n.ts +23 -0
- package/template/.storybook/main.ts +59 -0
- package/template/.storybook/nuxt-link-stub.ts +23 -0
- package/template/.storybook/preview.ts +52 -0
- package/template/.storybook/shims-vue.d.ts +10 -0
- package/template/.storybook/virtual-eldra.d.ts +27 -0
- package/template/README.md +288 -0
- package/template/app/app.vue +126 -0
- package/template/app/assets/main.css +404 -0
- package/template/app/components/EldraIcon.vue +66 -0
- package/template/app/components/EldraRouterLink.vue +62 -0
- package/template/app/components/ui/UiImage.stories.ts +30 -0
- package/template/app/components/ui/UiImage.vue +224 -0
- package/template/app/components/ui/__tests__/UiImage.spec.ts +292 -0
- package/template/app/composables/iconComponent.ts +84 -0
- package/template/app/composables/iconFetcher.ts +14 -0
- package/template/app/composables/useBlockData.ts +30 -0
- package/template/app/composables/useEditing.ts +31 -0
- package/template/app/composables/useEldraIcon.ts +46 -0
- package/template/app/composables/useRevalidating.ts +69 -0
- package/template/app/composables/useRichTextScrollRegions.ts +80 -0
- package/template/app/composables/useStorefront.ts +18 -0
- package/template/app/composables/useStorefrontFeedback.ts +49 -0
- package/template/app/composables/useUiId.ts +18 -0
- package/template/app/composables/useWishlist.ts +42 -0
- package/template/app/i18n.d.ts +28 -0
- package/template/app/icons.ts +185 -0
- package/template/app/pages/[...slug].vue +134 -0
- package/template/app/plugins/eldra-i18n.ts +98 -0
- package/template/app/plugins/eldra-storefront.ts +288 -0
- package/template/app/plugins/eldra-ui-messages.ts +112 -0
- package/template/app/storefront/cart.ts +245 -0
- package/template/app/storefront/categories.ts +283 -0
- package/template/app/storefront/collectionSelector.ts +60 -0
- package/template/app/storefront/commerce.ts +58 -0
- package/template/app/storefront/demo.ts +1313 -0
- package/template/app/storefront/facets.ts +476 -0
- package/template/app/storefront/feedback.ts +122 -0
- package/template/app/storefront/gateway.ts +2256 -0
- package/template/app/storefront/history.ts +233 -0
- package/template/app/storefront/money.ts +247 -0
- package/template/app/storefront/options.ts +71 -0
- package/template/app/storefront/prerender.ts +77 -0
- package/template/app/storefront/refresh.ts +222 -0
- package/template/app/storefront/toProductCard.ts +154 -0
- package/template/app/storefront/types.ts +815 -0
- package/template/app/storefront/volatile.ts +211 -0
- package/template/app/templates.ts +544 -0
- package/template/app/utils/classes.ts +40 -0
- package/template/app/utils/links.ts +70 -0
- package/template/app/utils/pageStructure.ts +77 -0
- package/template/app/utils/pageTitle.ts +37 -0
- package/template/app/virtual-eldra.d.ts +12 -0
- package/template/bitbucket-pipelines.yml +19 -0
- package/template/blocks/announcement-bar/Block.vue +203 -0
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +227 -0
- package/template/blocks/announcement-bar/block.json +45 -0
- package/template/blocks/announcement-bar/mock.json +7 -0
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/Block.vue +317 -0
- package/template/blocks/article/__tests__/Block.spec.ts +229 -0
- package/template/blocks/article/block.json +148 -0
- package/template/blocks/article/mock.json +512 -0
- package/template/blocks/article/preview.json +16 -0
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +343 -0
- package/template/blocks/article-list/__tests__/Block.spec.ts +279 -0
- package/template/blocks/article-list/block.json +181 -0
- package/template/blocks/article-list/mock.json +68 -0
- package/template/blocks/article-list/preview.json +84 -0
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/Block.vue +278 -0
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +461 -0
- package/template/blocks/breadcrumbs/block.json +89 -0
- package/template/blocks/breadcrumbs/mock.json +11 -0
- package/template/blocks/breadcrumbs/preview.json +3 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/Block.vue +372 -0
- package/template/blocks/cart/__tests__/Block.spec.ts +561 -0
- package/template/blocks/cart/__tests__/ShippingBar.spec.ts +78 -0
- package/template/blocks/cart/__tests__/Summary.spec.ts +245 -0
- package/template/blocks/cart/block.json +74 -0
- package/template/blocks/cart/mock.json +11 -0
- package/template/blocks/cart/parts/CartLines.vue +257 -0
- package/template/blocks/cart/parts/ShippingBar.vue +105 -0
- package/template/blocks/cart/parts/Summary.vue +291 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +1832 -0
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +3037 -0
- package/template/blocks/collection-grid/__tests__/groups.spec.ts +731 -0
- package/template/blocks/collection-grid/block.json +187 -0
- package/template/blocks/collection-grid/mock.json +23 -0
- package/template/blocks/collection-grid/parts/groups.ts +861 -0
- package/template/blocks/collection-grid/preview.json +7 -0
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +533 -0
- package/template/blocks/collection-header/__tests__/Block.spec.ts +381 -0
- package/template/blocks/collection-header/block.json +140 -0
- package/template/blocks/collection-header/mock.json +28 -0
- package/template/blocks/collection-header/preview.json +14 -0
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/Block.vue +621 -0
- package/template/blocks/contact/__tests__/Block.spec.ts +347 -0
- package/template/blocks/contact/block.json +174 -0
- package/template/blocks/contact/mock.json +28 -0
- package/template/blocks/contact/preview.json +9 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/Block.vue +383 -0
- package/template/blocks/cta/__tests__/Block.spec.ts +309 -0
- package/template/blocks/cta/block.json +86 -0
- package/template/blocks/cta/mock.json +10 -0
- package/template/blocks/cta/preview.json +9 -0
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/Block.vue +254 -0
- package/template/blocks/faq/__tests__/Block.spec.ts +312 -0
- package/template/blocks/faq/block.json +113 -0
- package/template/blocks/faq/mock.json +115 -0
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +241 -0
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +311 -0
- package/template/blocks/feature-grid/block.json +106 -0
- package/template/blocks/feature-grid/mock.json +29 -0
- package/template/blocks/feature-grid/preview.json +45 -0
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +652 -0
- package/template/blocks/footer/__tests__/Block.spec.ts +700 -0
- package/template/blocks/footer/block.json +240 -0
- package/template/blocks/footer/mock.json +161 -0
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/gallery/Block.vue +416 -0
- package/template/blocks/gallery/__tests__/Block.spec.ts +289 -0
- package/template/blocks/gallery/block.json +87 -0
- package/template/blocks/gallery/mock.json +16 -0
- package/template/blocks/gallery/preview.json +64 -0
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +378 -0
- package/template/blocks/hero/__tests__/Block.spec.ts +324 -0
- package/template/blocks/hero/block.json +146 -0
- package/template/blocks/hero/mock.json +11 -0
- package/template/blocks/hero/preview.json +55 -0
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/Block.vue +232 -0
- package/template/blocks/image/__tests__/Block.spec.ts +224 -0
- package/template/blocks/image/block.json +67 -0
- package/template/blocks/image/mock.json +7 -0
- package/template/blocks/image/preview.json +9 -0
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/Block.vue +206 -0
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +210 -0
- package/template/blocks/logo-cloud/block.json +79 -0
- package/template/blocks/logo-cloud/mock.json +15 -0
- package/template/blocks/logo-cloud/preview.json +92 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +1348 -0
- package/template/blocks/navigation/__tests__/Block.spec.ts +2030 -0
- package/template/blocks/navigation/block.json +167 -0
- package/template/blocks/navigation/mock.json +191 -0
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/navigation/useMegaMenuKeys.ts +276 -0
- package/template/blocks/newsletter/Block.vue +399 -0
- package/template/blocks/newsletter/__tests__/Block.spec.ts +365 -0
- package/template/blocks/newsletter/block.json +105 -0
- package/template/blocks/newsletter/mock.json +31 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/Block.vue +754 -0
- package/template/blocks/order-status/__tests__/Block.spec.ts +515 -0
- package/template/blocks/order-status/block.json +138 -0
- package/template/blocks/order-status/mock.json +19 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/Block.vue +297 -0
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +357 -0
- package/template/blocks/pricing-table/block.json +155 -0
- package/template/blocks/pricing-table/mock.json +47 -0
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +459 -0
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +957 -0
- package/template/blocks/product-carousel/block.json +71 -0
- package/template/blocks/product-carousel/mock.json +9 -0
- package/template/blocks/product-carousel/preview.json +7 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +886 -0
- package/template/blocks/product-detail/__tests__/Block.spec.ts +1495 -0
- package/template/blocks/product-detail/__tests__/stock.spec.ts +119 -0
- package/template/blocks/product-detail/block.json +155 -0
- package/template/blocks/product-detail/mock.json +113 -0
- package/template/blocks/product-detail/parts/Gallery.vue +181 -0
- package/template/blocks/product-detail/parts/StickyBuyBar.vue +99 -0
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/product-detail/stock.ts +150 -0
- package/template/blocks/quote/Block.vue +206 -0
- package/template/blocks/quote/__tests__/Block.spec.ts +265 -0
- package/template/blocks/quote/block.json +76 -0
- package/template/blocks/quote/mock.json +9 -0
- package/template/blocks/quote/preview.json +16 -0
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/Block.vue +143 -0
- package/template/blocks/rich-text/__tests__/Block.spec.ts +191 -0
- package/template/blocks/rich-text/block.json +57 -0
- package/template/blocks/rich-text/mock.json +87 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +589 -0
- package/template/blocks/search/PopularChips.vue +40 -0
- package/template/blocks/search/TypeSection.vue +148 -0
- package/template/blocks/search/__tests__/Block.spec.ts +718 -0
- package/template/blocks/search/__tests__/results.spec.ts +166 -0
- package/template/blocks/search/block.json +102 -0
- package/template/blocks/search/mock.json +18 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/search/results.ts +85 -0
- package/template/blocks/split-content/Block.vue +195 -0
- package/template/blocks/split-content/__tests__/Block.spec.ts +225 -0
- package/template/blocks/split-content/block.json +70 -0
- package/template/blocks/split-content/mock.json +45 -0
- package/template/blocks/split-content/preview.json +58 -0
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/Block.vue +159 -0
- package/template/blocks/stats/__tests__/Block.spec.ts +194 -0
- package/template/blocks/stats/block.json +73 -0
- package/template/blocks/stats/mock.json +12 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/Block.vue +278 -0
- package/template/blocks/tabs/__tests__/Block.spec.ts +303 -0
- package/template/blocks/tabs/block.json +97 -0
- package/template/blocks/tabs/mock.json +129 -0
- package/template/blocks/tabs/preview.json +153 -0
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/Block.vue +288 -0
- package/template/blocks/team/__tests__/Block.spec.ts +221 -0
- package/template/blocks/team/block.json +125 -0
- package/template/blocks/team/mock.json +39 -0
- package/template/blocks/team/preview.json +62 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/Block.vue +408 -0
- package/template/blocks/testimonials/__tests__/Block.spec.ts +319 -0
- package/template/blocks/testimonials/block.json +121 -0
- package/template/blocks/testimonials/mock.json +46 -0
- package/template/blocks/testimonials/preview.json +68 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/Block.vue +274 -0
- package/template/blocks/timeline/__tests__/Block.spec.ts +310 -0
- package/template/blocks/timeline/block.json +98 -0
- package/template/blocks/timeline/mock.json +27 -0
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +330 -0
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +290 -0
- package/template/blocks/trust-strip/block.json +117 -0
- package/template/blocks/trust-strip/mock.json +37 -0
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/Block.vue +354 -0
- package/template/blocks/video-embed/__tests__/Block.spec.ts +219 -0
- package/template/blocks/video-embed/__tests__/embed.spec.ts +76 -0
- package/template/blocks/video-embed/block.json +94 -0
- package/template/blocks/video-embed/embed.ts +84 -0
- package/template/blocks/video-embed/mock.json +13 -0
- package/template/blocks/video-embed/preview.json +9 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/Block.vue +367 -0
- package/template/blocks/wishlist/__tests__/Block.spec.ts +508 -0
- package/template/blocks/wishlist/block.json +42 -0
- package/template/blocks/wishlist/mock.json +9 -0
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +602 -0
- package/template/i18n/is-IS.json +602 -0
- package/template/nuxt.config.ts +148 -0
- package/template/package.json +55 -0
- package/template/pages/article.page.json +731 -0
- package/template/pages/cart.page.json +85 -0
- package/template/pages/category.page.json +133 -0
- package/template/pages/collection.page.json +194 -0
- package/template/pages/home.page.json +353 -0
- package/template/pages/product.page.json +323 -0
- package/template/pages/products.page.json +144 -0
- package/template/pages/search.page.json +83 -0
- package/template/pages/wishlist.page.json +88 -0
- package/template/public/demo/article-cover.svg +1 -0
- package/template/public/demo/article-figure.svg +1 -0
- package/template/public/demo/avatar-1.svg +3 -0
- package/template/public/demo/avatar-2.svg +3 -0
- package/template/public/demo/avatar-3.svg +3 -0
- package/template/public/demo/avatar-4.svg +3 -0
- package/template/public/demo/avatar-5.svg +3 -0
- package/template/public/demo/avatar-6.svg +3 -0
- package/template/public/demo/avatar-7.svg +3 -0
- package/template/public/demo/avatar-8.svg +3 -0
- package/template/public/demo/collection-1.svg +1 -0
- package/template/public/demo/collection-2.svg +1 -0
- package/template/public/demo/cta-split.svg +1 -0
- package/template/public/demo/feature-1.svg +1 -0
- package/template/public/demo/feature-2.svg +1 -0
- package/template/public/demo/feature-3.svg +1 -0
- package/template/public/demo/feature-4.svg +1 -0
- package/template/public/demo/gallery-1.svg +1 -0
- package/template/public/demo/gallery-2.svg +1 -0
- package/template/public/demo/gallery-3.svg +1 -0
- package/template/public/demo/gallery-4.svg +1 -0
- package/template/public/demo/gallery-5.svg +1 -0
- package/template/public/demo/gallery-6.svg +1 -0
- package/template/public/demo/gallery-7.svg +1 -0
- package/template/public/demo/gallery-8.svg +1 -0
- package/template/public/demo/hero-slide-1.svg +1 -0
- package/template/public/demo/hero-slide-2.svg +1 -0
- package/template/public/demo/hero-slide-3.svg +1 -0
- package/template/public/demo/hero-slide-4.svg +1 -0
- package/template/public/demo/hero-wide.svg +1 -0
- package/template/public/demo/hero.svg +1 -0
- package/template/public/demo/logo-1.svg +4 -0
- package/template/public/demo/logo-2.svg +4 -0
- package/template/public/demo/logo-3.svg +4 -0
- package/template/public/demo/logo-4.svg +4 -0
- package/template/public/demo/logo-5.svg +4 -0
- package/template/public/demo/logo-6.svg +4 -0
- package/template/public/demo/logo-7.svg +4 -0
- package/template/public/demo/logo-8.svg +4 -0
- package/template/public/demo/logo.svg +3 -0
- package/template/public/demo/map.svg +1 -0
- package/template/public/demo/poster.svg +1 -0
- package/template/public/demo/product-1.svg +4 -0
- package/template/public/demo/product-10.svg +4 -0
- package/template/public/demo/product-11.svg +4 -0
- package/template/public/demo/product-12.svg +4 -0
- package/template/public/demo/product-2.svg +4 -0
- package/template/public/demo/product-3.svg +4 -0
- package/template/public/demo/product-4.svg +4 -0
- package/template/public/demo/product-5.svg +4 -0
- package/template/public/demo/product-6.svg +4 -0
- package/template/public/demo/product-7.svg +4 -0
- package/template/public/demo/product-8.svg +4 -0
- package/template/public/demo/product-9.svg +4 -0
- package/template/public/demo/product-square-1.svg +4 -0
- package/template/public/demo/product-square-2.svg +4 -0
- package/template/public/demo/product-square-3.svg +4 -0
- package/template/public/demo/product-square-4.svg +4 -0
- package/template/public/demo/product-square-5.svg +4 -0
- package/template/public/demo/product-square-6.svg +4 -0
- package/template/public/demo/quote-portrait.svg +4 -0
- package/template/public/demo/split-1.svg +1 -0
- package/template/public/demo/split-2.svg +1 -0
- package/template/public/demo/split-3.svg +1 -0
- package/template/public/demo/split-4.svg +1 -0
- package/template/public/demo/team-1.svg +4 -0
- package/template/public/demo/team-2.svg +4 -0
- package/template/public/demo/team-3.svg +4 -0
- package/template/public/demo/team-4.svg +4 -0
- package/template/scripts/demo-images.mjs +393 -0
- package/template/scripts/generate-stories.mjs +156 -0
- package/template/scripts/previewHash.mjs +125 -0
- package/template/scripts/previews.mjs +149 -0
- package/template/stories/generated/announcement-bar.stories.ts +44 -0
- package/template/stories/generated/article-list.stories.ts +87 -0
- package/template/stories/generated/article.stories.ts +27 -0
- package/template/stories/generated/breadcrumbs.stories.ts +39 -0
- package/template/stories/generated/cart.stories.ts +38 -0
- package/template/stories/generated/collection-grid.stories.ts +117 -0
- package/template/stories/generated/collection-header.stories.ts +51 -0
- package/template/stories/generated/contact.stories.ts +45 -0
- package/template/stories/generated/cta.stories.ts +51 -0
- package/template/stories/generated/faq.stories.ts +56 -0
- package/template/stories/generated/feature-grid.stories.ts +69 -0
- package/template/stories/generated/footer.stories.ts +50 -0
- package/template/stories/generated/gallery.stories.ts +81 -0
- package/template/stories/generated/hero.stories.ts +75 -0
- package/template/stories/generated/image.stories.ts +99 -0
- package/template/stories/generated/logo-cloud.stories.ts +57 -0
- package/template/stories/generated/navigation.stories.ts +62 -0
- package/template/stories/generated/newsletter.stories.ts +68 -0
- package/template/stories/generated/order-status.stories.ts +32 -0
- package/template/stories/generated/pricing-table.stories.ts +44 -0
- package/template/stories/generated/product-carousel.stories.ts +75 -0
- package/template/stories/generated/product-detail.stories.ts +62 -0
- package/template/stories/generated/quote.stories.ts +69 -0
- package/template/stories/generated/rich-text.stories.ts +50 -0
- package/template/stories/generated/search.stories.ts +56 -0
- package/template/stories/generated/split-content.stories.ts +39 -0
- package/template/stories/generated/stats.stories.ts +68 -0
- package/template/stories/generated/tabs.stories.ts +45 -0
- package/template/stories/generated/team.stories.ts +45 -0
- package/template/stories/generated/testimonials.stories.ts +69 -0
- package/template/stories/generated/timeline.stories.ts +80 -0
- package/template/stories/generated/trust-strip.stories.ts +62 -0
- package/template/stories/generated/video-embed.stories.ts +63 -0
- package/template/stories/generated/wishlist.stories.ts +26 -0
- package/template/stories/pages/article.stories.ts +51 -0
- package/template/stories/pages/cart.stories.ts +56 -0
- package/template/stories/pages/category.stories.ts +56 -0
- package/template/stories/pages/collection.stories.ts +51 -0
- package/template/stories/pages/home.stories.ts +51 -0
- package/template/stories/pages/product.stories.ts +47 -0
- package/template/stories/pages/products.stories.ts +58 -0
- package/template/stories/pages/search.stories.ts +54 -0
- package/template/stories/pages/wishlist.stories.ts +53 -0
- package/template/stories/support/pageBlocks.ts +115 -0
- package/template/test/blocksEmptyData.spec.ts +52 -0
- package/template/test/carouselKeyboard.spec.ts +272 -0
- package/template/test/carouselRing.browser.spec.ts +193 -0
- package/template/test/carouselSlideWidth.browser.spec.ts +102 -0
- package/template/test/cartDrawer.spec.ts +295 -0
- package/template/test/cartToast.spec.ts +86 -0
- package/template/test/countPill.browser.spec.ts +196 -0
- package/template/test/demoImages.spec.ts +140 -0
- package/template/test/deps.spec.ts +102 -0
- package/template/test/eldraIcon.spec.ts +58 -0
- package/template/test/framing.spec.ts +76 -0
- package/template/test/i18n.spec.ts +200 -0
- package/template/test/iconComponent.spec.ts +91 -0
- package/template/test/inlineEditable.spec.ts +334 -0
- package/template/test/localePrefix.spec.ts +342 -0
- package/template/test/mainCss.spec.ts +107 -0
- package/template/test/mockGatewayContract.spec.ts +122 -0
- package/template/test/mocks/blocks.ts +20 -0
- package/template/test/mocks/breakpoints.ts +7 -0
- package/template/test/mocks/manifest.ts +11 -0
- package/template/test/moneyFormatting.spec.ts +89 -0
- package/template/test/pageTitle.spec.ts +49 -0
- package/template/test/pages/article.spec.ts +231 -0
- package/template/test/pages/category.spec.ts +185 -0
- package/template/test/pages/collection.spec.ts +396 -0
- package/template/test/pages/home.spec.ts +295 -0
- package/template/test/pages/hydration.spec.ts +557 -0
- package/template/test/pages/product.spec.ts +396 -0
- package/template/test/pages/seededPages.spec.ts +190 -0
- package/template/test/pages/ssr.spec.ts +393 -0
- package/template/test/prerenderCommerce.spec.ts +134 -0
- package/template/test/prerenderFailure.spec.ts +130 -0
- package/template/test/prerenderRefresh.browser.spec.ts +1431 -0
- package/template/test/previewsFresh.spec.ts +56 -0
- package/template/test/richText.spec.ts +161 -0
- package/template/test/richTextTypography.spec.ts +182 -0
- package/template/test/setup.ts +21 -0
- package/template/test/slugPage.spec.ts +244 -0
- package/template/test/slugPageTemplate.spec.ts +194 -0
- package/template/test/starter.spec.ts +1416 -0
- package/template/test/storefront/cart.spec.ts +404 -0
- package/template/test/storefront/categories.spec.ts +235 -0
- package/template/test/storefront/collectionSelector.spec.ts +74 -0
- package/template/test/storefront/demo.spec.ts +555 -0
- package/template/test/storefront/facets.spec.ts +425 -0
- package/template/test/storefront/feedback.spec.ts +97 -0
- package/template/test/storefront/gateway.spec.ts +2673 -0
- package/template/test/storefront/gatewayCart.spec.ts +289 -0
- package/template/test/storefront/gatewayPrerender.spec.ts +1037 -0
- package/template/test/storefront/history.spec.ts +341 -0
- package/template/test/storefront/money.spec.ts +171 -0
- package/template/test/storefront/toProductCard.spec.ts +138 -0
- package/template/test/storefront/volatile.spec.ts +284 -0
- package/template/test/support/axe.ts +14 -0
- package/template/test/support/dialog.ts +51 -0
- package/template/test/support/hydrate.ts +118 -0
- package/template/test/support/i18nText.ts +11 -0
- package/template/test/support/mockGateway.ts +1017 -0
- package/template/test/support/mountBlock.ts +194 -0
- package/template/test/support/mountPage.spec.ts +72 -0
- package/template/test/support/mountPage.ts +254 -0
- package/template/test/support/mountProbe.client.ts +69 -0
- package/template/test/support/renderSsr.ts +97 -0
- package/template/test/support/staticServer.ts +96 -0
- package/template/test/themeIcons.spec.ts +140 -0
- package/template/test/toastAnnouncement.spec.ts +133 -0
- package/template/test/tokens.spec.ts +102 -0
- package/template/test/uiMessagesPlugin.spec.ts +104 -0
- package/template/test/useBlockData.spec.ts +46 -0
- package/template/test/useEditing.spec.ts +54 -0
- package/template/test/useEldraIcon.spec.ts +126 -0
- package/template/test/useUiId.spec.ts +40 -0
- package/template/tokens.json +149 -0
- package/template/tsconfig.json +3 -0
- package/template/tsconfig.storybook.json +17 -0
- package/template/vitest-axe.d.ts +13 -0
- package/template/vitest.config.ts +44 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"announcement-bar": "74568cc738713d94522f87051eac5ac3202e4a34a6a2cccb93d1d23006757dc6",
|
|
3
|
+
"article": "264ea00a8484b1ce3d1a0294eba299436018263a15f5f974f4bbc5a2ac0f8853",
|
|
4
|
+
"article-list": "56c5e25e868a3bc2fb58d4c49fbf3a778117f6f3082e6c9ee7eefe48c1a715b0",
|
|
5
|
+
"breadcrumbs": "be1b8ad3340731fd3d568ec93c1b4387fb83585729068d43f292034a722be0ac",
|
|
6
|
+
"cart": "6c6100b79ddae82a86f7063e751ae34d6ed5655f8204b4a1090b8237775bb866",
|
|
7
|
+
"collection-grid": "0a4c72191a6d7061938152bc326415d06ac32f51f4ad66abffe2ee3ece14ebd6",
|
|
8
|
+
"collection-header": "d8a5eb6ad19a3965e18bdcdc4b483230a8abeca2aacf42695ed78e53cb12c116",
|
|
9
|
+
"contact": "ce62a7483da0850f91ffb2c28ea15a63af94d2c88df8e1d6a4d18ed01bf2e4a9",
|
|
10
|
+
"cta": "11a8d0c2a8dadfe6f551b39eb8333b605049a9727a12677eaf9b2f0870a2b451",
|
|
11
|
+
"faq": "9f15691956276af3069b3f510ceae6d55d354620c0484cac6107598602512bd3",
|
|
12
|
+
"feature-grid": "9ae5fac430ae8747602f68f0f240e7d0d6df2c525552afbfe7710942315f88cd",
|
|
13
|
+
"footer": "b6e52f54747b8f35c9b3aff1eda0b93da2362ca7ed76cb7ba04d976cdbb957ea",
|
|
14
|
+
"gallery": "b984ab2180061e43e87e0b9a8043220bbcfb9c38cf56e84c078f28dae63bf116",
|
|
15
|
+
"hero": "ab97d096977fe94984e7e1bee0402208279a690262d5554ccf66fc9b00dc7ff3",
|
|
16
|
+
"image": "a216eb344c65c27bf9499a4d39e54f2dfd5289800992540b8072fceb4ea4eb79",
|
|
17
|
+
"logo-cloud": "7ec6cc499a16d6b9bd34e39b0c9a37e1a50c66454def1bc5c5f50031e23a55d4",
|
|
18
|
+
"navigation": "ee4c0883ad5bedff51e02fa7f64f2df7e68ea4cb41d7cddb97d312b3ba947893",
|
|
19
|
+
"newsletter": "abebd23e0499663d38a66f618a64f4ca95f4913b4e48bbbc4b9201cc5949ed54",
|
|
20
|
+
"order-status": "19f42c10aa052e77f99bb64e49ab2ddd3eff9f993654ddffcf42cef809fd481b",
|
|
21
|
+
"pricing-table": "6e787638ca0aafc9a80877dac6ea55e123acbd50512464b5a26680443d320165",
|
|
22
|
+
"product-carousel": "51e39657b8b6cd6b8fa7c4417e5dc9c6045b89050e14cf3f5df437371753a8de",
|
|
23
|
+
"product-detail": "3a46534325ced9605762549e4a60d4082b3805cc695cf5b652135af4573b2928",
|
|
24
|
+
"quote": "2e3b2d3bbd284627a7de5e5a2382e2155fd091f4a965fd0f6274d9fc330261b2",
|
|
25
|
+
"rich-text": "e56c92289e8ba62de933e6a59f79dada39ec9b75b95e1dd405a2b1472a27d80d",
|
|
26
|
+
"search": "c3fba4b204f972c8d2982a9c3ef00203edb3b1e0f6b94f52be058798e57359c2",
|
|
27
|
+
"split-content": "ef48d33fa5fc232a880dcf8af8434291985422ca02bcd3047c54f9cdf6a5265f",
|
|
28
|
+
"stats": "cbd6377b1605b6c0721de7b53493710776d06562baa4ee1d9966bfdbe81336d4",
|
|
29
|
+
"tabs": "8ff8b34844a4d7911ce1a93d367c87a10762b24b9ebeb0f0b24e4c55450ac42b",
|
|
30
|
+
"team": "588bf53972c9739a6f16455090b9056d71d495bf1af487994b5434973933c15d",
|
|
31
|
+
"testimonials": "ee33c350459c6ab3f5e140ed7a7edb1353fc0c4447fe9e92e96b16c5deb3b992",
|
|
32
|
+
"timeline": "1aa014103138fc9ad6dbfa1c2339bd92635b17bb4762a4280ffe84fca29a112b",
|
|
33
|
+
"trust-strip": "51bec9509b83e9c09d6f356ac911894459352ef28e67767098e61e2607233685",
|
|
34
|
+
"video-embed": "f3c0b99e1d605cf1702a167b437a469a6f536d100a4c1c4502aa3dca99e7d1bc",
|
|
35
|
+
"wishlist": "bc550e2a3cdebce5db370cb4335990b544bfe03619345e562bcf3c8c84d57bbc"
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: eldra-deploy
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
repository_dispatch:
|
|
6
|
+
types: [eldra.rebuild]
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: pnpm/action-setup@v4
|
|
13
|
+
- uses: actions/setup-node@v4
|
|
14
|
+
with: { node-version: 20, cache: pnpm }
|
|
15
|
+
- run: pnpm install --frozen-lockfile
|
|
16
|
+
- run: pnpm exec nuxi generate
|
|
17
|
+
env:
|
|
18
|
+
ELDRA_GATEWAY_URL: ${{ vars.ELDRA_GATEWAY_URL }}
|
|
19
|
+
ELDRA_ORG_ID: ${{ vars.ELDRA_ORG_ID }}
|
|
20
|
+
- run: pnpm exec eldra-theme deploy
|
|
21
|
+
env:
|
|
22
|
+
ELDRA_API_URL: ${{ vars.ELDRA_API_URL }}
|
|
23
|
+
ELDRA_DEPLOY_TOKEN: ${{ secrets.ELDRA_DEPLOY_TOKEN }}
|
|
24
|
+
ELDRA_TRIGGER_DEPLOYMENT_ID: ${{ github.event.client_payload.deploymentId }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
stages: [deploy]
|
|
2
|
+
|
|
3
|
+
eldra-deploy:
|
|
4
|
+
stage: deploy
|
|
5
|
+
image: node:20
|
|
6
|
+
rules:
|
|
7
|
+
- if: '$CI_PIPELINE_SOURCE == "trigger"'
|
|
8
|
+
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
9
|
+
before_script:
|
|
10
|
+
- corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
11
|
+
script:
|
|
12
|
+
- pnpm install --frozen-lockfile
|
|
13
|
+
- pnpm exec nuxi generate
|
|
14
|
+
- pnpm exec eldra-theme deploy
|
|
15
|
+
variables:
|
|
16
|
+
ELDRA_TRIGGER_DEPLOYMENT_ID: $ELDRA_TRIGGER_DEPLOYMENT_ID
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { Decorator } from '@storybook/vue3-vite';
|
|
2
|
+
import { provide } from 'vue';
|
|
3
|
+
import { createEldraClient } from '@eldrajs/theme-core';
|
|
4
|
+
import { flattenMessages } from '@eldrajs/theme-core/i18n';
|
|
5
|
+
import { provideEldra } from '@eldrajs/theme-vue';
|
|
6
|
+
import {
|
|
7
|
+
enUS as uiEnUS,
|
|
8
|
+
provideEldraUiCurrency,
|
|
9
|
+
provideEldraUiLocale,
|
|
10
|
+
provideEldraUiMessages,
|
|
11
|
+
} from '@eldrajs/ui';
|
|
12
|
+
import { createDemoStorefront, DEMO_CART_LINES } from '../app/storefront/demo';
|
|
13
|
+
import { STOREFRONT_KEY } from '../app/storefront/types';
|
|
14
|
+
import { storybookI18n } from './i18n';
|
|
15
|
+
import enUSMessages from '../i18n/en-US.json';
|
|
16
|
+
import isISMessages from '../i18n/is-IS.json';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Provides the same `EldraContext` a real page gets from
|
|
20
|
+
* `@eldrajs/theme-nuxt`'s runtime plugin, so a block rendered as a story
|
|
21
|
+
* sees exactly what it sees in production: a client (never called —
|
|
22
|
+
* stories pass `entry` data directly via args, no block here fetches), read
|
|
23
|
+
* mode (`preview.active` stays `false`, its `createEldraPreviewState()`
|
|
24
|
+
* default — there is no Studio bridge in Storybook), and a fixed content
|
|
25
|
+
* locale. `provideEldra` builds the rest of the context
|
|
26
|
+
* (`@eldrajs/theme-vue`'s own `EldraContext`) with its own safe defaults,
|
|
27
|
+
* which is all a block needs: none of the 33 starter blocks read
|
|
28
|
+
* `designTokens` directly, only the CSS custom properties
|
|
29
|
+
* `virtual:eldra/tokens.css` sets (imported once in `preview.ts`).
|
|
30
|
+
*
|
|
31
|
+
* Also provides the Northwind demo storefront (`app/storefront/demo.ts`) under `STOREFRONT_KEY` —
|
|
32
|
+
* the same wiring `app/plugins/eldra-storefront.ts` does on a real page — so a commerce block
|
|
33
|
+
* story (and the Playwright preview screenshot taken from it) renders real-looking catalogue,
|
|
34
|
+
* cart and order data with no gateway, exactly like `test/support/mountBlock.ts` does for specs.
|
|
35
|
+
*
|
|
36
|
+
* `query: 'linen'` seeds `route.query` with the design spec's own example search (spec
|
|
37
|
+
* `02-blocks.md` "Search results page" → "Default content"), so the `search` block's own
|
|
38
|
+
* `results-page` story renders its heading as "Results for “linen”" rather than an empty pair of
|
|
39
|
+
* quotes — the only block that reads `route.query` today, so this is inert for every other one.
|
|
40
|
+
*
|
|
41
|
+
* The cart seed is **not** inert, so unlike the query it is scoped to one block's stories: a cart
|
|
42
|
+
* with items changes the header's bag badge and its accessible name (`blocks/navigation/Block.vue`
|
|
43
|
+
* renders the badge under `v-if="cartCount > 0"`), which would quietly change every other block's
|
|
44
|
+
* story and screenshot. `CART_STORY_TITLE` is the title `scripts/generate-stories.mjs` gives the
|
|
45
|
+
* cart block's generated file, and Storybook hands every decorator the story's own context
|
|
46
|
+
* (`storyContext` — the local `context` below is the Eldra one), so the seed applies there and
|
|
47
|
+
* nowhere else.
|
|
48
|
+
*/
|
|
49
|
+
const CART_STORY_TITLE = 'Blocks/cart';
|
|
50
|
+
/**
|
|
51
|
+
* The category sample page's own story, and the one place the demo route is a **category** page.
|
|
52
|
+
*
|
|
53
|
+
* Scoped by title for the same reason the cart seed is: a route that resolves a category is not
|
|
54
|
+
* inert anywhere near a commerce block — `breadcrumbs` would append the category's ancestors to
|
|
55
|
+
* every one of its own stories, and `collection-grid`/`collection-header` would read it the moment
|
|
56
|
+
* an author's scope said so. The path is the demo tree's own nested one (`Homeware › Ceramics`), so
|
|
57
|
+
* the page shows a real trail and a real strip of sibling categories.
|
|
58
|
+
*/
|
|
59
|
+
const CATEGORY_PAGE_STORY_TITLE = 'Pages/Category';
|
|
60
|
+
/**
|
|
61
|
+
* The generated `scope: "category"` story of any block that declares that option — the story id is
|
|
62
|
+
* the kebab-cased export name, which `scripts/generate-stories.mjs` takes from the option itself
|
|
63
|
+
* (`collection-grid`'s and `collection-header`'s `ScopeCategory`). Without the route those two
|
|
64
|
+
* stories would draw nothing at all: both blocks read the page's category and neither has anything
|
|
65
|
+
* to fall back to.
|
|
66
|
+
*/
|
|
67
|
+
const CATEGORY_SCOPE_STORY_SUFFIX = '--scope-category';
|
|
68
|
+
const DEMO_CATEGORY_PATH = 'home/ceramics';
|
|
69
|
+
|
|
70
|
+
export const withEldraContext: Decorator = (story, storyContext) => ({
|
|
71
|
+
components: { story },
|
|
72
|
+
setup() {
|
|
73
|
+
const context = provideEldra({
|
|
74
|
+
client: createEldraClient({ gatewayUrl: 'https://storybook.invalid', orgId: 'storybook' }),
|
|
75
|
+
// The same catalogue `storybookI18n` (`./i18n.ts`) installs — nothing in Storybook reads
|
|
76
|
+
// `context.messages` directly today, but the shape should match a real page's (the merged/
|
|
77
|
+
// resolved `virtual:eldra/messages`) rather than the empty fallback `provideEldra` otherwise
|
|
78
|
+
// defaults to.
|
|
79
|
+
messages: {
|
|
80
|
+
defaultLocale: 'en-US',
|
|
81
|
+
locales: {
|
|
82
|
+
'en-US': flattenMessages(enUSMessages),
|
|
83
|
+
'is-IS': flattenMessages(isISMessages),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
context.preview.locale = 'en-US';
|
|
88
|
+
// No story here switches language (see the module doc comment on `storybookI18n`), so
|
|
89
|
+
// `storybookI18n.global.locale.value` only ever needs setting to confirm it, not to follow a
|
|
90
|
+
// switch — unlike `app/plugins/eldra-i18n.ts`'s real watcher. Cast: `context.preview.locale` is
|
|
91
|
+
// a plain `string | null` (`EldraContext`'s own shape), narrower than what this file actually
|
|
92
|
+
// ever assigns it (the literal above).
|
|
93
|
+
storybookI18n.global.locale.value = context.preview.locale as 'en-US' | 'is-IS';
|
|
94
|
+
// The same wiring `app/plugins/eldra-ui-messages.ts` does on a real page:
|
|
95
|
+
// `@eldrajs/ui`'s own strings and number locale follow the story's content
|
|
96
|
+
// locale, and its store currency comes from the storefront rather than the
|
|
97
|
+
// locale — on a real page the platform publishes it, here the demo source
|
|
98
|
+
// declares it (`DEMO_COMMERCE`, US dollars, the currency every Northwind
|
|
99
|
+
// amount in the fixtures is quoted in). `uiEnUS` directly: every story here renders `en-US`.
|
|
100
|
+
provideEldraUiMessages(uiEnUS);
|
|
101
|
+
provideEldraUiLocale(context.preview.locale);
|
|
102
|
+
// The demo cart starts empty (a real shopper's first visit), which would leave the `cart`
|
|
103
|
+
// block's own stories showing only its empty state — and its `drawer` story showing nothing at
|
|
104
|
+
// all, since a closed `<dialog>` draws nothing. Seeding the spec's own cart content and opening
|
|
105
|
+
// the drawer is what makes both stories (and the screenshots taken from them) show the real
|
|
106
|
+
// thing; every other story keeps the empty cart it had before, badge and all. The demo search
|
|
107
|
+
// query is global by contrast — see the comment above.
|
|
108
|
+
const isCartStory = storyContext.title === CART_STORY_TITLE;
|
|
109
|
+
const isCategoryPageStory =
|
|
110
|
+
storyContext.title === CATEGORY_PAGE_STORY_TITLE ||
|
|
111
|
+
storyContext.id.endsWith(CATEGORY_SCOPE_STORY_SUFFIX);
|
|
112
|
+
const storefront = createDemoStorefront({
|
|
113
|
+
query: 'linen',
|
|
114
|
+
cartLines: isCartStory ? DEMO_CART_LINES : undefined,
|
|
115
|
+
categoryPath: isCategoryPageStory ? DEMO_CATEGORY_PATH : undefined,
|
|
116
|
+
});
|
|
117
|
+
if (isCartStory) storefront.cart.drawerOpen.value = true;
|
|
118
|
+
provideEldraUiCurrency(storefront.commerce?.currency);
|
|
119
|
+
provide(STOREFRONT_KEY, storefront);
|
|
120
|
+
return {};
|
|
121
|
+
},
|
|
122
|
+
template: '<story />',
|
|
123
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createI18n } from 'vue-i18n';
|
|
2
|
+
import enUS from '../i18n/en-US.json';
|
|
3
|
+
import isIS from '../i18n/is-IS.json';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* No gateway and no `virtual:eldra/messages` in Storybook — `vue-i18n` is installed straight from
|
|
7
|
+
* the starter's own two locale files, the same fallback chain a real build's `app/plugins/
|
|
8
|
+
* eldra-i18n.ts` resolves to on a single-locale site (there is no organisation here, so "org
|
|
9
|
+
* default" and "theme default" are the one locale, `en-US`).
|
|
10
|
+
*
|
|
11
|
+
* One instance, installed once on the Storybook Vue app (`preview.ts`'s `setup(app)`); every block
|
|
12
|
+
* rendered as a story calls `useI18n()` and reaches this. `withEldraContext` only ever needs its
|
|
13
|
+
* `locale` to read `en-US` — no story here switches language (see `.storybook/eldra.ts`) — so there
|
|
14
|
+
* is nothing to keep in sync beyond installing it.
|
|
15
|
+
*/
|
|
16
|
+
export const STARTER_DEFAULT_LOCALE = 'en-US';
|
|
17
|
+
|
|
18
|
+
export const storybookI18n = createI18n({
|
|
19
|
+
legacy: false,
|
|
20
|
+
locale: STARTER_DEFAULT_LOCALE,
|
|
21
|
+
fallbackLocale: STARTER_DEFAULT_LOCALE,
|
|
22
|
+
messages: { 'en-US': enUS, 'is-IS': isIS },
|
|
23
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/vue3-vite';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
4
|
+
import vue from '@vitejs/plugin-vue';
|
|
5
|
+
import eldraTheme from '@eldrajs/vite-plugin-theme';
|
|
6
|
+
import { generateStories } from '../scripts/generate-stories.mjs';
|
|
7
|
+
import { starterSeeds, starterTemplateRoles } from '../app/templates';
|
|
8
|
+
|
|
9
|
+
const themeDir = fileURLToPath(new URL('..', import.meta.url));
|
|
10
|
+
|
|
11
|
+
const config: StorybookConfig = {
|
|
12
|
+
stories: ['../stories/**/*.stories.ts', '../app/components/ui/**/*.stories.ts'],
|
|
13
|
+
addons: ['@storybook/addon-docs', '@storybook/addon-a11y'],
|
|
14
|
+
framework: { name: '@storybook/vue3-vite', options: {} },
|
|
15
|
+
async viteFinal(config) {
|
|
16
|
+
// Stories are generated, not hand-written (see scripts/generate-stories.mjs)
|
|
17
|
+
// — regenerate on every `storybook dev` / `build-storybook` invocation so
|
|
18
|
+
// they are always current with blocks/*/block.json + mock.json.
|
|
19
|
+
generateStories();
|
|
20
|
+
config.plugins = [
|
|
21
|
+
...(config.plugins ?? []),
|
|
22
|
+
vue(),
|
|
23
|
+
// @storybook/vue3-vite only compiles CSF story templates
|
|
24
|
+
// (storybookVuePlugin); it does not register @vitejs/plugin-vue for
|
|
25
|
+
// the theme's own `.vue` SFCs, so this config adds it explicitly.
|
|
26
|
+
//
|
|
27
|
+
// `nuxt.config.ts` wires Tailwind via the fallback route
|
|
28
|
+
// (`eldra.tailwind: false`, `app/assets/main.css` starts with
|
|
29
|
+
// `@import 'tailwindcss'`) because the plugin's own
|
|
30
|
+
// `virtual:eldra/tailwind-theme.css` entry cannot be resolved through
|
|
31
|
+
// Vite's `@import` resolver. Mirror that here: register Tailwind's own
|
|
32
|
+
// Vite plugin and disable the adapter's Tailwind entry.
|
|
33
|
+
tailwindcss(),
|
|
34
|
+
// Every block under `blocks/**` imports `vue`/`@eldrajs/*`
|
|
35
|
+
// explicitly (see the block contract rule in `docs/starter-kit.md`),
|
|
36
|
+
// so Storybook — which has no Nuxt build step to auto-import from —
|
|
37
|
+
// needs no auto-import shim any more.
|
|
38
|
+
// `templates`/`templateRoles` are declared here as well as in
|
|
39
|
+
// `nuxt.config.ts` — not because Storybook renders a seeded template
|
|
40
|
+
// (it does not), but because this plugin instance writes the same
|
|
41
|
+
// `.eldra/manifest.json` the Nuxt build writes. Leaving them out here
|
|
42
|
+
// made the checked-in manifest flip between "with seeds" and "without"
|
|
43
|
+
// depending on which build ran last.
|
|
44
|
+
eldraTheme({
|
|
45
|
+
themeDir,
|
|
46
|
+
framework: 'nuxt',
|
|
47
|
+
tailwind: false,
|
|
48
|
+
templates: starterSeeds(),
|
|
49
|
+
templateRoles: starterTemplateRoles(),
|
|
50
|
+
}),
|
|
51
|
+
];
|
|
52
|
+
config.resolve = {
|
|
53
|
+
...config.resolve,
|
|
54
|
+
alias: { ...(config.resolve?.alias ?? {}), '~': `${themeDir}app`, '@': `${themeDir}app` },
|
|
55
|
+
};
|
|
56
|
+
return config;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export default config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Storybook renders blocks outside Nuxt, so the `<NuxtLink>` Nuxt injects as
|
|
5
|
+
* a global component (see `blocks/navigation/Block.vue`, the only block that
|
|
6
|
+
* uses it) has nothing to resolve to. This stub renders a plain `<a>` from
|
|
7
|
+
* the same `to` prop Nuxt's real component reads, which is all a static
|
|
8
|
+
* story needs — it never has to navigate.
|
|
9
|
+
*/
|
|
10
|
+
export const NuxtLinkStub = defineComponent({
|
|
11
|
+
name: 'NuxtLink',
|
|
12
|
+
props: {
|
|
13
|
+
to: { type: [String, Object], default: '' },
|
|
14
|
+
},
|
|
15
|
+
setup(props, { slots }) {
|
|
16
|
+
return () =>
|
|
17
|
+
h(
|
|
18
|
+
'a',
|
|
19
|
+
{ href: typeof props.to === 'string' ? props.to : JSON.stringify(props.to) },
|
|
20
|
+
slots.default?.()
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { setup, type Preview } from '@storybook/vue3-vite';
|
|
2
|
+
import { registerBlockFields } from '@eldrajs/theme-vue';
|
|
3
|
+
import blockFields from 'virtual:eldra/block-fields';
|
|
4
|
+
import '../app/assets/main.css';
|
|
5
|
+
// The theme's own `--eldra-color-*` / `--eldra-container-*` custom properties,
|
|
6
|
+
// generated from tokens.json — normally injected by @eldrajs/theme-nuxt's
|
|
7
|
+
// runtime plugin. It comes *after* main.css deliberately: main.css imports
|
|
8
|
+
// `@eldrajs/ui/tailwind.css`, which declares the package's own defaults for
|
|
9
|
+
// the same `--eldra-color-*` names on `:root`, and the theme's values (what
|
|
10
|
+
// Studio edits) have to be the ones that win.
|
|
11
|
+
import 'virtual:eldra/tokens.css';
|
|
12
|
+
import { withEldraContext } from './eldra';
|
|
13
|
+
import { storybookI18n } from './i18n';
|
|
14
|
+
import { NuxtLinkStub } from './nuxt-link-stub';
|
|
15
|
+
|
|
16
|
+
// Mirrors the runtime plugin: register block field metadata once so
|
|
17
|
+
// `useEldraBlockField` / `EldraRichText` (the `article` block's rich-text
|
|
18
|
+
// field) resolve a field's `localized` flag the same way a real page does.
|
|
19
|
+
registerBlockFields(blockFields);
|
|
20
|
+
|
|
21
|
+
setup((app) => {
|
|
22
|
+
// No gateway, no `virtual:eldra/messages` — every block calls `useI18n()` directly, with no
|
|
23
|
+
// wrapper in front of it, so Storybook needs `vue-i18n` installed on the app the same way a real
|
|
24
|
+
// page's `app/plugins/eldra-i18n.ts` installs it. See `./i18n.ts`.
|
|
25
|
+
app.use(storybookI18n);
|
|
26
|
+
// The only Nuxt global the theme reaches for, and only from
|
|
27
|
+
// `app/components/EldraRouterLink.vue` (the component blocks hand
|
|
28
|
+
// `@eldrajs/ui`'s `Link` as `as` for an internal destination) — Storybook has
|
|
29
|
+
// no Nuxt runtime to resolve the tag, so render a plain `<a>` in its place.
|
|
30
|
+
app.component('NuxtLink', NuxtLinkStub);
|
|
31
|
+
// Icons need nothing wired here: `useEldraIcon` reads `app/icons.ts`, which
|
|
32
|
+
// bundles the theme's own Tabler icons, so a story resolves them exactly the
|
|
33
|
+
// way a real page does.
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const preview: Preview = {
|
|
37
|
+
decorators: [withEldraContext],
|
|
38
|
+
parameters: {
|
|
39
|
+
// Storybook pads `#storybook-root` by 1rem unless a story is `fullscreen`. Every block here is
|
|
40
|
+
// a full-width page section (a sticky header, a hero, a footer), so it renders edge to edge the
|
|
41
|
+
// way it does on a real page — and the preview screenshots, which clip to the story root,
|
|
42
|
+
// stay true to the page too.
|
|
43
|
+
layout: 'fullscreen',
|
|
44
|
+
controls: {
|
|
45
|
+
matchers: {
|
|
46
|
+
color: /(background|color)$/i,
|
|
47
|
+
date: /Date$/i,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export default preview;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// `typecheck:storybook` runs plain `tsc` (not `vue-tsc`) over `.storybook/**`
|
|
2
|
+
// and the generated `stories/**`, so it needs its own `*.vue` module shim —
|
|
3
|
+
// `vue-tsc` (what `nuxi typecheck` uses) understands `.vue` imports natively
|
|
4
|
+
// and needs no shim, which is why the app itself has none.
|
|
5
|
+
declare module '*.vue' {
|
|
6
|
+
import type { DefineComponent } from 'vue';
|
|
7
|
+
|
|
8
|
+
const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>;
|
|
9
|
+
export default component;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Ambient shapes for the `virtual:eldra/*` modules `@eldrajs/vite-plugin-theme` emits.
|
|
2
|
+
// Neither `@eldrajs/theme-vue` nor `@eldrajs/vite-plugin-theme` ships these
|
|
3
|
+
// declarations to consumers (they are source-only, used to type-check each
|
|
4
|
+
// package's own source), so Storybook config/stories — the first place in
|
|
5
|
+
// this app that imports a `virtual:eldra/*` id directly — declares the slice
|
|
6
|
+
// it actually uses here. Kept minimal and in sync with
|
|
7
|
+
// `@eldrajs/vite-plugin-theme`'s own equivalent internal declaration.
|
|
8
|
+
declare module 'virtual:eldra/block-fields' {
|
|
9
|
+
const blockFields: Record<
|
|
10
|
+
string,
|
|
11
|
+
Array<{
|
|
12
|
+
fieldId: string;
|
|
13
|
+
type: string;
|
|
14
|
+
localized?: boolean;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
}>
|
|
17
|
+
>;
|
|
18
|
+
export default blockFields;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'virtual:eldra/tokens.css' {}
|
|
22
|
+
|
|
23
|
+
// Plain `tsc` (see shims-vue.d.ts) has no `vite/client` ambient CSS-import
|
|
24
|
+
// shim either, and pulling in `vite/client` here would require `vite` to be
|
|
25
|
+
// a direct devDependency just for its types. `preview.ts`'s side-effect
|
|
26
|
+
// `import '../app/assets/main.css'` only needs the module to exist.
|
|
27
|
+
declare module '*.css';
|