@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.
Files changed (142) hide show
  1. package/README.md +34 -2
  2. package/dist/bin/caartzee-theme.js +7449 -0
  3. package/dist/lib/index.js +9838 -0
  4. package/dist/types/src/auth/credentials-store.d.ts +18 -0
  5. package/dist/types/src/auth/index.d.ts +2 -0
  6. package/dist/types/src/auth/oauth-client.d.ts +39 -0
  7. package/dist/types/src/blocks/block-contract.d.ts +242 -0
  8. package/dist/types/src/candy/compatibility-matrix.d.ts +10 -0
  9. package/dist/types/src/candy/context-builder.d.ts +31 -0
  10. package/dist/types/src/candy/engine.d.ts +69 -0
  11. package/dist/types/src/candy/filters.d.ts +32 -0
  12. package/dist/types/src/candy/ide-support.d.ts +20 -0
  13. package/dist/types/src/candy/index.d.ts +9 -0
  14. package/dist/types/src/candy/schema-parser.d.ts +13 -0
  15. package/dist/types/src/candy/security.d.ts +54 -0
  16. package/dist/types/src/candy/tags.d.ts +11 -0
  17. package/dist/types/src/candy/types.d.ts +185 -0
  18. package/dist/types/src/cli/caartzee-cli.d.ts +9 -0
  19. package/dist/types/src/cli/index.d.ts +1 -0
  20. package/dist/types/src/cli/sdk-client.d.ts +12 -0
  21. package/dist/types/src/contracts/category-selection.d.ts +15 -0
  22. package/dist/types/src/contracts/commerce.d.ts +282 -0
  23. package/dist/types/src/contracts/footer-builder.d.ts +125 -0
  24. package/dist/types/src/contracts/hooks.d.ts +37 -0
  25. package/dist/types/src/contracts/manifest.d.ts +3127 -0
  26. package/dist/types/src/contracts/navigation.d.ts +39 -0
  27. package/dist/types/src/contracts/order-tracking.d.ts +40 -0
  28. package/dist/types/src/contracts/page.d.ts +262 -0
  29. package/dist/types/src/contracts/storefront-content.d.ts +60 -0
  30. package/dist/types/src/contracts/style-document.d.ts +2 -0
  31. package/dist/types/src/contracts/styles.d.ts +2002 -0
  32. package/dist/types/src/contracts/theme.d.ts +35 -0
  33. package/dist/types/src/dev-server/catalog-preview.d.ts +25 -0
  34. package/dist/types/src/dev-server/dev-server.d.ts +22 -0
  35. package/dist/types/src/dev-server/index.d.ts +1 -0
  36. package/dist/types/src/dev-server/theme-preview.d.ts +4 -0
  37. package/dist/types/src/index.d.ts +27 -0
  38. package/dist/types/src/mock/index.d.ts +10 -0
  39. package/dist/types/src/mock/mock-categories.d.ts +2 -0
  40. package/dist/types/src/mock/mock-commerce.d.ts +55 -0
  41. package/dist/types/src/mock/mock-customer.d.ts +47 -0
  42. package/dist/types/src/mock/mock-hooks.d.ts +2 -0
  43. package/dist/types/src/mock/mock-products.d.ts +3 -0
  44. package/dist/types/src/rendering/commerce-pages.d.ts +16 -0
  45. package/dist/types/src/rendering/raw-html.d.ts +12 -0
  46. package/dist/types/src/rendering/section-wrapper.d.ts +30 -0
  47. package/dist/types/src/scaffold/candy-starter-assets.d.ts +2 -0
  48. package/dist/types/src/scaffold/commerce-generator.d.ts +3 -0
  49. package/dist/types/src/scaffold/index.d.ts +2 -0
  50. package/dist/types/src/scaffold/template-generator.d.ts +21 -0
  51. package/dist/types/src/sections/section-contract.d.ts +350 -0
  52. package/dist/types/src/settings/global-settings.d.ts +25 -0
  53. package/dist/types/src/templates/json-template.d.ts +991 -0
  54. package/dist/types/src/validation/package-validator.d.ts +53 -0
  55. package/dist/types/src/validation/rich-text.d.ts +24 -0
  56. package/package.json +28 -3
  57. package/templates/commerce/README.md +165 -0
  58. package/templates/commerce/assets/theme.css +1 -0
  59. package/templates/commerce/manifest.json +1 -0
  60. package/templates/commerce/src/blocks/index.ts +184 -0
  61. package/templates/commerce/src/config/settings-defaults.ts +25 -0
  62. package/templates/commerce/src/config/settings-schema.ts +102 -0
  63. package/templates/commerce/src/index.ts +90 -0
  64. package/templates/commerce/src/layouts/default.ts +275 -0
  65. package/templates/commerce/src/manifest.ts +976 -0
  66. package/templates/commerce/src/pages/account/components.ts +369 -0
  67. package/templates/commerce/src/pages/account/tabs.ts +792 -0
  68. package/templates/commerce/src/pages/account.ts +55 -0
  69. package/templates/commerce/src/pages/campaign.ts +423 -0
  70. package/templates/commerce/src/pages/cart.ts +261 -0
  71. package/templates/commerce/src/pages/category-detail.ts +124 -0
  72. package/templates/commerce/src/pages/category-list.ts +87 -0
  73. package/templates/commerce/src/pages/checkout.ts +712 -0
  74. package/templates/commerce/src/pages/commerce.ts +45 -0
  75. package/templates/commerce/src/pages/home.ts +160 -0
  76. package/templates/commerce/src/pages/index.ts +99 -0
  77. package/templates/commerce/src/pages/login.ts +204 -0
  78. package/templates/commerce/src/pages/order-success.ts +80 -0
  79. package/templates/commerce/src/pages/product-detail.ts +489 -0
  80. package/templates/commerce/src/pages/product-list.ts +125 -0
  81. package/templates/commerce/src/pages/search.ts +88 -0
  82. package/templates/commerce/src/pages/signup.ts +253 -0
  83. package/templates/commerce/src/pages/status.ts +7 -0
  84. package/templates/commerce/src/pages/theme-layout.ts +491 -0
  85. package/templates/commerce/src/pages/track-order.ts +196 -0
  86. package/templates/commerce/src/pages/wishlist.ts +83 -0
  87. package/templates/commerce/src/sections/about-story.ts +117 -0
  88. package/templates/commerce/src/sections/announcement-bar.ts +101 -0
  89. package/templates/commerce/src/sections/banner-grid.ts +319 -0
  90. package/templates/commerce/src/sections/campaign-banners.ts +158 -0
  91. package/templates/commerce/src/sections/category-slider.ts +144 -0
  92. package/templates/commerce/src/sections/content-builder.ts +123 -0
  93. package/templates/commerce/src/sections/content-controls.ts +45 -0
  94. package/templates/commerce/src/sections/custom-form.ts +59 -0
  95. package/templates/commerce/src/sections/faq-accordion.ts +123 -0
  96. package/templates/commerce/src/sections/footer.ts +728 -0
  97. package/templates/commerce/src/sections/header.ts +439 -0
  98. package/templates/commerce/src/sections/hero-slider.ts +492 -0
  99. package/templates/commerce/src/sections/hero.ts +137 -0
  100. package/templates/commerce/src/sections/index.ts +102 -0
  101. package/templates/commerce/src/sections/mobile-slider.ts +102 -0
  102. package/templates/commerce/src/sections/newsletter.ts +43 -0
  103. package/templates/commerce/src/sections/product-grid.ts +191 -0
  104. package/templates/commerce/src/sections/raw-html.ts +1 -0
  105. package/templates/commerce/src/sections/rich-text.ts +26 -0
  106. package/templates/commerce/src/sections/services-features.ts +211 -0
  107. package/templates/commerce/src/sections/testimonials.ts +194 -0
  108. package/templates/commerce/src/snippets/product-card.ts +178 -0
  109. package/templates/commerce/src/snippets/product-price.ts +46 -0
  110. package/templates/commerce/src/snippets/responsive-image.ts +29 -0
  111. package/templates/commerce/src/styles.ts +477 -0
  112. package/templates/commerce/src/templates/404.json +26 -0
  113. package/templates/commerce/src/templates/account.json +17 -0
  114. package/templates/commerce/src/templates/cart.json +17 -0
  115. package/templates/commerce/src/templates/category.json +16 -0
  116. package/templates/commerce/src/templates/checkout.json +15 -0
  117. package/templates/commerce/src/templates/collection.json +16 -0
  118. package/templates/commerce/src/templates/index.json +180 -0
  119. package/templates/commerce/src/templates/login.json +17 -0
  120. package/templates/commerce/src/templates/order-success.json +17 -0
  121. package/templates/commerce/src/templates/page.json +17 -0
  122. package/templates/commerce/src/templates/product.json +17 -0
  123. package/templates/commerce/src/templates/search.json +18 -0
  124. package/templates/commerce/src/templates/signup.json +17 -0
  125. package/templates/commerce/src/templates/track-order.json +17 -0
  126. package/templates/commerce/src/templates/wishlist.json +17 -0
  127. package/templates/commerce/src/templates.ts +510 -0
  128. package/templates/commerce/src/tokens.ts +22 -0
  129. package/templates/vscode-candy/README.md +22 -0
  130. package/templates/vscode-candy/extension.js +338 -0
  131. package/templates/vscode-candy/icons/candy-dark.svg +23 -0
  132. package/templates/vscode-candy/icons/candy-light.svg +23 -0
  133. package/templates/vscode-candy/icons/candy-logo.png +0 -0
  134. package/templates/vscode-candy/icons/candy-sweet-dark.svg +23 -0
  135. package/templates/vscode-candy/icons/candy-sweet-light.svg +23 -0
  136. package/templates/vscode-candy/language-configuration.json +47 -0
  137. package/templates/vscode-candy/package.json +103 -0
  138. package/templates/vscode-candy/schemas/candy-config.schema.json +56 -0
  139. package/templates/vscode-candy/schemas/candy-settings.schema.json +70 -0
  140. package/templates/vscode-candy/snippets/candy.code-snippets +179 -0
  141. package/templates/vscode-candy/syntaxes/candy.tmLanguage.json +296 -0
  142. package/templates/vscode-candy/vim/ftdetect/candy.vim +5 -0
