@nuvler/cli 0.5.10 → 0.5.11

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.
@@ -21,6 +21,7 @@ function MiniBanner({ item, ImageComponent }: { item: ThemeMiniBannerItem; Image
21
21
  <ImageComponent image={image} fallbackAlt={item.title || "Mini banner"} sizes="(max-width: 800px) 100vw, 50vw" fallbackWidth={800} fallbackHeight={450} />
22
22
  </span>
23
23
  {item.title && <strong>{item.title}</strong>}
24
+ {item.link && item.linkLabel && <span className="mini-banner-link-label">{item.linkLabel}</span>}
24
25
  </>
25
26
  );
26
27
  return item.link
@@ -85,7 +85,7 @@ export function ProductDetail({
85
85
  const information = <>
86
86
  {product.categories[0] && <span className="product-category">{product.categories[0].name}</span>}
87
87
  <h1>{product.title}</h1>
88
- {showPrices && <div className="product-price-block">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições com a loja</span>}{discount && <small>{discount}% de desconto</small>}</div>}
88
+ {showPrices && <div className="product-price-block">{previousPrice && <s>De: {previousPrice}</s>}{currentPrice ? <strong>{previousPrice ? "por " : ""}{currentPrice}</strong> : <span>Consulte condições com a loja</span>}{discount && <small>{discount}% de desconto</small>}</div>}
89
89
  {stockLabel && <p className={`product-availability${product.stockQuantity === 0 ? " unavailable" : ""}`}>{stockLabel}</p>}
90
90
  {product.sku && <p className="product-reference">Ref. {product.sku}</p>}
91
91
  <div className="product-description">{descriptionContent}</div>
@@ -1,6 +1,6 @@
1
1
  import { productUrl, type ProductGridProps, type ThemeProduct } from "@nuvler/theme-sdk";
2
2
  import { ProductCardAction } from "./product-detail-interactive.js";
3
- import { displayPrice, plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
3
+ import { displayPrice, effectivePrice, plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
4
4
 
5
5
  function discountPercent(price: number | null, promotionalPrice: number | null) {
6
6
  if (price === null || promotionalPrice === null || promotionalPrice >= price || price <= 0) return null;
@@ -21,7 +21,7 @@ export function ProductCard({ product, showPrices = true, showCategory = true, s
21
21
  const previousPrice = product.promotionalPrice !== null && product.price !== null && product.promotionalPrice < product.price
22
22
  ? displayPrice({ ...product, promotionalPrice: null })
23
23
  : null;
24
- return <article className="product-card" data-unavailable={unavailable || undefined}><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}>{showPrices && discount && <span className="product-card-badge">-{discount}%</span>}{unavailable && <span className="product-card-stock">Indisponível</span>}<ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}{showPrices && <div className="product-card-price">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições</span>}</div>}{product.sku && <small className="product-card-sku">Ref. {product.sku}</small>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} unavailable={unavailable} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice: showPrices ? product.promotionalPrice ?? product.price : null }} /></div></article>;
24
+ return <article className="product-card" data-unavailable={unavailable || undefined}><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}>{showPrices && discount && <span className="product-card-badge">-{discount}%</span>}{unavailable && <span className="product-card-stock">Indisponível</span>}<ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}{showPrices && <div className="product-card-price">{previousPrice && <s>De: {previousPrice}</s>}{currentPrice ? <strong>{previousPrice ? "por " : ""}{currentPrice}</strong> : <span>Consulte condições</span>}</div>}{product.sku && <small className="product-card-sku">Ref. {product.sku}</small>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} unavailable={unavailable} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice: showPrices ? effectivePrice(product) : null }} /></div></article>;
25
25
  }
26
26
 
