@kubuild/schema 0.7.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 +5 -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 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/index.cjs +437 -126
- 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 +316 -819
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +74 -6
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/template.d.ts +6 -0
- 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/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,
|
|
@@ -80,10 +85,16 @@ __export(index_exports, {
|
|
|
80
85
|
StyleDefinitionSchema: () => StyleDefinitionSchema,
|
|
81
86
|
StyleValueSchema: () => StyleValueSchema,
|
|
82
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,
|
|
83
90
|
TRACKING_RELAY_PROTOCOL_VERSION: () => TRACKING_RELAY_PROTOCOL_VERSION,
|
|
84
91
|
TemplatePackageRefSchema: () => TemplatePackageRefSchema,
|
|
85
92
|
TemplateRecordSchema: () => TemplateRecordSchema,
|
|
86
93
|
TemplateRequirementsSchema: () => TemplateRequirementsSchema,
|
|
94
|
+
ThemeSchema: () => ThemeSchema,
|
|
95
|
+
ThemeTokenKeySchema: () => ThemeTokenKeySchema,
|
|
96
|
+
ThemeTokenMapSchema: () => ThemeTokenMapSchema,
|
|
97
|
+
ThemeTokenValueSchema: () => ThemeTokenValueSchema,
|
|
87
98
|
TikTokTrackingProviderConfigSchema: () => TikTokTrackingProviderConfigSchema,
|
|
88
99
|
TikTokTrackingSecretsSchema: () => TikTokTrackingSecretsSchema,
|
|
89
100
|
ToggleModalStepPayloadSchema: () => ToggleModalStepPayloadSchema,
|
|
@@ -101,8 +112,11 @@ __export(index_exports, {
|
|
|
101
112
|
ValidationRuleTypeSchema: () => ValidationRuleTypeSchema,
|
|
102
113
|
VariableBindingSchema: () => VariableBindingSchema,
|
|
103
114
|
collectNodeIds: () => collectNodeIds,
|
|
115
|
+
findDeprecatedPropAliases: () => findDeprecatedPropAliases,
|
|
104
116
|
generateDeterministicNodeId: () => generateDeterministicNodeId,
|
|
105
117
|
getActionPipelineJsonSchema: () => getActionPipelineJsonSchema,
|
|
118
|
+
getBreakpointForWidth: () => getBreakpointForWidth,
|
|
119
|
+
getCanonicalTextPropRule: () => getCanonicalTextPropRule,
|
|
106
120
|
getFormConfigJsonSchema: () => getFormConfigJsonSchema,
|
|
107
121
|
getFormFieldBindingJsonSchema: () => getFormFieldBindingJsonSchema,
|
|
108
122
|
getManifestJsonSchema: () => getManifestJsonSchema,
|
|
@@ -120,15 +134,19 @@ __export(index_exports, {
|
|
|
120
134
|
isAnimationConfig: () => isAnimationConfig,
|
|
121
135
|
isArtboardReferenceNode: () => isArtboardReferenceNode,
|
|
122
136
|
isAssetReference: () => isAssetReference,
|
|
137
|
+
isBuiltinComponentType: () => isBuiltinComponentType,
|
|
123
138
|
isConditionOperator: () => isConditionOperator,
|
|
124
139
|
isFormConfig: () => isFormConfig,
|
|
125
140
|
isFormFieldBinding: () => isFormFieldBinding,
|
|
126
141
|
isManifest: () => isManifest,
|
|
127
142
|
isProjectDocument: () => isProjectDocument,
|
|
128
143
|
isSafeActionUrl: () => isSafeActionUrl,
|
|
144
|
+
isSafeThemeTokenKey: () => isSafeThemeTokenKey,
|
|
145
|
+
isSafeThemeTokenValue: () => isSafeThemeTokenValue,
|
|
129
146
|
isSafeThumbnail: () => isSafeThumbnail,
|
|
130
147
|
isSafeThumbnailUrl: () => isSafeThumbnailUrl,
|
|
131
148
|
isTemplateRecord: () => isTemplateRecord,
|
|
149
|
+
isTheme: () => isTheme,
|
|
132
150
|
isTrackEventStepPayload: () => isTrackEventStepPayload,
|
|
133
151
|
isTrackingConfig: () => isTrackingConfig,
|
|
134
152
|
isTrackingRelayRequest: () => isTrackingRelayRequest,
|
|
@@ -137,6 +155,8 @@ __export(index_exports, {
|
|
|
137
155
|
isValidationRuleType: () => isValidationRuleType,
|
|
138
156
|
isVariableBinding: () => isVariableBinding,
|
|
139
157
|
looksLikeProjectDocument: () => looksLikeProjectDocument,
|
|
158
|
+
mergeThemes: () => mergeThemes,
|
|
159
|
+
parseThemeTokenRef: () => parseThemeTokenRef,
|
|
140
160
|
sanitizeActionPayload: () => sanitizeActionPayload,
|
|
141
161
|
sanitizeActionPipeline: () => sanitizeActionPipeline,
|
|
142
162
|
sanitizeActionStep: () => sanitizeActionStep,
|
|
@@ -144,13 +164,16 @@ __export(index_exports, {
|
|
|
144
164
|
sanitizeActionUrl: () => sanitizeActionUrl,
|
|
145
165
|
sanitizeActionValue: () => sanitizeActionValue,
|
|
146
166
|
starterPageFixture: () => starterPageFixture,
|
|
167
|
+
themeToCssVariables: () => themeToCssVariables,
|
|
168
|
+
themeTokenCssVarName: () => themeTokenCssVarName,
|
|
169
|
+
themeTokenRef: () => themeTokenRef,
|
|
147
170
|
validateActionStepPayload: () => validateActionStepPayload,
|
|
148
171
|
validateNodeIdUniqueness: () => validateNodeIdUniqueness
|
|
149
172
|
});
|
|
150
173
|
module.exports = __toCommonJS(index_exports);
|
|
151
174
|
|
|
152
175
|
// src/document.ts
|
|
153
|
-
var
|
|
176
|
+
var import_zod5 = require("zod");
|
|
154
177
|
|
|
155
178
|
// src/actions.ts
|
|
156
179
|
var import_zod2 = require("zod");
|
|
@@ -361,7 +384,9 @@ var ActionTriggerTypeSchema = import_zod2.z.enum([
|
|
|
361
384
|
"change",
|
|
362
385
|
"blur",
|
|
363
386
|
"focus",
|
|
364
|
-
"load"
|
|
387
|
+
"load",
|
|
388
|
+
// Fired once by time-bound components (e.g. `countdown`) when they reach zero.
|
|
389
|
+
"expire"
|
|
365
390
|
]);
|
|
366
391
|
var ActionTriggerSchema = ActionTriggerTypeSchema;
|
|
367
392
|
var ActionStepTypeSchema = import_zod2.z.enum([
|
|
@@ -415,7 +440,11 @@ var ApiRequestStepPayloadSchema = import_zod2.z.object({
|
|
|
415
440
|
method: import_zod2.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).default("GET"),
|
|
416
441
|
headers: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
417
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(),
|
|
418
|
-
|
|
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(),
|
|
419
448
|
bodyFormat: import_zod2.z.enum(["json", "form-data", "formData", "urlencoded", "url-encoded", "raw", "text"]).optional(),
|
|
420
449
|
bodyType: import_zod2.z.enum(["json", "form-data", "formData", "urlencoded", "url-encoded", "raw", "text"]).optional(),
|
|
421
450
|
timeout: import_zod2.z.number().positive("Timeout must be greater than 0 ms").optional(),
|
|
@@ -681,58 +710,158 @@ function isFormConfig(value) {
|
|
|
681
710
|
return FormConfigSchema.safeParse(value).success;
|
|
682
711
|
}
|
|
683
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
|
+
|
|
684
813
|
// src/document.ts
|
|
685
814
|
var SCHEMA_NAME = "stora.page";
|
|
686
|
-
var CURRENT_SCHEMA_VERSION = "1.
|
|
687
|
-
var AssetReferenceSchema =
|
|
688
|
-
type:
|
|
689
|
-
assetId:
|
|
690
|
-
filename:
|
|
691
|
-
mimeType:
|
|
692
|
-
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()
|
|
693
822
|
});
|
|
694
|
-
var VariableBindingSchema =
|
|
695
|
-
type:
|
|
696
|
-
key:
|
|
697
|
-
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()
|
|
698
827
|
});
|
|
699
|
-
var ActionBindingSchema =
|
|
700
|
-
type:
|
|
701
|
-
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()
|
|
702
831
|
});
|
|
703
832
|
var DANGEROUS_STYLE_VALUE_PATTERN = /javascript:|expression\(|@import|<script|vbscript:|data:text\/html/i;
|
|
704
|
-
var StyleValueSchema =
|
|
705
|
-
|
|
833
|
+
var StyleValueSchema = import_zod5.z.union([
|
|
834
|
+
import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
706
835
|
message: "Style value contains a disallowed or unsafe pattern"
|
|
707
836
|
}),
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
837
|
+
import_zod5.z.number(),
|
|
838
|
+
import_zod5.z.boolean(),
|
|
839
|
+
import_zod5.z.null(),
|
|
840
|
+
import_zod5.z.undefined()
|
|
712
841
|
]);
|
|
713
|
-
var StyleDefinitionSchema =
|
|
714
|
-
var PseudoStateStylesSchema =
|
|
715
|
-
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({
|
|
716
845
|
base: StyleDefinitionSchema.optional(),
|
|
717
846
|
desktop: StyleDefinitionSchema.optional(),
|
|
718
847
|
tablet: StyleDefinitionSchema.optional(),
|
|
719
848
|
mobile: StyleDefinitionSchema.optional(),
|
|
720
849
|
states: PseudoStateStylesSchema.optional()
|
|
721
850
|
}).passthrough().default({});
|
|
722
|
-
var AnimationConfigSchema =
|
|
723
|
-
type:
|
|
851
|
+
var AnimationConfigSchema = import_zod5.z.object({
|
|
852
|
+
type: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
724
853
|
message: "Animation type contains a disallowed or unsafe pattern"
|
|
725
854
|
}).optional().default("none"),
|
|
726
|
-
duration:
|
|
727
|
-
delay:
|
|
728
|
-
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), {
|
|
729
858
|
message: "Animation easing contains a disallowed or unsafe pattern"
|
|
730
859
|
}).optional().default("ease-out"),
|
|
731
|
-
once:
|
|
732
|
-
hoverEffect:
|
|
860
|
+
once: import_zod5.z.boolean().optional().default(true),
|
|
861
|
+
hoverEffect: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
733
862
|
message: "Hover effect contains a disallowed or unsafe pattern"
|
|
734
863
|
}).optional().default("none"),
|
|
735
|
-
loopEffect:
|
|
864
|
+
loopEffect: import_zod5.z.string().refine((value) => !DANGEROUS_STYLE_VALUE_PATTERN.test(value), {
|
|
736
865
|
message: "Loop effect contains a disallowed or unsafe pattern"
|
|
737
866
|
}).optional().default("none")
|
|
738
867
|
});
|
|
@@ -745,16 +874,16 @@ var DEFAULT_ANIMATION_CONFIG = {
|
|
|
745
874
|
hoverEffect: "none",
|
|
746
875
|
loopEffect: "none"
|
|
747
876
|
};
|
|
748
|
-
var NodeSchema =
|
|
749
|
-
() =>
|
|
750
|
-
id:
|
|
751
|
-
type:
|
|
752
|
-
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({}),
|
|
753
882
|
styles: ResponsiveStylesSchema.optional().default({}),
|
|
754
883
|
animation: AnimationConfigSchema.optional(),
|
|
755
|
-
actions:
|
|
884
|
+
actions: import_zod5.z.array(ActionPipelineSchema).optional(),
|
|
756
885
|
formConfig: FormConfigSchema.optional(),
|
|
757
|
-
children:
|
|
886
|
+
children: import_zod5.z.array(NodeSchema).optional().default([])
|
|
758
887
|
})
|
|
759
888
|
);
|
|
760
889
|
var RootPageNodeSchema = NodeSchema.refine(
|
|
@@ -764,64 +893,65 @@ var RootPageNodeSchema = NodeSchema.refine(
|
|
|
764
893
|
path: ["type"]
|
|
765
894
|
}
|
|
766
895
|
);
|
|
767
|
-
var DocumentMetadataSchema =
|
|
768
|
-
title:
|
|
769
|
-
description:
|
|
770
|
-
author:
|
|
771
|
-
createdAt:
|
|
772
|
-
updatedAt:
|
|
773
|
-
tags:
|
|
774
|
-
category:
|
|
775
|
-
version:
|
|
776
|
-
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(),
|
|
777
906
|
tracking: TrackingConfigSchema.optional()
|
|
778
907
|
});
|
|
779
|
-
var PageDocumentSchema =
|
|
780
|
-
schema:
|
|
781
|
-
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),
|
|
782
911
|
metadata: DocumentMetadataSchema.optional(),
|
|
783
912
|
tracking: TrackingConfigSchema.optional(),
|
|
913
|
+
theme: ThemeSchema.optional(),
|
|
784
914
|
document: RootPageNodeSchema
|
|
785
915
|
});
|
|
786
916
|
var PROJECT_SCHEMA_NAME = "stora.project";
|
|
787
917
|
var CURRENT_PROJECT_SCHEMA_VERSION = "1.0.0";
|
|
788
918
|
var ARTBOARD_REFERENCE_NODE_TYPE = "artboard-reference";
|
|
789
|
-
var ArtboardTypeSchema =
|
|
790
|
-
var ArtboardSchema =
|
|
791
|
-
id:
|
|
792
|
-
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"),
|
|
793
923
|
artboardType: ArtboardTypeSchema,
|
|
794
924
|
/** Route for page artboards (e.g. "/about"). */
|
|
795
|
-
slug:
|
|
925
|
+
slug: import_zod5.z.string().optional(),
|
|
796
926
|
/**
|
|
797
927
|
* For component artboards: the id that `open_modal` / `close_modal` actions target.
|
|
798
928
|
* Mirrors the detached node's own `props.modalId` so ModalManager keeps working unchanged.
|
|
799
929
|
*/
|
|
800
|
-
triggerId:
|
|
930
|
+
triggerId: import_zod5.z.string().optional(),
|
|
801
931
|
/**
|
|
802
932
|
* Viewport/breakpoint this artboard is currently authored at. Declared inline
|
|
803
933
|
* (rather than imported) because viewport is otherwise an editor/renderer concept.
|
|
804
934
|
*/
|
|
805
|
-
viewport:
|
|
935
|
+
viewport: import_zod5.z.enum(["desktop", "tablet", "mobile"]).optional(),
|
|
806
936
|
/** Persisted artboard width in px, matching the canvas ViewportResizer's `width`. */
|
|
807
|
-
width:
|
|
937
|
+
width: import_zod5.z.number().positive().optional(),
|
|
808
938
|
/**
|
|
809
939
|
* Free position on the builder's infinite canvas, in unscaled canvas px. Absent means
|
|
810
940
|
* "not placed yet" — the canvas then falls back to laying the artboard out in a row.
|
|
811
941
|
*/
|
|
812
|
-
position:
|
|
813
|
-
x:
|
|
814
|
-
y:
|
|
942
|
+
position: import_zod5.z.object({
|
|
943
|
+
x: import_zod5.z.number(),
|
|
944
|
+
y: import_zod5.z.number()
|
|
815
945
|
}).optional(),
|
|
816
946
|
document: PageDocumentSchema
|
|
817
947
|
});
|
|
818
|
-
var ProjectDocumentSchema =
|
|
819
|
-
schema:
|
|
820
|
-
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),
|
|
821
951
|
metadata: DocumentMetadataSchema.optional(),
|
|
822
952
|
tracking: TrackingConfigSchema.optional(),
|
|
823
|
-
artboards:
|
|
824
|
-
activeArtboardId:
|
|
953
|
+
artboards: import_zod5.z.array(ArtboardSchema).min(1, "A project needs at least one artboard"),
|
|
954
|
+
activeArtboardId: import_zod5.z.string().optional()
|
|
825
955
|
});
|
|
826
956
|
function isAssetReference(value) {
|
|
827
957
|
return AssetReferenceSchema.safeParse(value).success;
|
|
@@ -876,31 +1006,58 @@ function validateNodeIdUniqueness(node) {
|
|
|
876
1006
|
};
|
|
877
1007
|
}
|
|
878
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
|
+
|
|
879
1036
|
// src/manifest.ts
|
|
880
|
-
var
|
|
881
|
-
var ManifestAssetItemSchema =
|
|
882
|
-
id:
|
|
883
|
-
path:
|
|
884
|
-
mimeType:
|
|
885
|
-
size:
|
|
886
|
-
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()
|
|
887
1044
|
});
|
|
888
|
-
var ManifestSchema =
|
|
889
|
-
schema:
|
|
890
|
-
schemaVersion:
|
|
891
|
-
packageVersion:
|
|
892
|
-
builderCompatibility:
|
|
893
|
-
requiredComponents:
|
|
894
|
-
requiredCapabilities:
|
|
895
|
-
assets:
|
|
896
|
-
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()
|
|
897
1054
|
});
|
|
898
1055
|
function isManifest(value) {
|
|
899
1056
|
return ManifestSchema.safeParse(value).success;
|
|
900
1057
|
}
|
|
901
1058
|
|
|
902
1059
|
// src/template.ts
|
|
903
|
-
var
|
|
1060
|
+
var import_zod7 = require("zod");
|
|
904
1061
|
var DANGEROUS_URI_PATTERN = /^(javascript:|vbscript:|data:(?!image\/))|<script/i;
|
|
905
1062
|
function isSafeThumbnailUrl(url) {
|
|
906
1063
|
if (!url || typeof url !== "string") return false;
|
|
@@ -909,49 +1066,49 @@ function isSafeThumbnailUrl(url) {
|
|
|
909
1066
|
if (DANGEROUS_URI_PATTERN.test(trimmed)) return false;
|
|
910
1067
|
return true;
|
|
911
1068
|
}
|
|
912
|
-
var SafeThumbnailUrlSchema =
|
|
1069
|
+
var SafeThumbnailUrlSchema = import_zod7.z.string().min(1, "Thumbnail URL cannot be empty").refine(
|
|
913
1070
|
(url) => isSafeThumbnailUrl(url),
|
|
914
1071
|
{ message: "Thumbnail URL contains an unsafe protocol or payload" }
|
|
915
1072
|
);
|
|
916
|
-
var SafeThumbnailObjectSchema =
|
|
1073
|
+
var SafeThumbnailObjectSchema = import_zod7.z.object({
|
|
917
1074
|
url: SafeThumbnailUrlSchema,
|
|
918
|
-
alt:
|
|
919
|
-
width:
|
|
920
|
-
height:
|
|
1075
|
+
alt: import_zod7.z.string().optional(),
|
|
1076
|
+
width: import_zod7.z.number().positive().optional(),
|
|
1077
|
+
height: import_zod7.z.number().positive().optional()
|
|
921
1078
|
});
|
|
922
|
-
var SafeThumbnailSchema =
|
|
1079
|
+
var SafeThumbnailSchema = import_zod7.z.union([
|
|
923
1080
|
AssetReferenceSchema,
|
|
924
1081
|
SafeThumbnailObjectSchema,
|
|
925
1082
|
SafeThumbnailUrlSchema
|
|
926
1083
|
]);
|
|
927
|
-
var TemplatePackageRefSchema =
|
|
928
|
-
path:
|
|
1084
|
+
var TemplatePackageRefSchema = import_zod7.z.object({
|
|
1085
|
+
path: import_zod7.z.string().optional(),
|
|
929
1086
|
url: SafeThumbnailUrlSchema.optional(),
|
|
930
|
-
checksum:
|
|
931
|
-
format:
|
|
1087
|
+
checksum: import_zod7.z.string().optional(),
|
|
1088
|
+
format: import_zod7.z.enum(["stora", "json"]).default("stora")
|
|
932
1089
|
});
|
|
933
|
-
var TemplateRequirementsSchema =
|
|
934
|
-
requiredComponents:
|
|
935
|
-
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([])
|
|
936
1093
|
});
|
|
937
|
-
var TemplateRecordSchema =
|
|
938
|
-
id:
|
|
939
|
-
name:
|
|
940
|
-
description:
|
|
941
|
-
category:
|
|
942
|
-
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([]),
|
|
943
1100
|
thumbnail: SafeThumbnailSchema.optional(),
|
|
944
|
-
author:
|
|
945
|
-
version:
|
|
1101
|
+
author: import_zod7.z.string().optional().default(""),
|
|
1102
|
+
version: import_zod7.z.string().optional().default("1.0.0"),
|
|
946
1103
|
document: PageDocumentSchema.optional(),
|
|
947
1104
|
packageReference: TemplatePackageRefSchema.optional(),
|
|
948
1105
|
requirements: TemplateRequirementsSchema.default({
|
|
949
1106
|
requiredComponents: [],
|
|
950
1107
|
requiredCapabilities: []
|
|
951
1108
|
}),
|
|
952
|
-
createdAt:
|
|
953
|
-
updatedAt:
|
|
954
|
-
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()
|
|
955
1112
|
});
|
|
956
1113
|
function isTemplateRecord(value) {
|
|
957
1114
|
return TemplateRecordSchema.safeParse(value).success;
|
|
@@ -963,7 +1120,7 @@ function isSafeThumbnail(value) {
|
|
|
963
1120
|
// src/fixtures/starter-page.json
|
|
964
1121
|
var starter_page_default = {
|
|
965
1122
|
schema: "stora.page",
|
|
966
|
-
version: "1.
|
|
1123
|
+
version: "1.2.0",
|
|
967
1124
|
metadata: {
|
|
968
1125
|
title: "Welcome to KUBUILD",
|
|
969
1126
|
description: "A starter template built with KUBUILD portable web builder",
|
|
@@ -1044,7 +1201,8 @@ var starter_page_default = {
|
|
|
1044
1201
|
id: "hero-text",
|
|
1045
1202
|
type: "text",
|
|
1046
1203
|
props: {
|
|
1047
|
-
|
|
1204
|
+
as: "p",
|
|
1205
|
+
text: "KUBUILD is an open, portable web page builder engine designed for modern web applications."
|
|
1048
1206
|
},
|
|
1049
1207
|
styles: {
|
|
1050
1208
|
base: {
|
|
@@ -1085,14 +1243,24 @@ var starter_page_default = {
|
|
|
1085
1243
|
id: "hero-button",
|
|
1086
1244
|
type: "button",
|
|
1087
1245
|
props: {
|
|
1088
|
-
label: "Get Started"
|
|
1089
|
-
action: {
|
|
1090
|
-
type: "navigate",
|
|
1091
|
-
payload: {
|
|
1092
|
-
url: "/docs"
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1246
|
+
label: "Get Started"
|
|
1095
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
|
+
],
|
|
1096
1264
|
styles: {
|
|
1097
1265
|
base: {
|
|
1098
1266
|
backgroundColor: "#2563eb",
|
|
@@ -1122,7 +1290,7 @@ var starter_page_default = {
|
|
|
1122
1290
|
var starterPageFixture = starter_page_default;
|
|
1123
1291
|
|
|
1124
1292
|
// src/json-schema.ts
|
|
1125
|
-
var
|
|
1293
|
+
var import_zod8 = require("zod");
|
|
1126
1294
|
var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
1127
1295
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
1128
1296
|
$id: "https://schema.stora.page/v1/page.json",
|
|
@@ -1141,7 +1309,7 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1141
1309
|
type: "string",
|
|
1142
1310
|
pattern: "^\\d+(\\.\\d+)*$",
|
|
1143
1311
|
description: "Schema version of the document",
|
|
1144
|
-
default: "1.
|
|
1312
|
+
default: "1.2.0"
|
|
1145
1313
|
},
|
|
1146
1314
|
metadata: {
|
|
1147
1315
|
$ref: "#/definitions/documentMetadata"
|
|
@@ -1151,9 +1319,33 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1151
1319
|
},
|
|
1152
1320
|
tracking: {
|
|
1153
1321
|
$ref: "#/definitions/trackingConfig"
|
|
1322
|
+
},
|
|
1323
|
+
theme: {
|
|
1324
|
+
$ref: "#/definitions/theme"
|
|
1154
1325
|
}
|
|
1155
1326
|
},
|
|
1156
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
|
+
},
|
|
1157
1349
|
trackingConfig: {
|
|
1158
1350
|
type: "object",
|
|
1159
1351
|
description: "Tracking configuration. Contains only public ids, flags and opaque credential ids \u2014 secrets are host-owned.",
|
|
@@ -1414,7 +1606,7 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1414
1606
|
},
|
|
1415
1607
|
trigger: {
|
|
1416
1608
|
type: "string",
|
|
1417
|
-
enum: ["click", "submit", "change", "blur", "focus", "load"]
|
|
1609
|
+
enum: ["click", "submit", "change", "blur", "focus", "load", "expire"]
|
|
1418
1610
|
},
|
|
1419
1611
|
label: { type: "string" },
|
|
1420
1612
|
debounceMs: { type: "number", minimum: 0 },
|
|
@@ -1835,7 +2027,7 @@ var ACTION_PIPELINE_JSON_SCHEMA_V1 = {
|
|
|
1835
2027
|
},
|
|
1836
2028
|
trigger: {
|
|
1837
2029
|
type: "string",
|
|
1838
|
-
enum: ["click", "submit", "change", "blur", "focus", "load"],
|
|
2030
|
+
enum: ["click", "submit", "change", "blur", "focus", "load", "expire"],
|
|
1839
2031
|
description: "DOM or component event that triggers the action pipeline"
|
|
1840
2032
|
},
|
|
1841
2033
|
label: {
|
|
@@ -2054,7 +2246,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
2054
2246
|
}
|
|
2055
2247
|
function toDraft7(schema, id, title, io) {
|
|
2056
2248
|
return {
|
|
2057
|
-
...
|
|
2249
|
+
...import_zod8.z.toJSONSchema(schema, { target: "draft-7", io }),
|
|
2058
2250
|
$id: id,
|
|
2059
2251
|
title
|
|
2060
2252
|
};
|
|
@@ -2082,7 +2274,7 @@ function getTrackingRelayResponseJsonSchema() {
|
|
|
2082
2274
|
}
|
|
2083
2275
|
function getTrackingProviderSecretsJsonSchema() {
|
|
2084
2276
|
trackingProviderSecretsJsonSchema ??= toDraft7(
|
|
2085
|
-
|
|
2277
|
+
import_zod8.z.object({
|
|
2086
2278
|
meta: MetaTrackingSecretsSchema.optional(),
|
|
2087
2279
|
google: GoogleTrackingSecretsSchema.optional(),
|
|
2088
2280
|
tiktok: TikTokTrackingSecretsSchema.optional(),
|
|
@@ -2094,6 +2286,102 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2094
2286
|
);
|
|
2095
2287
|
return trackingProviderSecretsJsonSchema;
|
|
2096
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
|
+
}
|
|
2097
2385
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2098
2386
|
0 && (module.exports = {
|
|
2099
2387
|
ACTION_PIPELINE_JSON_SCHEMA_V1,
|
|
@@ -2110,6 +2398,11 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2110
2398
|
ArtboardSchema,
|
|
2111
2399
|
ArtboardTypeSchema,
|
|
2112
2400
|
AssetReferenceSchema,
|
|
2401
|
+
BREAKPOINTS,
|
|
2402
|
+
BREAKPOINT_MEDIA_QUERIES,
|
|
2403
|
+
BREAKPOINT_ORDER,
|
|
2404
|
+
BUILTIN_COMPONENT_TYPES,
|
|
2405
|
+
CANONICAL_TEXT_PROPS,
|
|
2113
2406
|
CURRENT_PROJECT_SCHEMA_VERSION,
|
|
2114
2407
|
CURRENT_SCHEMA_VERSION,
|
|
2115
2408
|
CloseModalStepPayloadSchema,
|
|
@@ -2156,10 +2449,16 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2156
2449
|
StyleDefinitionSchema,
|
|
2157
2450
|
StyleValueSchema,
|
|
2158
2451
|
TEMPLATE_RECORD_JSON_SCHEMA_V1,
|
|
2452
|
+
THEME_TOKEN_CSS_PREFIX,
|
|
2453
|
+
THEME_TOKEN_GROUPS,
|
|
2159
2454
|
TRACKING_RELAY_PROTOCOL_VERSION,
|
|
2160
2455
|
TemplatePackageRefSchema,
|
|
2161
2456
|
TemplateRecordSchema,
|
|
2162
2457
|
TemplateRequirementsSchema,
|
|
2458
|
+
ThemeSchema,
|
|
2459
|
+
ThemeTokenKeySchema,
|
|
2460
|
+
ThemeTokenMapSchema,
|
|
2461
|
+
ThemeTokenValueSchema,
|
|
2163
2462
|
TikTokTrackingProviderConfigSchema,
|
|
2164
2463
|
TikTokTrackingSecretsSchema,
|
|
2165
2464
|
ToggleModalStepPayloadSchema,
|
|
@@ -2177,8 +2476,11 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2177
2476
|
ValidationRuleTypeSchema,
|
|
2178
2477
|
VariableBindingSchema,
|
|
2179
2478
|
collectNodeIds,
|
|
2479
|
+
findDeprecatedPropAliases,
|
|
2180
2480
|
generateDeterministicNodeId,
|
|
2181
2481
|
getActionPipelineJsonSchema,
|
|
2482
|
+
getBreakpointForWidth,
|
|
2483
|
+
getCanonicalTextPropRule,
|
|
2182
2484
|
getFormConfigJsonSchema,
|
|
2183
2485
|
getFormFieldBindingJsonSchema,
|
|
2184
2486
|
getManifestJsonSchema,
|
|
@@ -2196,15 +2498,19 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2196
2498
|
isAnimationConfig,
|
|
2197
2499
|
isArtboardReferenceNode,
|
|
2198
2500
|
isAssetReference,
|
|
2501
|
+
isBuiltinComponentType,
|
|
2199
2502
|
isConditionOperator,
|
|
2200
2503
|
isFormConfig,
|
|
2201
2504
|
isFormFieldBinding,
|
|
2202
2505
|
isManifest,
|
|
2203
2506
|
isProjectDocument,
|
|
2204
2507
|
isSafeActionUrl,
|
|
2508
|
+
isSafeThemeTokenKey,
|
|
2509
|
+
isSafeThemeTokenValue,
|
|
2205
2510
|
isSafeThumbnail,
|
|
2206
2511
|
isSafeThumbnailUrl,
|
|
2207
2512
|
isTemplateRecord,
|
|
2513
|
+
isTheme,
|
|
2208
2514
|
isTrackEventStepPayload,
|
|
2209
2515
|
isTrackingConfig,
|
|
2210
2516
|
isTrackingRelayRequest,
|
|
@@ -2213,6 +2519,8 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2213
2519
|
isValidationRuleType,
|
|
2214
2520
|
isVariableBinding,
|
|
2215
2521
|
looksLikeProjectDocument,
|
|
2522
|
+
mergeThemes,
|
|
2523
|
+
parseThemeTokenRef,
|
|
2216
2524
|
sanitizeActionPayload,
|
|
2217
2525
|
sanitizeActionPipeline,
|
|
2218
2526
|
sanitizeActionStep,
|
|
@@ -2220,6 +2528,9 @@ function getTrackingProviderSecretsJsonSchema() {
|
|
|
2220
2528
|
sanitizeActionUrl,
|
|
2221
2529
|
sanitizeActionValue,
|
|
2222
2530
|
starterPageFixture,
|
|
2531
|
+
themeToCssVariables,
|
|
2532
|
+
themeTokenCssVarName,
|
|
2533
|
+
themeTokenRef,
|
|
2223
2534
|
validateActionStepPayload,
|
|
2224
2535
|
validateNodeIdUniqueness
|
|
2225
2536
|
});
|