### Build Setup for react-chrono Source: https://github.com/prabhuignoto/react-chrono/blob/master/README.md This section provides essential commands for setting up the react-chrono project. It covers cloning the repository, installing dependencies using pnpm, starting the development server, building for production, and running tests. ```bash # Clone the repository git clone https://github.com/prabhuignoto/react-chrono.git cd react-chrono # Install dependencies pnpm install # Start development server pnpm run dev # Build for production pnpm run build # Run tests pnpm test ``` -------------------------------- ### Install react-chrono Source: https://github.com/prabhuignoto/react-chrono/blob/master/README.md Instructions for installing the react-chrono library using either yarn or npm package managers. ```bash # Using yarn yarn add react-chrono # Using npm npm install react-chrono ``` -------------------------------- ### Install React Chrono Source: https://github.com/prabhuignoto/react-chrono/blob/master/README.md Installs the react-chrono package using npm. This is the primary method for adding the component to your React project. ```bash npm install react-chrono ``` -------------------------------- ### Pretty Print Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-content/content-header.tsx.html This JavaScript code snippet initializes the 'prettyPrint' function when the window's 'load' event occurs. This is commonly used for formatting code examples on a webpage. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Pretty Print Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card-content/content-header.tsx.html This JavaScript code snippet initializes the 'prettyPrint' function when the window's 'load' event occurs. This is commonly used for formatting code examples on a webpage. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Timeline Controls Wrapper Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-controls-wrapper/index.html This JavaScript code initializes the prettyPrint function when the window loads. This is typically used for formatting code examples or logs, ensuring they are displayed readably. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Pretty Print Initialization (JavaScript) Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-media/__tests__/timeline-card-media.test.tsx.html This JavaScript code snippet is responsible for initializing the pretty print functionality when the window loads. It calls the prettyPrint() function, which is typically used for formatting code examples on a web page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### JavaScript Initialization for Code Coverage Report Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/toolbar/index.html This JavaScript code initializes the pretty print functionality when the window loads. This is typically used to format code examples or reports for better readability. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print on Window Load Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-content/content-footer.tsx.html This JavaScript code snippet ensures that the prettyPrint function is called once the entire page has finished loading. This is often used for formatting code examples or other content dynamically. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card/__tests__/index.html This JavaScript code snippet ensures that the prettyPrint function is called once the window has finished loading. This is typically used for formatting code examples on a webpage. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print (JavaScript) Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card-media/hooks/index.html This JavaScript code snippet ensures that the prettyPrint function is called when the window's load event occurs, likely to format code examples on the page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Pretty Print Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/hooks/useEscapeKey.ts.html This JavaScript snippet demonstrates the initialization of the pretty print functionality, typically used for code formatting. It sets up the window's onload event to call the `prettyPrint` function, ensuring that code blocks are formatted correctly after the page has fully loaded. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Start and End Component Render Timing Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/performance.ts.html This code defines a `startTiming` method that records the start time of a component render and returns a function to be called at the end of the render. The returned function calculates the render duration and logs it using `logRenderTime`. ```typescript startTiming(componentName: string): () => void { if (!this.isEnabled) return () => {}; const startTime = performance.now(); return () => { const endTime = performance.now(); const renderTime = endTime - startTime; this.logRenderTime(componentName, renderTime); }; } ``` -------------------------------- ### Initialize Pretty Print (JavaScript) Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-media/components/YoutubePlayer.tsx.html This JavaScript code snippet ensures that the 'prettyPrint' function is called when the window's 'load' event occurs. This is commonly used to format code examples or other content on a web page after the page has fully loaded. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Progress Bar Slide Animation Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-content/timeline-card-content.styles.ts.html Defines a keyframes animation for a progress bar, controlling its width from a start to an end point. ```javascript const slideAnimation = (start?: number, end?: number) => keyframes` 0% { width: ${start}px; } 100% { width: ${end}px; } `; ``` -------------------------------- ### Testing Commands for react-chrono Source: https://github.com/prabhuignoto/react-chrono/blob/master/README.md This snippet outlines the commands used for testing the react-chrono project with Vitest. It includes running all tests, running tests in watch mode for continuous feedback, and generating code coverage reports. ```bash # Run all tests pnpm test # Run tests in watch mode pnpm test:watch # Generate coverage report pnpm test:coverage ``` -------------------------------- ### Progress Bar Slide Animation Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card-content/timeline-card-content.styles.ts.html Defines a keyframes animation for a progress bar, controlling its width from a start to an end point. ```javascript const slideAnimation = (start?: number, end?: number) => keyframes` 0% { width: ${start}px; } 100% { width: ${end}px; } `; ``` -------------------------------- ### Get All Performance Entries Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/performance.ts.html This method returns a copy of all recorded performance entries, providing a snapshot of the monitoring data. It ensures that the original `entries` array is not mutated. ```typescript getAllEntries(): PerformanceEntry[] { return [...this.entries]; } ``` -------------------------------- ### Clear Performance Data Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/performance.ts.html The `clear` method resets the performance monitoring data by clearing the `entries` array and the `renderTimes` map. This is useful for starting fresh performance measurements. ```typescript clear(): void { this.entries = []; this.renderTimes.clear(); } ``` -------------------------------- ### Code Coverage Report Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/toolbar/index.tsx.html This snippet represents the initialization script for displaying code coverage reports. It ensures that the pretty-printing functionality is available once the window has loaded, which is typically used to format the coverage data for better readability. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Compute Active Index for Non-Flipped Layout Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/__tests__/GlobalContext.test.tsx.html Tests the calculation of `activeItemIndex` for a non-flipped layout. It verifies that the index starts at 0 for the first item. ```javascript it('should compute active index for non-flipped layout', () => { const { getContext } = renderWithContext({ flipLayout: false, items: [ { title: 'Item 1' }, { title: 'Item 2' }, { title: 'Item 3' }, ], }); expect(getContext().activeItemIndex).toBe(0); }); ``` -------------------------------- ### Get Default Class Names Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/utils.test.ts.html Tests the `getDefaultClassNames` function to verify that it returns the predefined default CSS class names for various components. ```javascript import { describe, it, expect } from 'vitest'; import { getDefaultClassNames } from './index'; describe('Utility Functions', () => { it('getDefaultClassNames should return default class names', () => { expect(getDefaultClassNames()).toEqual({ card: 'rc-card', cardMedia: 'rc-card-media', cardSubTitle: 'rc-card-subtitle', cardText: 'rc-card-text', cardTitle: 'rc-card-title', controls: 'rc-controls', title: 'rc-title', }); }); }); ``` -------------------------------- ### JavaScript for Code Coverage Report Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline/timeline-toolbar.model.ts.html Initializes the code coverage reporting by calling the `prettyPrint()` function when the window loads. This is a common pattern for integrating code coverage tools like Istanbul. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Measure Async Operation Duration Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/performance.ts.html This utility function `measureAsync` measures the execution time of an asynchronous operation. It records the start and end times and calculates the duration, logging it to the console. ```typescript export const measureAsync = async ( operation: () => Promise, operationName: string, ): Promise => { const startTime = performance.now(); try { const result = await operation(); const endTime = performance.now(); const duration = endTime - startTime; console.log(`Operation ${operationName} took ${duration.toFixed(2)}ms`); return result; } catch (error) { const endTime = performance.now(); const duration = endTime - startTime; console.error(`Operation ${operationName} failed after ${duration.toFixed(2)}ms`, error); throw error; } }; ``` -------------------------------- ### JavaScript Initialization for Code Coverage Report Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline/timeline-toolbar.model.ts.html Initializes the code coverage reporting by calling the `prettyPrint()` function when the window loads. This is a common pattern for integrating with code coverage tools like istanbul. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Get Default Button Texts Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/utils.test.ts.html Tests the `getDefaultButtonTexts` function to ensure it returns the complete set of default text configurations for buttons and UI elements. ```javascript import { describe, it, expect } from 'vitest'; import { getDefaultButtonTexts } from './index'; describe('Utility Functions', () => { it('getDefaultButtonTexts should return default button texts', () => { expect(getDefaultButtonTexts()).toEqual({ changeDensity: 'Change density', changeDensityOptions: { high: { helpText: 'Show more items at once', text: 'High', }, low: { helpText: 'Show fewer items at once', text: 'Low', }, }, changeLayout: 'Change layout', changeLayoutOptions: { alternating: { helpText: 'Show cards in a vertical layout with alternating fashion', text: 'Alternating', }, horizontal: { helpText: 'Show cards in a horizontal layout', text: 'Horizontal', }, horizontal_all: { helpText: 'Show all cards in a horizontal layout', text: 'Show all cards', }, vertical: { helpText: 'Show cards in a vertical layout', text: 'Vertical', }, }, dark: 'Switch to Dark Mode', first: 'Go to First', jumpTo: 'Jump to', last: 'Go to Last', light: 'Switch to Light Mode', next: 'Next', play: 'Play Slideshow', previous: 'Previous', stop: 'Stop Slideshow', searchPlaceholder: 'Search Timeline', searchAriaLabel: 'Search timeline content', clearSearch: 'Clear Search', previousMatch: 'Previous Match', nextMatch: 'Next Match', timelinePoint: 'Timeline point', }); }); }); ``` -------------------------------- ### Get Default Theme or Dark Theme Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/utils.test.ts.html Tests the `getDefaultThemeOrDark` function to ensure it returns the dark theme when `isDark` is true, and the default theme otherwise. ```javascript import { describe, it, expect } from 'vitest'; import { darkTheme, defaultTheme } from '../components/common/themes'; import { getDefaultThemeOrDark } from './index'; describe('Utility Functions', () => { it('getDefaultThemeOrDark should return dark theme if isDark is true', () => { expect(getDefaultThemeOrDark(true)).toEqual(darkTheme); }); it('getDefaultThemeOrDark should return default theme if isDark is false or undefined', () => { expect(getDefaultThemeOrDark(false)).toEqual(defaultTheme); expect(getDefaultThemeOrDark()).toEqual(defaultTheme); }); }); ``` -------------------------------- ### JavaScript for Code Pretty Printing Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card/timeline-horizontal-card.styles.ts.html This JavaScript code snippet is intended to be executed when the window loads. It calls the `prettyPrint()` function, likely for formatting code examples on the page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print on Load Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/toolbar/toolbar.styles.ts.html Sets up the window's onload event to call the prettyPrint() function. This is typically used for formatting code snippets displayed on a web page, often in conjunction with libraries like Google Code Prettify. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### JavaScript Initialization for Pretty Printing Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card-media/timeline-card-media.styles.ts.html This JavaScript snippet sets up the window's onload event to call the prettyPrint() function. This is commonly used to format code blocks or other content for better readability after the page has fully loaded. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print for Coverage Report Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/common/themes/index.ts.html This JavaScript code snippet is designed to be executed when the window loads. It calls the 'prettyPrint()' function, which is commonly used in code coverage reports (like those generated by Istanbul) to format and display the code nicely. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### JavaScript for Code Pretty Printing Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/elements/list/__tests__/index.html This JavaScript code initializes the pretty printing functionality when the window loads, likely for formatting code examples within the report. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/elements/list/list.model.ts.html Sets up the window.onload event to call the prettyPrint() function, likely used for formatting code output or the coverage report itself. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/common/styles/index.html This JavaScript code snippet is executed when the window loads. It calls the prettyPrint() function, likely used for formatting code examples or output. ```JavaScript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Pretty Print Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card/__tests__/index.html This JavaScript code initializes the prettyPrint function when the window loads, likely for formatting code examples or output on the coverage report page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Printing on Window Load (JavaScript) Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card/timeline-card-portal/index.html This JavaScript snippet ensures that the 'prettyPrint' function is called once the entire page has finished loading. This is commonly used for formatting code examples or other structured text for better readability. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Code Pretty Printing Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-media/hooks/useMediaLoad.ts.html This JavaScript snippet is responsible for initializing the pretty printing functionality, typically used for displaying code in a formatted manner. It ensures that the `prettyPrint` function is called once the window has finished loading. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print on Load Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/elements/popover/index.html This JavaScript code ensures that the 'prettyPrint' function is called when the window finishes loading, typically used for formatting code examples or reports. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Code Coverage Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-media/components/VideoPlayer.tsx.html Initializes code coverage reporting using Istanbul. This script is typically run when the page loads to ensure accurate coverage metrics are collected. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Render Play Button for Slideshow Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-control/__tests__/timeline-control.test.tsx.html Ensures that the 'start slideshow' button is rendered when the `slideShowEnabled` prop is set to true and `slideShowRunning` is false. This tests the conditional rendering of the slideshow control. ```javascript it('should render the play button when slideShowEnabled is true', () => { const { getByLabelText } = customRender( , { providerProps }, ); expect(getByLabelText('start slideshow')).toBeInTheDocument(); }); ``` -------------------------------- ### Get Default Button Texts Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/utils/index.ts.html Returns an object containing default button text translations for the timeline interface. This function ensures that all interactive elements have appropriate labels. ```typescript export const getDefaultButtonTexts = (): ButtonTexts => DEFAULT_BUTTON_TEXTS; ``` -------------------------------- ### Code Coverage Initialization (JavaScript) Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/hooks/index.ts.html This JavaScript code ensures that the `prettyPrint()` function is called once the window has finished loading. This is a common pattern for initializing code highlighting or formatting libraries on a web page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Get Default Button Texts Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/utils/index.ts.html Returns an object containing default button text translations for the timeline interface. This function ensures that all interactive elements have appropriate labels. ```typescript export const getDefaultButtonTexts = (): ButtonTexts => DEFAULT_BUTTON_TEXTS; ``` -------------------------------- ### JavaScript for Pretty Print Initialization Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/timeline-card-media/timeline-card-media.styles.ts.html A JavaScript snippet that initializes the pretty print functionality when the window loads. This is typically used for code syntax highlighting. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### JavaScript for Page Load Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/lcov-report/components/timeline-elements/memoized/index.html This JavaScript code ensures that the prettyPrint() function is called once the entire page has finished loading. This is typically used for formatting code examples or other content on the page. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### Initialize Pretty Print on Window Load Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/timeline-elements/timeline-card/timeline-card-portal/index.html This JavaScript code ensures that the 'prettyPrint' function is called once the entire page has finished loading. 'prettyPrint' is commonly used for code syntax highlighting. ```javascript window.onload = function () { prettyPrint(); }; ``` -------------------------------- ### HTML Page Load Script Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/hooks/__tests__/useTimelineMedia.test.ts.html A simple HTML script that executes a function `prettyPrint()` when the window has finished loading. This is often used for formatting code examples on a webpage. ```html ``` -------------------------------- ### Initialize Pretty Print Source: https://github.com/prabhuignoto/react-chrono/blob/master/coverage/components/elements/popover/__tests__/index.html This JavaScript code snippet is designed to execute once the browser window has fully loaded. It calls the 'prettyPrint()' function, which is likely used for formatting and displaying code snippets or other content in a readable manner on the webpage. ```javascript window.onload = function () { prettyPrint(); }; ```