@snowcone-app/ui 0.10.11 → 0.10.13
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 +15 -0
- package/README.md +7 -4
- package/dist/{chunk-UJ5ZXSFD.js → chunk-4E5PVNXY.js} +18 -3
- package/dist/chunk-4E5PVNXY.js.map +1 -0
- package/dist/{dev-warnings-LI2YBKKQ.js → dev-warnings-2MCWOVV5.js} +2 -2
- package/dist/index.cjs +79 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +2 -1
- package/src/composed/search/CurrentRefinements.tsx +9 -2
- package/src/utils/dev-warnings.ts +4 -2
- package/dist/chunk-UJ5ZXSFD.js.map +0 -1
- /package/dist/{dev-warnings-LI2YBKKQ.js.map → dev-warnings-2MCWOVV5.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.13",
|
|
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.
|
|
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
|
-
|
|
1334
|
+
`${SNOWCONE_HOSTS.docs}/design-system/signing-at-scale`,
|
|
1334
1335
|
);
|
|
1335
1336
|
}
|
|
1336
1337
|
}}
|
|
@@ -8,6 +8,13 @@ import type { ComponentType } from "react";
|
|
|
8
8
|
type IconProps = { className?: string; size?: number };
|
|
9
9
|
const XIcon = LucideX as ComponentType<IconProps>;
|
|
10
10
|
|
|
11
|
+
// "≥ 3434" / "≤ 1000" price labels. Built from strings, never regex literals: a raw ≥ or ≤ in a regex literal reaches a
|
|
12
|
+
// server bundle as-is (minifiers undo a \u escape there, and esbuild escapes strings but not regexes), and one such
|
|
13
|
+
// character makes V8 hold the whole script at two bytes per character. In the www worker that was about 50 MB of its
|
|
14
|
+
// 128 MB isolate, and cold isolates answered Cloudflare's 1102 page (2026-11-12).
|
|
15
|
+
const MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
16
|
+
const MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
17
|
+
|
|
11
18
|
export function CurrentRefinements() {
|
|
12
19
|
const { items, refine } = useCurrentRefinements();
|
|
13
20
|
|
|
@@ -33,14 +40,14 @@ export function CurrentRefinements() {
|
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
// Handle >= format like "price >= 3434" or "≥ 3434"
|
|
36
|
-
const minMatch = label.match(
|
|
43
|
+
const minMatch = label.match(MIN_PRICE);
|
|
37
44
|
if (minMatch) {
|
|
38
45
|
const min = parseInt(minMatch[1]);
|
|
39
46
|
return `Min ${formatPriceValue(min)}`;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
// Handle <= format like "price <= 1000" or "≤ 1000"
|
|
43
|
-
const maxMatch = label.match(
|
|
50
|
+
const maxMatch = label.match(MAX_PRICE);
|
|
44
51
|
if (maxMatch) {
|
|
45
52
|
const max = parseInt(maxMatch[1]);
|
|
46
53
|
return `Max ${formatPriceValue(max)}`;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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,QAAO;AAC7B,qBAAmB;AAEnB,MAAI;AAEF,UAAM,cAAc,SAAS,cAAc,KAAK;AAChD,gBAAY,YAAY;AACxB,gBAAY,MAAM,W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