@snowcone-app/ui 0.10.12 → 0.10.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/ui",
3
- "version": "0.10.12",
3
+ "version": "0.10.14",
4
4
  "description": "React components for merchandise visualization and customization",
5
5
  "keywords": [
6
6
  "react",
@@ -103,7 +103,7 @@
103
103
  "react-instantsearch": "^7.15.5",
104
104
  "react-zoom-pan-pinch": "^3.6.4",
105
105
  "tailwind-merge": "^3.0.0",
106
- "@snowcone-app/sdk": "0.29.1"
106
+ "@snowcone-app/sdk": "0.30.0"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@chromatic-com/storybook": "^4.1.2",
@@ -26,6 +26,7 @@ import {
26
26
  resolveVariantId,
27
27
  resolvePreviewVariantId,
28
28
  resolveMockupId,
29
+ SNOWCONE_HOSTS,
29
30
  } from "@snowcone-app/sdk";
30
31
 
31
32
  /** Slugify a placement label into the catalog's `placements[].key` form. */
@@ -1330,7 +1331,7 @@ export const HeroProductImage = memo(function HeroProductImage({
1330
1331
  : "[Snowcone] A mockup image failed to load (likely 'Missing required " +
1331
1332
  "signature'). If your shop requires signed URLs, pass `signMockupUrl` " +
1332
1333
  "to <Shop> so the UI can sign mockup <img> URLs. Docs: " +
1333
- "https://developers.snowcone.app/design-system/signing-at-scale",
1334
+ `${SNOWCONE_HOSTS.docs}/design-system/signing-at-scale`,
1334
1335
  );
1335
1336
  }
1336
1337
  }}
@@ -49,6 +49,7 @@ import React, {
49
49
  memo,
50
50
  } from "react";
51
51
  import type { CarouselImage } from "./types";
52
+ import { slideFit, zoomFit } from "./fit";
52
53
  import { EnhancedImageViewer } from "../zoom/EnhancedImageViewer";
53
54
  import { HeroProductImage } from "../HeroProductImage";
54
55
  import { LoadingOverlayPrismCandyInline } from "../../components/LoadingOverlayPrismCandy";
