Это первая доступная в Git версия файла.
1/**2* @typedef {Object} Step3* @property {HTMLElement | undefined} element4* @property {'step' | 'cover' | 'result' | 'contacts'} type5*/67/** @typedef {'next' | 'prev'} TransitionDirection */89/**10* @typedef {(direction: 'next' | 'prev', callbacks?: AnimationCallbacks, transitionInfo?: TransitionInfo) => CurrentStepInfo} ChangeStepHandler11*/12
/** * @typedef {{ isAutoTransition?: boolean, isOnSuccess?: boolean }} TransitionInfo *//** * @typedef {Object} CurrentStepInfo * @property {Step['type']} type * @property {boolean} isFirst * @property {boolean} isLast - после шага нет вопросов и формы контактов * @property {boolean} isFinal - после шага нет видимых шагов, кроме сообщения об успешной отправке * @property {Step | null} step *//** * @typedef {(direction: TransitionDirection, stepInfo: CurrentStepInfo, transitionInfo?: TransitionInfo) => boolean} TransitionGuard *//** * @typedef {Object} ActiveStep * @property {number} index * @property {Step | null | undefined} step *//** * @typedef {Object} Progress * @property {number} total * @property {number | null} current - если null, то счетчик не выводится *//** @typedef {'fade' | 'fade-with-move'} AnimationType *//** @typedef {Record<Step['type'], AnimationType>} AnimationTypeConfig *//** * @typedef {Object} AnimationCallbacks * @property {(oldStep?: Step, newStep: Step) => void} onAnimationStart функция, выполняемая перед началом анимации. * @property {(oldStep?: Step, newStep: Step) => void} onAnimationComplete функция, выполняемая после завершения анимации. * @property {(oldStep?: Step, newStep: Step) => void} onNewStepAnimationStart функция, выполняемая после начала анимации появления нового шага. *//** * @typedef {Object} StepAnimation * @property {AnimationType | AnimationTypeConfig} type * @property {AnimationCallbacks} callbacks *//** * @typedef {Object} StepManagerInitOptions * @property {string} recId * @property {Step[]} steps * @property {HTMLElement | null} [successStepElement] шаг с сообщением об успешной отправке, который показывается только после отправки формы * @property {string} activeStepClass * @property {string} hiddenStepClass * @property {boolean} [enableAutoStepChange] * @property {(step: Step) => void} onStepChange * @property {(progress: Progress) => void} onProgressChange * @property {(event: Event) => void} onConditionalStateChange * @property {() => void | undefined} onInit * @property {(oldStep: Step, newStep: Step) => void} handleStepAnimation * @property {StepAnimation} [animation] * @property {boolean} [enableConditionals] * @property {TransitionGuard} [checkIfCanChangeStep] функция, которая будет вызываться перед началом смены шага. Если возвращает false, смена шага не произойдет *//** * @typedef {ReturnType<typeof t_quiz__step_manager>} StepsManager *//** * @typedef {ReturnType<typeof t_quiz__step_manager>} StepsManager *//** * @param {StepManagerInitOptions} initOptions */function t_quiz__step_manager( initOptions = { steps: [], activeStepClass: '', }) { const INITIAL_ACTIVE_STEP = { index: -1, step: null, }; const steps = initOptions.steps;