@kubuild/schema 0.6.0 → 0.8.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 +24 -0
- package/dist/actions.d.ts +26 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/breakpoints.d.ts +35 -0
- package/dist/breakpoints.d.ts.map +1 -0
- package/dist/builtin-components.d.ts +17 -0
- package/dist/builtin-components.d.ts.map +1 -0
- package/dist/canonical-props.d.ts +39 -0
- package/dist/canonical-props.d.ts.map +1 -0
- package/dist/chunk-MT3M7D67.js +1041 -0
- package/dist/chunk-MT3M7D67.js.map +1 -0
- package/dist/chunk-PECTZDCI.js +1038 -0
- package/dist/chunk-PECTZDCI.js.map +1 -0
- package/dist/document.d.ts +21 -82
- package/dist/document.d.ts.map +1 -1
- package/dist/index.cjs +700 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +447 -747
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +323 -10
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/template.d.ts +6 -18
- package/dist/template.d.ts.map +1 -1
- package/dist/theme.d.ts +80 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/tracking.d.ts +178 -31
- package/dist/tracking.d.ts.map +1 -1
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +331 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.cjs +715 -0
- package/dist/validate.cjs.map +1 -0
- package/dist/validate.d.ts +16 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +53 -0
- package/dist/validate.js.map +1 -0
- package/package.json +22 -2
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,11 @@ __export(index_exports, {
|
|
|
34
34
|
ArtboardSchema: () => ArtboardSchema,
|
|
35
35
|
ArtboardTypeSchema: () => ArtboardTypeSchema,
|
|
36
36
|
AssetReferenceSchema: () => AssetReferenceSchema,
|
|
37
|
+
BREAKPOINTS: () => BREAKPOINTS,
|
|
38
|
+
BREAKPOINT_MEDIA_QUERIES: () => BREAKPOINT_MEDIA_QUERIES,
|
|
39
|
+
BREAKPOINT_ORDER: () => BREAKPOINT_ORDER,
|
|
40
|
+
BUILTIN_COMPONENT_TYPES: () => BUILTIN_COMPONENT_TYPES,
|
|
41
|
+
CANONICAL_TEXT_PROPS: () => CANONICAL_TEXT_PROPS,
|
|
37
42
|
CURRENT_PROJECT_SCHEMA_VERSION: () => CURRENT_PROJECT_SCHEMA_VERSION,
|
|
38
43
|
CURRENT_SCHEMA_VERSION: () => CURRENT_SCHEMA_VERSION,
|
|
39
44
|
CloseModalStepPayloadSchema: () => CloseModalStepPayloadSchema,
|
|
@@ -41,6 +46,7 @@ __export(index_exports, {
|
|
|
41
46
|
CopyClipboardStepPayloadSchema: () => CopyClipboardStepPayloadSchema,
|
|
42
47
|
CustomEventStepPayloadSchema: () => CustomEventStepPayloadSchema,
|
|
43
48
|
CustomTrackingProviderConfigSchema: () => CustomTrackingProviderConfigSchema,
|
|
49
|
+
CustomTrackingSecretsSchema: () => CustomTrackingSecretsSchema,
|
|
44
50
|
DEFAULT_ANIMATION_CONFIG: () => DEFAULT_ANIMATION_CONFIG,
|
|
45
51
|
DocumentMetadataSchema: () => DocumentMetadataSchema,
|
|
46
52
|
FORM_CONFIG_JSON_SCHEMA_V1: () => FORM_CONFIG_JSON_SCHEMA_V1,
|
|
@@ -48,11 +54,14 @@ __export(index_exports, {
|
|
|
48
54
|
FormConfigSchema: () => FormConfigSchema,
|
|
49
55
|
FormFieldBindingSchema: () => FormFieldBindingSchema,
|
|
50
56
|
GoogleTrackingProviderConfigSchema: () => GoogleTrackingProviderConfigSchema,
|
|
57
|
+
GoogleTrackingSecretsSchema: () => GoogleTrackingSecretsSchema,
|
|
51
58
|
GtmTrackingProviderConfigSchema: () => GtmTrackingProviderConfigSchema,
|
|
59
|
+
LEGACY_TRACKING_SECRET_KEYS: () => LEGACY_TRACKING_SECRET_KEYS,
|
|
52
60
|
MANIFEST_JSON_SCHEMA_V1: () => MANIFEST_JSON_SCHEMA_V1,
|
|
53
61
|
ManifestAssetItemSchema: () => ManifestAssetItemSchema,
|
|
54
62
|
ManifestSchema: () => ManifestSchema,
|
|
55
63
|
MetaTrackingProviderConfigSchema: () => MetaTrackingProviderConfigSchema,
|
|
64
|
+
MetaTrackingSecretsSchema: () => MetaTrackingSecretsSchema,
|
|
56
65
|
NavigateStepPayloadSchema: () => NavigateStepPayloadSchema,
|
|
57
66
|
NodeSchema: () => NodeSchema,
|
|
58
67
|
OpenModalStepPayloadSchema: () => OpenModalStepPayloadSchema,
|
|
@@ -68,6 +77,7 @@ __export(index_exports, {
|
|
|
68
77
|
SafeThumbnailObjectSchema: () => SafeThumbnailObjectSchema,
|
|
69
78
|
SafeThumbnailSchema: () => SafeThumbnailSchema,
|
|
70
79
|
SafeThumbnailUrlSchema: () => SafeThumbnailUrlSchema,
|
|
80
|
+
ServerTrackingEventSchema: () => ServerTrackingEventSchema,
|
|
71
81
|
SetStateStepPayloadSchema: () => SetStateStepPayloadSchema,
|
|
72
82
|
ShowToastStepPayloadSchema: () => ShowToastStepPayloadSchema,
|
|
73
83
|
StandardTrackingEventSchema: () => StandardTrackingEventSchema,
|
|
@@ -75,26 +85,46 @@ __export(index_exports, {
|
|
|
75
85
|
StyleDefinitionSchema: () => StyleDefinitionSchema,
|
|
76
86
|
StyleValueSchema: () => StyleValueSchema,
|
|
77
87
|
TEMPLATE_RECORD_JSON_SCHEMA_V1: () => TEMPLATE_RECORD_JSON_SCHEMA_V1,
|
|
88
|
+
THEME_TOKEN_CSS_PREFIX: () => THEME_TOKEN_CSS_PREFIX,
|
|
89
|
+
THEME_TOKEN_GROUPS: () => THEME_TOKEN_GROUPS,
|
|
90
|
+
TRACKING_RELAY_PROTOCOL_VERSION: () => TRACKING_RELAY_PROTOCOL_VERSION,
|
|
78
91
|
TemplatePackageRefSchema: () => TemplatePackageRefSchema,
|
|
79
92
|
TemplateRecordSchema: () => TemplateRecordSchema,
|
|
80
93
|
TemplateRequirementsSchema: () => TemplateRequirementsSchema,
|
|
94
|
+
ThemeSchema: () => ThemeSchema,
|
|
95
|
+
ThemeTokenKeySchema: () => ThemeTokenKeySchema,
|
|
96
|
+
ThemeTokenMapSchema: () => ThemeTokenMapSchema,
|
|
97
|
+
ThemeTokenValueSchema: () => ThemeTokenValueSchema,
|
|
81
98
|
TikTokTrackingProviderConfigSchema: () => TikTokTrackingProviderConfigSchema,
|
|
99
|
+
TikTokTrackingSecretsSchema: () => TikTokTrackingSecretsSchema,
|
|
100
|
+
ToggleModalStepPayloadSchema: () => ToggleModalStepPayloadSchema,
|
|
101
|
+
TrackEventProviderSchema: () => TrackEventProviderSchema,
|
|
82
102
|
TrackEventStepPayloadSchema: () => TrackEventStepPayloadSchema,
|
|
83
103
|
TrackingConfigSchema: () => TrackingConfigSchema,
|
|
84
104
|
TrackingDeliverySchema: () => TrackingDeliverySchema,
|
|
85
105
|
TrackingProviderTypeSchema: () => TrackingProviderTypeSchema,
|
|
106
|
+
TrackingRelayErrorCodeSchema: () => TrackingRelayErrorCodeSchema,
|
|
107
|
+
TrackingRelayProviderResultSchema: () => TrackingRelayProviderResultSchema,
|
|
108
|
+
TrackingRelayRequestSchema: () => TrackingRelayRequestSchema,
|
|
109
|
+
TrackingRelayResponseSchema: () => TrackingRelayResponseSchema,
|
|
86
110
|
ValidateOnEventSchema: () => ValidateOnEventSchema,
|
|
87
111
|
ValidationRuleSchema: () => ValidationRuleSchema,
|
|
88
112
|
ValidationRuleTypeSchema: () => ValidationRuleTypeSchema,
|
|
89
113
|
VariableBindingSchema: () => VariableBindingSchema,
|
|
90
114
|
collectNodeIds: () => collectNodeIds,
|
|
115
|
+
findDeprecatedPropAliases: () => findDeprecatedPropAliases,
|
|
91
116
|
generateDeterministicNodeId: () => generateDeterministicNodeId,
|
|
92
117
|
getActionPipelineJsonSchema: () => getActionPipelineJsonSchema,
|
|
118
|
+
getBreakpointForWidth: () => getBreakpointForWidth,
|
|
119
|
+
getCanonicalTextPropRule: () => getCanonicalTextPropRule,
|
|
93
120
|
getFormConfigJsonSchema: () => getFormConfigJsonSchema,
|
|
94
121
|
getFormFieldBindingJsonSchema: () => getFormFieldBindingJsonSchema,
|
|
95
122
|
getManifestJsonSchema: () => getManifestJsonSchema,
|
|
96
123
|
getPageDocumentJsonSchema: () => getPageDocumentJsonSchema,
|
|
97
124
|
getTemplateRecordJsonSchema: () => getTemplateRecordJsonSchema,
|
|
125
|
+
getTrackingProviderSecretsJsonSchema: () => getTrackingProviderSecretsJsonSchema,
|
|
126
|
+
getTrackingRelayRequestJsonSchema: () => getTrackingRelayRequestJsonSchema,
|
|
127
|
+
getTrackingRelayResponseJsonSchema: () => getTrackingRelayResponseJsonSchema,
|
|
98
128
|
isActionBinding: () => isActionBinding,
|
|
99
129
|
isActionPipeline: () => isActionPipeline,
|
|
100
130
|
isActionStep: () => isActionStep,
|
|
@@ -104,22 +134,29 @@ __export(index_exports, {
|
|
|
104
134
|
isAnimationConfig: () => isAnimationConfig,
|
|
105
135
|
isArtboardReferenceNode: () => isArtboardReferenceNode,
|
|
106
136
|
isAssetReference: () => isAssetReference,
|
|
137
|
+
isBuiltinComponentType: () => isBuiltinComponentType,
|
|
107
138
|
isConditionOperator: () => isConditionOperator,
|
|
108
139
|
isFormConfig: () => isFormConfig,
|
|
109
140
|
isFormFieldBinding: () => isFormFieldBinding,
|
|
110
141
|
isManifest: () => isManifest,
|
|
111
142
|
isProjectDocument: () => isProjectDocument,
|
|
112
143
|
isSafeActionUrl: () => isSafeActionUrl,
|
|
144
|
+
isSafeThemeTokenKey: () => isSafeThemeTokenKey,
|
|
145
|
+
isSafeThemeTokenValue: () => isSafeThemeTokenValue,
|
|
113
146
|
isSafeThumbnail: () => isSafeThumbnail,
|
|
114
147
|
isSafeThumbnailUrl: () => isSafeThumbnailUrl,
|
|
115
148
|
isTemplateRecord: () => isTemplateRecord,
|
|
149
|
+
isTheme: () => isTheme,
|
|
116
150
|
isTrackEventStepPayload: () => isTrackEventStepPayload,
|
|
117
151
|
isTrackingConfig: () => isTrackingConfig,
|
|
152
|
+
isTrackingRelayRequest: () => isTrackingRelayRequest,
|
|
118
153
|
isValidateOnEvent: () => isValidateOnEvent,
|
|
119
154
|
isValidationRule: () => isValidationRule,
|
|
120
155
|
isValidationRuleType: () => isValidationRuleType,
|
|
121
156
|
isVariableBinding: () => isVariableBinding,
|
|
122
157
|
looksLikeProjectDocument: () => looksLikeProjectDocument,
|
|
158
|
+
mergeThemes: () => mergeThemes,
|
|
159
|
+
parseThemeTokenRef: () => parseThemeTokenRef,
|
|
123
160
|
sanitizeActionPayload: () => sanitizeActionPayload,
|
|
124
161
|
sanitizeActionPipeline: () => sanitizeActionPipeline,
|
|
125
162
|
sanitizeActionStep: () => sanitizeActionStep,
|
|
@@ -127,13 +164,16 @@ __export(index_exports, {
|
|
|
127
164
|
sanitizeActionUrl: () => sanitizeActionUrl,
|
|
128
165
|
sanitizeActionValue: () => sanitizeActionValue,
|
|
129
166
|
starterPageFixture: () => starterPageFixture,
|
|
167
|
+
themeToCssVariables: () => themeToCssVariables,
|
|
168
|
+
themeTokenCssVarName: () => themeTokenCssVarName,
|
|
169
|
+
themeTokenRef: () => themeTokenRef,
|
|
130
170
|
validateActionStepPayload: () => validateActionStepPayload,
|
|
131
171
|
validateNodeIdUniqueness: () => validateNodeIdUniqueness
|
|
132
172
|
});
|
|
133
173
|
module.exports = __toCommonJS(index_exports);
|
|
134
174
|
|
|
135
175
|
// src/document.ts
|
|
136
|
-
var
|
|
176
|
+
var import_zod5 = require("zod");
|
|
137
177
|
|
|
138
178
|
// src/actions.ts
|
|
139
179
|
var import_zod2 = require("zod");
|
|
@@ -150,69 +190,51 @@ var TrackingProviderTypeSchema = import_zod.z.enum([
|
|
|
150
190
|
var TrackingDeliverySchema = import_zod.z.enum(["both", "client_only", "server_only"]);
|
|
151
191
|
var MetaTrackingProviderConfigSchema = import_zod.z.object({
|
|
152
192
|
enabled: import_zod.z.boolean().default(true),
|
|
153
|
-
/**
|
|
193
|
+
/** Host credential id; the server resolves the CAPI access token from it. */
|
|
154
194
|
credentialId: import_zod.z.string().optional(),
|
|
155
|
-
/** Meta Pixel ID (e.g. 123456789012345) */
|
|
195
|
+
/** Meta Pixel ID (e.g. 123456789012345) — public */
|
|
156
196
|
pixelId: import_zod.z.string().optional().default(""),
|
|
157
|
-
/** Enable Server-Side Conversions API */
|
|
197
|
+
/** Enable Server-Side Conversions API (delivered through the host relay) */
|
|
158
198
|
capiEnabled: import_zod.z.boolean().optional().default(false),
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
* Note: For security in production, prefer configuring tokens on your server backend
|
|
162
|
-
* or proxying via `serverRelayUrl`.
|
|
163
|
-
*/
|
|
164
|
-
capiAccessToken: import_zod.z.string().optional().default(""),
|
|
165
|
-
/** Test Event Code from Meta Events Manager (e.g. "TEST12345") */
|
|
166
|
-
testEventCode: import_zod.z.string().optional().default(""),
|
|
167
|
-
/**
|
|
168
|
-
* Host Server Relay URL (e.g. "/api/tracking/meta").
|
|
169
|
-
* Recommended for browser clients to post CAPI events safely without exposing the secret token.
|
|
170
|
-
*/
|
|
171
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
199
|
+
/** Test Event Code from Meta Events Manager (e.g. "TEST12345") — not a secret */
|
|
200
|
+
testEventCode: import_zod.z.string().optional().default("")
|
|
172
201
|
});
|
|
173
202
|
var GoogleTrackingProviderConfigSchema = import_zod.z.object({
|
|
174
203
|
enabled: import_zod.z.boolean().default(true),
|
|
175
|
-
/**
|
|
204
|
+
/** Host credential id; the server resolves the Measurement Protocol API secret from it. */
|
|
176
205
|
credentialId: import_zod.z.string().optional(),
|
|
177
|
-
/** GA4 Measurement ID (e.g. "G-XXXXXXXXXX") */
|
|
178
|
-
measurementId: import_zod.z.string().optional().default("")
|
|
179
|
-
/** GA4 Measurement Protocol API Secret (for server-side events) */
|
|
180
|
-
measurementProtocolSecret: import_zod.z.string().optional().default(""),
|
|
181
|
-
/** Host Server Relay URL (e.g. "/api/tracking/ga4") */
|
|
182
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
206
|
+
/** GA4 Measurement ID (e.g. "G-XXXXXXXXXX") — public */
|
|
207
|
+
measurementId: import_zod.z.string().optional().default("")
|
|
183
208
|
});
|
|
184
209
|
var GtmTrackingProviderConfigSchema = import_zod.z.object({
|
|
185
210
|
enabled: import_zod.z.boolean().default(true),
|
|
186
211
|
/** Optional linked account/workspace credential ID */
|
|
187
212
|
credentialId: import_zod.z.string().optional(),
|
|
188
|
-
/** GTM Container ID (e.g. "GTM-XXXXXXX") */
|
|
189
|
-
containerId: import_zod.z.string().optional().default("")
|
|
190
|
-
/** Host Server Relay URL */
|
|
191
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
213
|
+
/** GTM Container ID (e.g. "GTM-XXXXXXX") — public */
|
|
214
|
+
containerId: import_zod.z.string().optional().default("")
|
|
192
215
|
});
|
|
193
216
|
var TikTokTrackingProviderConfigSchema = import_zod.z.object({
|
|
194
217
|
enabled: import_zod.z.boolean().default(true),
|
|
195
|
-
/**
|
|
218
|
+
/** Host credential id; the server resolves the Events API access token from it. */
|
|
196
219
|
credentialId: import_zod.z.string().optional(),
|
|
197
|
-
/** TikTok Pixel ID (e.g. "C1234567890") */
|
|
220
|
+
/** TikTok Pixel ID (e.g. "C1234567890") — public */
|
|
198
221
|
pixelId: import_zod.z.string().optional().default(""),
|
|
199
|
-
/** Enable TikTok Events API (server-side) */
|
|
222
|
+
/** Enable TikTok Events API (server-side, delivered through the host relay) */
|
|
200
223
|
eventsApiEnabled: import_zod.z.boolean().optional().default(false),
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
/** Test Event Code from TikTok Event Manager */
|
|
204
|
-
testEventCode: import_zod.z.string().optional().default(""),
|
|
205
|
-
/** Host Server Relay URL (e.g. "/api/tracking/tiktok") */
|
|
206
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
224
|
+
/** Test Event Code from TikTok Event Manager — not a secret */
|
|
225
|
+
testEventCode: import_zod.z.string().optional().default("")
|
|
207
226
|
});
|
|
208
227
|
var CustomTrackingProviderConfigSchema = import_zod.z.object({
|
|
209
228
|
enabled: import_zod.z.boolean().default(true),
|
|
210
|
-
/**
|
|
211
|
-
credentialId: import_zod.z.string().optional()
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
229
|
+
/** Host credential id; the server resolves the webhook `endpointUrl` + `headers` from it. */
|
|
230
|
+
credentialId: import_zod.z.string().optional()
|
|
231
|
+
});
|
|
232
|
+
var LEGACY_TRACKING_SECRET_KEYS = Object.freeze({
|
|
233
|
+
meta: ["capiAccessToken", "serverRelayUrl"],
|
|
234
|
+
google: ["measurementProtocolSecret", "serverRelayUrl"],
|
|
235
|
+
gtm: ["serverRelayUrl"],
|
|
236
|
+
tiktok: ["accessToken", "serverRelayUrl"],
|
|
237
|
+
custom: ["endpointUrl", "headers"]
|
|
216
238
|
});
|
|
217
239
|
var TrackingConfigSchema = import_zod.z.object({
|
|
218
240
|
/** Master toggle: dynamically enables or disables all tracking operations */
|
|
@@ -232,6 +254,22 @@ var TrackingConfigSchema = import_zod.z.object({
|
|
|
232
254
|
custom: CustomTrackingProviderConfigSchema.optional()
|
|
233
255
|
}).optional().default({})
|
|
234
256
|
});
|
|
257
|
+
var MetaTrackingSecretsSchema = import_zod.z.object({
|
|
258
|
+
/** System User access token for the Meta Graph API. */
|
|
259
|
+
capiAccessToken: import_zod.z.string().min(1)
|
|
260
|
+
});
|
|
261
|
+
var GoogleTrackingSecretsSchema = import_zod.z.object({
|
|
262
|
+
/** Measurement Protocol `api_secret`. */
|
|
263
|
+
measurementProtocolSecret: import_zod.z.string().min(1)
|
|
264
|
+
});
|
|
265
|
+
var TikTokTrackingSecretsSchema = import_zod.z.object({
|
|
266
|
+
/** Long-term Events API access token. */
|
|
267
|
+
accessToken: import_zod.z.string().min(1)
|
|
268
|
+
});
|
|
269
|
+
var CustomTrackingSecretsSchema = import_zod.z.object({
|
|
270
|
+
endpointUrl: import_zod.z.string().url(),
|
|
271
|
+
headers: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional()
|
|
272
|
+
});
|
|
235
273
|
var StandardTrackingEventSchema = import_zod.z.enum([
|
|
236
274
|
"PageView",
|
|
237
275
|
"ViewContent",
|
|
@@ -246,13 +284,17 @@ var StandardTrackingEventSchema = import_zod.z.enum([
|
|
|
246
284
|
"SubmitApplication",
|
|
247
285
|
"Schedule"
|
|
248
286
|
]);
|
|
287
|
+
var TrackEventProviderSchema = import_zod.z.enum(["all", "meta", "google", "gtm", "tiktok", "custom"]);
|
|
249
288
|
var TrackEventStepPayloadSchema = import_zod.z.object({
|
|
250
289
|
/** Event name: e.g. "Purchase", "Lead", or custom string */
|
|
251
290
|
eventName: import_zod.z.string().min(1, "Event name cannot be empty"),
|
|
252
291
|
/** Standard event vs custom event identifier */
|
|
253
292
|
eventType: import_zod.z.enum(["standard", "custom"]).optional().default("standard"),
|
|
254
|
-
/**
|
|
255
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Target provider: 'all' or a specific provider.
|
|
295
|
+
* 'gtm' pushes the event to `window.dataLayer` (client-side only).
|
|
296
|
+
*/
|
|
297
|
+
provider: TrackEventProviderSchema.optional().default("all"),
|
|
256
298
|
/** Delivery channel: 'both', 'client_only', or 'server_only' */
|
|
257
299
|
delivery: TrackingDeliverySchema.optional().default("both"),
|
|
258
300
|
/**
|
|
@@ -274,12 +316,66 @@ var TrackEventStepPayloadSchema = import_zod.z.object({
|
|
|
274
316
|
/** Step-level active toggle */
|
|
275
317
|
enabled: import_zod.z.boolean().optional().default(true)
|
|
276
318
|
});
|
|
319
|
+
var TRACKING_RELAY_PROTOCOL_VERSION = 1;
|
|
320
|
+
var ServerTrackingEventSchema = import_zod.z.object({
|
|
321
|
+
eventName: import_zod.z.string().min(1).max(256),
|
|
322
|
+
eventType: import_zod.z.enum(["standard", "custom"]).optional(),
|
|
323
|
+
eventId: import_zod.z.string().max(256).optional(),
|
|
324
|
+
/** Unix epoch seconds. */
|
|
325
|
+
eventTime: import_zod.z.number().int().nonnegative().optional(),
|
|
326
|
+
eventSourceUrl: import_zod.z.string().max(4096).optional(),
|
|
327
|
+
actionSource: import_zod.z.enum(["website", "app", "system_generated"]).optional(),
|
|
328
|
+
params: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
329
|
+
/** Raw (unhashed) user data; the relay hashes PII per provider spec before forwarding. */
|
|
330
|
+
userData: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
331
|
+
customData: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
332
|
+
});
|
|
333
|
+
var TrackingRelayRequestSchema = import_zod.z.object({
|
|
334
|
+
version: import_zod.z.literal(TRACKING_RELAY_PROTOCOL_VERSION),
|
|
335
|
+
event: ServerTrackingEventSchema,
|
|
336
|
+
provider: TrackEventProviderSchema.optional().default("all"),
|
|
337
|
+
/** Optional hint only; the relay uses the credentialId from its trusted config. */
|
|
338
|
+
credentialId: import_zod.z.string().max(256).optional(),
|
|
339
|
+
/** Host document/page id so the relay can look up the trusted tracking config. */
|
|
340
|
+
documentId: import_zod.z.string().max(256).optional()
|
|
341
|
+
});
|
|
342
|
+
var TrackingRelayProviderResultSchema = import_zod.z.object({
|
|
343
|
+
provider: import_zod.z.string(),
|
|
344
|
+
success: import_zod.z.boolean(),
|
|
345
|
+
status: import_zod.z.number().int().optional(),
|
|
346
|
+
skipped: import_zod.z.boolean().optional(),
|
|
347
|
+
reason: import_zod.z.string().optional(),
|
|
348
|
+
error: import_zod.z.string().optional()
|
|
349
|
+
});
|
|
350
|
+
var TrackingRelayErrorCodeSchema = import_zod.z.enum([
|
|
351
|
+
"INVALID_REQUEST",
|
|
352
|
+
"UNSUPPORTED_VERSION",
|
|
353
|
+
"FORBIDDEN_ORIGIN",
|
|
354
|
+
"METHOD_NOT_ALLOWED",
|
|
355
|
+
"CONFIG_NOT_FOUND",
|
|
356
|
+
"INTERNAL_ERROR"
|
|
357
|
+
]);
|
|
358
|
+
var TrackingRelayResponseSchema = import_zod.z.object({
|
|
359
|
+
version: import_zod.z.literal(TRACKING_RELAY_PROTOCOL_VERSION),
|
|
360
|
+
success: import_zod.z.boolean(),
|
|
361
|
+
eventId: import_zod.z.string().optional(),
|
|
362
|
+
skipped: import_zod.z.boolean().optional(),
|
|
363
|
+
reason: import_zod.z.string().optional(),
|
|
364
|
+
results: import_zod.z.record(import_zod.z.string(), TrackingRelayProviderResultSchema).optional(),
|
|
365
|
+
error: import_zod.z.object({
|
|
366
|
+
code: TrackingRelayErrorCodeSchema,
|
|
367
|
+
message: import_zod.z.string()
|
|
368
|
+
}).optional()
|
|
369
|
+
});
|
|
277
370
|
function isTrackingConfig(value) {
|
|
278
371
|
return TrackingConfigSchema.safeParse(value).success;
|
|
279
372
|
}
|
|
280
373
|
function isTrackEventStepPayload(value) {
|
|
281
374
|
return TrackEventStepPayloadSchema.safeParse(value).success;
|
|
282
375
|
}
|
|
376
|
+
function isTrackingRelayRequest(value) {
|
|
377
|
+
return TrackingRelayRequestSchema.safeParse(value).success;
|
|
378
|
+
}
|
|
283
379
|
|
|
284
380
|
// src/actions.ts
|
|
285
381
|
var ActionTriggerTypeSchema = import_zod2.z.enum([
|
|
@@ -288,7 +384,9 @@ var ActionTriggerTypeSchema = import_zod2.z.enum([
|
|
|
288
384
|
"change",
|
|
289
385
|
"blur",
|
|
290
386
|
"focus",
|
|
291
|
-
"load"
|
|
387
|
+
"load",
|
|
388
|
+
// Fired once by time-bound components (e.g. `countdown`) when they reach zero.
|
|
389
|
+
"expire"
|
|
292
390
|
]);
|
|
293
391
|
var ActionTriggerSchema = ActionTriggerTypeSchema;
|
|
294
392
|
var ActionStepTypeSchema = import_zod2.z.enum([
|
|
@@ -299,6 +397,7 @@ var ActionStepTypeSchema = import_zod2.z.enum([
|
|
|
299
397
|
"show_toast",
|
|
300
398
|
"open_modal",
|
|
301
399
|
"close_modal",
|
|
400
|
+
"toggle_modal",
|
|
302
401
|
"copy_clipboard",
|
|
303
402
|
"custom_event",
|
|
304
403
|
"track_event"
|
|
@@ -341,7 +440,11 @@ var ApiRequestStepPayloadSchema = import_zod2.z.object({
|
|
|
341
440
|
method: import_zod2.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).default("GET"),
|
|
342
441
|
headers: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
343
442
|
queryParams: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean()])).optional(),
|
|
344
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Request body. Omitted inside a form `submit` pipeline → the form's values are sent;
|
|
445
|
+
* `null` → explicitly no body.
|
|
446
|
+
*/
|
|
447
|
+
body: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()), import_zod2.z.array(import_zod2.z.unknown())]).nullable().optional(),
|
|
345
448
|
bodyFormat: import_zod2.z.enum(["json", "form-data", "formData", "urlencoded", "url-encoded", "raw", "text"]).optional(),
|
|
346
449
|
bodyType: import_zod2.z.enum(["json", "form-data", "formData", "urlencoded", "url-encoded", "raw", "text"]).optional(),
|
|
347
450
|
timeout: import_zod2.z.number().positive("Timeout must be greater than 0 ms").optional(),
|
|
@@ -381,6 +484,19 @@ var CloseModalStepPayloadSchema = import_zod2.z.object({
|
|
|
381
484
|
modalId: import_zod2.z.string().optional(),
|
|
382
485
|
modalNodeId: import_zod2.z.string().optional()
|
|
383
486
|
});
|
|
487
|
+
var ToggleModalStepPayloadSchema = import_zod2.z.object({
|
|
488
|
+
modalId: import_zod2.z.string().optional(),
|
|
489
|
+
modalNodeId: import_zod2.z.string().optional(),
|
|
490
|
+
targetNodeId: import_zod2.z.string().optional(),
|
|
491
|
+
nodeId: import_zod2.z.string().optional()
|
|
492
|
+
}).refine(
|
|
493
|
+
(data) => [data.modalId, data.modalNodeId, data.targetNodeId, data.nodeId].some(
|
|
494
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
495
|
+
),
|
|
496
|
+
{
|
|
497
|
+
message: "Modal ID or Modal Node ID cannot be empty"
|
|
498
|
+
}
|
|
499
|
+
);
|
|
384
500
|
var CopyClipboardStepPayloadSchema = import_zod2.z.object({
|
|
385
501
|
text: import_zod2.z.string().optional(),
|
|
386
502
|
value: import_zod2.z.unknown().optional(),
|
|
@@ -401,6 +517,7 @@ var StepPayloadSchemas = {
|
|
|
401
517
|
show_toast: ShowToastStepPayloadSchema,
|
|
402
518
|
open_modal: OpenModalStepPayloadSchema,
|
|
403
519
|
close_modal: CloseModalStepPayloadSchema,
|
|
520
|
+
toggle_modal: ToggleModalStepPayloadSchema,
|
|
404
521
|
copy_clipboard: CopyClipboardStepPayloadSchema,
|
|
405
522
|
custom_event: CustomEventStepPayloadSchema,
|
|
406
523
|
track_event: TrackEventStepPayloadSchema
|
|
@@ -593,58 +710,158 @@ function isFormConfig(value) {
|
|
|
593
710
|
return FormConfigSchema.safeParse(value).success;
|
|
594
711
|
}
|
|
595
712
|
|
|
713
|
+
// src/theme.ts
|
|
714
|
+
var import_zod4 = require("zod");
|
|
715
|
+
var THEME_TOKEN_GROUPS = ["colors", "fonts", "radii", "spacing"];
|
|
716
|
+
var THEME_TOKEN_CSS_PREFIX = Object.freeze({
|
|
717
|
+
colors: "--kb-color-",
|
|
718
|
+
fonts: "--kb-font-",
|
|
719
|
+
radii: "--kb-radius-",
|
|
720
|
+
spacing: "--kb-space-"
|
|
721
|
+
});
|
|
722
|
+
var THEME_TOKEN_KEY_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
723
|
+
var DANGEROUS_THEME_VALUE_PATTERN = /javascript:|expression\(|@import|<script|vbscript:|data:text\/html|url\s*\(/i;
|
|
724
|
+
var FORBIDDEN_THEME_VALUE_CHARS = /[;{}<>\\]/;
|
|
725
|
+
var MAX_THEME_VALUE_LENGTH = 512;
|
|
726
|
+
function isSafeThemeTokenKey(key) {
|
|
727
|
+
return typeof key === "string" && THEME_TOKEN_KEY_PATTERN.test(key);
|
|
728
|
+
}
|
|
729
|
+
function isSafeThemeTokenValue(value) {
|
|
730
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
731
|
+
if (typeof value !== "string") return false;
|
|
732
|
+
if (value.trim().length === 0 || value.length > MAX_THEME_VALUE_LENGTH) return false;
|
|
733
|
+
if (FORBIDDEN_THEME_VALUE_CHARS.test(value)) return false;
|
|
734
|
+
if (DANGEROUS_THEME_VALUE_PATTERN.test(value)) return false;
|
|
735
|
+
return true;
|
|
736
|
+
}
|
|
737
|
+
var ThemeTokenKeySchema = import_zod4.z.string().refine(isSafeThemeTokenKey, {
|
|
738
|
+
message: 'Theme token key must be 1-64 characters of letters, digits, "-" or "_" (starting with a letter or digit)'
|
|
739
|
+
});
|
|
740
|
+
var ThemeTokenValueSchema = import_zod4.z.union([
|
|
741
|
+
import_zod4.z.string().refine((value) => isSafeThemeTokenValue(value), {
|
|
742
|
+
message: "Theme token value contains a disallowed or unsafe pattern"
|
|
743
|
+
}),
|
|
744
|
+
import_zod4.z.number().refine((value) => Number.isFinite(value), { message: "Theme token value must be finite" })
|
|
745
|
+
]);
|
|
746
|
+
var ThemeTokenMapSchema = import_zod4.z.record(ThemeTokenKeySchema, ThemeTokenValueSchema);
|
|
747
|
+
var ThemeSchema = import_zod4.z.object({
|
|
748
|
+
colors: ThemeTokenMapSchema.optional(),
|
|
749
|
+
fonts: ThemeTokenMapSchema.optional(),
|
|
750
|
+
radii: ThemeTokenMapSchema.optional(),
|
|
751
|
+
spacing: ThemeTokenMapSchema.optional()
|
|
752
|
+
});
|
|
753
|
+
function themeTokenCssVarName(group, key) {
|
|
754
|
+
if (!isSafeThemeTokenKey(key)) return null;
|
|
755
|
+
return `${THEME_TOKEN_CSS_PREFIX[group]}${key}`;
|
|
756
|
+
}
|
|
757
|
+
function themeTokenRef(group, key) {
|
|
758
|
+
const name = themeTokenCssVarName(group, key);
|
|
759
|
+
if (!name) {
|
|
760
|
+
throw new Error(`Invalid theme token key "${key}"`);
|
|
761
|
+
}
|
|
762
|
+
return `var(${name})`;
|
|
763
|
+
}
|
|
764
|
+
var TOKEN_REF_PATTERN = /^var\(\s*--kb-(color|font|radius|space)-([a-zA-Z0-9][a-zA-Z0-9_-]*)\s*(?:,[^)]*)?\)$/;
|
|
765
|
+
var PREFIX_TO_GROUP = {
|
|
766
|
+
color: "colors",
|
|
767
|
+
font: "fonts",
|
|
768
|
+
radius: "radii",
|
|
769
|
+
space: "spacing"
|
|
770
|
+
};
|
|
771
|
+
function parseThemeTokenRef(value) {
|
|
772
|
+
if (typeof value !== "string") return null;
|
|
773
|
+
const match = TOKEN_REF_PATTERN.exec(value.trim());
|
|
774
|
+
if (!match) return null;
|
|
775
|
+
return { group: PREFIX_TO_GROUP[match[1]], key: match[2] };
|
|
776
|
+
}
|
|
777
|
+
function mergeThemes(...layers) {
|
|
778
|
+
const merged = {};
|
|
779
|
+
for (const layer of layers) {
|
|
780
|
+
if (!layer || typeof layer !== "object") continue;
|
|
781
|
+
for (const group of THEME_TOKEN_GROUPS) {
|
|
782
|
+
const tokens = layer[group];
|
|
783
|
+
if (!tokens || typeof tokens !== "object") continue;
|
|
784
|
+
for (const [key, value] of Object.entries(tokens)) {
|
|
785
|
+
if (!isSafeThemeTokenKey(key) || !isSafeThemeTokenValue(value)) continue;
|
|
786
|
+
merged[group] = { ...merged[group] ?? {}, [key]: value };
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return merged;
|
|
791
|
+
}
|
|
792
|
+
function themeToCssVariables(theme) {
|
|
793
|
+
const entries = [];
|
|
794
|
+
if (!theme || typeof theme !== "object") return entries;
|
|
795
|
+
for (const group of THEME_TOKEN_GROUPS) {
|
|
796
|
+
const tokens = theme[group];
|
|
797
|
+
if (!tokens || typeof tokens !== "object") continue;
|
|
798
|
+
for (const [key, value] of Object.entries(tokens)) {
|
|
799
|
+
const name = themeTokenCssVarName(group, key);
|
|
800
|
+
if (!name || !isSafeThemeTokenValue(value)) continue;
|
|
801
|
+
entries.push([
|
|
802
|
+
name,
|
|
803
|
+
typeof value === "number" && (group === "radii" || group === "spacing") ? `${value}px` : String(value)
|
|
804
|
+
]);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return entries;
|
|
808
|
+
}
|
|
809
|
+
function isTheme(value) {
|
|
810
|
+
return ThemeSchema.safeParse(value).success;
|
|
811
|
+
}
|
|
812
|
+
|
|
596
813
|
// src/document.ts
|
|
597
814
|
var SCHEMA_NAME = "stora.page";
|
|
598
|
-
var CURRENT_SCHEMA_VERSION = "1.
|
|
599
|
-
var AssetReferenceSchema =
|
|
600
|
-
type:
|
|
601
|
-
assetId:
|
|
602
|
-
filename:
|
|
603
|
-
mimeType:
|
|
604
|
-
fallbackUrl:
|
|
815
|
+
var CURRENT_SCHEMA_VERSION = "1.2.0";
|
|
816
|
+
var AssetReferenceSchema = import_zod5.z.object({
|
|
817
|
+
type: import_zod5.z.literal("asset"),
|
|
818
|
+
assetId: import_zod5.z.string().min(1, "Asset ID cannot be empty"),
|
|
819
|
+
filename: import_zod5.z.string().optional(),
|
|
820
|
+
mimeType: import_zod5.z.string().optional(),
|
|
821
|
+
fallbackUrl: import_zod5.z.string().url().optional()
|
|
605
822
|
});
|
|
606
|
-
var VariableBindingSchema =
|
|
607
|
-
type:
|
|
608
|
-
key:
|
|
609
|
-
fallback:
|
|
823
|
+
var VariableBindingSchema = import_zod5.z.object({
|
|
824
|
+
type: import_zod5.z.literal("variable"),
|
|
825
|
+
key: import_zod5.z.string().min(1, "Variable key cannot be empty"),
|
|
826
|
+
fallback: import_zod5.z.unknown().optional()
|
|
610
827
|
});
|
|
611
|
-
var ActionBindingSchema =
|
|
612
|
-
type:
|
|
613
|
-
payload:
|
|
828
|
+
var ActionBindingSchema = import_zod5.z.object({
|
|
829
|
+
type: import_zod5.z.string().min(1, "Action type cannot be empty"),
|
|
830
|
+
payload: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional()
|
|
614
831
|
});
|
|
615
832
|
var DANGEROUS_STYLE_VALUE_PATTERN = /javascript:|expression\(|@import|<script|vbscript:|data:text\/html/i;
|
|
616
|
-
var StyleValueSchema =
|
|
617
|
-
|
|
833
|
+
var StyleValueSchema = import_zod5.z.union([
|
|
834
|
+
import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
618
835
|
message: "Style value contains a disallowed or unsafe pattern"
|
|
619
836
|
}),
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
837
|
+
import_zod5.z.number(),
|
|
838
|
+
import_zod5.z.boolean(),
|
|
839
|
+
import_zod5.z.null(),
|
|
840
|
+
import_zod5.z.undefined()
|
|
624
841
|
]);
|
|
625
|
-
var StyleDefinitionSchema =
|
|
626
|
-
var PseudoStateStylesSchema =
|
|
627
|
-
var ResponsiveStylesSchema =
|
|
842
|
+
var StyleDefinitionSchema = import_zod5.z.record(import_zod5.z.string(), StyleValueSchema);
|
|
843
|
+
var PseudoStateStylesSchema = import_zod5.z.record(import_zod5.z.string(), StyleDefinitionSchema);
|
|
844
|
+
var ResponsiveStylesSchema = import_zod5.z.object({
|
|
628
845
|
base: StyleDefinitionSchema.optional(),
|
|
629
846
|
desktop: StyleDefinitionSchema.optional(),
|
|
630
847
|
tablet: StyleDefinitionSchema.optional(),
|
|
631
848
|
mobile: StyleDefinitionSchema.optional(),
|
|
632
849
|
states: PseudoStateStylesSchema.optional()
|
|
633
850
|
}).passthrough().default({});
|
|
634
|
-
var AnimationConfigSchema =
|
|
635
|
-
type:
|
|
851
|
+
var AnimationConfigSchema = import_zod5.z.object({
|
|
852
|
+
type: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
636
853
|
message: "Animation type contains a disallowed or unsafe pattern"
|
|
637
854
|
}).optional().default("none"),
|
|
638
|
-
duration:
|
|
639
|
-
delay:
|
|
640
|
-
easing:
|
|
855
|
+
duration: import_zod5.z.number().min(0, "Duration must be non-negative").optional().default(600),
|
|
856
|
+
delay: import_zod5.z.number().min(0, "Delay must be non-negative").optional().default(0),
|
|
857
|
+
easing: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
641
858
|
message: "Animation easing contains a disallowed or unsafe pattern"
|
|
642
859
|
}).optional().default("ease-out"),
|
|
643
|
-
once:
|
|
644
|
-
hoverEffect:
|
|
860
|
+
once: import_zod5.z.boolean().optional().default(true),
|
|
861
|
+
hoverEffect: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
645
862
|
message: "Hover effect contains a disallowed or unsafe pattern"
|
|
646
863
|
}).optional().default("none"),
|
|
647
|
-
loopEffect:
|
|
864
|
+
loopEffect: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
648
865
|
message: "Loop effect contains a disallowed or unsafe pattern"
|
|
649
866
|
}).optional().default("none")
|
|
650
867
|
});
|
|
@@ -657,16 +874,16 @@ var DEFAULT_ANIMATION_CONFIG = {
|
|
|
657
874
|
hoverEffect: "none",
|
|
658
875
|
loopEffect: "none"
|
|
659
876
|
};
|
|
660
|
-
var NodeSchema =
|
|
661
|
-
() =>
|
|
662
|
-
id:
|
|
663
|
-
type:
|
|
664
|
-
props:
|
|
877
|
+
var NodeSchema = import_zod5.z.lazy(
|
|
878
|
+
() => import_zod5.z.object({
|
|
879
|
+
id: import_zod5.z.string().min(1, "Node ID must be a non-empty string"),
|
|
880
|
+
type: import_zod5.z.string().min(1, "Node type must be a non-empty string"),
|
|
881
|
+
props: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional().default({}),
|
|
665
882
|
styles: ResponsiveStylesSchema.optional().default({}),
|
|
666
883
|
animation: AnimationConfigSchema.optional(),
|
|
667
|
-
actions:
|
|
884
|
+
actions: import_zod5.z.array(ActionPipelineSchema).optional(),
|
|
668
885
|
formConfig: FormConfigSchema.optional(),
|
|
669
|
-
children:
|
|
886
|
+
children: import_zod5.z.array(NodeSchema).optional().default([])
|
|
670
887
|
})
|
|
671
888
|
);
|
|
672
889
|
var RootPageNodeSchema = NodeSchema.refine(
|
|
@@ -676,64 +893,65 @@ var RootPageNodeSchema = NodeSchema.refine(
|
|
|
676
893
|
path: ["type"]
|
|
677
894
|
}
|
|
678
895
|
);
|
|
679
|
-
var DocumentMetadataSchema =
|
|
680
|
-
title:
|
|
681
|
-
description:
|
|
682
|
-
author:
|
|
683
|
-
createdAt:
|
|
684
|
-
updatedAt:
|
|
685
|
-
tags:
|
|
686
|
-
category:
|
|
687
|
-
version:
|
|
688
|
-
custom:
|
|
896
|
+
var DocumentMetadataSchema = import_zod5.z.object({
|
|
897
|
+
title: import_zod5.z.string().min(1, "Title is required").default("Untitled Page"),
|
|
898
|
+
description: import_zod5.z.string().optional().default(""),
|
|
899
|
+
author: import_zod5.z.string().optional().default(""),
|
|
900
|
+
createdAt: import_zod5.z.string().optional(),
|
|
901
|
+
updatedAt: import_zod5.z.string().optional(),
|
|
902
|
+
tags: import_zod5.z.array(import_zod5.z.string()).optional().default([]),
|
|
903
|
+
category: import_zod5.z.string().optional().default("general"),
|
|
904
|
+
version: import_zod5.z.string().optional().default("1.0.0"),
|
|
905
|
+
custom: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional(),
|
|
689
906
|
tracking: TrackingConfigSchema.optional()
|
|
690
907
|
});
|
|
691
|
-
var PageDocumentSchema =
|
|
692
|
-
schema:
|
|
693
|
-
version:
|
|
908
|
+
var PageDocumentSchema = import_zod5.z.object({
|
|
909
|
+
schema: import_zod5.z.literal(SCHEMA_NAME),
|
|
910
|
+
version: import_zod5.z.string().min(1, "Schema version is required").default(CURRENT_SCHEMA_VERSION),
|
|
694
911
|
metadata: DocumentMetadataSchema.optional(),
|
|
695
912
|
tracking: TrackingConfigSchema.optional(),
|
|
913
|
+
theme: ThemeSchema.optional(),
|
|
696
914
|
document: RootPageNodeSchema
|
|
697
915
|
});
|
|
698
916
|
var PROJECT_SCHEMA_NAME = "stora.project";
|
|
699
917
|
var CURRENT_PROJECT_SCHEMA_VERSION = "1.0.0";
|
|
700
918
|
var ARTBOARD_REFERENCE_NODE_TYPE = "artboard-reference";
|
|
701
|
-
var ArtboardTypeSchema =
|
|
702
|
-
var ArtboardSchema =
|
|
703
|
-
id:
|
|
704
|
-
name:
|
|
919
|
+
var ArtboardTypeSchema = import_zod5.z.enum(["page", "component"]);
|
|
920
|
+
var ArtboardSchema = import_zod5.z.object({
|
|
921
|
+
id: import_zod5.z.string().min(1, "Artboard ID is required"),
|
|
922
|
+
name: import_zod5.z.string().min(1, "Artboard name is required"),
|
|
705
923
|
artboardType: ArtboardTypeSchema,
|
|
706
924
|
/** Route for page artboards (e.g. "/about"). */
|
|
707
|
-
slug:
|
|
925
|
+
slug: import_zod5.z.string().optional(),
|
|
708
926
|
/**
|
|
709
927
|
* For component artboards: the id that `open_modal` / `close_modal` actions target.
|
|
710
928
|
* Mirrors the detached node's own `props.modalId` so ModalManager keeps working unchanged.
|
|
711
929
|
*/
|
|
712
|
-
triggerId:
|
|
930
|
+
triggerId: import_zod5.z.string().optional(),
|
|
713
931
|
/**
|
|
714
932
|
* Viewport/breakpoint this artboard is currently authored at. Declared inline
|
|
715
933
|
* (rather than imported) because viewport is otherwise an editor/renderer concept.
|
|
716
934
|
*/
|
|
717
|
-
viewport:
|
|
935
|
+
viewport: import_zod5.z.enum(["desktop", "tablet", "mobile"]).optional(),
|
|
718
936
|
/** Persisted artboard width in px, matching the canvas ViewportResizer's `width`. */
|
|
719
|
-
width:
|
|
937
|
+
width: import_zod5.z.number().positive().optional(),
|
|
720
938
|
/**
|
|
721
939
|
* Free position on the builder's infinite canvas, in unscaled canvas px. Absent means
|
|
722
940
|
* "not placed yet" — the canvas then falls back to laying the artboard out in a row.
|
|
723
941
|
*/
|
|
724
|
-
position:
|
|
725
|
-
x:
|
|
726
|
-
y:
|
|
942
|
+
position: import_zod5.z.object({
|
|
943
|
+
x: import_zod5.z.number(),
|
|
944
|
+
y: import_zod5.z.number()
|
|
727
945
|
}).optional(),
|
|
728
946
|
document: PageDocumentSchema
|
|
729
947
|
});
|
|
730
|
-
var ProjectDocumentSchema =
|
|
731
|
-
schema:
|
|
732
|
-
version:
|
|
948
|
+
var ProjectDocumentSchema = import_zod5.z.object({
|
|
949
|
+
schema: import_zod5.z.literal(PROJECT_SCHEMA_NAME),
|
|
950
|
+
version: import_zod5.z.string().min(1, "Schema version is required").default(CURRENT_PROJECT_SCHEMA_VERSION),
|
|
733
951
|
metadata: DocumentMetadataSchema.optional(),
|
|
734
952
|
tracking: TrackingConfigSchema.optional(),
|
|
735
|
-
artboards:
|
|
736
|
-
activeArtboardId:
|
|
953
|
+
artboards: import_zod5.z.array(ArtboardSchema).min(1, "A project needs at least one artboard"),
|
|
954
|
+
activeArtboardId: import_zod5.z.string().optional()
|
|
737
955
|
});
|
|
738
956
|
function isAssetReference(value) {
|
|
739
957
|
return AssetReferenceSchema.safeParse(value).success;
|
|
@@ -788,31 +1006,58 @@ function validateNodeIdUniqueness(node) {
|
|
|
788
1006
|
};
|
|
789
1007
|
}
|
|
790
1008
|
|
|
1009
|
+
// src/breakpoints.ts
|
|
1010
|
+
var BREAKPOINTS = Object.freeze({
|
|
1011
|
+
mobile: Object.freeze({ minWidth: 0, maxWidth: 767 }),
|
|
1012
|
+
tablet: Object.freeze({ minWidth: 768, maxWidth: 1023 }),
|
|
1013
|
+
desktop: Object.freeze({ minWidth: 1024, maxWidth: null })
|
|
1014
|
+
});
|
|
1015
|
+
var BREAKPOINT_ORDER = Object.freeze([
|
|
1016
|
+
"desktop",
|
|
1017
|
+
"tablet",
|
|
1018
|
+
"mobile"
|
|
1019
|
+
]);
|
|
1020
|
+
function formatMaxWidth(maxWidth) {
|
|
1021
|
+
return `${maxWidth + 0.98}px`;
|
|
1022
|
+
}
|
|
1023
|
+
var BREAKPOINT_MEDIA_QUERIES = Object.freeze({
|
|
1024
|
+
desktop: `(min-width: ${BREAKPOINTS.desktop.minWidth}px)`,
|
|
1025
|
+
tablet: `(min-width: ${BREAKPOINTS.tablet.minWidth}px) and (max-width: ${formatMaxWidth(
|
|
1026
|
+
BREAKPOINTS.tablet.maxWidth
|
|
1027
|
+
)})`,
|
|
1028
|
+
mobile: `(max-width: ${formatMaxWidth(BREAKPOINTS.mobile.maxWidth)})`
|
|
1029
|
+
});
|
|
1030
|
+
function getBreakpointForWidth(width) {
|
|
1031
|
+
if (width < BREAKPOINTS.tablet.minWidth) return "mobile";
|
|
1032
|
+
if (width < BREAKPOINTS.desktop.minWidth) return "tablet";
|
|
1033
|
+
return "desktop";
|
|
1034
|
+
}
|
|
1035
|
+
|
|
791
1036
|
// src/manifest.ts
|
|
792
|
-
var
|
|
793
|
-
var ManifestAssetItemSchema =
|
|
794
|
-
id:
|
|
795
|
-
path:
|
|
796
|
-
mimeType:
|
|
797
|
-
size:
|
|
798
|
-
checksum:
|
|
1037
|
+
var import_zod6 = require("zod");
|
|
1038
|
+
var ManifestAssetItemSchema = import_zod6.z.object({
|
|
1039
|
+
id: import_zod6.z.string().min(1, "Asset ID cannot be empty"),
|
|
1040
|
+
path: import_zod6.z.string().min(1, "Asset archive path cannot be empty"),
|
|
1041
|
+
mimeType: import_zod6.z.string().min(1, "MIME type cannot be empty"),
|
|
1042
|
+
size: import_zod6.z.number().nonnegative("Asset size must be non-negative"),
|
|
1043
|
+
checksum: import_zod6.z.string().optional()
|
|
799
1044
|
});
|
|
800
|
-
var ManifestSchema =
|
|
801
|
-
schema:
|
|
802
|
-
schemaVersion:
|
|
803
|
-
packageVersion:
|
|
804
|
-
builderCompatibility:
|
|
805
|
-
requiredComponents:
|
|
806
|
-
requiredCapabilities:
|
|
807
|
-
assets:
|
|
808
|
-
createdAt:
|
|
1045
|
+
var ManifestSchema = import_zod6.z.object({
|
|
1046
|
+
schema: import_zod6.z.literal(SCHEMA_NAME).default(SCHEMA_NAME),
|
|
1047
|
+
schemaVersion: import_zod6.z.string().min(1, "Schema version cannot be empty").default("1.0.0"),
|
|
1048
|
+
packageVersion: import_zod6.z.string().min(1, "Package version cannot be empty").default("1.0.0"),
|
|
1049
|
+
builderCompatibility: import_zod6.z.string().default(">=0.1.0"),
|
|
1050
|
+
requiredComponents: import_zod6.z.array(import_zod6.z.string()).default([]),
|
|
1051
|
+
requiredCapabilities: import_zod6.z.array(import_zod6.z.string()).default([]),
|
|
1052
|
+
assets: import_zod6.z.array(ManifestAssetItemSchema).default([]),
|
|
1053
|
+
createdAt: import_zod6.z.string().optional()
|
|
809
1054
|
});
|
|
810
1055
|
function isManifest(value) {
|
|
811
1056
|
return ManifestSchema.safeParse(value).success;
|
|
812
1057
|
}
|
|
813
1058
|
|
|
814
1059
|
// src/template.ts
|
|
815
|
-
var
|
|
1060
|
+
var import_zod7 = require("zod");
|
|
816
1061
|
var DANGEROUS_URI_PATTERN = /^(javascript:|vbscript:|data:(?!image\/))|<script/i;
|
|
817
1062
|
function isSafeThumbnailUrl(url) {
|
|
818
1063
|
if (!url || typeof url !== "string") return false;
|
|
@@ -821,49 +1066,49 @@ function isSafeThumbnailUrl(url) {
|
|
|
821
1066
|
if (DANGEROUS_URI_PATTERN.test(trimmed)) return false;
|
|
822
1067
|
return true;
|
|
823
1068
|
}
|
|
824
|
-
var SafeThumbnailUrlSchema =
|
|
1069
|
+
var SafeThumbnailUrlSchema = import_zod7.z.string().min(1, "Thumbnail URL cannot be empty").refine(
|
|
825
1070
|
(url) => isSafeThumbnailUrl(url),
|
|
826
1071
|
{ message: "Thumbnail URL contains an unsafe protocol or payload" }
|
|
827
1072
|
);
|
|
828
|
-
var SafeThumbnailObjectSchema =
|
|
1073
|
+
var SafeThumbnailObjectSchema = import_zod7.z.object({
|
|
829
1074
|
url: SafeThumbnailUrlSchema,
|
|
830
|
-
alt:
|
|
831
|
-
width:
|
|
832
|
-
height:
|
|
1075
|
+
alt: import_zod7.z.string().optional(),
|
|
1076
|
+
width: import_zod7.z.number().positive().optional(),
|
|
1077
|
+
height: import_zod7.z.number().positive().optional()
|
|
833
1078
|
});
|
|
834
|
-
var SafeThumbnailSchema =
|
|
1079
|
+
var SafeThumbnailSchema = import_zod7.z.union([
|
|
835
1080
|
AssetReferenceSchema,
|
|
836
1081
|
SafeThumbnailObjectSchema,
|
|
837
1082
|
SafeThumbnailUrlSchema
|
|
838
1083
|
]);
|
|
839
|
-
var TemplatePackageRefSchema =
|
|
840
|
-
path:
|
|
1084
|
+
var TemplatePackageRefSchema = import_zod7.z.object({
|
|
1085
|
+
path: import_zod7.z.string().optional(),
|
|
841
1086
|
url: SafeThumbnailUrlSchema.optional(),
|
|
842
|
-
checksum:
|
|
843
|
-
format:
|
|
1087
|
+
checksum: import_zod7.z.string().optional(),
|
|
1088
|
+
format: import_zod7.z.enum(["stora", "json"]).default("stora")
|
|
844
1089
|
});
|
|
845
|
-
var TemplateRequirementsSchema =
|
|
846
|
-
requiredComponents:
|
|
847
|
-
requiredCapabilities:
|
|
1090
|
+
var TemplateRequirementsSchema = import_zod7.z.object({
|
|
1091
|
+
requiredComponents: import_zod7.z.array(import_zod7.z.string()).default([]),
|
|
1092
|
+
requiredCapabilities: import_zod7.z.array(import_zod7.z.string()).default([])
|
|
848
1093
|
});
|
|
849
|
-
var TemplateRecordSchema =
|
|
850
|
-
id:
|
|
851
|
-
name:
|
|
852
|
-
description:
|
|
853
|
-
category:
|
|
854
|
-
tags:
|
|
1094
|
+
var TemplateRecordSchema = import_zod7.z.object({
|
|
1095
|
+
id: import_zod7.z.string().min(1, "Template ID must be a non-empty string"),
|
|
1096
|
+
name: import_zod7.z.string().min(1, "Template name must be a non-empty string"),
|
|
1097
|
+
description: import_zod7.z.string().optional().default(""),
|
|
1098
|
+
category: import_zod7.z.string().optional().default("general"),
|
|
1099
|
+
tags: import_zod7.z.array(import_zod7.z.string()).optional().default([]),
|
|
855
1100
|
thumbnail: SafeThumbnailSchema.optional(),
|
|
856
|
-
author:
|
|
857
|
-
version:
|
|
1101
|
+
author: import_zod7.z.string().optional().default(""),
|
|
1102
|
+
version: import_zod7.z.string().optional().default("1.0.0"),
|
|
858
1103
|
document: PageDocumentSchema.optional(),
|
|
859
1104
|
packageReference: TemplatePackageRefSchema.optional(),
|
|
860
1105
|
requirements: TemplateRequirementsSchema.default({
|
|
861
1106
|
requiredComponents: [],
|
|
862
1107
|
requiredCapabilities: []
|
|
863
1108
|
}),
|
|
864
|
-
createdAt:
|
|
865
|
-
updatedAt:
|
|
866
|
-
custom:
|
|
1109
|
+
createdAt: import_zod7.z.string().optional(),
|
|
1110
|
+
updatedAt: import_zod7.z.string().optional(),
|
|
1111
|
+
custom: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional()
|
|
867
1112
|
});
|
|
868
1113
|
function isTemplateRecord(value) {
|
|
869
1114
|
return TemplateRecordSchema.safeParse(value).success;
|
|
@@ -875,7 +1120,7 @@ function isSafeThumbnail(value) {
|
|
|
875
1120
|
// src/fixtures/starter-page.json
|
|
876
1121
|
var starter_page_default = {
|
|
877
1122
|
schema: "stora.page",
|
|
878
|
-
version: "1.
|
|
1123
|
+
version: "1.2.0",
|
|
879
1124
|
metadata: {
|
|
880
1125
|
title: "Welcome to KUBUILD",
|
|
881
1126
|
description: "A starter template built with KUBUILD portable web builder",
|
|
@@ -956,7 +1201,8 @@ var starter_page_default = {
|
|
|
956
1201
|
id: "hero-text",
|
|
957
1202
|
type: "text",
|
|
958
1203
|
props: {
|
|
959
|
-
|
|
1204
|
+
as: "p",
|
|
1205
|
+
text: "KUBUILD is an open, portable web page builder engine designed for modern web applications."
|
|
960
1206
|
},
|
|
961
1207
|
styles: {
|
|
962
1208
|
base: {
|
|
@@ -997,14 +1243,24 @@ var starter_page_default = {
|
|
|
997
1243
|
id: "hero-button",
|
|
998
1244
|
type: "button",
|
|
999
1245
|
props: {
|
|
1000
|
-
label: "Get Started"
|
|
1001
|
-
action: {
|
|
1002
|
-
type: "navigate",
|
|
1003
|
-
payload: {
|
|
1004
|
-
url: "/docs"
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1246
|
+
label: "Get Started"
|
|
1007
1247
|
},
|
|
1248
|
+
actions: [
|
|
1249
|
+
{
|
|
1250
|
+
id: "hero-button-click",
|
|
1251
|
+
trigger: "click",
|
|
1252
|
+
enabled: true,
|
|
1253
|
+
steps: [
|
|
1254
|
+
{
|
|
1255
|
+
id: "hero-button-navigate",
|
|
1256
|
+
type: "navigate",
|
|
1257
|
+
payload: {
|
|
1258
|
+
url: "/docs"
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
]
|
|
1262
|
+
}
|
|
1263
|
+
],
|
|
1008
1264
|
styles: {
|
|
1009
1265
|
base: {
|
|
1010
1266
|
backgroundColor: "#2563eb",
|
|
@@ -1034,6 +1290,7 @@ var starter_page_default = {
|
|
|
1034
1290
|
var starterPageFixture = starter_page_default;
|
|
1035
1291
|
|
|
1036
1292
|
// src/json-schema.ts
|
|
1293
|
+
var import_zod8 = require("zod");
|
|
1037
1294
|
var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
1038
1295
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
1039
1296
|
$id: "https://schema.stora.page/v1/page.json",
|
|
@@ -1052,16 +1309,108 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1052
1309
|
type: "string",
|
|
1053
1310
|
pattern: "^\\d+(\\.\\d+)*$",
|
|
1054
1311
|
description: "Schema version of the document",
|
|
1055
|
-
default: "1.
|
|
1312
|
+
default: "1.2.0"
|
|
1056
1313
|
},
|
|
1057
1314
|
metadata: {
|
|
1058
1315
|
$ref: "#/definitions/documentMetadata"
|
|
1059
1316
|
},
|
|
1060
1317
|
document: {
|
|
1061
1318
|
$ref: "#/definitions/rootPageNode"
|
|
1319
|
+
},
|
|
1320
|
+
tracking: {
|
|
1321
|
+
$ref: "#/definitions/trackingConfig"
|
|
1322
|
+
},
|
|
1323
|
+
theme: {
|
|
1324
|
+
$ref: "#/definitions/theme"
|
|
1062
1325
|
}
|
|
1063
1326
|
},
|
|
1064
1327
|
definitions: {
|
|
1328
|
+
themeTokenMap: {
|
|
1329
|
+
type: "object",
|
|
1330
|
+
propertyNames: { pattern: "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$" },
|
|
1331
|
+
additionalProperties: {
|
|
1332
|
+
type: ["string", "number"],
|
|
1333
|
+
maxLength: 512,
|
|
1334
|
+
pattern: "^[^;{}<>\\\\]*$"
|
|
1335
|
+
},
|
|
1336
|
+
description: "Design tokens keyed by name. Values must not contain ; { } < > or backslashes."
|
|
1337
|
+
},
|
|
1338
|
+
theme: {
|
|
1339
|
+
type: "object",
|
|
1340
|
+
description: "Document design tokens, emitted as CSS custom properties (--kb-color-*, --kb-font-*, --kb-radius-*, --kb-space-*) and referenced from styles as var(--kb-color-<key>).",
|
|
1341
|
+
properties: {
|
|
1342
|
+
colors: { $ref: "#/definitions/themeTokenMap" },
|
|
1343
|
+
fonts: { $ref: "#/definitions/themeTokenMap" },
|
|
1344
|
+
radii: { $ref: "#/definitions/themeTokenMap" },
|
|
1345
|
+
spacing: { $ref: "#/definitions/themeTokenMap" }
|
|
1346
|
+
},
|
|
1347
|
+
additionalProperties: false
|
|
1348
|
+
},
|
|
1349
|
+
trackingConfig: {
|
|
1350
|
+
type: "object",
|
|
1351
|
+
description: "Tracking configuration. Contains only public ids, flags and opaque credential ids \u2014 secrets are host-owned.",
|
|
1352
|
+
properties: {
|
|
1353
|
+
enabled: { type: "boolean", default: true },
|
|
1354
|
+
debugMode: { type: "boolean", default: false },
|
|
1355
|
+
autoPageView: { type: "boolean", default: true },
|
|
1356
|
+
defaultDelivery: { type: "string", enum: ["both", "client_only", "server_only"], default: "both" },
|
|
1357
|
+
providers: {
|
|
1358
|
+
type: "object",
|
|
1359
|
+
properties: {
|
|
1360
|
+
meta: {
|
|
1361
|
+
type: "object",
|
|
1362
|
+
properties: {
|
|
1363
|
+
enabled: { type: "boolean" },
|
|
1364
|
+
credentialId: { type: "string" },
|
|
1365
|
+
pixelId: { type: "string" },
|
|
1366
|
+
capiEnabled: { type: "boolean" },
|
|
1367
|
+
testEventCode: { type: "string" }
|
|
1368
|
+
},
|
|
1369
|
+
additionalProperties: false
|
|
1370
|
+
},
|
|
1371
|
+
google: {
|
|
1372
|
+
type: "object",
|
|
1373
|
+
properties: {
|
|
1374
|
+
enabled: { type: "boolean" },
|
|
1375
|
+
credentialId: { type: "string" },
|
|
1376
|
+
measurementId: { type: "string" }
|
|
1377
|
+
},
|
|
1378
|
+
additionalProperties: false
|
|
1379
|
+
},
|
|
1380
|
+
gtm: {
|
|
1381
|
+
type: "object",
|
|
1382
|
+
properties: {
|
|
1383
|
+
enabled: { type: "boolean" },
|
|
1384
|
+
credentialId: { type: "string" },
|
|
1385
|
+
containerId: { type: "string" }
|
|
1386
|
+
},
|
|
1387
|
+
additionalProperties: false
|
|
1388
|
+
},
|
|
1389
|
+
tiktok: {
|
|
1390
|
+
type: "object",
|
|
1391
|
+
properties: {
|
|
1392
|
+
enabled: { type: "boolean" },
|
|
1393
|
+
credentialId: { type: "string" },
|
|
1394
|
+
pixelId: { type: "string" },
|
|
1395
|
+
eventsApiEnabled: { type: "boolean" },
|
|
1396
|
+
testEventCode: { type: "string" }
|
|
1397
|
+
},
|
|
1398
|
+
additionalProperties: false
|
|
1399
|
+
},
|
|
1400
|
+
custom: {
|
|
1401
|
+
type: "object",
|
|
1402
|
+
properties: {
|
|
1403
|
+
enabled: { type: "boolean" },
|
|
1404
|
+
credentialId: { type: "string" }
|
|
1405
|
+
},
|
|
1406
|
+
additionalProperties: false
|
|
1407
|
+
}
|
|
1408
|
+
},
|
|
1409
|
+
additionalProperties: false
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
additionalProperties: false
|
|
1413
|
+
},
|
|
1065
1414
|
styleValue: {
|
|
1066
1415
|
type: ["string", "number", "boolean", "null"],
|
|
1067
1416
|
description: "A CSS property or design token value"
|
|
@@ -1201,8 +1550,10 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1201
1550
|
"show_toast",
|
|
1202
1551
|
"open_modal",
|
|
1203
1552
|
"close_modal",
|
|
1553
|
+
"toggle_modal",
|
|
1204
1554
|
"copy_clipboard",
|
|
1205
|
-
"custom_event"
|
|
1555
|
+
"custom_event",
|
|
1556
|
+
"track_event"
|
|
1206
1557
|
]
|
|
1207
1558
|
},
|
|
1208
1559
|
label: { type: "string" },
|
|
@@ -1255,7 +1606,7 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1255
1606
|
},
|
|
1256
1607
|
trigger: {
|
|
1257
1608
|
type: "string",
|
|
1258
|
-
enum: ["click", "submit", "change", "blur", "focus", "load"]
|
|
1609
|
+
enum: ["click", "submit", "change", "blur", "focus", "load", "expire"]
|
|
1259
1610
|
},
|
|
1260
1611
|
label: { type: "string" },
|
|
1261
1612
|
debounceMs: { type: "number", minimum: 0 },
|
|
@@ -1676,7 +2027,7 @@ var ACTION_PIPELINE_JSON_SCHEMA_V1 = {
|
|
|
1676
2027
|
},
|
|
1677
2028
|
trigger: {
|
|
1678
2029
|
type: "string",
|
|
1679
|
-
enum: ["click", "submit", "change", "blur", "focus", "load"],
|
|
2030
|
+
enum: ["click", "submit", "change", "blur", "focus", "load", "expire"],
|
|
1680
2031
|
description: "DOM or component event that triggers the action pipeline"
|
|
1681
2032
|
},
|
|
1682
2033
|
label: {
|
|
@@ -1723,8 +2074,10 @@ var ACTION_PIPELINE_JSON_SCHEMA_V1 = {
|
|
|
1723
2074
|
"show_toast",
|
|
1724
2075
|
"open_modal",
|
|
1725
2076
|
"close_modal",
|
|
2077
|
+
"toggle_modal",
|
|
1726
2078
|
"copy_clipboard",
|
|
1727
|
-
"custom_event"
|
|
2079
|
+
"custom_event",
|
|
2080
|
+
"track_event"
|
|
1728
2081
|
]
|
|
1729
2082
|
},
|
|
1730
2083
|
label: { type: "string" },
|
|
@@ -1891,6 +2244,144 @@ var FORM_FIELD_BINDING_JSON_SCHEMA_V1 = {
|
|
|
1891
2244
|
function getFormFieldBindingJsonSchema() {
|
|
1892
2245
|
return FORM_FIELD_BINDING_JSON_SCHEMA_V1;
|
|
1893
2246
|
}
|
|
2247
|
+
function toDraft7(schema, id, title, io) {
|
|
2248
|
+
return {
|
|
2249
|
+
...import_zod8.z.toJSONSchema(schema, { target: "draft-7", io }),
|
|
2250
|
+
$id: id,
|
|
2251
|
+
title
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
var trackingRelayRequestJsonSchema;
|
|
2255
|
+
var trackingRelayResponseJsonSchema;
|
|
2256
|
+
var trackingProviderSecretsJsonSchema;
|
|
2257
|
+
function getTrackingRelayRequestJsonSchema() {
|
|
2258
|
+
trackingRelayRequestJsonSchema ??= toDraft7(
|
|
2259
|
+
TrackingRelayRequestSchema,
|
|
2260
|
+
"https://schema.stora.page/v1/tracking-relay-request.json",
|
|
2261
|
+
"StoraTrackingRelayRequest",
|
|
2262
|
+
"input"
|
|
2263
|
+
);
|
|
2264
|
+
return trackingRelayRequestJsonSchema;
|
|
2265
|
+
}
|
|
2266
|
+
function getTrackingRelayResponseJsonSchema() {
|
|
2267
|
+
trackingRelayResponseJsonSchema ??= toDraft7(
|
|
2268
|
+
TrackingRelayResponseSchema,
|
|
2269
|
+
"https://schema.stora.page/v1/tracking-relay-response.json",
|
|
2270
|
+
"StoraTrackingRelayResponse",
|
|
2271
|
+
"output"
|
|
2272
|
+
);
|
|
2273
|
+
return trackingRelayResponseJsonSchema;
|
|
2274
|
+
}
|
|
2275
|
+
function getTrackingProviderSecretsJsonSchema() {
|
|
2276
|
+
trackingProviderSecretsJsonSchema ??= toDraft7(
|
|
2277
|
+
import_zod8.z.object({
|
|
2278
|
+
meta: MetaTrackingSecretsSchema.optional(),
|
|
2279
|
+
google: GoogleTrackingSecretsSchema.optional(),
|
|
2280
|
+
tiktok: TikTokTrackingSecretsSchema.optional(),
|
|
2281
|
+
custom: CustomTrackingSecretsSchema.optional()
|
|
2282
|
+
}),
|
|
2283
|
+
"https://schema.stora.page/v1/tracking-provider-secrets.json",
|
|
2284
|
+
"StoraTrackingProviderSecrets",
|
|
2285
|
+
"input"
|
|
2286
|
+
);
|
|
2287
|
+
return trackingProviderSecretsJsonSchema;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
// src/builtin-components.ts
|
|
2291
|
+
var BUILTIN_COMPONENT_TYPES = [
|
|
2292
|
+
// layout
|
|
2293
|
+
"page",
|
|
2294
|
+
"section",
|
|
2295
|
+
"container",
|
|
2296
|
+
"columns",
|
|
2297
|
+
"flex",
|
|
2298
|
+
"grid",
|
|
2299
|
+
// typography
|
|
2300
|
+
"heading",
|
|
2301
|
+
"text",
|
|
2302
|
+
"paragraph",
|
|
2303
|
+
"link",
|
|
2304
|
+
"blockquote",
|
|
2305
|
+
"badge",
|
|
2306
|
+
"code-block",
|
|
2307
|
+
// media
|
|
2308
|
+
"image",
|
|
2309
|
+
"video",
|
|
2310
|
+
"icon",
|
|
2311
|
+
"html-embed",
|
|
2312
|
+
// form
|
|
2313
|
+
"button",
|
|
2314
|
+
"button-submit",
|
|
2315
|
+
"form",
|
|
2316
|
+
"input",
|
|
2317
|
+
"textarea",
|
|
2318
|
+
"select",
|
|
2319
|
+
"checkbox",
|
|
2320
|
+
"switch",
|
|
2321
|
+
"radio-group",
|
|
2322
|
+
"radio",
|
|
2323
|
+
"radio-item",
|
|
2324
|
+
"file-upload",
|
|
2325
|
+
// data
|
|
2326
|
+
"collection",
|
|
2327
|
+
"list",
|
|
2328
|
+
"list-item",
|
|
2329
|
+
"table",
|
|
2330
|
+
"table-row",
|
|
2331
|
+
"table-cell",
|
|
2332
|
+
// interactive
|
|
2333
|
+
"modal",
|
|
2334
|
+
"drawer",
|
|
2335
|
+
"collapsible",
|
|
2336
|
+
// conversion (Epic 60)
|
|
2337
|
+
"countdown",
|
|
2338
|
+
"accordion",
|
|
2339
|
+
"accordion-item",
|
|
2340
|
+
"tabs",
|
|
2341
|
+
"tab-panel",
|
|
2342
|
+
"carousel",
|
|
2343
|
+
"rating",
|
|
2344
|
+
"divider",
|
|
2345
|
+
"spacer"
|
|
2346
|
+
];
|
|
2347
|
+
function isBuiltinComponentType(type) {
|
|
2348
|
+
return typeof type === "string" && BUILTIN_COMPONENT_TYPES.includes(type);
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
// src/canonical-props.ts
|
|
2352
|
+
var CANONICAL_TEXT_PROPS = Object.freeze({
|
|
2353
|
+
heading: { canonical: "text", aliases: ["content"], legacyReadOrder: ["text", "content"] },
|
|
2354
|
+
text: { canonical: "text", aliases: ["content"], legacyReadOrder: ["text", "content"] },
|
|
2355
|
+
paragraph: { canonical: "text", aliases: ["content"], legacyReadOrder: ["text", "content"] },
|
|
2356
|
+
link: {
|
|
2357
|
+
canonical: "text",
|
|
2358
|
+
aliases: ["label", "content"],
|
|
2359
|
+
legacyReadOrder: ["text", "label", "content"]
|
|
2360
|
+
},
|
|
2361
|
+
badge: { canonical: "text", aliases: ["label"], legacyReadOrder: ["text", "label"] },
|
|
2362
|
+
blockquote: { canonical: "text", aliases: ["quote"], legacyReadOrder: ["quote", "text"] },
|
|
2363
|
+
button: {
|
|
2364
|
+
canonical: "label",
|
|
2365
|
+
aliases: ["text", "content"],
|
|
2366
|
+
legacyReadOrder: ["label", "text", "content"]
|
|
2367
|
+
}
|
|
2368
|
+
});
|
|
2369
|
+
function getCanonicalTextPropRule(componentType) {
|
|
2370
|
+
return Object.prototype.hasOwnProperty.call(CANONICAL_TEXT_PROPS, componentType) ? CANONICAL_TEXT_PROPS[componentType] : void 0;
|
|
2371
|
+
}
|
|
2372
|
+
function findDeprecatedPropAliases(componentType, props) {
|
|
2373
|
+
const rule = getCanonicalTextPropRule(componentType);
|
|
2374
|
+
if (!rule || !props) return [];
|
|
2375
|
+
const canonicalPresent = props[rule.canonical] !== void 0;
|
|
2376
|
+
let aliasInEffect = canonicalPresent;
|
|
2377
|
+
const usages = [];
|
|
2378
|
+
for (const alias of rule.aliases) {
|
|
2379
|
+
if (props[alias] === void 0) continue;
|
|
2380
|
+
usages.push({ propName: alias, canonicalName: rule.canonical, inEffect: !aliasInEffect });
|
|
2381
|
+
aliasInEffect = true;
|
|
2382
|
+
}
|
|
2383
|
+
return usages;
|
|
2384
|
+
}
|
|
1894
2385
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1895
2386
|
0 && (module.exports = {
|
|
1896
2387
|
ACTION_PIPELINE_JSON_SCHEMA_V1,
|
|
@@ -1907,6 +2398,11 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1907
2398
|
ArtboardSchema,
|
|
1908
2399
|
ArtboardTypeSchema,
|
|
1909
2400
|
AssetReferenceSchema,
|
|
2401
|
+
BREAKPOINTS,
|
|
2402
|
+
BREAKPOINT_MEDIA_QUERIES,
|
|
2403
|
+
BREAKPOINT_ORDER,
|
|
2404
|
+
BUILTIN_COMPONENT_TYPES,
|
|
2405
|
+
CANONICAL_TEXT_PROPS,
|
|
1910
2406
|
CURRENT_PROJECT_SCHEMA_VERSION,
|
|
1911
2407
|
CURRENT_SCHEMA_VERSION,
|
|
1912
2408
|
CloseModalStepPayloadSchema,
|
|
@@ -1914,6 +2410,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1914
2410
|
CopyClipboardStepPayloadSchema,
|
|
1915
2411
|
CustomEventStepPayloadSchema,
|
|
1916
2412
|
CustomTrackingProviderConfigSchema,
|
|
2413
|
+
CustomTrackingSecretsSchema,
|
|
1917
2414
|
DEFAULT_ANIMATION_CONFIG,
|
|
1918
2415
|
DocumentMetadataSchema,
|
|
1919
2416
|
FORM_CONFIG_JSON_SCHEMA_V1,
|
|
@@ -1921,11 +2418,14 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1921
2418
|
FormConfigSchema,
|
|
1922
2419
|
FormFieldBindingSchema,
|
|
1923
2420
|
GoogleTrackingProviderConfigSchema,
|
|
2421
|
+
GoogleTrackingSecretsSchema,
|
|
1924
2422
|
GtmTrackingProviderConfigSchema,
|
|
2423
|
+
LEGACY_TRACKING_SECRET_KEYS,
|
|
1925
2424
|
MANIFEST_JSON_SCHEMA_V1,
|
|
1926
2425
|
ManifestAssetItemSchema,
|
|
1927
2426
|
ManifestSchema,
|
|
1928
2427
|
MetaTrackingProviderConfigSchema,
|
|
2428
|
+
MetaTrackingSecretsSchema,
|
|
1929
2429
|
NavigateStepPayloadSchema,
|
|
1930
2430
|
NodeSchema,
|
|
1931
2431
|
OpenModalStepPayloadSchema,
|
|
@@ -1941,6 +2441,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1941
2441
|
SafeThumbnailObjectSchema,
|
|
1942
2442
|
SafeThumbnailSchema,
|
|
1943
2443
|
SafeThumbnailUrlSchema,
|
|
2444
|
+
ServerTrackingEventSchema,
|
|
1944
2445
|
SetStateStepPayloadSchema,
|
|
1945
2446
|
ShowToastStepPayloadSchema,
|
|
1946
2447
|
StandardTrackingEventSchema,
|
|
@@ -1948,26 +2449,46 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1948
2449
|
StyleDefinitionSchema,
|
|
1949
2450
|
StyleValueSchema,
|
|
1950
2451
|
TEMPLATE_RECORD_JSON_SCHEMA_V1,
|
|
2452
|
+
THEME_TOKEN_CSS_PREFIX,
|
|
2453
|
+
THEME_TOKEN_GROUPS,
|
|
2454
|
+
TRACKING_RELAY_PROTOCOL_VERSION,
|
|
1951
2455
|
TemplatePackageRefSchema,
|
|
1952
2456
|
TemplateRecordSchema,
|
|
1953
2457
|
TemplateRequirementsSchema,
|
|
2458
|
+
ThemeSchema,
|
|
2459
|
+
ThemeTokenKeySchema,
|
|
2460
|
+
ThemeTokenMapSchema,
|
|
2461
|
+
ThemeTokenValueSchema,
|
|
1954
2462
|
TikTokTrackingProviderConfigSchema,
|
|
2463
|
+
TikTokTrackingSecretsSchema,
|
|
2464
|
+
ToggleModalStepPayloadSchema,
|
|
2465
|
+
TrackEventProviderSchema,
|
|
1955
2466
|
TrackEventStepPayloadSchema,
|
|
1956
2467
|
TrackingConfigSchema,
|
|
1957
2468
|
TrackingDeliverySchema,
|
|
1958
2469
|
TrackingProviderTypeSchema,
|
|
2470
|
+
TrackingRelayErrorCodeSchema,
|
|
2471
|
+
TrackingRelayProviderResultSchema,
|
|
2472
|
+
TrackingRelayRequestSchema,
|
|
2473
|
+
TrackingRelayResponseSchema,
|
|
1959
2474
|
ValidateOnEventSchema,
|
|
1960
2475
|
ValidationRuleSchema,
|
|
1961
2476
|
ValidationRuleTypeSchema,
|
|
1962
2477
|
VariableBindingSchema,
|
|
1963
2478
|
collectNodeIds,
|
|
2479
|
+
findDeprecatedPropAliases,
|
|
1964
2480
|
generateDeterministicNodeId,
|
|
1965
2481
|
getActionPipelineJsonSchema,
|
|
2482
|
+
getBreakpointForWidth,
|
|
2483
|
+
getCanonicalTextPropRule,
|
|
1966
2484
|
getFormConfigJsonSchema,
|
|
1967
2485
|
getFormFieldBindingJsonSchema,
|
|
1968
2486
|
getManifestJsonSchema,
|
|
1969
2487
|
getPageDocumentJsonSchema,
|
|
1970
2488
|
getTemplateRecordJsonSchema,
|
|
2489
|
+
getTrackingProviderSecretsJsonSchema,
|
|
2490
|
+
getTrackingRelayRequestJsonSchema,
|
|
2491
|
+
getTrackingRelayResponseJsonSchema,
|
|
1971
2492
|
isActionBinding,
|
|
1972
2493
|
isActionPipeline,
|
|
1973
2494
|
isActionStep,
|
|
@@ -1977,22 +2498,29 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1977
2498
|
isAnimationConfig,
|
|
1978
2499
|
isArtboardReferenceNode,
|
|
1979
2500
|
isAssetReference,
|
|
2501
|
+
isBuiltinComponentType,
|
|
1980
2502
|
isConditionOperator,
|
|
1981
2503
|
isFormConfig,
|
|
1982
2504
|
isFormFieldBinding,
|
|
1983
2505
|
isManifest,
|
|
1984
2506
|
isProjectDocument,
|
|
1985
2507
|
isSafeActionUrl,
|
|
2508
|
+
isSafeThemeTokenKey,
|
|
2509
|
+
isSafeThemeTokenValue,
|
|
1986
2510
|
isSafeThumbnail,
|
|
1987
2511
|
isSafeThumbnailUrl,
|
|
1988
2512
|
isTemplateRecord,
|
|
2513
|
+
isTheme,
|
|
1989
2514
|
isTrackEventStepPayload,
|
|
1990
2515
|
isTrackingConfig,
|
|
2516
|
+
isTrackingRelayRequest,
|
|
1991
2517
|
isValidateOnEvent,
|
|
1992
2518
|
isValidationRule,
|
|
1993
2519
|
isValidationRuleType,
|
|
1994
2520
|
isVariableBinding,
|
|
1995
2521
|
looksLikeProjectDocument,
|
|
2522
|
+
mergeThemes,
|
|
2523
|
+
parseThemeTokenRef,
|
|
1996
2524
|
sanitizeActionPayload,
|
|
1997
2525
|
sanitizeActionPipeline,
|
|
1998
2526
|
sanitizeActionStep,
|
|
@@ -2000,6 +2528,9 @@ function getFormFieldBindingJsonSchema() {
|
|
|
2000
2528
|
sanitizeActionUrl,
|
|
2001
2529
|
sanitizeActionValue,
|
|
2002
2530
|
starterPageFixture,
|
|
2531
|
+
themeToCssVariables,
|
|
2532
|
+
themeTokenCssVarName,
|
|
2533
|
+
themeTokenRef,
|
|
2003
2534
|
validateActionStepPayload,
|
|
2004
2535
|
validateNodeIdUniqueness
|
|
2005
2536
|
});
|