OMD Documentation

Configuration Options

This document details all available configuration options for the OMD library, managed by the omdConfigManager module. These options allow you to customize various aspects of the library's behavior, appearance, and mathematical preferences.

Overview

The OMD configuration is a single JavaScript object that can be loaded from a JSON file or set programmatically. It is organized into logical categories.

Default Configuration Structure

If no custom configuration is provided, the library uses the following default structure:

{
    "multiplication": {
        "symbol": "·",
        "forceImplicit": false,
        "implicitCombinations": {
            "constantVariable": true,
            "variableConstant": false,
            "parenthesisAfterVariable": true,
            "parenthesisAfterConstant": true,
            "variableParenthesis": true,
            "parenthesisParenthesis": true,
            "parenthesisVariable": true,
            "parenthesisConstant": true,
            "variableVariable": true
        }
    },
    "stepVisualizer": {
        "dotSizes": {
            "level0": 8,
            "level1": 6,
            "level2": 4
        },
        "fontWeights": {
            "level0": 400,
            "level1": 400,
            "level2": 400
        }
    }
}

Configuration Categories and Options

multiplication

Settings related to how multiplication is displayed and handled.

stepVisualizer

Settings specific to the omdStepVisualizer component, controlling the appearance of step dots and text.

Usage

Configuration options can be set during initialization or updated at runtime using the omdConfigManager functions.

initializeConfig(configSource)

Initializes the configuration by loading it from a file or object. This should be called early in the application lifecycle.

import { initializeConfig } from '@teachinglab/omd';

// Initialize with a custom config file
await initializeConfig('./my-custom-omd-config.json');

setConfig(config)

Sets the configuration directly, bypassing file loading.

import { setConfig } from '@teachinglab/omd';

setConfig({
    multiplication: {
        symbol: '*'
    }
});

getDefaultConfig()

Returns a copy of the default configuration object.

isEnabled(category, setting)

Checks if a specific feature is enabled in the configuration.

useImplicitMultiplication(combination)

Checks if implicit multiplication should be used for a specific combination of terms.

getMultiplicationSymbol()

Returns the configured multiplication symbol.

updateConfig(category, setting, value)

Updates a configuration setting at runtime.

getConfigValue(path)

Retrieves a configuration value using a dot-separated path.

setConfigValue(path, value)

Sets a configuration value using a dot-separated path.

resetConfig()

Resets the configuration to its default state. Note: In the current implementation, this throws an error and advises to edit the omdConfig.json file directly.

reloadConfig()

Reloads the configuration from the JSON file.