@@ -0,0 +1,18 @@
1
+ export interface DeveloperCredentials {
2
+ developerId: string;
3
+ appId?: string | undefined;
4
+ email: string;
5
+ name?: string | undefined;
6
+ accessToken: string;
7
+ refreshToken?: string | undefined;
8
+ expiresAt?: number | undefined;
9
+ scopes: string[];
10
+ portalUrl: string;
11
+ savedAt: string;
12
+ }
13
+ export declare function getCaartzeeConfigDir(): string;
14
+ export declare function getCredentialsFilePath(): string;
15
+ export declare function saveDeveloperCredentials(creds: DeveloperCredentials): void;
16
+ export declare function loadDeveloperCredentials(): DeveloperCredentials | null;
17
+ export declare function clearDeveloperCredentials(): void;
18
+ export declare function isCredentialActive(creds: DeveloperCredentials | null): boolean;
@@ -0,0 +1,2 @@
1
+ export * from './credentials-store';
2
+ export * from './oauth-client';
@@ -0,0 +1,39 @@
1
+ import { type DeveloperCredentials } from './credentials-store';
2
+ export interface PkcePair {
3
+ codeVerifier: string;
4
+ codeChallenge: string;
5
+ codeChallengeMethod: 'S256';
6
+ state: string;
7
+ }
8
+ export interface OAuthConfig {
9
+ clientId?: string | undefined;
10
+ portalUrl?: string | undefined;
11
+ redirectPort?: number | undefined;
12
+ scopes?: string[] | undefined;
13
+ }
14
+ export declare const DEFAULT_PORTAL_URL = "https://partners.caartzee.com";
15
+ export declare const DEFAULT_CLIENT_ID = "caartzee-theme-cli";
16
+ export declare const DEFAULT_REDIRECT_PORT = 8484;
17
+ export declare const DEFAULT_SCOPES: string[];
18
+ /**
19
+ * Generates an RFC 7636 compliant PKCE code verifier, challenge (S256), and CSRF state token.
20
+ */
21
+ export declare function generatePkcePair(): PkcePair;
22
+ /**
23
+ * Builds the browser authorization URL for Caartzee Partner OAuth login.
24
+ */
25
+ export declare function buildAuthorizationUrl(pkce: PkcePair, config?: OAuthConfig): {
26
+ authUrl: string;
27
+ redirectUri: string;
28
+ };
29
+ /**
30
+ * Starts a transient local HTTP server binding strictly to 127.0.0.1 to receive the OAuth callback.
31
+ * Automatically shuts down once callback is received or on timeout.
32
+ */
33
+ export declare function startLocalCallbackServer(expectedState: string, port?: number, timeoutMs?: number): Promise<{
34
+ code: string;
35
+ }>;
36
+ /**
37
+ * Exchanges the authorization code + PKCE verifier for an access token.
38
+ */
39
+ export declare function exchangeCodeForToken(code: string, pkce: PkcePair, redirectUri: string, config?: OAuthConfig): Promise<DeveloperCredentials>;
@@ -0,0 +1,242 @@
1
+ import { z } from 'zod';
2
+ import { type SettingField } from '../contracts/manifest';
3
+ export declare const BlockContractSchema: z.ZodObject<{
4
+ type: z.ZodString;
5
+ label: z.ZodOptional<z.ZodString>;
6
+ name: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ max: z.ZodOptional<z.ZodNumber>;
9
+ allowedParents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ allowedParentSections: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
12
+ id: z.ZodString;
13
+ type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "select", "range", "url", "json", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
14
+ label: z.ZodString;
15
+ default: z.ZodOptional<z.ZodUnknown>;
16
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ label: z.ZodString;
18
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ value: string | number | boolean;
21
+ label: string;
22
+ }, {
23
+ value: string | number | boolean;
24
+ label: string;
25
+ }>, "many">>;
26
+ min: z.ZodOptional<z.ZodNumber>;
27
+ max: z.ZodOptional<z.ZodNumber>;
28
+ step: z.ZodOptional<z.ZodNumber>;
29
+ required: z.ZodOptional<z.ZodBoolean>;
30
+ placeholder: z.ZodOptional<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ id: string;
33
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
34
+ label: string;
35
+ options?: {
36
+ value: string | number | boolean;
37
+ label: string;
38
+ }[] | undefined;
39
+ default?: unknown;
40
+ min?: number | undefined;
41
+ max?: number | undefined;
42
+ step?: number | undefined;
43
+ required?: boolean | undefined;
44
+ placeholder?: string | undefined;
45
+ }, {
46
+ id: string;
47
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
48
+ label: string;
49
+ options?: {
50
+ value: string | number | boolean;
51
+ label: string;
52
+ }[] | undefined;
53
+ default?: unknown;
54
+ min?: number | undefined;
55
+ max?: number | undefined;
56
+ step?: number | undefined;
57
+ required?: boolean | undefined;
58
+ placeholder?: string | undefined;
59
+ }>, "many">>;
60
+ settingsSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
61
+ id: z.ZodString;
62
+ type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "select", "range", "url", "json", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
63
+ label: z.ZodString;
64
+ default: z.ZodOptional<z.ZodUnknown>;
65
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ label: z.ZodString;
67
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ value: string | number | boolean;
70
+ label: string;
71
+ }, {
72
+ value: string | number | boolean;
73
+ label: string;
74
+ }>, "many">>;
75
+ min: z.ZodOptional<z.ZodNumber>;
76
+ max: z.ZodOptional<z.ZodNumber>;
77
+ step: z.ZodOptional<z.ZodNumber>;
78
+ required: z.ZodOptional<z.ZodBoolean>;
79
+ placeholder: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ id: string;
82
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
83
+ label: string;
84
+ options?: {
85
+ value: string | number | boolean;
86
+ label: string;
87
+ }[] | undefined;
88
+ default?: unknown;
89
+ min?: number | undefined;
90
+ max?: number | undefined;
91
+ step?: number | undefined;
92
+ required?: boolean | undefined;
93
+ placeholder?: string | undefined;
94
+ }, {
95
+ id: string;
96
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
97
+ label: string;
98
+ options?: {
99
+ value: string | number | boolean;
100
+ label: string;
101
+ }[] | undefined;
102
+ default?: unknown;
103
+ min?: number | undefined;
104
+ max?: number | undefined;
105
+ step?: number | undefined;
106
+ required?: boolean | undefined;
107
+ placeholder?: string | undefined;
108
+ }>, "many">>;
109
+ defaultSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ type: string;
112
+ settings?: {
113
+ id: string;
114
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
115
+ label: string;
116
+ options?: {
117
+ value: string | number | boolean;
118
+ label: string;
119
+ }[] | undefined;
120
+ default?: unknown;
121
+ min?: number | undefined;
122
+ max?: number | undefined;
123
+ step?: number | undefined;
124
+ required?: boolean | undefined;
125
+ placeholder?: string | undefined;
126
+ }[] | undefined;
127
+ name?: string | undefined;
128
+ label?: string | undefined;
129
+ max?: number | undefined;
130
+ description?: string | undefined;
131
+ settingsSchema?: {
132
+ id: string;
133
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
134
+ label: string;
135
+ options?: {
136
+ value: string | number | boolean;
137
+ label: string;
138
+ }[] | undefined;
139
+ default?: unknown;
140
+ min?: number | undefined;
141
+ max?: number | undefined;
142
+ step?: number | undefined;
143
+ required?: boolean | undefined;
144
+ placeholder?: string | undefined;
145
+ }[] | undefined;
146
+ defaultSettings?: Record<string, unknown> | undefined;
147
+ allowedParents?: string[] | undefined;
148
+ allowedParentSections?: string[] | undefined;
149
+ }, {
150
+ type: string;
151
+ settings?: {
152
+ id: string;
153
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
154
+ label: string;
155
+ options?: {
156
+ value: string | number | boolean;
157
+ label: string;
158
+ }[] | undefined;
159
+ default?: unknown;
160
+ min?: number | undefined;
161
+ max?: number | undefined;
162
+ step?: number | undefined;
163
+ required?: boolean | undefined;
164
+ placeholder?: string | undefined;
165
+ }[] | undefined;
166
+ name?: string | undefined;
167
+ label?: string | undefined;
168
+ max?: number | undefined;
169
+ description?: string | undefined;
170
+ settingsSchema?: {
171
+ id: string;
172
+ type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
173
+ label: string;
174
+ options?: {
175
+ value: string | number | boolean;
176
+ label: string;
177
+ }[] | undefined;
178
+ default?: unknown;
179
+ min?: number | undefined;
180
+ max?: number | undefined;
181
+ step?: number | undefined;
182
+ required?: boolean | undefined;
183
+ placeholder?: string | undefined;
184
+ }[] | undefined;
185
+ defaultSettings?: Record<string, unknown> | undefined;
186
+ allowedParents?: string[] | undefined;
187
+ allowedParentSections?: string[] | undefined;
188
+ }>;
189
+ export type BlockContract = z.infer<typeof BlockContractSchema> & {
190
+ settingsSchema?: SettingField[];
191
+ render?: (context: {
192
+ block: {
193
+ id: string;
194
+ type: string;
195
+ settings: Record<string, unknown>;
196
+ };
197
+ parentSection?: {
198
+ id: string;
199
+ type: string;
200
+ } | undefined;
201
+ globalSettings?: Record<string, unknown> | undefined;
202
+ }) => string;
203
+ };
204
+ /**
205
+ * Initializes a new block instance with default values.
206
+ */
207
+ export declare function initializeBlockInstance(block: BlockContract, options?: {
208
+ instanceId?: string;
209
+ customSettings?: Record<string, unknown>;
210
+ }): {
211
+ id: string;
212
+ type: string;
213
+ settings: Record<string, unknown>;
214
+ };
215
+ /**
216
+ * Standard Reusable Block Definitions following Shopify's core theme block architecture.
217
+ */
218
+ export declare const HEADING_BLOCK: BlockContract;
219
+ export declare const TEXT_BLOCK: BlockContract;
220
+ export declare const IMAGE_BLOCK: BlockContract;
221
+ export declare const BUTTON_BLOCK: BlockContract;
222
+ export declare const PRODUCT_CARD_BLOCK: BlockContract;
223
+ export declare const ICON_BLOCK: BlockContract;
224
+ export declare const VIDEO_BLOCK: BlockContract;
225
+ export declare const SPACER_BLOCK: BlockContract;
226
+ export declare const CANONICAL_STANDARD_BLOCKS: BlockContract[];
227
+ export declare const STANDARD_BLOCKS: Record<string, BlockContract>;
228
+ /**
229
+ * Registry for managing reusable block definitions and checking parent section constraints.
230
+ */
231
+ export declare class BlockRegistry {
232
+ private blocks;
233
+ constructor(initialBlocks?: BlockContract[]);
234
+ registerBlock(block: BlockContract): void;
235
+ register(block: BlockContract): void;
236
+ registerAll(blocks: BlockContract[]): void;
237
+ getBlock(type: string): BlockContract | undefined;
238
+ hasBlock(type: string): boolean;
239
+ listBlocks(): BlockContract[];
240
+ isBlockAllowedInParent(blockType: string, parentSectionType: string): boolean;
241
+ }
242
+ export declare const blockRegistry: BlockRegistry;
@@ -0,0 +1,10 @@
1
+ import type { CompatibilityMatrixEntry } from './types';
2
+ export declare const CANDY_CORE_AND_TAG_MATRIX: CompatibilityMatrixEntry[];
3
+ export declare function getFullCandyCompatibilityMatrix(): CompatibilityMatrixEntry[];
4
+ export declare const CANDY_COMPATIBILITY_MATRIX: CompatibilityMatrixEntry[];
5
+ export declare function getCandyCompatibilitySummary(): {
6
+ total: number;
7
+ supported: number;
8
+ unsupported: number;
9
+ };
10
+ export declare function generateCompatibilityMatrixMarkdown(): string;
@@ -0,0 +1,31 @@
1
+ import { Drop } from 'liquidjs';
2
+ import type { StorefrontCategory, StorefrontProduct, StorefrontProductDetails } from '../contracts/commerce';
3
+ import type { SectionManifest, ThemeDesignTokens } from '../contracts/manifest';
4
+ import type { LayoutDocument, PageDocument, StorefrontPageContext } from '../contracts/page';
5
+ export declare class CandyTemplateDrop extends Drop {
6
+ readonly name: string;
7
+ readonly directory: string | null;
8
+ readonly suffix: string | null;
9
+ constructor(name: string, directory?: string | null, suffix?: string | null);
10
+ valueOf(): string;
11
+ toString(): string;
12
+ }
13
+ export declare function normalizeProductForCandy(product: StorefrontProduct | StorefrontProductDetails | Record<string, any>): Record<string, unknown>;
14
+ export declare function normalizeCollectionForCandy(category: StorefrontCategory | Record<string, any>, products?: Record<string, unknown>[]): Record<string, unknown>;
15
+ export declare function normalizeCartForCandy(rawCart: unknown): Record<string, unknown>;
16
+ export declare function mapPageTypeToCandyTemplateName(pageType: string): string;
17
+ export interface BuildCandyContextOptions {
18
+ pageContext: StorefrontPageContext;
19
+ tokens?: ThemeDesignTokens | undefined;
20
+ defaultGlobalSettings?: Record<string, unknown> | undefined;
21
+ layoutDocument?: LayoutDocument | undefined;
22
+ pageDocument?: PageDocument | undefined;
23
+ sectionManifests?: Record<string, SectionManifest> | undefined;
24
+ contentForLayout?: string | undefined;
25
+ extraContext?: Record<string, unknown> | undefined;
26
+ }
27
+ /**
28
+ * Constructs a rich, Shopify-Liquid-compatible and Caartzee-normalized variable scope
29
+ * from a `StorefrontPageContext` and canonical layout/page documents.
30
+ */
31
+ export declare function buildCandyContext(options: BuildCandyContextOptions): Record<string, unknown>;
@@ -0,0 +1,69 @@
1
+ import { Liquid, type Template } from 'liquidjs';
2
+ import { type ThemeDesignTokens } from '../contracts/manifest';
3
+ import type { LayoutDocument, PageDocument, SectionNode, StorefrontPageContext } from '../contracts/page';
4
+ import type { StorefrontThemeDefinition, ThemeSectionRenderer } from '../contracts/theme';
5
+ import { CandyRestrictedFs } from './security';
6
+ import { type CandyDiagnostic, type CandyEngineOptions, type CandyThemeBundle, type CandyValidationResult } from './types';
7
+ export declare class CandyEngine {
8
+ readonly liquid: Liquid;
9
+ readonly fs: CandyRestrictedFs;
10
+ readonly options: CandyEngineOptions;
11
+ private readonly maxOutputSizeBytes;
12
+ constructor(options?: CandyEngineOptions);
13
+ setFile(relativePath: string, content: string): void;
14
+ parse(source: string, filepath?: string): Template[];
15
+ private unwrapCandyError;
16
+ renderSync(source: string, context?: Record<string, unknown>, filepath?: string): string;
17
+ render(source: string, context?: Record<string, unknown>, filepath?: string): Promise<string>;
18
+ renderFileSync(filepath: string, context?: Record<string, unknown>): string;
19
+ renderFile(filepath: string, context?: Record<string, unknown>): Promise<string>;
20
+ /**
21
+ * Renders a single Caartzee `SectionNode` using `sections/<type>.candy`.
22
+ * Used by both full-page rendering and the Theme Builder live section preview endpoint.
23
+ */
24
+ renderSection(sectionNode: SectionNode, pageContext?: StorefrontPageContext, extraContext?: Record<string, unknown>): string;
25
+ /**
26
+ * Renders a complete storefront page from a `StorefrontPageContext` and optional
27
+ * canonical `LayoutDocument` and `PageDocument`.
28
+ */
29
+ renderPage(pageContext: StorefrontPageContext, renderOptions?: {
30
+ tokens?: ThemeDesignTokens | undefined;
31
+ defaultGlobalSettings?: Record<string, unknown> | undefined;
32
+ layoutDocument?: LayoutDocument | undefined;
33
+ pageDocument?: PageDocument | undefined;
34
+ preferDocumentSections?: boolean | undefined;
35
+ renderBodyOnly?: boolean | undefined;
36
+ renderDocumentSection?: ((section: SectionNode) => string) | undefined;
37
+ renderFallbackPage?: (() => string) | undefined;
38
+ extraContext?: Record<string, unknown> | undefined;
39
+ }): string;
40
+ /**
41
+ * Statically validates a `.candy` template for syntax errors, unknown tags, unknown filters,
42
+ * invalid filter expressions, invalid `{% schema %}` blocks, and broken static references.
43
+ */
44
+ validateTemplate(source: string, filepath?: string, options?: {
45
+ checkReferences?: boolean;
46
+ }): CandyDiagnostic[];
47
+ private enforceOutputLimit;
48
+ }
49
+ /**
50
+ * Loads, extracts section schemas, validates, and compiles a Candy theme directory into a `CandyThemeBundle`.
51
+ */
52
+ export declare function loadCandyThemeFromDirectory(rootDir: string): {
53
+ bundle: CandyThemeBundle;
54
+ diagnostics: CandyDiagnostic[];
55
+ };
56
+ export declare function loadCandyThemeFromFiles(files: Record<string, string>): {
57
+ bundle: CandyThemeBundle;
58
+ diagnostics: CandyDiagnostic[];
59
+ };
60
+ export declare function validateCandyThemeDirectory(rootDir: string): CandyValidationResult;
61
+ /**
62
+ * Adapts a compiled `CandyThemeBundle` into a standard `StorefrontThemeDefinition`
63
+ * so that Caartzee's `ThemeRegistry`, SSR engine, and Dev Server can render both
64
+ * TypeScript and Candy themes through a unified interface.
65
+ */
66
+ export declare function createCandyStorefrontTheme(bundle: CandyThemeBundle, platform?: {
67
+ sections?: Record<string, ThemeSectionRenderer> | undefined;
68
+ renderPage?: StorefrontThemeDefinition['renderPage'];
69
+ }): StorefrontThemeDefinition;
@@ -0,0 +1,32 @@
1
+ import { type Liquid } from 'liquidjs';
2
+ import type { CandyEngineOptions, CompatibilityClassification } from './types';
3
+ /**
4
+ * Wrapper class representing pre-escaped or trusted HTML produced by safe Candy tags/filters.
5
+ * The Candy output auto-escaper preserves `CandySafeString` instances without double-escaping.
6
+ */
7
+ export declare class CandySafeString {
8
+ readonly html: string;
9
+ constructor(html: string);
10
+ toString(): string;
11
+ valueOf(): string;
12
+ }
13
+ export declare function markSafeHtml(html: string): CandySafeString;
14
+ export declare function escapeCandyHtml(value: unknown): string;
15
+ export declare function unescapeCandyHtml(value: unknown): string;
16
+ /**
17
+ * Sanitizes URLs in HTML-generating filters (`link_to`, `image_tag`, `stylesheet_tag`, `script_tag`)
18
+ * to prevent `javascript:`, `vbscript:`, or `data:text/html` XSS vectors.
19
+ */
20
+ export declare function sanitizeFilterUrl(rawUrl: unknown): string;
21
+ export interface CandyFilterMetadata {
22
+ name: string;
23
+ category: 'string' | 'math' | 'array' | 'html_url' | 'date' | 'utility' | 'commerce' | 'color';
24
+ classification: CompatibilityClassification;
25
+ signature: string;
26
+ description: string;
27
+ }
28
+ export declare const CANDY_FILTER_REGISTRY_METADATA: CandyFilterMetadata[];
29
+ /**
30
+ * Registers all Candy filters and safety wrappers onto a LiquidJS instance.
31
+ */
32
+ export declare function registerCandyFilters(liquid: Liquid, options?: CandyEngineOptions): void;
@@ -0,0 +1,20 @@
1
+ export interface CandyIdeInstallResult {
2
+ installedExtensionPaths: string[];
3
+ updatedWorkspaceFiles: string[];
4
+ }
5
+ export interface CandyIdeInstallOptions {
6
+ workspaceDir?: string | undefined;
7
+ extensionSourceDir?: string | undefined;
8
+ userHomeDir?: string | undefined;
9
+ }
10
+ /**
11
+ * Installs the Caartzee Candy Language Support extension into all detected VS Code-compatible
12
+ * IDE extension directories (`~/.antigravity-ide/extensions`, `~/.vscode/extensions`,
13
+ * `~/.cursor/extensions`, `~/.windsurf/extensions`) and optionally scaffolds workspace IDE files.
14
+ */
15
+ export declare function installCandyIdeSupport(options?: CandyIdeInstallOptions): CandyIdeInstallResult;
16
+ /**
17
+ * Writes `.vscode/settings.json`, `.vscode/extensions.json`, `.vscode/candy.code-snippets`,
18
+ * `.editorconfig`, `.gitattributes`, and `.idea/fileTypes/Candy.xml` into a theme or workspace directory.
19
+ */
20
+ export declare function scaffoldCandyIdeWorkspaceFiles(targetDir: string): string[];
@@ -0,0 +1,9 @@
1
+ export * from './types';
2
+ export * from './security';
3
+ export * from './filters';
4
+ export * from './schema-parser';
5
+ export * from './tags';
6
+ export * from './context-builder';
7
+ export * from './engine';
8
+ export * from './compatibility-matrix';
9
+ export * from './ide-support';
@@ -0,0 +1,13 @@
1
+ import { type SectionManifest } from '../contracts/manifest';
2
+ import type { SectionNode } from '../contracts/page';
3
+ import type { ExtractedCandySectionSchema } from './types';
4
+ /**
5
+ * Extracts and compiles `{% schema %}...{% endschema %}` from a `.candy` section file
6
+ * into a validated Caartzee `SectionManifest`.
7
+ */
8
+ export declare function extractCandySectionSchema(source: string, sectionTypeFromFilename: string, filePath?: string): ExtractedCandySectionSchema;
9
+ /**
10
+ * Builds a default SectionNode for a section manifest by merging setting defaults
11
+ * and default preset settings/blocks.
12
+ */
13
+ export declare function buildDefaultSectionNode(manifest: SectionManifest, sectionId?: string, overrideSettings?: Record<string, unknown>, overrideBlocks?: SectionNode['blocks']): SectionNode;
@@ -0,0 +1,54 @@
1
+ import type { FS } from 'liquidjs';
2
+ export declare class CandySecurityError extends Error {
3
+ readonly code: string;
4
+ readonly file?: string | undefined;
5
+ constructor(code: string, message: string, file?: string);
6
+ }
7
+ export declare const FORBIDDEN_IDENTIFIERS: Set<string>;
8
+ /**
9
+ * Validates that a template reference name (used in render, include, layout, section)
10
+ * does not attempt path traversal, absolute path access, protocol injection, or null-byte injection.
11
+ */
12
+ export declare function validateSafeTemplatePath(rawPath: string): string;
13
+ /**
14
+ * Validates filter expressions (such as in `where_exp`) to prevent access to
15
+ * prototype properties or global runtime objects.
16
+ */
17
+ export declare function validateSafeFilterExpression(expression: string): void;
18
+ /**
19
+ * Deeply clones and sanitizes a context object so that prototype properties,
20
+ * functions, and dangerous keys cannot be accessed from templates.
21
+ */
22
+ export declare function sanitizeCandyContext<T>(value: T, seen?: WeakMap<object, unknown>): T;
23
+ export interface CandyRestrictedFsOptions {
24
+ rootDir?: string | undefined;
25
+ files?: Record<string, string> | undefined;
26
+ maxTemplateSizeBytes?: number | undefined;
27
+ stripSchemaTags?: boolean | undefined;
28
+ }
29
+ /**
30
+ * Strips `{% schema %}...{% endschema %}` blocks while preserving newline count
31
+ * so line numbers in runtime errors still match the original `.candy` source file.
32
+ */
33
+ export declare function stripSchemaPreservingLines(source: string): string;
34
+ /**
35
+ * Restricted virtual/physical filesystem implementation for LiquidJS.
36
+ * Only permits reading `.candy` files inside the theme's layout/, templates/, sections/, or snippets/ directories.
37
+ */
38
+ export declare class CandyRestrictedFs implements FS {
39
+ readonly sep = "/";
40
+ private readonly rootDir?;
41
+ private readonly files;
42
+ private readonly maxTemplateSizeBytes;
43
+ private readonly stripSchemaTags;
44
+ constructor(options?: CandyRestrictedFsOptions);
45
+ setFile(relativePath: string, content: string): void;
46
+ getFileMap(): ReadonlyMap<string, string>;
47
+ dirname(filepath: string): string;
48
+ resolve(_dir: string, file: string, ext?: string): string;
49
+ existsSync(filepath: string): boolean;
50
+ exists(filepath: string): Promise<boolean>;
51
+ readFileSync(filepath: string): string;
52
+ readFile(filepath: string): Promise<string>;
53
+ private resolveSafeDiskPath;
54
+ }
@@ -0,0 +1,11 @@
1
+ import { type Liquid } from 'liquidjs';
2
+ import type { SectionManifest } from '../contracts/manifest';
3
+ import type { SectionNode } from '../contracts/page';
4
+ import type { CandyEngineOptions } from './types';
5
+ export declare function decorateSectionNodeForCandy(sectionNode: SectionNode, manifest?: SectionManifest): Record<string, unknown>;
6
+ export declare function wrapRenderedSectionHtml(sectionNode: SectionNode, innerHtml: string): string;
7
+ /**
8
+ * Registers all Candy-specific and Shopify-compatible tags onto a LiquidJS instance,
9
+ * and instruments `render` / `include` with recursion depth protection.
10
+ */
11
+ export declare function registerCandyTags(liquid: Liquid, options?: CandyEngineOptions): void;