@caartzee/theme-sdk 1.2.0 → 1.2.2
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/bin/caartzee-theme.js +469 -54
- package/dist/lib/index.js +469 -54
- package/dist/types/src/blocks/block-contract.d.ts +10 -10
- package/dist/types/src/cli/mcp/ui-patterns-tools.d.ts +26 -0
- package/dist/types/src/cli/mcp/v2-api-catalog.d.ts +69 -0
- package/dist/types/src/cli/mcp/v2-commerce-tools.d.ts +18 -0
- package/dist/types/src/contracts/manifest.d.ts +77 -77
- package/dist/types/src/scaffold/design-presets.d.ts +41 -0
- package/dist/types/src/scaffold/template-generator.d.ts +2 -0
- package/dist/types/src/sections/section-contract.d.ts +12 -12
- package/package.json +1 -1
- package/templates/commerce/manifest.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -622,6 +622,7 @@ var SettingTypeSchema = z2.enum([
|
|
|
622
622
|
"range",
|
|
623
623
|
"url",
|
|
624
624
|
"json",
|
|
625
|
+
"html",
|
|
625
626
|
"code",
|
|
626
627
|
"javascript",
|
|
627
628
|
"category_list",
|
|
@@ -734,7 +735,7 @@ var RAW_HTML_SECTION_MANIFEST = {
|
|
|
734
735
|
settings: [
|
|
735
736
|
{
|
|
736
737
|
id: "html",
|
|
737
|
-
type: "
|
|
738
|
+
type: "html",
|
|
738
739
|
label: "HTML Content",
|
|
739
740
|
placeholder: "<div>Custom HTML content...</div>",
|
|
740
741
|
required: false,
|
|
@@ -4866,6 +4867,9 @@ function loadCandyThemeFromSource(source, fallbackSlug = "candy-theme") {
|
|
|
4866
4867
|
});
|
|
4867
4868
|
}
|
|
4868
4869
|
}
|
|
4870
|
+
if (!sectionSchemas["raw-html"]) {
|
|
4871
|
+
sectionSchemas["raw-html"] = RAW_HTML_SECTION_MANIFEST;
|
|
4872
|
+
}
|
|
4869
4873
|
for (const entry of source.list("assets")) {
|
|
4870
4874
|
assets[entry] = source.read(`assets/${entry}`) ?? "";
|
|
4871
4875
|
}
|
|
@@ -6587,6 +6591,323 @@ var candyStarterProductCard = `<article class="candy-product-card">
|
|
|
6587
6591
|
</article>
|
|
6588
6592
|
`;
|
|
6589
6593
|
|
|
6594
|
+
// src/scaffold/design-presets.ts
|
|
6595
|
+
var CANDY_DESIGN_PRESETS = {
|
|
6596
|
+
"minimal-luxury": {
|
|
6597
|
+
id: "minimal-luxury",
|
|
6598
|
+
name: "Minimal Luxury",
|
|
6599
|
+
description: "Warm ivory canvas, editorial serif headings, hairline borders, and champagne bronze accents.",
|
|
6600
|
+
bestFor: "Fashion, jewelry, skincare, home fragrance, boutique lifestyle brands.",
|
|
6601
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap",
|
|
6602
|
+
tokens: {
|
|
6603
|
+
colors: {
|
|
6604
|
+
background: "#FAF9F6",
|
|
6605
|
+
surface: "#F2EFE9",
|
|
6606
|
+
text: "#141414",
|
|
6607
|
+
muted: "#6B665E",
|
|
6608
|
+
border: "#E5E0D8",
|
|
6609
|
+
primary: "#141414",
|
|
6610
|
+
primaryText: "#FAF9F6",
|
|
6611
|
+
accent: "#9A7B4F",
|
|
6612
|
+
danger: "#B91C1C",
|
|
6613
|
+
success: "#166534"
|
|
6614
|
+
},
|
|
6615
|
+
typography: {
|
|
6616
|
+
headingFont: "'Cormorant Garamond', Georgia, serif",
|
|
6617
|
+
bodyFont: "'Plus Jakarta Sans', system-ui, -apple-system, sans-serif"
|
|
6618
|
+
},
|
|
6619
|
+
borderRadius: { sm: "2px", md: "4px", lg: "6px", button: "2px" }
|
|
6620
|
+
}
|
|
6621
|
+
},
|
|
6622
|
+
"streetwear-editorial": {
|
|
6623
|
+
id: "streetwear-editorial",
|
|
6624
|
+
name: "Streetwear Editorial",
|
|
6625
|
+
description: "High-contrast stark monochrome, architectural zero-radius grid, and punchy grotesk typography.",
|
|
6626
|
+
bestFor: "Streetwear, sneakers, archival fashion, skate, music merch.",
|
|
6627
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6628
|
+
tokens: {
|
|
6629
|
+
colors: {
|
|
6630
|
+
background: "#FFFFFF",
|
|
6631
|
+
surface: "#F4F4F5",
|
|
6632
|
+
text: "#09090B",
|
|
6633
|
+
muted: "#52525B",
|
|
6634
|
+
border: "#E4E4E7",
|
|
6635
|
+
primary: "#09090B",
|
|
6636
|
+
primaryText: "#FFFFFF",
|
|
6637
|
+
accent: "#E11D48",
|
|
6638
|
+
danger: "#DC2626",
|
|
6639
|
+
success: "#15803D"
|
|
6640
|
+
},
|
|
6641
|
+
typography: {
|
|
6642
|
+
headingFont: "'Space Grotesk', system-ui, sans-serif",
|
|
6643
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6644
|
+
},
|
|
6645
|
+
borderRadius: { sm: "0px", md: "0px", lg: "2px", button: "0px" }
|
|
6646
|
+
}
|
|
6647
|
+
},
|
|
6648
|
+
"organic-wellness": {
|
|
6649
|
+
id: "organic-wellness",
|
|
6650
|
+
name: "Organic Wellness",
|
|
6651
|
+
description: "Soft oat background, forest green ink, sage surfaces, and calm rounded cards.",
|
|
6652
|
+
bestFor: "Skincare, botanicals, tea/coffee, supplements, sustainable living.",
|
|
6653
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=DM+Sans:wght@400;500;600&display=swap",
|
|
6654
|
+
tokens: {
|
|
6655
|
+
colors: {
|
|
6656
|
+
background: "#F7F5F0",
|
|
6657
|
+
surface: "#ECECE4",
|
|
6658
|
+
text: "#1F2D24",
|
|
6659
|
+
muted: "#5A6B5F",
|
|
6660
|
+
border: "#DCE0D6",
|
|
6661
|
+
primary: "#2F523B",
|
|
6662
|
+
primaryText: "#F7F5F0",
|
|
6663
|
+
accent: "#C26D47",
|
|
6664
|
+
danger: "#B91C1C",
|
|
6665
|
+
success: "#166534"
|
|
6666
|
+
},
|
|
6667
|
+
typography: {
|
|
6668
|
+
headingFont: "'Fraunces', Georgia, serif",
|
|
6669
|
+
bodyFont: "'DM Sans', system-ui, -apple-system, sans-serif"
|
|
6670
|
+
},
|
|
6671
|
+
borderRadius: { sm: "8px", md: "14px", lg: "20px", button: "9999px" }
|
|
6672
|
+
}
|
|
6673
|
+
},
|
|
6674
|
+
"modern-tech": {
|
|
6675
|
+
id: "modern-tech",
|
|
6676
|
+
name: "Modern Tech",
|
|
6677
|
+
description: "Sleek dark slate surfaces, luminous contrast, geometric sans, and electric indigo accent.",
|
|
6678
|
+
bestFor: "Electronics, audio gear, gaming hardware, digital products, SaaS merch.",
|
|
6679
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6680
|
+
tokens: {
|
|
6681
|
+
colors: {
|
|
6682
|
+
background: "#090D16",
|
|
6683
|
+
surface: "#111827",
|
|
6684
|
+
text: "#F8FAFC",
|
|
6685
|
+
muted: "#94A3B8",
|
|
6686
|
+
border: "#1E293B",
|
|
6687
|
+
primary: "#6366F1",
|
|
6688
|
+
primaryText: "#FFFFFF",
|
|
6689
|
+
accent: "#38BDF8",
|
|
6690
|
+
danger: "#F43F5E",
|
|
6691
|
+
success: "#10B981"
|
|
6692
|
+
},
|
|
6693
|
+
typography: {
|
|
6694
|
+
headingFont: "'Plus Jakarta Sans', system-ui, sans-serif",
|
|
6695
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6696
|
+
},
|
|
6697
|
+
borderRadius: { sm: "6px", md: "10px", lg: "16px", button: "8px" }
|
|
6698
|
+
}
|
|
6699
|
+
},
|
|
6700
|
+
"vibrant-d2c": {
|
|
6701
|
+
id: "vibrant-d2c",
|
|
6702
|
+
name: "Vibrant D2C",
|
|
6703
|
+
description: "Energetic high-conversion D2C palette, pill buttons, clear savings badges, and crisp card hierarchy.",
|
|
6704
|
+
bestFor: "Snacks, beverages, pets, fitness, everyday consumer brands.",
|
|
6705
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Outfit:wght@600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6706
|
+
tokens: {
|
|
6707
|
+
colors: {
|
|
6708
|
+
background: "#FFFFFF",
|
|
6709
|
+
surface: "#FFF7ED",
|
|
6710
|
+
text: "#0F172A",
|
|
6711
|
+
muted: "#475569",
|
|
6712
|
+
border: "#E2E8F0",
|
|
6713
|
+
primary: "#EA580C",
|
|
6714
|
+
primaryText: "#FFFFFF",
|
|
6715
|
+
accent: "#0F172A",
|
|
6716
|
+
danger: "#DC2626",
|
|
6717
|
+
success: "#059669"
|
|
6718
|
+
},
|
|
6719
|
+
typography: {
|
|
6720
|
+
headingFont: "'Outfit', system-ui, sans-serif",
|
|
6721
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6722
|
+
},
|
|
6723
|
+
borderRadius: { sm: "8px", md: "14px", lg: "20px", button: "9999px" }
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6726
|
+
};
|
|
6727
|
+
var CANDY_DESIGN_PRESET_IDS = Object.keys(CANDY_DESIGN_PRESETS);
|
|
6728
|
+
function resolveDesignPreset(id) {
|
|
6729
|
+
const key = (id || "minimal-luxury").trim().toLowerCase();
|
|
6730
|
+
return CANDY_DESIGN_PRESETS[key] || CANDY_DESIGN_PRESETS["minimal-luxury"];
|
|
6731
|
+
}
|
|
6732
|
+
function buildCandyDesignSystemCss(presetInput) {
|
|
6733
|
+
const preset = typeof presetInput === "string" || !presetInput ? resolveDesignPreset(presetInput) : presetInput;
|
|
6734
|
+
const { colors, typography, borderRadius } = preset.tokens;
|
|
6735
|
+
return `/* Caartzee Candy Design System — Preset: ${preset.name} (${preset.id}) */
|
|
6736
|
+
@import url('${preset.googleFontsUrl}');
|
|
6737
|
+
|
|
6738
|
+
:root {
|
|
6739
|
+
--cz-bg: ${colors.background};
|
|
6740
|
+
--cz-surface: ${colors.surface};
|
|
6741
|
+
--cz-ink: ${colors.text};
|
|
6742
|
+
--cz-muted: ${colors.muted};
|
|
6743
|
+
--cz-border: ${colors.border};
|
|
6744
|
+
--cz-primary: ${colors.primary};
|
|
6745
|
+
--cz-primary-ink: ${colors.primaryText};
|
|
6746
|
+
--cz-accent: ${colors.accent};
|
|
6747
|
+
--cz-danger: ${colors.danger};
|
|
6748
|
+
--cz-success: ${colors.success};
|
|
6749
|
+
--cz-font-heading: ${typography.headingFont};
|
|
6750
|
+
--cz-font-body: ${typography.bodyFont};
|
|
6751
|
+
--cz-radius-sm: ${borderRadius.sm};
|
|
6752
|
+
--cz-radius-md: ${borderRadius.md};
|
|
6753
|
+
--cz-radius-lg: ${borderRadius.lg};
|
|
6754
|
+
--cz-radius-btn: ${borderRadius.button};
|
|
6755
|
+
--cz-container: 1280px;
|
|
6756
|
+
--cz-space-xs: 0.5rem;
|
|
6757
|
+
--cz-space-sm: 1rem;
|
|
6758
|
+
--cz-space-md: 1.5rem;
|
|
6759
|
+
--cz-space-lg: 3rem;
|
|
6760
|
+
--cz-space-xl: 4.5rem;
|
|
6761
|
+
}
|
|
6762
|
+
|
|
6763
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
6764
|
+
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
|
|
6765
|
+
body {
|
|
6766
|
+
margin: 0;
|
|
6767
|
+
background: var(--cz-bg);
|
|
6768
|
+
color: var(--cz-ink);
|
|
6769
|
+
font-family: var(--cz-font-body);
|
|
6770
|
+
line-height: 1.6;
|
|
6771
|
+
}
|
|
6772
|
+
h1, h2, h3, h4 { font-family: var(--cz-font-heading); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
|
|
6773
|
+
a { color: inherit; text-decoration: none; }
|
|
6774
|
+
img { max-width: 100%; height: auto; display: block; }
|
|
6775
|
+
|
|
6776
|
+
.cz-container { width: 100%; max-width: var(--cz-container); margin: 0 auto; padding: 0 1.25rem; }
|
|
6777
|
+
|
|
6778
|
+
/* Buttons */
|
|
6779
|
+
.cz-btn, button.js-add-to-cart, button.js-submit-btn {
|
|
6780
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
|
|
6781
|
+
padding: 0.75rem 1.4rem; border-radius: var(--cz-radius-btn);
|
|
6782
|
+
background: var(--cz-primary); color: var(--cz-primary-ink);
|
|
6783
|
+
border: 1px solid var(--cz-primary); font: 600 0.875rem/1 var(--cz-font-body);
|
|
6784
|
+
cursor: pointer; transition: opacity 0.18s ease, transform 0.15s ease;
|
|
6785
|
+
}
|
|
6786
|
+
.cz-btn:hover, button.js-add-to-cart:hover, button.js-submit-btn:hover { opacity: 0.88; }
|
|
6787
|
+
.cz-btn--outline { background: transparent; color: var(--cz-ink); border-color: var(--cz-border); }
|
|
6788
|
+
.cz-btn--outline:hover { border-color: var(--cz-ink); opacity: 1; }
|
|
6789
|
+
|
|
6790
|
+
/* Announcement & Header */
|
|
6791
|
+
.cz-announcement-bar {
|
|
6792
|
+
background: var(--cz-primary); color: var(--cz-primary-ink);
|
|
6793
|
+
text-align: center; font-size: 0.78rem; font-weight: 500;
|
|
6794
|
+
padding: 0.5rem 1rem; letter-spacing: 0.03em;
|
|
6795
|
+
}
|
|
6796
|
+
.cz-candy-header {
|
|
6797
|
+
position: sticky; top: 0; z-index: 40;
|
|
6798
|
+
background: var(--cz-bg); color: var(--cz-ink);
|
|
6799
|
+
border-bottom: 1px solid var(--cz-border);
|
|
6800
|
+
}
|
|
6801
|
+
.cz-header-inner {
|
|
6802
|
+
max-width: var(--cz-container); margin: 0 auto; padding: 0.9rem 1.25rem;
|
|
6803
|
+
display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap;
|
|
6804
|
+
}
|
|
6805
|
+
.cz-header-logo { font-family: var(--cz-font-heading); font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
|
|
6806
|
+
.cz-candy-header nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; font-size: 0.9rem; font-weight: 500; }
|
|
6807
|
+
.cz-candy-header nav a:hover { color: var(--cz-accent); }
|
|
6808
|
+
.cz-header-actions { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; font-weight: 500; }
|
|
6809
|
+
|
|
6810
|
+
/* Hero Banner */
|
|
6811
|
+
.cz-candy-hero {
|
|
6812
|
+
position: relative; overflow: hidden; background: var(--cz-surface);
|
|
6813
|
+
padding: clamp(3rem, 7vw, 6.5rem) 1.25rem; text-align: center;
|
|
6814
|
+
border-bottom: 1px solid var(--cz-border);
|
|
6815
|
+
}
|
|
6816
|
+
.cz-candy-hero h1 { font-size: clamp(2.1rem, 5vw, 4rem); max-width: 18ch; margin: 0 auto 1rem; }
|
|
6817
|
+
.cz-candy-hero p { color: var(--cz-muted); max-width: 54ch; margin: 0 auto 1.75rem; font-size: 1.05rem; }
|
|
6818
|
+
.cz-candy-hero > a {
|
|
6819
|
+
display: inline-flex; padding: 0.85rem 1.8rem; border-radius: var(--cz-radius-btn);
|
|
6820
|
+
background: var(--cz-primary); color: var(--cz-primary-ink); font-weight: 600; font-size: 0.9rem;
|
|
6821
|
+
}
|
|
6822
|
+
.cz-hero-desktop-img {
|
|
6823
|
+
width: 100%; max-width: 1120px; max-height: 480px; object-fit: cover;
|
|
6824
|
+
margin: 0 auto 2rem; border-radius: var(--cz-radius-lg);
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6827
|
+
/* Uniform Product Grid & Cards (used on Home, Collection, Search, Related Products) */
|
|
6828
|
+
.cz-candy-featured-products, .cz-candy-collection, .cz-candy-search {
|
|
6829
|
+
max-width: var(--cz-container); margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6830
|
+
}
|
|
6831
|
+
.candy-product-grid {
|
|
6832
|
+
display: grid; gap: 1.5rem;
|
|
6833
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
6834
|
+
}
|
|
6835
|
+
.candy-product-card {
|
|
6836
|
+
display: flex; flex-direction: column; gap: 0.65rem;
|
|
6837
|
+
background: var(--cz-bg); border: 1px solid var(--cz-border);
|
|
6838
|
+
border-radius: var(--cz-radius-md); overflow: hidden; padding-bottom: 1rem;
|
|
6839
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
6840
|
+
}
|
|
6841
|
+
.candy-product-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
|
|
6842
|
+
.candy-product-card img {
|
|
6843
|
+
width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--cz-surface);
|
|
6844
|
+
}
|
|
6845
|
+
.candy-product-card h3, .candy-product-card .candy-card-title {
|
|
6846
|
+
font-size: 1rem; font-weight: 600; margin: 0; padding: 0 0.9rem;
|
|
6847
|
+
}
|
|
6848
|
+
.candy-product-card .candy-price { padding: 0 0.9rem; font-weight: 600; color: var(--cz-ink); font-size: 0.95rem; }
|
|
6849
|
+
.candy-product-card .js-add-to-cart { margin: 0.25rem 0.9rem 0; width: calc(100% - 1.8rem); }
|
|
6850
|
+
|
|
6851
|
+
/* Product Detail Page */
|
|
6852
|
+
.cz-candy-product-detail {
|
|
6853
|
+
max-width: var(--cz-container); margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6854
|
+
display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 3rem; align-items: start;
|
|
6855
|
+
}
|
|
6856
|
+
.cz-candy-product-detail img[data-product-main-image] {
|
|
6857
|
+
width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
|
|
6858
|
+
border-radius: var(--cz-radius-lg); background: var(--cz-surface); border: 1px solid var(--cz-border);
|
|
6859
|
+
}
|
|
6860
|
+
|
|
6861
|
+
/* Cart, Auth, Wishlist & Content Pages */
|
|
6862
|
+
.cz-candy-cart, .cz-wishlist-section, .cz-candy-page {
|
|
6863
|
+
max-width: 960px; margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6864
|
+
}
|
|
6865
|
+
.cz-auth-section {
|
|
6866
|
+
max-width: 440px; margin: 3.5rem auto; padding: 2rem;
|
|
6867
|
+
background: var(--cz-surface); border: 1px solid var(--cz-border);
|
|
6868
|
+
border-radius: var(--cz-radius-lg);
|
|
6869
|
+
}
|
|
6870
|
+
.cz-auth-section form { display: grid; gap: 0.85rem; margin-top: 1.25rem; }
|
|
6871
|
+
.cz-auth-section input {
|
|
6872
|
+
width: 100%; padding: 0.75rem 0.9rem; border-radius: var(--cz-radius-sm);
|
|
6873
|
+
border: 1px solid var(--cz-border); background: var(--cz-bg); color: var(--cz-ink);
|
|
6874
|
+
font: inherit;
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
/* Editorial Split Section */
|
|
6878
|
+
.cz-candy-image-with-text {
|
|
6879
|
+
max-width: var(--cz-container); margin: var(--cz-space-lg) auto; padding: 2.5rem;
|
|
6880
|
+
background: var(--cz-surface); border: 1px solid var(--cz-border); border-radius: var(--cz-radius-lg);
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6883
|
+
/* Footer */
|
|
6884
|
+
.cz-candy-footer {
|
|
6885
|
+
margin-top: var(--cz-space-xl); border-top: 1px solid var(--cz-border);
|
|
6886
|
+
padding: var(--cz-space-lg) 1.25rem 2rem;
|
|
6887
|
+
}
|
|
6888
|
+
.cz-footer-grid {
|
|
6889
|
+
max-width: var(--cz-container); margin: 0 auto 2rem;
|
|
6890
|
+
display: grid; grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); gap: 2rem;
|
|
6891
|
+
}
|
|
6892
|
+
.cz-footer-col { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
|
|
6893
|
+
.cz-footer-bottom {
|
|
6894
|
+
max-width: var(--cz-container); margin: 0 auto; padding-top: 1.25rem;
|
|
6895
|
+
border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.8rem; opacity: 0.8;
|
|
6896
|
+
}
|
|
6897
|
+
|
|
6898
|
+
/* Responsive Breakpoints */
|
|
6899
|
+
@media (max-width: 1024px) {
|
|
6900
|
+
.candy-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
6901
|
+
.cz-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
6902
|
+
}
|
|
6903
|
+
@media (max-width: 768px) {
|
|
6904
|
+
.candy-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
|
|
6905
|
+
.cz-candy-product-detail { grid-template-columns: 1fr; gap: 1.75rem; }
|
|
6906
|
+
.cz-footer-grid { grid-template-columns: 1fr; }
|
|
6907
|
+
}
|
|
6908
|
+
`;
|
|
6909
|
+
}
|
|
6910
|
+
|
|
6590
6911
|
// src/scaffold/template-generator.ts
|
|
6591
6912
|
function scaffoldTheme(options) {
|
|
6592
6913
|
const rawSlug = options.slug || options.name?.toLowerCase().replace(/[^a-z0-9_-]+/g, "-") || "starter-theme";
|
|
@@ -6615,7 +6936,7 @@ function scaffoldTheme(options) {
|
|
|
6615
6936
|
};
|
|
6616
6937
|
if (options.engine === "candy") {
|
|
6617
6938
|
const sdkDependency = options.sdkVersion ?? (options.sdkPath ? "file:" + relative2(rootDir, options.sdkPath).replace(/\\/g, "/") : "^1.0.0");
|
|
6618
|
-
return scaffoldCandyThemeInternal({ slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency });
|
|
6939
|
+
return scaffoldCandyThemeInternal({ slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency, preset: options.preset });
|
|
6619
6940
|
}
|
|
6620
6941
|
writeFile("package.json", JSON.stringify({
|
|
6621
6942
|
name: `@caartzee-theme/${slug}`,
|
|
@@ -6969,7 +7290,7 @@ npm run push
|
|
|
6969
7290
|
};
|
|
6970
7291
|
}
|
|
6971
7292
|
function scaffoldCandyThemeInternal(params) {
|
|
6972
|
-
const { slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency } = params;
|
|
7293
|
+
const { slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency, preset } = params;
|
|
6973
7294
|
writeFile("candy.config.json", JSON.stringify({
|
|
6974
7295
|
engine: "candy",
|
|
6975
7296
|
candyVersion: "1.0.0",
|
|
@@ -7441,15 +7762,26 @@ Read [AGENTS.md](./AGENTS.md) and call the Candy MCP tool \`read_candy_guide\` b
|
|
|
7441
7762
|
`);
|
|
7442
7763
|
}
|
|
7443
7764
|
writeFile("snippets/product-card.candy", candyStarterProductCard);
|
|
7765
|
+
const resolvedPreset = resolveDesignPreset(preset);
|
|
7444
7766
|
writeFile("schemas/settings_schema.json", JSON.stringify([
|
|
7445
7767
|
{
|
|
7446
7768
|
name: "Colors",
|
|
7447
7769
|
settings: [
|
|
7448
|
-
{ id: "primary_color", type: "color", label: "Primary Color", default:
|
|
7770
|
+
{ id: "primary_color", type: "color", label: "Primary Color", default: resolvedPreset.tokens.colors.primary },
|
|
7771
|
+
{ id: "accent_color", type: "color", label: "Accent Color", default: resolvedPreset.tokens.colors.accent },
|
|
7772
|
+
{ id: "background_color", type: "color", label: "Background Color", default: resolvedPreset.tokens.colors.background },
|
|
7773
|
+
{ id: "text_color", type: "color", label: "Text Color", default: resolvedPreset.tokens.colors.text }
|
|
7774
|
+
]
|
|
7775
|
+
},
|
|
7776
|
+
{
|
|
7777
|
+
name: "Typography",
|
|
7778
|
+
settings: [
|
|
7779
|
+
{ id: "heading_font", type: "font", label: "Heading Font", default: resolvedPreset.tokens.typography.headingFont },
|
|
7780
|
+
{ id: "body_font", type: "font", label: "Body Font", default: resolvedPreset.tokens.typography.bodyFont }
|
|
7449
7781
|
]
|
|
7450
7782
|
}
|
|
7451
7783
|
], null, 2));
|
|
7452
|
-
writeFile("assets/theme.css",
|
|
7784
|
+
writeFile("assets/theme.css", buildCandyDesignSystemCss(resolvedPreset));
|
|
7453
7785
|
writeFile("assets/theme.js", `window.__CAARTZEE_CANDY_THEME__ = true;
|
|
7454
7786
|
document.addEventListener('caartzee:section:load', function () {
|
|
7455
7787
|
// Re-initialize any section-specific UI widgets after Theme Editor live swaps.
|
|
@@ -10406,8 +10738,8 @@ function collectThemeSources(root) {
|
|
|
10406
10738
|
}
|
|
10407
10739
|
|
|
10408
10740
|
// src/cli/caartzee-cli.ts
|
|
10409
|
-
import { existsSync as
|
|
10410
|
-
import { resolve as
|
|
10741
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync5 } from "node:fs";
|
|
10742
|
+
import { resolve as resolve10, join as join12 } from "node:path";
|
|
10411
10743
|
|
|
10412
10744
|
// src/cli/mcp/editor-tools.ts
|
|
10413
10745
|
import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
|
|
@@ -10652,7 +10984,7 @@ ${productCard}`;
|
|
|
10652
10984
|
slug,
|
|
10653
10985
|
version,
|
|
10654
10986
|
packageHash,
|
|
10655
|
-
sdkVersion: "1.2.
|
|
10987
|
+
sdkVersion: "1.2.1",
|
|
10656
10988
|
runtimeVersion: "candy-1.0",
|
|
10657
10989
|
status: summary.failed > 0 ? "failed" : summary.warnings > 0 ? "partial" : "passed",
|
|
10658
10990
|
summary,
|
|
@@ -10660,6 +10992,58 @@ ${productCard}`;
|
|
|
10660
10992
|
};
|
|
10661
10993
|
}
|
|
10662
10994
|
|
|
10995
|
+
// src/cli/mcp/ui-patterns-tools.ts
|
|
10996
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "node:fs";
|
|
10997
|
+
import { join as join11, resolve as resolve9 } from "node:path";
|
|
10998
|
+
import { z as z8 } from "zod";
|
|
10999
|
+
function auditCandyUiConsistency(themeDir) {
|
|
11000
|
+
const dir = resolve9(themeDir);
|
|
11001
|
+
const readRel = (rel) => {
|
|
11002
|
+
const p = join11(dir, rel);
|
|
11003
|
+
return existsSync11(p) ? readFileSync11(p, "utf8") : "";
|
|
11004
|
+
};
|
|
11005
|
+
const css = readRel("assets/theme.css");
|
|
11006
|
+
const productCard = readRel("snippets/product-card.candy");
|
|
11007
|
+
const cart = readRel("templates/cart.candy");
|
|
11008
|
+
const search = readRel("templates/search.candy");
|
|
11009
|
+
const collection = readRel("templates/collection.candy");
|
|
11010
|
+
const checks = [
|
|
11011
|
+
{
|
|
11012
|
+
id: "ui.design_tokens",
|
|
11013
|
+
status: css.includes(":root") && (css.includes("--cz-") || css.includes("--sf-")) ? "passed" : "warning",
|
|
11014
|
+
message: css.includes(":root") ? "Semantic CSS design tokens (:root) found in assets/theme.css." : "Define semantic :root design tokens (--cz-bg, --cz-ink, --cz-primary) in assets/theme.css for cross-page visual consistency."
|
|
11015
|
+
},
|
|
11016
|
+
{
|
|
11017
|
+
id: "ui.uniform_card_aspect_ratio",
|
|
11018
|
+
status: css.includes("aspect-ratio") && css.includes("object-fit") ? "passed" : "warning",
|
|
11019
|
+
message: css.includes("aspect-ratio") && css.includes("object-fit") ? "Product cards enforce uniform aspect-ratio and object-fit: cover." : "Add aspect-ratio (e.g. 4/5) and object-fit: cover on product card images to prevent uneven grid rows."
|
|
11020
|
+
},
|
|
11021
|
+
{
|
|
11022
|
+
id: "ui.responsive_breakpoints",
|
|
11023
|
+
status: /@media\s*\(max-width:/i.test(css) ? "passed" : "warning",
|
|
11024
|
+
message: /@media\s*\(max-width:/i.test(css) ? "Responsive tablet/mobile @media breakpoints detected." : "Add @media (max-width: 1024px) and @media (max-width: 768px) rules for tablet and mobile layouts."
|
|
11025
|
+
},
|
|
11026
|
+
{
|
|
11027
|
+
id: "ui.reusable_product_card",
|
|
11028
|
+
status: productCard.trim().length > 0 ? "passed" : "failed",
|
|
11029
|
+
message: productCard.trim().length > 0 ? "Shared snippets/product-card.candy exists for consistent product grids." : "Missing snippets/product-card.candy — reuse one product card snippet across Home, Collection, and Search."
|
|
11030
|
+
},
|
|
11031
|
+
{
|
|
11032
|
+
id: "ui.empty_states",
|
|
11033
|
+
status: [cart, search, collection].every((t) => /else|empty|no\s+/i.test(t)) ? "passed" : "warning",
|
|
11034
|
+
message: "Checked Cart, Search, and Collection templates for empty/zero-result states."
|
|
11035
|
+
}
|
|
11036
|
+
];
|
|
11037
|
+
const failed = checks.filter((c) => c.status === "failed").length;
|
|
11038
|
+
const warnings = checks.filter((c) => c.status === "warning").length;
|
|
11039
|
+
return {
|
|
11040
|
+
themeDir: dir,
|
|
11041
|
+
status: failed > 0 ? "failed" : warnings > 0 ? "partial" : "passed",
|
|
11042
|
+
summary: { passed: checks.length - failed - warnings, failed, warnings },
|
|
11043
|
+
checks
|
|
11044
|
+
};
|
|
11045
|
+
}
|
|
11046
|
+
|
|
10663
11047
|
// src/cli/caartzee-cli.ts
|
|
10664
11048
|
async function runCli(rawArgs, io = {}) {
|
|
10665
11049
|
const log = io.stdout ?? console.log;
|
|
@@ -10707,8 +11091,8 @@ async function runCli(rawArgs, io = {}) {
|
|
|
10707
11091
|
case "dev":
|
|
10708
11092
|
return await handleDev(args, log, error);
|
|
10709
11093
|
case "sync-manifest": {
|
|
10710
|
-
const theme = await loadLocalTheme(
|
|
10711
|
-
writeFileSync5(
|
|
11094
|
+
const theme = await loadLocalTheme(resolve10(args[0] || process.cwd()));
|
|
11095
|
+
writeFileSync5(resolve10(args[0] || process.cwd(), "manifest.json"), JSON.stringify(theme.manifest, null, 2));
|
|
10712
11096
|
log("Exported runtime theme manifest.");
|
|
10713
11097
|
return 0;
|
|
10714
11098
|
}
|
|
@@ -10730,9 +11114,11 @@ async function runCli(rawArgs, io = {}) {
|
|
|
10730
11114
|
return await handleTestSuite(args, "commerce", log, error);
|
|
10731
11115
|
case "test-report":
|
|
10732
11116
|
return await handleTestReport(args, log, error);
|
|
11117
|
+
case "ui-audit":
|
|
11118
|
+
return await handleUiAudit(args, log, error);
|
|
10733
11119
|
case "ide":
|
|
10734
11120
|
case "ide-setup": {
|
|
10735
|
-
const targetDir = args[0] ?
|
|
11121
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
10736
11122
|
const res = installCandyIdeSupport({ workspaceDir: targetDir });
|
|
10737
11123
|
log(`
|
|
10738
11124
|
\uD83C\uDFA8 Installed Candy (.candy) IDE language support:`);
|
|
@@ -10774,6 +11160,15 @@ async function handleInit(args, log, error) {
|
|
|
10774
11160
|
throw new Error("The commerce scaffold uses TypeScript.");
|
|
10775
11161
|
if (engineIndex >= 0)
|
|
10776
11162
|
args = args.filter((_, index) => index !== engineIndex && index !== engineIndex + 1);
|
|
11163
|
+
const presetIndex = args.indexOf("--preset");
|
|
11164
|
+
const presetRaw = presetIndex < 0 ? undefined : args[presetIndex + 1];
|
|
11165
|
+
if (presetIndex >= 0) {
|
|
11166
|
+
if (!presetRaw || !CANDY_DESIGN_PRESET_IDS.includes(presetRaw)) {
|
|
11167
|
+
throw new Error(`Supported presets: ${CANDY_DESIGN_PRESET_IDS.join(", ")}`);
|
|
11168
|
+
}
|
|
11169
|
+
args = args.filter((_, index) => index !== presetIndex && index !== presetIndex + 1);
|
|
11170
|
+
}
|
|
11171
|
+
const preset = presetRaw;
|
|
10777
11172
|
const dirIndex = args.indexOf("--dir");
|
|
10778
11173
|
const dir = dirIndex < 0 ? undefined : args[dirIndex + 1];
|
|
10779
11174
|
if (dirIndex >= 0 && !dir)
|
|
@@ -10781,7 +11176,7 @@ async function handleInit(args, log, error) {
|
|
|
10781
11176
|
if (dirIndex >= 0)
|
|
10782
11177
|
args = args.filter((_, index) => index !== dirIndex && index !== dirIndex + 1);
|
|
10783
11178
|
const nameArg = args[0];
|
|
10784
|
-
const targetDir =
|
|
11179
|
+
const targetDir = resolve10(dir || args[1] || nameArg || "my-caartzee-theme");
|
|
10785
11180
|
const themeName = nameArg || "My Caartzee Theme";
|
|
10786
11181
|
log(`
|
|
10787
11182
|
\uD83D\uDCE6 Scaffolding new Caartzee theme in: ${targetDir}`);
|
|
@@ -10791,7 +11186,8 @@ async function handleInit(args, log, error) {
|
|
|
10791
11186
|
targetDir,
|
|
10792
11187
|
sdkPath: fileURLToPath3(new URL("../../", import.meta.url)),
|
|
10793
11188
|
name: themeName,
|
|
10794
|
-
engine
|
|
11189
|
+
engine,
|
|
11190
|
+
...preset ? { preset } : {}
|
|
10795
11191
|
});
|
|
10796
11192
|
log(`✨ Successfully generated theme "${result.name}" (${result.slug})!`);
|
|
10797
11193
|
log(` Created ${result.createdFiles.length} files:`);
|
|
@@ -10929,7 +11325,7 @@ async function handleDev(args, log, error) {
|
|
|
10929
11325
|
port = parseInt(args[i + 1], 10);
|
|
10930
11326
|
i++;
|
|
10931
11327
|
} else if (args[i] === "--dir" && args[i + 1]) {
|
|
10932
|
-
themeDir =
|
|
11328
|
+
themeDir = resolve10(args[i + 1]);
|
|
10933
11329
|
i++;
|
|
10934
11330
|
} else if (args[i] === "--store") {
|
|
10935
11331
|
store = args[++i];
|
|
@@ -10996,21 +11392,21 @@ Shutting down dev server...`);
|
|
|
10996
11392
|
}
|
|
10997
11393
|
}
|
|
10998
11394
|
async function handleValidate(args, log, error) {
|
|
10999
|
-
const targetDir = args[0] ?
|
|
11395
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11000
11396
|
log(`
|
|
11001
11397
|
\uD83D\uDEE1️ Running Caartzee Theme Security & Package Validation...`);
|
|
11002
11398
|
log(` Target: ${targetDir}`);
|
|
11003
|
-
const manifestPath =
|
|
11004
|
-
if (!
|
|
11399
|
+
const manifestPath = join12(targetDir, "manifest.json");
|
|
11400
|
+
if (!existsSync12(manifestPath)) {
|
|
11005
11401
|
error(`❌ Missing manifest.json in ${targetDir}`);
|
|
11006
11402
|
return 1;
|
|
11007
11403
|
}
|
|
11008
11404
|
try {
|
|
11009
|
-
if (
|
|
11405
|
+
if (existsSync12(join12(targetDir, "src/manifest.ts")) && typeof Bun !== "undefined") {
|
|
11010
11406
|
const theme = await loadLocalTheme(targetDir);
|
|
11011
11407
|
writeFileSync5(manifestPath, JSON.stringify(theme.manifest, null, 2));
|
|
11012
11408
|
}
|
|
11013
|
-
const rawManifest = JSON.parse(
|
|
11409
|
+
const rawManifest = JSON.parse(readFileSync12(manifestPath, "utf-8"));
|
|
11014
11410
|
const manifestCheck = ThemePackageValidator.validateManifest(rawManifest);
|
|
11015
11411
|
if (!manifestCheck.success) {
|
|
11016
11412
|
error(`❌ Manifest validation failed:`);
|
|
@@ -11049,7 +11445,7 @@ async function handleValidate(args, log, error) {
|
|
|
11049
11445
|
}
|
|
11050
11446
|
}
|
|
11051
11447
|
async function handleBuild(args, log, error) {
|
|
11052
|
-
const targetDir = args[0] ?
|
|
11448
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11053
11449
|
log(`
|
|
11054
11450
|
\uD83D\uDD28 Building Caartzee Theme Package...`);
|
|
11055
11451
|
log(` Source directory: ${targetDir}`);
|
|
@@ -11061,9 +11457,9 @@ async function handleBuild(args, log, error) {
|
|
|
11061
11457
|
}
|
|
11062
11458
|
return 1;
|
|
11063
11459
|
}
|
|
11064
|
-
const isCandy =
|
|
11065
|
-
const distDir =
|
|
11066
|
-
if (!
|
|
11460
|
+
const isCandy = existsSync12(join12(targetDir, "candy.config.json")) || existsSync12(join12(targetDir, "layout", "theme.candy")) || valResult.manifest?.engine === "candy";
|
|
11461
|
+
const distDir = join12(targetDir, "dist");
|
|
11462
|
+
if (!existsSync12(distDir)) {
|
|
11067
11463
|
mkdirSync5(distDir, { recursive: true });
|
|
11068
11464
|
}
|
|
11069
11465
|
if (isCandy) {
|
|
@@ -11076,8 +11472,8 @@ async function handleBuild(args, log, error) {
|
|
|
11076
11472
|
}
|
|
11077
11473
|
return 1;
|
|
11078
11474
|
}
|
|
11079
|
-
const bundlePath =
|
|
11080
|
-
const manifestOutPath =
|
|
11475
|
+
const bundlePath = join12(distDir, "candy-theme-bundle.json");
|
|
11476
|
+
const manifestOutPath = join12(distDir, "manifest.json");
|
|
11081
11477
|
writeFileSync5(bundlePath, JSON.stringify(bundle, null, 2), "utf-8");
|
|
11082
11478
|
writeFileSync5(manifestOutPath, JSON.stringify(bundle.manifest, null, 2), "utf-8");
|
|
11083
11479
|
log(`✓ Extracted ${Object.keys(bundle.sectionSchemas).length} section schemas`);
|
|
@@ -11087,7 +11483,7 @@ async function handleBuild(args, log, error) {
|
|
|
11087
11483
|
return 0;
|
|
11088
11484
|
}
|
|
11089
11485
|
if (valResult.manifest) {
|
|
11090
|
-
const manifestOutPath =
|
|
11486
|
+
const manifestOutPath = join12(distDir, "manifest.json");
|
|
11091
11487
|
writeFileSync5(manifestOutPath, JSON.stringify(valResult.manifest, null, 2), "utf-8");
|
|
11092
11488
|
log(`✓ Wrote validated manifest to ${manifestOutPath}
|
|
11093
11489
|
`);
|
|
@@ -11106,10 +11502,10 @@ async function handlePush(args, log, error) {
|
|
|
11106
11502
|
error(`❌ Insufficient scope. Your account lacks "theme:publish" permissions.`);
|
|
11107
11503
|
return 1;
|
|
11108
11504
|
}
|
|
11109
|
-
const targetDir = args[0] ?
|
|
11110
|
-
if (
|
|
11505
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11506
|
+
if (existsSync12(join12(targetDir, "src/manifest.ts")) && typeof Bun !== "undefined") {
|
|
11111
11507
|
const theme = await loadLocalTheme(targetDir);
|
|
11112
|
-
writeFileSync5(
|
|
11508
|
+
writeFileSync5(join12(targetDir, "manifest.json"), JSON.stringify(theme.manifest, null, 2));
|
|
11113
11509
|
}
|
|
11114
11510
|
const valResult = await ThemePackageValidator.validatePackage(targetDir);
|
|
11115
11511
|
if (!valResult.valid) {
|
|
@@ -11131,7 +11527,7 @@ async function handlePush(args, log, error) {
|
|
|
11131
11527
|
return 0;
|
|
11132
11528
|
}
|
|
11133
11529
|
async function handleDoctor(args, log, error) {
|
|
11134
|
-
const targetDir = args[0] ?
|
|
11530
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11135
11531
|
log(`
|
|
11136
11532
|
\uD83E\uDE7A Running Caartzee Candy Theme Doctor...`);
|
|
11137
11533
|
log(` Target: ${targetDir}
|
|
@@ -11140,8 +11536,8 @@ async function handleDoctor(args, log, error) {
|
|
|
11140
11536
|
const warnings = [];
|
|
11141
11537
|
const passed = [];
|
|
11142
11538
|
const readIfExists = (rel) => {
|
|
11143
|
-
const full =
|
|
11144
|
-
return
|
|
11539
|
+
const full = join12(targetDir, rel);
|
|
11540
|
+
return existsSync12(full) ? readFileSync12(full, "utf8") : null;
|
|
11145
11541
|
};
|
|
11146
11542
|
const configRaw = readIfExists("candy.config.json");
|
|
11147
11543
|
const manifestRaw = readIfExists("manifest.json");
|
|
@@ -11185,7 +11581,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11185
11581
|
}
|
|
11186
11582
|
const templateNames = ["index.candy", "collection.candy", "list-collections.candy", "product.candy", "cart.candy", "search.candy", "wishlist.candy", "login.candy", "register.candy", "page.candy", "404.candy"];
|
|
11187
11583
|
for (const name of templateNames) {
|
|
11188
|
-
const content = readIfExists(
|
|
11584
|
+
const content = readIfExists(join12("templates", name));
|
|
11189
11585
|
if (!content)
|
|
11190
11586
|
continue;
|
|
11191
11587
|
if (usesShell && /\{%\s*layout\s+/i.test(content)) {
|
|
@@ -11195,7 +11591,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11195
11591
|
issues.push(`templates/${name} emits a synthetic "-default" variant ID, which causes POST /_api/cart 422 errors.`);
|
|
11196
11592
|
}
|
|
11197
11593
|
}
|
|
11198
|
-
const productCard = readIfExists(
|
|
11594
|
+
const productCard = readIfExists(join12("snippets", "product-card.candy"));
|
|
11199
11595
|
if (productCard) {
|
|
11200
11596
|
if (/data-variant-id\s*=\s*["'][^"']*-default["']/i.test(productCard)) {
|
|
11201
11597
|
issues.push('snippets/product-card.candy emits a synthetic "-default" variant ID. Guard data-variant-id with product.has_inventory_variants.');
|
|
@@ -11203,7 +11599,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11203
11599
|
passed.push("Product card variant ID contract looks safe");
|
|
11204
11600
|
}
|
|
11205
11601
|
}
|
|
11206
|
-
const headerCandy = readIfExists(
|
|
11602
|
+
const headerCandy = readIfExists(join12("sections", "header.candy"));
|
|
11207
11603
|
if (headerCandy) {
|
|
11208
11604
|
if (!headerCandy.includes("js-cart-count")) {
|
|
11209
11605
|
warnings.push("sections/header.candy is missing .js-cart-count on the cart badge (live Add to Cart count won't update).");
|
|
@@ -11216,7 +11612,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11216
11612
|
passed.push("Header navigation menu (menuId + linklists) wired");
|
|
11217
11613
|
}
|
|
11218
11614
|
}
|
|
11219
|
-
const heroCandy = readIfExists(
|
|
11615
|
+
const heroCandy = readIfExists(join12("sections", "hero-banner.candy"));
|
|
11220
11616
|
if (heroCandy) {
|
|
11221
11617
|
if (!heroCandy.includes("mobile_sliders")) {
|
|
11222
11618
|
warnings.push("sections/hero-banner.candy does not read mobile_sliders (merchant Mobile Slider changes won't reflect).");
|
|
@@ -11224,8 +11620,8 @@ async function handleDoctor(args, log, error) {
|
|
|
11224
11620
|
passed.push("Hero banner mobile_sliders support present");
|
|
11225
11621
|
}
|
|
11226
11622
|
}
|
|
11227
|
-
const loginCandy = readIfExists(
|
|
11228
|
-
const registerCandy = readIfExists(
|
|
11623
|
+
const loginCandy = readIfExists(join12("templates", "login.candy"));
|
|
11624
|
+
const registerCandy = readIfExists(join12("templates", "register.candy"));
|
|
11229
11625
|
if (loginCandy) {
|
|
11230
11626
|
if (!loginCandy.includes("/_api/auth/login") || !loginCandy.includes("js-auth-form")) {
|
|
11231
11627
|
issues.push('templates/login.candy must post to /_api/auth/login with class="js-auth-form".');
|
|
@@ -11240,11 +11636,11 @@ async function handleDoctor(args, log, error) {
|
|
|
11240
11636
|
passed.push("Signup page (/signup, /register) auth contract verified");
|
|
11241
11637
|
}
|
|
11242
11638
|
}
|
|
11243
|
-
if (readIfExists(
|
|
11639
|
+
if (readIfExists(join12("assets", "theme.css")))
|
|
11244
11640
|
passed.push("assets/theme.css found");
|
|
11245
11641
|
else
|
|
11246
11642
|
warnings.push("assets/theme.css not found.");
|
|
11247
|
-
if (readIfExists(
|
|
11643
|
+
if (readIfExists(join12("assets", "theme.js")))
|
|
11248
11644
|
passed.push("assets/theme.js found");
|
|
11249
11645
|
else
|
|
11250
11646
|
warnings.push("assets/theme.js not found.");
|
|
@@ -11271,19 +11667,19 @@ async function handleDoctor(args, log, error) {
|
|
|
11271
11667
|
}
|
|
11272
11668
|
async function handleVersion(args, log, error) {
|
|
11273
11669
|
const bump = args[0]?.trim();
|
|
11274
|
-
const targetDir = args[1] ?
|
|
11670
|
+
const targetDir = args[1] ? resolve10(args[1]) : process.cwd();
|
|
11275
11671
|
if (!bump) {
|
|
11276
11672
|
error("Usage: caartzee-theme version <patch|minor|major|x.y.z> [path]");
|
|
11277
11673
|
return 1;
|
|
11278
11674
|
}
|
|
11279
|
-
const configPath =
|
|
11280
|
-
const manifestPath =
|
|
11281
|
-
if (!
|
|
11675
|
+
const configPath = join12(targetDir, "candy.config.json");
|
|
11676
|
+
const manifestPath = join12(targetDir, "manifest.json");
|
|
11677
|
+
if (!existsSync12(configPath) && !existsSync12(manifestPath)) {
|
|
11282
11678
|
error(`No candy.config.json or manifest.json found in ${targetDir}`);
|
|
11283
11679
|
return 1;
|
|
11284
11680
|
}
|
|
11285
|
-
const readJson = (p) => JSON.parse(
|
|
11286
|
-
const current =
|
|
11681
|
+
const readJson = (p) => JSON.parse(readFileSync12(p, "utf8"));
|
|
11682
|
+
const current = existsSync12(configPath) ? String(readJson(configPath).version || "1.0.0") : String(readJson(manifestPath).version || "1.0.0");
|
|
11287
11683
|
let nextVersion = bump;
|
|
11288
11684
|
if (bump === "patch" || bump === "minor" || bump === "major") {
|
|
11289
11685
|
const parts = current.split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -11293,13 +11689,13 @@ async function handleVersion(args, log, error) {
|
|
|
11293
11689
|
error(`Invalid version "${bump}". Use patch, minor, major, or semver like 1.0.3.`);
|
|
11294
11690
|
return 1;
|
|
11295
11691
|
}
|
|
11296
|
-
if (
|
|
11692
|
+
if (existsSync12(configPath)) {
|
|
11297
11693
|
const cfg = readJson(configPath);
|
|
11298
11694
|
cfg.version = nextVersion;
|
|
11299
11695
|
writeFileSync5(configPath, JSON.stringify(cfg, null, 2) + `
|
|
11300
11696
|
`, "utf8");
|
|
11301
11697
|
}
|
|
11302
|
-
if (
|
|
11698
|
+
if (existsSync12(manifestPath)) {
|
|
11303
11699
|
const man = readJson(manifestPath);
|
|
11304
11700
|
man.version = nextVersion;
|
|
11305
11701
|
writeFileSync5(manifestPath, JSON.stringify(man, null, 2) + `
|
|
@@ -11311,7 +11707,7 @@ async function handleVersion(args, log, error) {
|
|
|
11311
11707
|
function parseTargetAndJson(args) {
|
|
11312
11708
|
const asJson = args.includes("--json");
|
|
11313
11709
|
const positional = args.filter((a) => !a.startsWith("-"));
|
|
11314
|
-
const targetDir = positional[0] ?
|
|
11710
|
+
const targetDir = positional[0] ? resolve10(positional[0]) : process.cwd();
|
|
11315
11711
|
return { targetDir, asJson };
|
|
11316
11712
|
}
|
|
11317
11713
|
async function handleTestEditor(args, log, error) {
|
|
@@ -11366,10 +11762,10 @@ ${failed === 0 ? "✅" : "❌"} Result: ${passed} passed, ${failed} failed, ${wa
|
|
|
11366
11762
|
async function handleTestReport(args, log, error) {
|
|
11367
11763
|
const { targetDir, asJson } = parseTargetAndJson(args);
|
|
11368
11764
|
const report = await runThemeReadinessAudit(targetDir);
|
|
11369
|
-
const distDir =
|
|
11370
|
-
if (!
|
|
11765
|
+
const distDir = join12(targetDir, "dist");
|
|
11766
|
+
if (!existsSync12(distDir))
|
|
11371
11767
|
mkdirSync5(distDir, { recursive: true });
|
|
11372
|
-
const outPath =
|
|
11768
|
+
const outPath = join12(distDir, "theme-readiness-report.json");
|
|
11373
11769
|
writeFileSync5(outPath, JSON.stringify(report, null, 2), "utf8");
|
|
11374
11770
|
if (asJson) {
|
|
11375
11771
|
log(JSON.stringify({ reportPath: outPath, ...report }, null, 2));
|
|
@@ -11386,10 +11782,28 @@ async function handleTestReport(args, log, error) {
|
|
|
11386
11782
|
}
|
|
11387
11783
|
return 0;
|
|
11388
11784
|
}
|
|
11785
|
+
async function handleUiAudit(args, log, error) {
|
|
11786
|
+
const { targetDir, asJson } = parseTargetAndJson(args);
|
|
11787
|
+
const report = auditCandyUiConsistency(targetDir);
|
|
11788
|
+
if (asJson) {
|
|
11789
|
+
log(JSON.stringify(report, null, 2));
|
|
11790
|
+
return report.summary.failed > 0 ? 1 : 0;
|
|
11791
|
+
}
|
|
11792
|
+
log(`
|
|
11793
|
+
\uD83C\uDFA8 Caartzee Candy UI Consistency Audit (${targetDir})`);
|
|
11794
|
+
for (const c of report.checks) {
|
|
11795
|
+
const icon = c.status === "passed" ? "✓" : c.status === "warning" ? "⚠️" : "❌";
|
|
11796
|
+
(c.status === "failed" ? error : log)(` ${icon} [${c.id}] ${c.message}`);
|
|
11797
|
+
}
|
|
11798
|
+
log(`
|
|
11799
|
+
${report.summary.failed === 0 ? "✅" : "❌"} UI Audit: ${report.summary.passed} passed, ${report.summary.failed} failed, ${report.summary.warnings} warning(s).
|
|
11800
|
+
`);
|
|
11801
|
+
return report.summary.failed > 0 ? 1 : 0;
|
|
11802
|
+
}
|
|
11389
11803
|
function printHelp(log) {
|
|
11390
11804
|
log(`
|
|
11391
11805
|
╔═══════════════════════════════════════════════════════════════╗
|
|
11392
|
-
║ CAARTZEE THEME SDK CLI (v1.2.
|
|
11806
|
+
║ CAARTZEE THEME SDK CLI (v1.2.1) ║
|
|
11393
11807
|
║ Build, test, and publish secure storefront themes locally ║
|
|
11394
11808
|
╚═══════════════════════════════════════════════════════════════╝
|
|
11395
11809
|
|
|
@@ -11398,8 +11812,9 @@ Usage:
|
|
|
11398
11812
|
npx @caartzee/theme-sdk <command> [options]
|
|
11399
11813
|
|
|
11400
11814
|
Commands:
|
|
11401
|
-
init [name]
|
|
11815
|
+
init [name] [--engine candy] [--preset minimal-luxury|streetwear-editorial|organic-wellness|modern-tech|vibrant-d2c]
|
|
11402
11816
|
dev [--port 3333] [--store DOMAIN] [--editor] Preview with full local commerce/auth & Theme Editor
|
|
11817
|
+
ui-audit [path] [--json] Audit design tokens, uniform card aspect ratios, responsive CSS & empty states
|
|
11403
11818
|
doctor [path] Audit storefront-shell, cart/variant hooks, auth forms, menus & mobile sliders
|
|
11404
11819
|
version <patch|minor|major|x.y.z> [path] Bump version across candy.config.json and manifest.json
|
|
11405
11820
|
sync-manifest [path] Export the locally authored theme manifest to JSON
|