Source: global/types.js

/**
 * @module Types
 * @author Radim Brnka
 * @description Data types & DDOs used in the application
 * @copyright Synaptory Fractal Traveler, 2025-2026
 * @license MIT
 */
// ---------------------------------------------------------------------------------------------------------------------
// DEBUG TYPES
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {number} DEBUG_LEVEL
 * @description Debug level
 */
// ---------------------------------------------------------------------------------------------------------------------
// URL_PRESET
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object} URL_PRESET
 *      @property {FRACTAL_TYPE} mode Defaults to FRACTAL_TYPE.MANDELBROT
 *      @property {number|null} [px] panX
 *      @property {number|null} [py] panY
 *      @property {number|null} [cx] Julia only
 *      @property {number|null} [cy] Julia only
 *      @property {number|null} [zoom]
 *      @property {number|null} [r] rotation
 *      @property {string|null} [paletteId] color palette ID
 * @description URL Preset is an object containing properties of specific point in the fractal on the scene compatible
 * with URL encoding. All array values (pan, c) are expanded
 */
// ---------------------------------------------------------------------------------------------------------------------
// PRESET
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object} PRESET
 *      @property {string} [id] Id name/title. Does not have to be unique but it's recommended.
 *      @property {COMPLEX} pan
 *      @property {number} zoom
 *      @property {number} [index] Set dynamically for simpler cycling during demo animations
 *      @property {number} [rotation]
 *      @property {number} [speed] preset animation speed
 *      @property {string} [paletteId] color palette ID to match a JSON palette entry
 * @description Preset is an object containing properties of specific point in the fractal on the scene.
 */
// ---------------------------------------------------------------------------------------------------------------------
//  MANDELBROT_PRESET
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object | PRESET} MANDELBROT_PRESET
 * @extends PRESET
 * @see {@link JULIA_PRESET}
 * @description Mandelbrot-specific presets
 */
// ---------------------------------------------------------------------------------------------------------------------
// JULIA_PRESET
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object | PRESET} JULIA_PRESET
 *      @property {COMPLEX} c
 * @extends PRESET
 * @see {@link MANDELBROT_PRESET}
 * @description Julia-specific presets
 */
// ---------------------------------------------------------------------------------------------------------------------
// COMPLEX
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Array.<number>} COMPLEX
  * @description The complex number c=x+yi as [x, y], used as C in Julia or Pan in general. x: the real part, y: the imaginary part.
 */
// ---------------------------------------------------------------------------------------------------------------------
// PALETTE
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Array.<number>} PALETTE
 * @description Color palette [R, G, B] (0-1)
 */
// ---------------------------------------------------------------------------------------------------------------------
// JULIA PALETTE
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object} JULIA_PALETTE
 *      @property {Array<number, number, number, number, number>} theme 5 innerStops of RGB colors defining the Julia palette
 *      @property {string} id Identifier / title
 *      @property {string} [keyColor] Main theme color. If not set, 3. innerStop's color is used. Use hex #rrggbb notation.
 * @description Color palette defined by inner stops
 */
// ---------------------------------------------------------------------------------------------------------------------
// COLOR THEME
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object} COLOR_THEME
 *      @property {string} ACCENT_COLOR
 *      @property {string} BG_COLOR
 * @description Color theme
 */
// ---------------------------------------------------------------------------------------------------------------------
// PHASES
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Array.<number>} PHASES
 *      @property {number} 0 1st phase
 *      @property {number} 1 2nd phase
 *      @property {number} 2 3rd phase
 *      @property {number} 3 4th phase
 * @description Quad array of phase order for a DIVE.
 */
// ---------------------------------------------------------------------------------------------------------------------
// DIVE
// ---------------------------------------------------------------------------------------------------------------------
/**
 * @typedef {Object} DIVE
 *      @property {string} [title] HTML element title (on hover)
 *      @property {number} cxDirection Use -1/+1 for negative/positive direction of the animation
 *      @property {number} cyDirection Use -1/+1 for negative/positive direction of the animation
 *      @property {PHASES} [phases]
 *           1: animate cx toward dive.endC[0],
 *           2: animate cy toward dive.endC[1],
 *           3: animate cx back toward dive.startC[0],
 *           4: animate cy back toward dive.startC[1]
 *      @property {COMPLEX} pan
 *      @property {COMPLEX} startC
 *      @property {COMPLEX} endC
 *      @property {number} zoom
 *      @property {number} [rotation]
 *      @property {number} step
 *      @property {string} [paletteId] color palette ID to match a JSON palette entry
 * @description Dive is a special animation loop that first animates cx in given direction and when it reaches a set threshold,
 * then it will start animating cy in given direction until its threshold is also hit. Then it loops in the opposite
 * direction. If phases are defined, it follows their order.
 */
// ---------------------------------------------------------------------------------------------------------------------
export {}