@caartzee/theme-sdk 0.0.0-stage → 1.0.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/README.md +34 -2
- package/dist/bin/caartzee-theme.js +7449 -0
- package/dist/lib/index.js +9838 -0
- package/dist/types/src/auth/credentials-store.d.ts +18 -0
- package/dist/types/src/auth/index.d.ts +2 -0
- package/dist/types/src/auth/oauth-client.d.ts +39 -0
- package/dist/types/src/blocks/block-contract.d.ts +242 -0
- package/dist/types/src/candy/compatibility-matrix.d.ts +10 -0
- package/dist/types/src/candy/context-builder.d.ts +31 -0
- package/dist/types/src/candy/engine.d.ts +69 -0
- package/dist/types/src/candy/filters.d.ts +32 -0
- package/dist/types/src/candy/ide-support.d.ts +20 -0
- package/dist/types/src/candy/index.d.ts +9 -0
- package/dist/types/src/candy/schema-parser.d.ts +13 -0
- package/dist/types/src/candy/security.d.ts +54 -0
- package/dist/types/src/candy/tags.d.ts +11 -0
- package/dist/types/src/candy/types.d.ts +185 -0
- package/dist/types/src/cli/caartzee-cli.d.ts +9 -0
- package/dist/types/src/cli/index.d.ts +1 -0
- package/dist/types/src/cli/sdk-client.d.ts +12 -0
- package/dist/types/src/contracts/category-selection.d.ts +15 -0
- package/dist/types/src/contracts/commerce.d.ts +282 -0
- package/dist/types/src/contracts/footer-builder.d.ts +125 -0
- package/dist/types/src/contracts/hooks.d.ts +37 -0
- package/dist/types/src/contracts/manifest.d.ts +3127 -0
- package/dist/types/src/contracts/navigation.d.ts +39 -0
- package/dist/types/src/contracts/order-tracking.d.ts +40 -0
- package/dist/types/src/contracts/page.d.ts +262 -0
- package/dist/types/src/contracts/storefront-content.d.ts +60 -0
- package/dist/types/src/contracts/style-document.d.ts +2 -0
- package/dist/types/src/contracts/styles.d.ts +2002 -0
- package/dist/types/src/contracts/theme.d.ts +35 -0
- package/dist/types/src/dev-server/catalog-preview.d.ts +25 -0
- package/dist/types/src/dev-server/dev-server.d.ts +22 -0
- package/dist/types/src/dev-server/index.d.ts +1 -0
- package/dist/types/src/dev-server/theme-preview.d.ts +4 -0
- package/dist/types/src/index.d.ts +27 -0
- package/dist/types/src/mock/index.d.ts +10 -0
- package/dist/types/src/mock/mock-categories.d.ts +2 -0
- package/dist/types/src/mock/mock-commerce.d.ts +55 -0
- package/dist/types/src/mock/mock-customer.d.ts +47 -0
- package/dist/types/src/mock/mock-hooks.d.ts +2 -0
- package/dist/types/src/mock/mock-products.d.ts +3 -0
- package/dist/types/src/rendering/commerce-pages.d.ts +16 -0
- package/dist/types/src/rendering/raw-html.d.ts +12 -0
- package/dist/types/src/rendering/section-wrapper.d.ts +30 -0
- package/dist/types/src/scaffold/candy-starter-assets.d.ts +2 -0
- package/dist/types/src/scaffold/commerce-generator.d.ts +3 -0
- package/dist/types/src/scaffold/index.d.ts +2 -0
- package/dist/types/src/scaffold/template-generator.d.ts +21 -0
- package/dist/types/src/sections/section-contract.d.ts +350 -0
- package/dist/types/src/settings/global-settings.d.ts +25 -0
- package/dist/types/src/templates/json-template.d.ts +991 -0
- package/dist/types/src/validation/package-validator.d.ts +53 -0
- package/dist/types/src/validation/rich-text.d.ts +24 -0
- package/package.json +28 -3
- package/templates/commerce/README.md +165 -0
- package/templates/commerce/assets/theme.css +1 -0
- package/templates/commerce/manifest.json +1 -0
- package/templates/commerce/src/blocks/index.ts +184 -0
- package/templates/commerce/src/config/settings-defaults.ts +25 -0
- package/templates/commerce/src/config/settings-schema.ts +102 -0
- package/templates/commerce/src/index.ts +90 -0
- package/templates/commerce/src/layouts/default.ts +275 -0
- package/templates/commerce/src/manifest.ts +976 -0
- package/templates/commerce/src/pages/account/components.ts +369 -0
- package/templates/commerce/src/pages/account/tabs.ts +792 -0
- package/templates/commerce/src/pages/account.ts +55 -0
- package/templates/commerce/src/pages/campaign.ts +423 -0
- package/templates/commerce/src/pages/cart.ts +261 -0
- package/templates/commerce/src/pages/category-detail.ts +124 -0
- package/templates/commerce/src/pages/category-list.ts +87 -0
- package/templates/commerce/src/pages/checkout.ts +712 -0
- package/templates/commerce/src/pages/commerce.ts +45 -0
- package/templates/commerce/src/pages/home.ts +160 -0
- package/templates/commerce/src/pages/index.ts +99 -0
- package/templates/commerce/src/pages/login.ts +204 -0
- package/templates/commerce/src/pages/order-success.ts +80 -0
- package/templates/commerce/src/pages/product-detail.ts +489 -0
- package/templates/commerce/src/pages/product-list.ts +125 -0
- package/templates/commerce/src/pages/search.ts +88 -0
- package/templates/commerce/src/pages/signup.ts +253 -0
- package/templates/commerce/src/pages/status.ts +7 -0
- package/templates/commerce/src/pages/theme-layout.ts +491 -0
- package/templates/commerce/src/pages/track-order.ts +196 -0
- package/templates/commerce/src/pages/wishlist.ts +83 -0
- package/templates/commerce/src/sections/about-story.ts +117 -0
- package/templates/commerce/src/sections/announcement-bar.ts +101 -0
- package/templates/commerce/src/sections/banner-grid.ts +319 -0
- package/templates/commerce/src/sections/campaign-banners.ts +158 -0
- package/templates/commerce/src/sections/category-slider.ts +144 -0
- package/templates/commerce/src/sections/content-builder.ts +123 -0
- package/templates/commerce/src/sections/content-controls.ts +45 -0
- package/templates/commerce/src/sections/custom-form.ts +59 -0
- package/templates/commerce/src/sections/faq-accordion.ts +123 -0
- package/templates/commerce/src/sections/footer.ts +728 -0
- package/templates/commerce/src/sections/header.ts +439 -0
- package/templates/commerce/src/sections/hero-slider.ts +492 -0
- package/templates/commerce/src/sections/hero.ts +137 -0
- package/templates/commerce/src/sections/index.ts +102 -0
- package/templates/commerce/src/sections/mobile-slider.ts +102 -0
- package/templates/commerce/src/sections/newsletter.ts +43 -0
- package/templates/commerce/src/sections/product-grid.ts +191 -0
- package/templates/commerce/src/sections/raw-html.ts +1 -0
- package/templates/commerce/src/sections/rich-text.ts +26 -0
- package/templates/commerce/src/sections/services-features.ts +211 -0
- package/templates/commerce/src/sections/testimonials.ts +194 -0
- package/templates/commerce/src/snippets/product-card.ts +178 -0
- package/templates/commerce/src/snippets/product-price.ts +46 -0
- package/templates/commerce/src/snippets/responsive-image.ts +29 -0
- package/templates/commerce/src/styles.ts +477 -0
- package/templates/commerce/src/templates/404.json +26 -0
- package/templates/commerce/src/templates/account.json +17 -0
- package/templates/commerce/src/templates/cart.json +17 -0
- package/templates/commerce/src/templates/category.json +16 -0
- package/templates/commerce/src/templates/checkout.json +15 -0
- package/templates/commerce/src/templates/collection.json +16 -0
- package/templates/commerce/src/templates/index.json +180 -0
- package/templates/commerce/src/templates/login.json +17 -0
- package/templates/commerce/src/templates/order-success.json +17 -0
- package/templates/commerce/src/templates/page.json +17 -0
- package/templates/commerce/src/templates/product.json +17 -0
- package/templates/commerce/src/templates/search.json +18 -0
- package/templates/commerce/src/templates/signup.json +17 -0
- package/templates/commerce/src/templates/track-order.json +17 -0
- package/templates/commerce/src/templates/wishlist.json +17 -0
- package/templates/commerce/src/templates.ts +510 -0
- package/templates/commerce/src/tokens.ts +22 -0
- package/templates/vscode-candy/README.md +22 -0
- package/templates/vscode-candy/extension.js +338 -0
- package/templates/vscode-candy/icons/candy-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-light.svg +23 -0
- package/templates/vscode-candy/icons/candy-logo.png +0 -0
- package/templates/vscode-candy/icons/candy-sweet-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-sweet-light.svg +23 -0
- package/templates/vscode-candy/language-configuration.json +47 -0
- package/templates/vscode-candy/package.json +103 -0
- package/templates/vscode-candy/schemas/candy-config.schema.json +56 -0
- package/templates/vscode-candy/schemas/candy-settings.schema.json +70 -0
- package/templates/vscode-candy/snippets/candy.code-snippets +179 -0
- package/templates/vscode-candy/syntaxes/candy.tmLanguage.json +296 -0
- package/templates/vscode-candy/vim/ftdetect/candy.vim +5 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ThemeManifest, ThemeDesignTokens } from './manifest';
|
|
2
|
+
import type { LayoutDocument, PageDocument, SectionNode, StorefrontPageContext } from './page';
|
|
3
|
+
import type { StorefrontProduct, StorefrontCategory } from './commerce';
|
|
4
|
+
import type { CandyThemeBundle } from '../candy/types';
|
|
5
|
+
export interface SectionRenderContext {
|
|
6
|
+
section: SectionNode;
|
|
7
|
+
globalSettings?: Record<string, unknown> | undefined;
|
|
8
|
+
themeSlug: string;
|
|
9
|
+
catalog?: {
|
|
10
|
+
products?: StorefrontProduct[] | undefined;
|
|
11
|
+
categories?: StorefrontCategory[] | undefined;
|
|
12
|
+
featuredProducts?: StorefrontProduct[] | undefined;
|
|
13
|
+
recentProducts?: StorefrontProduct[] | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
pageContext?: StorefrontPageContext | undefined;
|
|
16
|
+
}
|
|
17
|
+
export type ThemeSectionRenderer = (context: SectionRenderContext) => string;
|
|
18
|
+
export interface StorefrontThemeDefinition {
|
|
19
|
+
slug: string;
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
manifest: ThemeManifest;
|
|
23
|
+
tokens: ThemeDesignTokens;
|
|
24
|
+
defaultTemplates: {
|
|
25
|
+
layout: LayoutDocument;
|
|
26
|
+
pages: Record<string, PageDocument>;
|
|
27
|
+
};
|
|
28
|
+
jsonTemplates?: Record<string, import('../templates/json-template').JsonTemplate> | undefined;
|
|
29
|
+
layouts?: Record<string, import('../templates/json-template').JsonLayoutTemplate> | undefined;
|
|
30
|
+
blocks?: Record<string, (context: any) => string> | undefined;
|
|
31
|
+
sections: Record<string, ThemeSectionRenderer>;
|
|
32
|
+
renderPage?: (context: StorefrontPageContext) => string;
|
|
33
|
+
engine?: 'typescript' | 'candy' | undefined;
|
|
34
|
+
candyBundle?: CandyThemeBundle | undefined;
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StorefrontCategory, StorefrontCurrencyInfo, StorefrontPagination, StorefrontProduct, StorefrontProductDetails } from '../contracts/commerce';
|
|
2
|
+
import type { StorefrontPageContext } from '../contracts/page';
|
|
3
|
+
export interface ThemePreviewCatalog {
|
|
4
|
+
tenantId: string;
|
|
5
|
+
products: StorefrontProduct[];
|
|
6
|
+
categories: StorefrontCategory[];
|
|
7
|
+
product: StorefrontProductDetails | null;
|
|
8
|
+
category: StorefrontCategory | null;
|
|
9
|
+
pagination: StorefrontPagination;
|
|
10
|
+
branding: {
|
|
11
|
+
siteTitle?: string;
|
|
12
|
+
siteTagline?: string;
|
|
13
|
+
logoUrl?: string;
|
|
14
|
+
faviconUrl?: string;
|
|
15
|
+
};
|
|
16
|
+
currency: StorefrontCurrencyInfo;
|
|
17
|
+
}
|
|
18
|
+
export type PreviewCatalogRequest = {
|
|
19
|
+
page?: number | undefined;
|
|
20
|
+
category?: string | undefined;
|
|
21
|
+
product?: string | undefined;
|
|
22
|
+
search?: string | undefined;
|
|
23
|
+
sort?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare function createCatalogDevContext(loadCatalog: (request: PreviewCatalogRequest) => Promise<ThemePreviewCatalog>, pageType: StorefrontPageContext['pageType'], pathname: string, params: URLSearchParams): Promise<StorefrontPageContext>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { StorefrontThemeDefinition } from '../contracts/theme';
|
|
2
|
+
import { type Server } from 'node:http';
|
|
3
|
+
import { type PreviewCatalogRequest, type ThemePreviewCatalog } from './catalog-preview';
|
|
4
|
+
export interface DevServerOptions {
|
|
5
|
+
port?: number;
|
|
6
|
+
themeDir?: string;
|
|
7
|
+
host?: string;
|
|
8
|
+
loadTheme?: () => Promise<StorefrontThemeDefinition>;
|
|
9
|
+
loadCatalog?: (request: PreviewCatalogRequest) => Promise<ThemePreviewCatalog>;
|
|
10
|
+
}
|
|
11
|
+
export interface DevServerInstance {
|
|
12
|
+
server: Server;
|
|
13
|
+
port: number;
|
|
14
|
+
url: string;
|
|
15
|
+
stop: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function createThemeDevServer(options?: DevServerOptions): DevServerInstance;
|
|
18
|
+
/**
|
|
19
|
+
* Starts the dev server and returns the instance.
|
|
20
|
+
*/
|
|
21
|
+
export declare function startThemeDevServer(options?: DevServerOptions): Promise<DevServerInstance>;
|
|
22
|
+
export declare function loadLocalTheme(themeDir: string): Promise<StorefrontThemeDefinition>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dev-server';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StorefrontThemeDefinition } from '../contracts/theme';
|
|
2
|
+
import type { StorefrontPageContext } from '../contracts/page';
|
|
3
|
+
/** Local trusted code only. Uploaded third-party packages are never executed by this renderer. */
|
|
4
|
+
export declare function renderThemePreview(theme: StorefrontThemeDefinition, context: StorefrontPageContext, preferContextSettings?: boolean): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './contracts/commerce';
|
|
2
|
+
export * from './contracts/manifest';
|
|
3
|
+
export * from './contracts/page';
|
|
4
|
+
export * from './contracts/theme';
|
|
5
|
+
export * from './contracts/navigation';
|
|
6
|
+
export * from './contracts/hooks';
|
|
7
|
+
export * from './validation/package-validator';
|
|
8
|
+
export * from './mock';
|
|
9
|
+
export * from './scaffold';
|
|
10
|
+
export * from './auth';
|
|
11
|
+
export * from './dev-server';
|
|
12
|
+
export * from './validation/rich-text';
|
|
13
|
+
export * from './contracts/category-selection';
|
|
14
|
+
export * from './contracts/styles';
|
|
15
|
+
export * from './templates/json-template';
|
|
16
|
+
export * from './settings/global-settings';
|
|
17
|
+
export * from './sections/section-contract';
|
|
18
|
+
export * from './blocks/block-contract';
|
|
19
|
+
export * from './rendering/section-wrapper';
|
|
20
|
+
export * from './contracts/style-document';
|
|
21
|
+
export * from './contracts/storefront-content';
|
|
22
|
+
export * from './rendering/commerce-pages';
|
|
23
|
+
export * from './contracts/footer-builder';
|
|
24
|
+
export * from './contracts/order-tracking';
|
|
25
|
+
export * from './candy';
|
|
26
|
+
export { runCli } from './cli/caartzee-cli';
|
|
27
|
+
export * from './rendering/raw-html';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './mock-products';
|
|
2
|
+
export * from './mock-categories';
|
|
3
|
+
export * from './mock-commerce';
|
|
4
|
+
export * from './mock-customer';
|
|
5
|
+
export * from './mock-hooks';
|
|
6
|
+
import type { StorefrontPageContext } from '../contracts/page';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a fully-populated mock page context for local theme rendering and automated unit testing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createMockPageContext(pageType?: StorefrontPageContext['pageType'], overrides?: Record<string, any>): StorefrontPageContext;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { StorefrontSiteSettings, StorefrontCurrencyInfo, StorefrontCampaign } from '../contracts/commerce';
|
|
2
|
+
export declare const mockCurrency: StorefrontCurrencyInfo;
|
|
3
|
+
export declare const mockSiteSettings: StorefrontSiteSettings;
|
|
4
|
+
export declare const mockCampaign: StorefrontCampaign;
|
|
5
|
+
export declare const mockCart: {
|
|
6
|
+
id: string;
|
|
7
|
+
items: {
|
|
8
|
+
id: string;
|
|
9
|
+
productId: string | number;
|
|
10
|
+
title: string;
|
|
11
|
+
name: string;
|
|
12
|
+
price: number;
|
|
13
|
+
priceFormatted: string;
|
|
14
|
+
quantity: number;
|
|
15
|
+
qty: number;
|
|
16
|
+
imageUrl: string;
|
|
17
|
+
variantName: string;
|
|
18
|
+
}[];
|
|
19
|
+
itemCount: number;
|
|
20
|
+
subtotal: number;
|
|
21
|
+
subtotalFormatted: string;
|
|
22
|
+
tax: number;
|
|
23
|
+
taxFormatted: string;
|
|
24
|
+
shipping: number;
|
|
25
|
+
shippingFormatted: string;
|
|
26
|
+
discount: number;
|
|
27
|
+
discountFormatted: string;
|
|
28
|
+
total: number;
|
|
29
|
+
totalFormatted: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const mockOrders: {
|
|
32
|
+
id: string;
|
|
33
|
+
orderNumber: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
status: string;
|
|
36
|
+
trackingNumber: string;
|
|
37
|
+
carrier: string;
|
|
38
|
+
total: number;
|
|
39
|
+
totalFormatted: string;
|
|
40
|
+
shippingAddress: {
|
|
41
|
+
name: string;
|
|
42
|
+
address1: string;
|
|
43
|
+
city: string;
|
|
44
|
+
state: string;
|
|
45
|
+
zip: string;
|
|
46
|
+
country: string;
|
|
47
|
+
};
|
|
48
|
+
items: {
|
|
49
|
+
id: number;
|
|
50
|
+
title: string;
|
|
51
|
+
quantity: number;
|
|
52
|
+
priceFormatted: string;
|
|
53
|
+
imageUrl: string;
|
|
54
|
+
}[];
|
|
55
|
+
}[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const mockCustomer: {
|
|
2
|
+
id: number;
|
|
3
|
+
firstName: string;
|
|
4
|
+
lastName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
defaultAddress: {
|
|
10
|
+
id: number;
|
|
11
|
+
name: string;
|
|
12
|
+
company: string;
|
|
13
|
+
address1: string;
|
|
14
|
+
address2: string;
|
|
15
|
+
city: string;
|
|
16
|
+
state: string;
|
|
17
|
+
zip: string;
|
|
18
|
+
country: string;
|
|
19
|
+
phone: string;
|
|
20
|
+
isDefault: boolean;
|
|
21
|
+
};
|
|
22
|
+
addresses: ({
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
company: string;
|
|
26
|
+
address1: string;
|
|
27
|
+
address2: string;
|
|
28
|
+
city: string;
|
|
29
|
+
state: string;
|
|
30
|
+
zip: string;
|
|
31
|
+
country: string;
|
|
32
|
+
phone: string;
|
|
33
|
+
isDefault: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
id: number;
|
|
36
|
+
name: string;
|
|
37
|
+
company: string;
|
|
38
|
+
address1: string;
|
|
39
|
+
city: string;
|
|
40
|
+
state: string;
|
|
41
|
+
zip: string;
|
|
42
|
+
country: string;
|
|
43
|
+
phone: string;
|
|
44
|
+
isDefault: boolean;
|
|
45
|
+
address2?: never;
|
|
46
|
+
})[];
|
|
47
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StorefrontComment, StorefrontSavedAddress as StorefrontAddress, StorefrontDownload } from '../contracts/storefront-content';
|
|
2
|
+
export declare function renderProductActions(id: string | number, options?: {
|
|
3
|
+
showEdd?: boolean;
|
|
4
|
+
}): string;
|
|
5
|
+
export declare function renderBlogDiscussion(id: string | number, comments: StorefrontComment[]): string;
|
|
6
|
+
export declare function renderAddressBook(addresses: StorefrontAddress[] | null, countries?: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}>): string;
|
|
10
|
+
export declare function renderDownloads(downloads: StorefrontDownload[] | null): string;
|
|
11
|
+
export declare function renderPolicy(title: string, content: string): string;
|
|
12
|
+
export declare function renderProfileSettings(customer: {
|
|
13
|
+
name?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
} | null): string;
|
|
16
|
+
export declare function renderAccountNavigation(): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SectionRenderContext } from '../contracts/theme';
|
|
2
|
+
/**
|
|
3
|
+
* Server-side HTML Sanitizer for Raw HTML Sections.
|
|
4
|
+
*
|
|
5
|
+
* Strips executable scripts, dangerous embed/frame/vector/style/form tags, inline event
|
|
6
|
+
* handlers (onclick, onload), srcdoc, and raw or entity-encoded javascript:/vbscript:/data: URIs.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizeRawHtml(rawHtml: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Renders a first-class Raw HTML section with server-side sanitization.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderRawHtml(ctx: SectionRenderContext): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SectionRenderContext } from '../contracts/theme';
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes a custom CSS class string to prevent attribute injection or malformed HTML.
|
|
4
|
+
* Only allows alphanumeric characters, underscores, hyphens, and whitespace.
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeCustomClass(rawClass?: unknown): string;
|
|
7
|
+
/**
|
|
8
|
+
* Sanitizes a padding value (in pixels) within reasonable bounds [0, 500].
|
|
9
|
+
* Returns undefined if the value is missing, null, or invalid number.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sanitizePaddingValue(rawPadding?: unknown): number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Sanitizes a margin value (in pixels) within reasonable bounds [-200, 500].
|
|
14
|
+
* Returns undefined if missing, null, or invalid number.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeMarginValue(rawMargin?: unknown): number | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Sanitizes a margin setting value supporting numeric (px) and valid CSS units (px, rem, em, %, auto).
|
|
19
|
+
* Clamps numeric values and strips/rejects any characters that could allow CSS injection.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sanitizeMarginCssValue(rawMargin?: unknown): string | undefined;
|
|
22
|
+
export interface SectionWrapperOptions {
|
|
23
|
+
nonce?: string | undefined;
|
|
24
|
+
isPreview?: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Applies global section settings (custom CSS class, padding top/bottom, margin top/bottom, and custom JavaScript)
|
|
28
|
+
* consistently to any rendered section HTML without requiring each section to reimplement the logic.
|
|
29
|
+
*/
|
|
30
|
+
export declare function applySectionGlobalSettings(renderedHtml: string, ctx: SectionRenderContext, options?: SectionWrapperOptions): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const candyStarterCss: string;
|
|
2
|
+
export declare const candyStarterProductCard = "<article class=\"candy-product-card\">\n <a href=\"{{ product.url | safe_url }}\">\n <img class=\"candy-product-card__image\" src=\"{{ product.featured_image | image_url | escape }}\" alt=\"\" width=\"400\" height=\"500\" loading=\"lazy\" decoding=\"async\">\n <h3>{{ product.title | escape }}</h3>\n </a>\n {% render 'price', product: product %}\n</article>\n";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ScaffoldThemeOptions, ScaffoldResult } from './template-generator';
|
|
2
|
+
/** Copies the trusted reference template shipped with the SDK; never imports a submitted theme. */
|
|
3
|
+
export declare function scaffoldCommerceTheme(options: ScaffoldThemeOptions): Promise<ScaffoldResult>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ScaffoldThemeOptions {
|
|
2
|
+
targetDir: string;
|
|
3
|
+
slug?: string | undefined;
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
author?: string | undefined;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
sdkPath?: string | undefined;
|
|
8
|
+
sdkVersion?: string | undefined;
|
|
9
|
+
engine?: 'typescript' | 'candy' | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface ScaffoldResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
themeSlug: string;
|
|
14
|
+
themeName: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
name: string;
|
|
17
|
+
targetDir: string;
|
|
18
|
+
createdFiles: string[];
|
|
19
|
+
engine?: 'typescript' | 'candy' | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare function scaffoldTheme(options: ScaffoldThemeOptions): ScaffoldResult;
|