27
27
  export function ProductGrid({ products, columns = 4, showPrices = true, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: ProductGridProps & { ImageComponent?: ThemeImageComponent }) {
@@ -44,8 +44,16 @@ export function plainText(value: string): string {
44
44
  return htmlToPlainText(value);
45
45
  }
46
46
 
47
+ export function effectivePrice(product: ThemeProduct): number | null {
48
+ const promotionalPrice = product.promotionalPrice;
49
+ const price = product.price;
50
+ return typeof promotionalPrice === "number" && typeof price === "number" && promotionalPrice < price
51
+ ? promotionalPrice
52
+ : price;
53
+ }
54
+
47
55
  export function displayPrice(product: ThemeProduct): string | null {
48
- const price = product.promotionalPrice ?? product.price;
56
+ const price = effectivePrice(product);
49
57
  return typeof price === "number"
50
58
  ? new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(price)
51
59
  : null;
@@ -1812,6 +1812,21 @@ select {
1812
1812
  line-height: 1.3;
1813
1813
  }
1814
1814
 
1815
+ .mini-banner-link-label {
1816
+ display: inline-flex;
1817
+ align-items: center;
1818
+ width: fit-content;
1819
+ margin-top: 8px;
1820
+ color: var(--color-primary);
1821
+ font-size: 14px;
1822
+ font-weight: 800;
1823
+ }
1824
+
1825
+ .mini-banner-link-label::after {
1826
+ content: "→";
1827
+ margin-left: 6px;
1828
+ }
1829
+
1815
1830
  a.mini-banner-card:hover .mini-banner-image > img {
1816
1831
  transform: scale(1.025);
1817
1832
  }
@@ -2205,16 +2220,18 @@ a.mini-banner-card:focus-visible {
2205
2220
 
2206
2221
  .image-text-media {
2207
2222
  overflow: hidden;
2208
- aspect-ratio: 4 / 3;
2209
2223
  border-radius: var(--radius-md);
2210
- background: #eef0ea;
2211
2224
  }
2212
2225
 
2213
- .image-text-media img,
2226
+ .image-text-media img {
2227
+ display: block;
2228
+ width: 100%;
2229
+ height: auto;
2230
+ }
2231
+
2214
2232
  .image-text-media .store-image-placeholder {
2233
+ min-height: 320px;
2215
2234
  width: 100%;
2216
- height: 100%;
2217
- object-fit: cover;
2218
2235
  }
2219
2236
 
2220
2237
  .image-text-copy > span {
@@ -2633,6 +2650,7 @@ a.mini-banner-card:focus-visible {
2633
2650
  color: var(--store-muted);
2634
2651
  font-size: 12px;
2635
2652
  line-height: 1.2;
2653
+ text-decoration: line-through;
2636
2654
  }
2637
2655
 
2638
2656
  .product-card-price strong {
@@ -2844,6 +2862,94 @@ a.mini-banner-card:focus-visible {
2844
2862
  gap: var(--space-3);
2845
2863
  }
2846
2864
 
2865
+ .home-brands-grid[data-columns="1"] {
2866
+ grid-template-columns: repeat(1, minmax(0, 1fr));
2867
+ }
2868
+
2869
+ .home-brands-grid[data-columns="2"] {
2870
+ grid-template-columns: repeat(2, minmax(0, 1fr));
2871
+ }
2872
+
2873
+ .home-brands-grid[data-columns="3"] {
2874
+ grid-template-columns: repeat(3, minmax(0, 1fr));
2875
+ }
2876
+
2877
+ .home-brands-grid[data-columns="4"] {
2878
+ grid-template-columns: repeat(4, minmax(0, 1fr));
2879
+ }
2880
+
2881
+ .home-brands-grid[data-columns="5"] {
2882
+ grid-template-columns: repeat(5, minmax(0, 1fr));
2883
+ }
2884
+
2885
+ .home-brands-grid[data-columns="6"] {
2886
+ grid-template-columns: repeat(6, minmax(0, 1fr));
2887
+ }
2888
+
2889
+ .brands-carousel {
2890
+ position: relative;
2891
+ padding-top: 46px;
2892
+ }
2893
+
2894
+ .brands-carousel-track {
2895
+ display: flex;
2896
+ align-items: stretch;
2897
+ gap: var(--space-3);
2898
+ overflow-x: auto;
2899
+ padding: 4px 0 22px;
2900
+ scroll-behavior: smooth;
2901
+ scroll-snap-type: x mandatory;
2902
+ scrollbar-width: none;
2903
+ }
2904
+
2905
+ .brands-carousel-track::-webkit-scrollbar {
2906
+ display: none;
2907
+ }
2908
+
2909
+ .brands-carousel-track > article,
2910
+ .brands-carousel-track > a {
2911
+ display: grid;
2912
+ min-width: 160px;
2913
+ min-height: 104px;
2914
+ flex: 0 0 calc((100% - 48px) / 5);
2915
+ place-items: center;
2916
+ overflow: hidden;
2917
+ border: 1px solid var(--store-line);
2918
+ border-radius: var(--radius-md);
2919
+ background: var(--store-surface);
2920
+ padding: var(--space-4);
2921
+ scroll-snap-align: start;
2922
+ text-align: center;
2923
+ }
2924
+
2925
+ .brands-carousel-track img {
2926
+ width: 100%;
2927
+ max-width: 150px;
2928
+ max-height: 54px;
2929
+ object-fit: contain;
2930
+ }
2931
+
2932
+ .brands-carousel-track strong {
2933
+ font-size: 14px;
2934
+ }
2935
+
2936
+ .brands-carousel .carousel-arrow {
2937
+ top: 0;
2938
+ width: 34px;
2939
+ height: 34px;
2940
+ transform: none;
2941
+ background: var(--store-surface);
2942
+ }
2943
+
2944
+ .brands-carousel .carousel-arrow-prev {
2945
+ right: 42px;
2946
+ left: auto;
2947
+ }
2948
+
2949
+ .brands-carousel .carousel-arrow-next {
2950
+ right: 0;
2951
+ }
2952
+
2847
2953
  .home-brands-grid > article,
2848
2954
  .home-brands-grid > a {
2849
2955
  display: grid;
@@ -4497,10 +4603,27 @@ a.mini-banner-card:focus-visible {
4497
4603
  grid-template-columns: 1fr;
4498
4604
  }
4499
4605
 
4500
- .home-brands-grid {
4606
+ .home-brands-grid[data-columns="1"] {
4607
+ grid-template-columns: repeat(1, minmax(0, 1fr));
4608
+ }
4609
+
4610
+ .home-brands-grid[data-columns="2"] {
4611
+ grid-template-columns: repeat(2, minmax(0, 1fr));
4612
+ }
4613
+
4614
+ .home-brands-grid[data-columns="3"],
4615
+ .home-brands-grid[data-columns="4"],
4616
+ .home-brands-grid[data-columns="5"],
4617
+ .home-brands-grid[data-columns="6"] {
4501
4618
  grid-template-columns: repeat(3, minmax(0, 1fr));
4502
4619
  }
4503
4620
 
4621
+ .brands-carousel-track > article,
4622
+ .brands-carousel-track > a {
4623
+ min-width: 0;
4624
+ flex-basis: calc((100% - 24px) / 3);
4625
+ }
4626
+
4504
4627
  .benefits-grid > div + div {
4505
4628
  border-top: 1px solid var(--store-line);
4506
4629
  border-left: 0;
@@ -4698,10 +4821,23 @@ a.mini-banner-card:focus-visible {
4698
4821
  font-size: 16px;
4699
4822
  }
4700
4823
 
4701
- .home-brands-grid {
4824
+ .home-brands-grid[data-columns="1"] {
4825
+ grid-template-columns: repeat(1, minmax(0, 1fr));
4826
+ }
4827
+
4828
+ .home-brands-grid[data-columns="2"],
4829
+ .home-brands-grid[data-columns="3"],
4830
+ .home-brands-grid[data-columns="4"],
4831
+ .home-brands-grid[data-columns="5"],
4832
+ .home-brands-grid[data-columns="6"] {
4702
4833
  grid-template-columns: repeat(2, minmax(0, 1fr));
4703
4834
  }
4704
4835
 
4836
+ .brands-carousel-track > article,
4837
+ .brands-carousel-track > a {
4838
+ flex-basis: calc((100% - 12px) / 2);
4839
+ }
4840
+
4705
4841
  .benefits-section {
4706
4842
  padding: 24px 0;
4707
4843
  }
@@ -13,13 +13,13 @@
13
13
  "typecheck": "tsc -p tsconfig.json --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@nuvler/theme-sdk": "^1.3.3"
16
+ "@nuvler/theme-sdk": "^1.4.3"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": "^19.0.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@nuvler/cli": "^0.5.10",
22
+ "@nuvler/cli": "^0.5.11",
23
23
  "@types/react": "^19.0.0",
24
24
  "react": "^19.0.0",
25
25
  "typescript": "^5.9.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuvler/cli",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "CLI oficial para criação, validação, preview e empacotamento de temas Nuvler",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,8 +20,8 @@
20
20
  "typecheck": "tsc -p tsconfig.json --noEmit"
21
21
  },
22
22
  "dependencies": {
23
- "@nuvler/theme-schema": "^1.4.0",
24
- "@nuvler/theme-sdk": "^1.4.2",
23
+ "@nuvler/theme-schema": "^1.4.1",
24
+ "@nuvler/theme-sdk": "^1.4.3",
25
25
  "@vitejs/plugin-react": "^6.0.5",
26
26
  "commander": "^15.0.0",
27
27
  "react": "19.2.8",
@@ -10,7 +10,7 @@
10
10
  "typecheck": "tsc -p tsconfig.json --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "@nuvler/theme-sdk": "^1.4.2",
13
+ "@nuvler/theme-sdk": "^1.4.3",
14
14
  "react": "19.2.8",
15
15
  "react-dom": "19.2.8"
16
16
  },
@@ -116,12 +116,19 @@ function CategoryTree({
116
116
  }
117
117
 
118
118
  function displayPrice(product: ThemeProduct): string | null {
119
- const price = product.promotionalPrice ?? product.price;
119
+ const price = typeof product.promotionalPrice === "number" && typeof product.price === "number" && product.promotionalPrice < product.price
120
+ ? product.promotionalPrice
121
+ : product.price;
120
122
  return typeof price === "number"
121
123
  ? new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(price)
122
124
  : null;
123
125
  }
124
126
 
127
+ function originalPrice(product: ThemeProduct): string | null {
128
+ if (typeof product.price !== "number" || typeof product.promotionalPrice !== "number" || product.promotionalPrice >= product.price) return null;
129
+ return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(product.price);
130
+ }
131
+
125
132
  function SmartSearch({ adapters, showPrices }: { adapters: ThemeRuntimeAdapters; showPrices: boolean }) {
126
133
  const { Link, Image } = adapters;
127
134
  const [value, setValue] = useState("");
@@ -303,7 +310,7 @@ function ProductCard({ product, context, adapters }: {
303
310
  {catalog.showDescription && product.description && (
304
311
  <p className="product-card-description">{plainText(product.description)}</p>
305
312
  )}
306
- {catalog.showPrices && displayPrice(product) && <b>{displayPrice(product)}</b>}
313
+ {catalog.showPrices && displayPrice(product) && <div className="product-card-price">{originalPrice(product) && <s>De: {originalPrice(product)}</s>}<b>{originalPrice(product) ? "por " : ""}{displayPrice(product)}</b></div>}
307
314
  <Link className="button button-secondary button-block" href={href}>
308
315
  Ver detalhes e orçar
309
316
  </Link>