Options Cascade
ChamevoJS uses a cascading options system where each level can override the previous one.
Cascade Order
OPTION_DEFAULTS → mainOptions → viewOptions → printAreaProfile
Each level deep-merges on top of the previous (objects are recursively merged, arrays are replaced).
Level 1: Defaults (OPTION_DEFAULTS)
Built-in defaults for all ~115 options. These are always the starting point.
Level 2: Main Options
The options you pass to createCustomizer() or ChamevoJS:
createCustomizer('#container', {
stageWidth: 1200, // Overrides default 900
maxPrice: 100, // Overrides default -1
customTextParameters: {
maxLength: 50, // Overrides default 0
},
});
Level 3: View Options
Per-view overrides via CVView.options. Only 21 view-scoped keys can be set here:
{
title: 'Back',
elements: [...],
options: {
stageWidth: 800, // This view uses a narrower canvas
maxPrice: 25, // Lower price limit for this view
},
}
Level 4: Print Area Profile
Per-print-area overrides via CVPrintAreaConfig.printProfile. Only 10 print-area-scoped keys can be set here:
{
printingBox: { left: 200, top: 100, width: 400, height: 500 },
printProfile: {
maxPrice: 10,
customTextParameters: {
maxLength: 20,
colors: ['#000', '#fff'],
},
},
}
Reading Current Options
Always use chamevo.currentOptions to get the fully resolved values:
// Returns DEFAULTS → main → currentView → currentPrintArea merged result
const resolved = chamevo.currentOptions;
console.log(resolved.maxPrice); // 10 (from print area profile)
Under the hood, OptionsService.getCurrentOptions() performs the cascade:
const svc = chamevo.optionsService;
// Get global options only
const main = svc.getMainOptions();
// Get view-merged options
const viewOpts = svc.createViewOptions(view.options);
// Get fully cascaded options
const current = svc.getCurrentOptions(viewOpts, printProfile);
Parameter Cascade
Element parameters have their own cascade within the resolved options:
elementParameters → textParameters → customTextParameters
elementParameters → imageParameters → customImageParameters
Use the helpers:
const textParams = svc.getTextParameters(currentOptions);
const imageParams = svc.getImageParameters(currentOptions);
const customTextParams = svc.getCustomTextParameters(currentOptions);
const customImageParams = svc.getCustomImageParameters(currentOptions);
Scope Keys
| Scope | Keys | Description |
|---|---|---|
ViewScopeKey | 20 keys | Can be set per view. Includes all printArea keys. |
PrintAreaScopeKey | 8 keys | Can be set per print area. Subset of view keys. |
View-scoped: stageWidth, stageHeight, elementParameters, textParameters, imageParameters, customImageParameters, customTextParameters, maxPrice, optionalView, layouts, industry, pricingRules, dynamicViewsOptions, customTextAsTextbox, maxColorableSVGPaths, disabledModules, printingBox, usePrintingBoxAsBounding, modulesConfig
Print-area-scoped: elementParameters, textParameters, imageParameters, customImageParameters, customTextParameters, maxPrice, disabledModules
modulesConfig is view-scoped, which means per-module settings (text templates, design categories, upload config, etc.) can be overridden per view.
Next Steps
- Options Reference — Full property list
- Module Configs — Per-module configuration pattern