@@ -922,9 +923,7 @@ export const MobileProductCarousel = memo(function MobileProductCarousel({
922
923
  // Edits render only the slides a shopper can see, at the
923
924
  // width the screen shows them (sessionShape.ts).
924
925
  viewportPolicy
925
- // The size picture is a diagram with a caption, not a hero:
926
- // the whole 16:9 frame, never cropped to the slide's centre.
927
- fit={image.galleryRole === "size-picture" ? "whole" : "cover"}
926
+ fit={slideFit(image.galleryRole)}
928
927
  />
929
928
  ) : image.isRealMockup && !currentArtwork ? (
930
929
  <LoadingOverlayPrismCandyInline visible variant="light" />
@@ -1028,7 +1027,7 @@ export const MobileProductCarousel = memo(function MobileProductCarousel({
1028
1027
  alt: img.label,
1029
1028
  naturalWidth: img.naturalWidth,
1030
1029
  naturalHeight: img.naturalHeight,
1031
- ...(img.galleryRole === "size-picture" ? { fit: "whole" as const } : {}),
1030
+ ...(zoomFit(img.galleryRole) === "whole" ? { fit: "whole" as const } : {}),
1032
1031
  } : null;
1033
1032
  })
1034
1033
  .filter((img): img is NonNullable<typeof img> => img !== null);
@@ -0,0 +1,16 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { slideFit, zoomFit } from "../fit";
3
+
4
+ // Known case (prod XTNA6J, iPhone 14 at 390 px, 2026-11-13): drawn whole in the phone hero, the size picture's
5
+ // garment was 92-120 px wide and its caption capitals 5 px; cropped it is 214-280 px and 11 px. Lead ruling A: the
6
+ // hero crops it (data-fit "cover"); the zoom viewer still opens it whole.
7
+ describe("size picture fit on a phone", () => {
8
+ it("the phone hero draws the size slide cropped, like every slide", () => {
9
+ expect(slideFit("size-picture")).toBe("cover");
10
+ expect(slideFit(undefined)).toBe("cover");
11
+ });
12
+ it("the zoom viewer opens the size picture whole; other pictures unchanged", () => {
13
+ expect(zoomFit("size-picture")).toBe("whole");
14
+ expect(zoomFit(undefined)).toBe("cover");
15
+ });
16
+ });
@@ -0,0 +1,18 @@
1
+ import type { CarouselImage } from "./types";
2
+
3
+ /**
4
+ * How the phone carousel draws a picture, and how the zoom viewer opens it.
5
+ *
6
+ * A size picture (galleryRole "size-picture") is a 16:9 diagram with a caption. On a phone the hero is ~342x448, so
7
+ * drawn WHOLE it shrinks to a letterbox: garment 92-120 px wide and caption capitals 5 px (measured on prod XTNA6J,
8
+ * 2026-11-13), against 214-280 px and 11 px cropped. The lead's ruling (A, 2026-11-13): the phone HERO draws it
9
+ * cropped (cover) like every slide; tapping it opens the zoom viewer, which shows it whole.
10
+ */
11
+ export function slideFit(_galleryRole: CarouselImage["galleryRole"]): "cover" | "whole" {
12
+ return "cover";
13
+ }
14
+
15
+ /** The zoom viewer opens a size picture whole (the full 16:9, caption readable); every other picture as before. */
16
+ export function zoomFit(galleryRole: CarouselImage["galleryRole"]): "cover" | "whole" {
17
+ return galleryRole === "size-picture" ? "whole" : "cover";
18
+ }
@@ -5,6 +5,8 @@
5
5
  * if Tailwind styles are properly applied to components.
6
6
  */
7
7
 
8
+ import { SNOWCONE_HOSTS } from '@snowcone-app/sdk';
9
+
8
10
  let hasCheckedConfig = false;
9
11
  let configCheckPassed = false;
10
12
 
@@ -50,7 +52,7 @@ export function checkTailwindConfig() {
50
52
  'Quick fix:\n' +
51
53
  ' Run: npx snowcone-cli init\n\n' +
52
54
  'Or manually check:\n' +
53
- ' https://developers.snowcone.app/llm-kit/latest/theme-setup.md\n'
55
+ ` ${SNOWCONE_HOSTS.docs}/llm-kit/latest/theme-setup.md\n`
54
56
  );
55
57
  configCheckPassed = false;
56
58
  return false;
@@ -135,7 +137,7 @@ export function checkThemeTokens(): boolean {
135
137
  `Missing: ${missingTokens.join(', ')}\n\n` +
136
138
  'Components may not render correctly.\n' +
137
139
  'Add theme tokens to globals.css:\n' +
138
- ' https://developers.snowcone.app/llm-kit/latest/themes.css'
140
+ ` ${SNOWCONE_HOSTS.docs}/llm-kit/latest/themes.css`
139
141
  );
140
142
  return false;
141
143
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/dev-warnings.ts"],"sourcesContent":["/**\n * Development-only warnings for detecting configuration issues\n *\n * This utility helps catch common setup problems early by checking\n * if Tailwind styles are properly applied to components.\n */\n\nlet hasCheckedConfig = false;\nlet configCheckPassed = false;\n\n/**\n * Check if Tailwind CSS is properly configured\n * This runs once per page load in development mode\n */\nexport function checkTailwindConfig() {\n // Only run in development\n if (process.env.NODE_ENV !== 'development') return true;\n\n // Only check once\n if (hasCheckedConfig) return configCheckPassed;\n hasCheckedConfig = true;\n\n try {\n // Create a test element with Tailwind classes\n const testElement = document.createElement('div');\n testElement.className = 'bg-background text-foreground';\n testElement.style.position = 'absolute';\n testElement.style.visibility = 'hidden';\n testElement.style.pointerEvents = 'none';\n document.body.appendChild(testElement);\n\n // Check if styles are applied\n const styles = window.getComputedStyle(testElement);\n const hasBackgroundColor = styles.backgroundColor && styles.backgroundColor !== 'rgba(0, 0, 0, 0)';\n const hasTextColor = styles.color && styles.color !== 'rgb(0, 0, 0)';\n\n // Clean up\n document.body.removeChild(testElement);\n\n if (!hasBackgroundColor || !hasTextColor) {\n console.error(\n '%c🚨 @snowcone-app/ui: Tailwind styles not detected!',\n 'font-size: 14px; font-weight: bold; color: #ef4444;',\n '\\n\\n' +\n '❌ Your components may look unstyled.\\n\\n' +\n 'Common causes:\\n' +\n ' 1. Missing or incorrect @source paths in globals.css\\n' +\n ' 2. Forgot to restart dev server after changing globals.css\\n' +\n ' 3. Tailwind CSS not imported in globals.css\\n\\n' +\n 'Quick fix:\\n' +\n ' Run: npx snowcone-cli init\\n\\n' +\n 'Or manually check:\\n' +\n ' https://developers.snowcone.app/llm-kit/latest/theme-setup.md\\n'\n );\n configCheckPassed = false;\n return false;\n }\n\n configCheckPassed = true;\n return true;\n\n } catch (error) {\n console.warn('@snowcone-app/ui: Could not verify Tailwind configuration', error);\n configCheckPassed = false;\n return false;\n }\n}\n\n/**\n * Check if a specific component has styles applied\n * Use this in individual components to provide more specific warnings\n */\nexport function checkComponentStyles(\n element: HTMLElement | null,\n componentName: string\n): boolean {\n // Only run in development\n if (process.env.NODE_ENV !== 'development') return true;\n if (!element) return false;\n\n try {\n const styles = window.getComputedStyle(element);\n\n // Check if any Tailwind styles are applied\n // Look for non-default values on common properties\n const hasStyles =\n (styles.backgroundColor && styles.backgroundColor !== 'rgba(0, 0, 0, 0)') ||\n (styles.padding && styles.padding !== '0px') ||\n (styles.margin && styles.margin !== '0px') ||\n (styles.display && !['inline', 'block'].includes(styles.display));\n\n if (!hasStyles) {\n console.warn(\n `%c⚠️ ${componentName}: Missing Tailwind styles`,\n 'font-size: 12px; color: #f59e0b;',\n '\\n' +\n 'Component may not render correctly.\\n' +\n 'Check @source configuration in globals.css or run: npx snowcone-cli init'\n );\n return false;\n }\n\n return true;\n\n } catch (error) {\n return false;\n }\n}\n\n/**\n * Check if required CSS variables (theme tokens) are defined\n */\nexport function checkThemeTokens(): boolean {\n // Only run in development\n if (process.env.NODE_ENV !== 'development') return true;\n\n try {\n const requiredTokens = [\n '--color-background',\n '--color-foreground',\n '--color-primary',\n '--color-card',\n ];\n\n const rootStyles = getComputedStyle(document.documentElement);\n const missingTokens = requiredTokens.filter(\n (token) => !rootStyles.getPropertyValue(token)\n );\n\n if (missingTokens.length > 0) {\n console.warn(\n '%c⚠️ @snowcone-app/ui: Missing theme tokens',\n 'font-size: 12px; color: #f59e0b;',\n '\\n' +\n `Missing: ${missingTokens.join(', ')}\\n\\n` +\n 'Components may not render correctly.\\n' +\n 'Add theme tokens to globals.css:\\n' +\n ' https://developers.snowcone.app/llm-kit/latest/themes.css'\n );\n return false;\n }\n\n return true;\n\n } catch (error) {\n return false;\n }\n}\n\n/**\n * Run all configuration checks\n * Call this once when the app initializes\n */\nexport function runConfigChecks(): boolean {\n if (process.env.NODE_ENV !== 'development') return true;\n\n const tailwindOk = checkTailwindConfig();\n const themesOk = checkThemeTokens();\n\n return tailwindOk && themesOk;\n}\n"],"mappings":";AAOA,IAAI,mBAAmB;AACvB,IAAI,oBAAoB;AAMjB,SAAS,sBAAsB;AAEpC,MAAI,QAAQ,IAAI,aAAa,cAAe,QAAO;AAGnD,MAAI,iBAAkB,QAA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